Example #1
0
        public static GaSymMapUnilinearMatrix ToMatrixMap(this Dictionary <int, GaSymMultivector> basisBladeMaps, int domainVSpaceDim, int targetVSpaceDim)
        {
            var targetGaSpaceDim = targetVSpaceDim.ToGaSpaceDimension();
            var zeroMvArray      = new Expr[targetGaSpaceDim];

            return(GaSymMapUnilinearMatrix.Create(
                       MathematicaMatrix.CreateFullMatrixFromColumns(
                           SymbolicUtils.Cas,
                           Enumerable
                           .Range(0, domainVSpaceDim.ToGaSpaceDimension())
                           .Select(
                               id =>
            {
                GaSymMultivector mv;
                basisBladeMaps.TryGetValue(id, out mv);

                return mv?.TermsToExprArray()
                ?? zeroMvArray;
            }
                               )
                           )
                       ));
        }