IMsDeterministicTransform.FactsMatrix

Fore Syntax

FactsMatrix(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): Array;

Fore.NET Syntax

FactsMatrix[Prognoz.Platform.Interop.Ms.IMsMethodCalculation,
Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord] : System.Array

Parameters

Calculation. Model calculation parameters.

Coord. The model slice, by which calculation is executed.

Description

The property is read-only.

The FactsMatrix property returns the array containing model factors values.

Comments

The Calculation and Coord parameters cannot be set to Null.

The array that contains the factors correlation is returned by the IMsDeterministicTransform.PairCorrelationMatrix property.

Fore Example

Executing the example requires a modeling container with the MS identifier that contains a determinate equation model with the ModelDeterm identifier. Add links to the Metabase, Ms, Matrix system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    hModel: IMetabaseObjectDescriptor;
    oModel: IMsModel;
    trans: IMsFormulaTransform;
    selector: IMsFormulaTransformSelector;
    formula: IMsFormula;
    output: IMsFormulaTransformVariable;
    determ: IMsDeterministicTransform;
    coord: IMsFormulaTransformCoord;
    calculation: IMsMethodCalculation;
    calcPeriod, modPeriod: IMsModelPeriod;
    matrix: Array Of Double;
    i, j: Integer;
    nFactors: Integer;
Begin
    mb := metabaseClass.Active;
    MsKey : = mb.ItemById("MS").Key;
    hModel := mb.ItemByIdNamespace("MODEL_DETERM", MsKey);
    oModel := hModel.Bind As IMsModel;
    trans := oModel.Transform;
    output := trans.Outputs.Item(0);
    selector := trans.CreateSelector;
    selector.Slice := output.Slices.Item(0);
    formula := trans.Transform(selector);
    determ := formula.Method As IMsDeterministicTransform;
    coord := trans.CreateCoord(output);
    calculation := trans.CreateCalculation;
    calcPeriod := calculation.Period;
    modPeriod := oModel.Period;
    calcPeriod.ForecastEndDate := modPeriod.ForecastEndDate;
    calcPeriod.ForecastStartDate := modPeriod.ForecastStartDate;
    calcPeriod.IdentificationEndDate := modPeriod.IdentificationEndDate;
    calcPeriod.IdentificationStartDate := modPeriod.IdentificationStartDate;
    matrix := determ.FactsMatrix(calculation, coord);
    nFactors := determ.Operands.Count;
    For i := 0 To nFactors - 1 Do
        Debug.WriteLine(Factor:  + determ.Operands.Item(i).TermToText + . Values:);
        For j := matrix.GetLowerBound(1To matrix.GetUpperBound(1Do
            Debug.WriteLine("  " + matrix[j, i].ToString);
        End For;
    End For;
End Sub UserProc;

After executing the example the names and values of the factors are displayed in the console window.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example

Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Matrix;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
   MsKey: uinteger;
    hModel: IMetabaseObjectDescriptor;
    oModel: IMsModel;
    trans: IMsFormulaTransform;
    selector: IMsFormulaTransformSelector;
    formula: IMsFormula;
    output: IMsFormulaTransformVariable;
    determ: IMsDeterministicTransform;
    coord: IMsFormulaTransformCoord;
    calculation: IMsMethodCalculation;
    calcPeriod, modPeriod: IMsModelPeriod;
    matrix: System.Array;
    i, j, k: Integer;
    nFactors: Integer;
Begin
    mb := Params.Metabase;
    MsKey := mb.ItemById["MS"].Key;
    hModel := mb.ItemByIdNamespace["MODEL_DETERM", MsKey];
    oModel := hModel.Bind() As IMsModel;
    trans := oModel.Transform;
    output := trans.Outputs.Item[0];
    selector := trans.CreateSelector();
    selector.Slice := output.Slices.Item[0];
    formula := trans.Transform[selector];
    determ := formula.Method As IMsDeterministicTransform;
    coord := trans.CreateCoord(output);
    calculation := trans.CreateCalculation();
    calcPeriod := calculation.Period;
    modPeriod := oModel.Period;
    calcPeriod.ForecastEndDate := modPeriod.ForecastEndDate;
    calcPeriod.ForecastStartDate := modPeriod.ForecastStartDate;
    calcPeriod.IdentificationEndDate := modPeriod.IdentificationEndDate;
    calcPeriod.IdentificationStartDate := modPeriod.IdentificationStartDate;
    matrix := determ.FactsMatrix[calculation, coord];
    nFactors := determ.Operands.Count;
    For i := 0 To nFactors - 1 Do
        System.Diagnostics.Debug.WriteLine(Factor:  + determ.Operands.Item[i].TermToText() + . Values:);
        k := matrix.GetUpperBound(1);
        For j := matrix.GetLowerBound(1To k Do
            System.Diagnostics.Debug.WriteLine("  " + matrix[i, j].ToString());
        End For;
    End For;
End Sub;

See also:

IMsDeterministicTransform