private static GaMultivector CreateFromMatrixColumn(ISymbolicMatrix matrix, int col) { var gaSpaceDim = FrameUtils.GaSpaceDimension(matrix.Rows); var mv = GaMultivector.CreateZero(gaSpaceDim); for (var index = 0; index < matrix.Rows; index++) { mv[1, index] = matrix[index, col]; } return(mv); }
/// <summary> /// Convert this binding pattern into a multivector value /// </summary> /// <param name="varNameTemplate"></param> /// <returns></returns> public AstValueMultivector ToValue(StringSequenceTemplate varNameTemplate) { var mv = GaMultivector.CreateZero(BaseFrameMultivector.AssociatedFrameMultivector.ParentFrame.GaSpaceDimension); foreach (var pair in _patternDictionary) { mv[pair.Key] = pair.Value.ToMathematicaScalar(varNameTemplate); } return(new AstValueMultivector( GMacValueMultivector.Create( BaseFrameMultivector.AssociatedFrameMultivector, mv ) )); }
internal static GaMultivector ToMultivector(this Dictionary <int, ListComposer> accumExprDict, int gaSpaceDim) { var resultMv = GaMultivector.CreateZero(gaSpaceDim); foreach (var pair in accumExprDict) { var resultCoef = SymbolicUtils.Cas[pair.Value.ToString()]; if (!(resultCoef.Args.Length == 0 && resultCoef.ToString() == "0")) { resultMv.Add(pair.Key, MathematicaScalar.Create(SymbolicUtils.Cas, resultCoef)); } } return(resultMv); }
/// <summary> /// Convert this binding pattern into a multivector value /// </summary> /// <param name="basisBladeToVarName"></param> /// <returns></returns> public AstValueMultivector ToValue(Func <AstFrameBasisBlade, string> basisBladeToVarName) { var frameInfo = new AstFrame(BaseFrameMultivector.AssociatedFrameMultivector.ParentFrame); var mv = GaMultivector.CreateZero(BaseFrameMultivector.AssociatedFrameMultivector.ParentFrame.GaSpaceDimension); foreach (var pair in _patternDictionary) { mv[pair.Key] = pair.Value.IsConstant ? pair.Value.ConstantSymbolicScalar : MathematicaScalar.Create( SymbolicUtils.Cas, basisBladeToVarName(frameInfo.BasisBlade(pair.Key)) ); } return (new AstValueMultivector( GMacValueMultivector.Create( BaseFrameMultivector.AssociatedFrameMultivector, mv ) )); }
internal static GMacValueMultivector CreateZero(GMacFrameMultivector mvType) { var mvCoefs = GaMultivector.CreateZero(mvType.ParentFrame.GaSpaceDimension); return(new GMacValueMultivector(mvType, mvCoefs)); }