public ILanguageValue Evaluate(GMacValueMultivector value1, GMacValueMultivector value2) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.MultivectorCoefficients.EuclideanHip(value2.MultivectorCoefficients) )); }
public ILanguageValue Evaluate(GMacValueMultivector value1, GMacValueMultivector value2) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.SymbolicFrame.Cp[value1.SymbolicMultivector, value2.SymbolicMultivector] )); }
public ILanguageValue Evaluate(GMacValueMultivector value1, GMacValueMultivector value2) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.SymbolicMultivector.Op(value2.SymbolicMultivector) )); }
/// <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 Evaluate(GMacValueMultivector value1, ValuePrimitive <MathematicaScalar> value2) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.MultivectorCoefficients * value2.Value )); }
public ILanguageValue Evaluate(GMacValueMultivector value1) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.MultivectorCoefficients.CliffConj() )); }
public ILanguageValue Evaluate(ValuePrimitive <MathematicaScalar> value1, GMacValueMultivector value2) { return(GMacValueMultivector.Create( value2.ValueMultivectorType, value2.SymbolicMultivector * value1.Value )); }
/// <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 = GaSymMultivector.CreateZero( BaseFrameMultivector.AssociatedFrameMultivector.ParentFrame.GaSpaceDimension ); foreach (var pair in _patternDictionary) { mv.AddFactor( 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 ) )); }
public ILanguageValue Evaluate(GMacValueMultivector value1) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.SymbolicMultivector.GradeInv() )); }
public ILanguageValue Evaluate(GMacValueMultivector value1, GMacValueMultivector value2) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.MultivectorCoefficients.OuterProduct(value2.MultivectorCoefficients) )); }
public ILanguageValue Evaluate(GMacValueMultivector value1, GMacValueMultivector value2) { return(GMacValueMultivector.Create( value1.ValueMultivectorType, value1.SymbolicFrame.Fdp( value1.MultivectorCoefficients, value2.MultivectorCoefficients ) )); }
/// <summary> /// Evaluate a multivector transform operation /// </summary> /// <param name="expr"></param> /// <returns></returns> private GMacValueMultivector EvaluateBasicUnaryMultivectorTransform(BasicUnary expr) { var value1 = (GMacValueMultivector)expr.Operand.AcceptVisitor(this); var transform = (GMacMultivectorTransform)expr.Operator; return(GMacValueMultivector.Create( transform.TargetFrame.MultivectorType, transform.AssociatedSymbolicTransform[value1.SymbolicMultivector] )); }
/// <summary> /// Convert this basis blade into a multivector value with unity coefficient of its single term /// </summary> /// <returns></returns> public AstValueMultivector ToMultivectorValue() { return(new AstValueMultivector( GMacValueMultivector.Create( AssociatedFrame.MultivectorType, GaSymMultivector.CreateBasisBlade( AssociatedFrame.GaSpaceDimension, BasisBladeId ) ) )); }
/// <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 ) )); }