コード例 #1
0
ファイル: MathematicaMatrix.cs プロジェクト: phreed/GMac
        public bool EigenSystem(EigenVectorsSpecs specs, out MathematicaVector values, out MathematicaMatrix vectors)
        {
            var sysExpr = CasInterface[Mfs.Eigensystem[MathExpr]];

            values = MathematicaVector.Create(CasInterface, sysExpr.Args[0]);

            Expr vectorsExpr;

            switch (specs)
            {
            case EigenVectorsSpecs.InMatrixRows:
                vectorsExpr = sysExpr.Args[1];
                break;

            case EigenVectorsSpecs.InMatrixColumns:
                vectorsExpr = CasInterface[Mfs.Transpose[sysExpr.Args[1]]];
                break;

            case EigenVectorsSpecs.OrthogonalInMatrixRows:
                vectorsExpr = CasInterface[Mfs.Orthogonalize[sysExpr.Args[1]]];
                break;

            default:
                vectorsExpr = CasInterface[Mfs.Transpose[Mfs.Orthogonalize[sysExpr.Args[1]]]];
                break;
            }

            vectors = Create(CasInterface, vectorsExpr);

            //TODO: Test if the eigen sytem is OK
            return(true);
        }
コード例 #2
0
ファイル: MathematicaMatrix.cs プロジェクト: phreed/GMac
        public static MathematicaMatrix CreateFullDiagonalMatrix(MathematicaInterface parentCas, IEnumerable <MathematicaScalar> scalarsList)
        {
            var vector = MathematicaVector.CreateFullVector(parentCas, scalarsList);

            return(CreateDiagonal(vector));
        }
コード例 #3
0
ファイル: MathematicaMatrix.cs プロジェクト: phreed/GMac
        //public MathematicaMatrix SetRow(int index, VectorBase vector);

        //public MathematicaMatrix SetColumn(int index, VectorBase vector);

        //public MathematicaMatrix SetDiagonal(VectorBase vector);

        //public MathematicaMatrix AppendRow(VectorBase vector);

        //public MathematicaMatrix AppendColumn(VectorBase vector);

        public MathematicaVector EigenValues_InVector()
        {
            return(MathematicaVector.Create(CasInterface, CasInterface[Mfs.Eigenvalues[MathExpr]]));
        }
コード例 #4
0
ファイル: MathematicaMatrix.cs プロジェクト: phreed/GMac
        public ISymbolicVector GetDiagonal()
        {
            var e = CasInterface[Mfs.Diagonal[MathExpr]];

            return(MathematicaVector.Create(CasInterface, e));
        }
コード例 #5
0
ファイル: MathematicaMatrix.cs プロジェクト: phreed/GMac
        public ISymbolicVector GetColumn(int index)
        {
            var e = CasInterface[Mfs.Part[MathExpr, OptionSymbols.All, (index + 1).ToExpr()]];

            return(MathematicaVector.Create(CasInterface, e));
        }
コード例 #6
0
ファイル: MathematicaMatrix.cs プロジェクト: phreed/GMac
        public ISymbolicVector Times(ISymbolicVector v)
        {
            var e = CasInterface[Mfs.Dot[MathExpr, v.ToMathematicaVector().MathExpr]];

            return(MathematicaVector.Create(CasInterface, e));
        }
コード例 #7
0
        public ISymbolicVector GetRow(int index)
        {
            var e = CasInterface[Mfs.Part[Expression, (index + 1).ToExpr(), OptionSymbols.All]];

            return(MathematicaVector.Create(CasInterface, e));
        }