/// <summary> /// Evaluate a cast to multivector value operation /// </summary> /// <param name="expr"></param> /// <returns></returns> private ILanguageValue EvaluateBasicUnaryCastToMultivector(BasicUnary expr) { var value1 = expr.Operand.AcceptVisitor(this); var mvType = (GMacFrameMultivector)expr.Operator; if (value1.ExpressionType.IsNumber()) { var scalarValue = ((ValuePrimitive <MathematicaScalar>)value1).Value; return(GMacValueMultivector.Create( mvType, GaSymMultivector.CreateScalar( mvType.ParentFrame.GaSpaceDimension, scalarValue ) )); } if (value1.ExpressionType.IsFrameMultivector() && value1.ExpressionType.GetFrame().VSpaceDimension == mvType.ParentFrame.VSpaceDimension) { var mvValue = (GMacValueMultivector)value1; return(GMacValueMultivector.Create( mvType, GaSymMultivector.CreateCopy(mvValue.SymbolicMultivector) )); } throw new InvalidOperationException("Invalid cast operation"); }
public ILanguageValue DuplicateValue(bool deepCopy) { return(new GMacValueMultivector(ValueMultivectorType, GaSymMultivector.CreateCopy(SymbolicMultivector))); }
public GaSymMultivector ToMultivector() { return(GaSymMultivector.CreateCopy(GaSpaceDimension, NonZeroExprTerms)); }