public IGMacCompositeBinding PickConstantComponents() { var mvPattern = new GMacMultivectorBinding(BaseFrameMultivector); foreach (var pair in _patternDictionary.Where(pair => pair.Value.IsConstant)) { mvPattern._patternDictionary.Add(pair.Key, pair.Value); } return(mvPattern); }
/// <summary> /// Create a multivector pattern binding all IDs in the given subspace to variables /// </summary> /// <param name="subspace"></param> /// <returns></returns> public static GMacMultivectorBinding Create(AstFrameSubspace subspace) { var mvPattern = new GMacMultivectorBinding(subspace.FrameMultivector); foreach (var id in subspace.AssociatedSubspace.SubspaceSignaturePattern.TrueIndexes) { mvPattern.BindCoefToVariable(id); } return(mvPattern); }
/// <summary> /// True if the given multivector pattern matches this pattern in all its variables and constants /// </summary> /// <param name="mvPattern"></param> /// <returns></returns> public bool MatchesPattern(GMacMultivectorBinding mvPattern) { if (_patternDictionary.Count != mvPattern._patternDictionary.Count) { return(false); } return (_patternDictionary .All( pair => mvPattern.ContainsScalarPattern(pair.Key, pair.Value) )); }
/// <summary> /// Create a multivector pattern from the given multivector value using only non-constant components /// from the multivector /// </summary> /// <param name="mv"></param> /// <returns></returns> public static GMacMultivectorBinding CreateFromNonConstants(AstValueMultivector mv) { var mvPattern = new GMacMultivectorBinding(mv.FrameMultivector); foreach (var term in mv.AssociatedMultivectorValue.MultivectorCoefficients) { if (term.Value.IsConstant() == false) { mvPattern.BindCoefToVariable(term.Key); } } return(mvPattern); }
public IGMacBinding ToConstantsFreePattern() { var mvPattern = new GMacMultivectorBinding(BaseFrameMultivector); foreach (var pair in _patternDictionary) { mvPattern ._patternDictionary .Add( pair.Key, (GMacScalarBinding)pair.Value.ToConstantsFreePattern() ); } return(mvPattern); }
/// <summary> /// Create a multivector pattern having no constant components from the given multivector value /// </summary> /// <param name="mv"></param> /// <param name="ignoreZeroCoefs"></param> /// <returns></returns> public static GMacMultivectorBinding CreateConstantsFree(AstValueMultivector mv, bool ignoreZeroCoefs = true) { var mvPattern = new GMacMultivectorBinding(mv.FrameMultivector); foreach (var term in mv.AssociatedMultivectorValue.MultivectorCoefficients) { if (ignoreZeroCoefs && term.Value.IsZero()) { continue; } mvPattern.BindCoefToVariable(term.Key); } return(mvPattern); }
/// <summary> /// Create a multivector pattern from the given multivector value using only constant components /// from the multivector /// </summary> /// <param name="mv"></param> /// <param name="ignoreZeroCoefs"></param> /// <returns></returns> public static GMacMultivectorBinding CreateFromConstants(AstValueMultivector mv, bool ignoreZeroCoefs = true) { var mvPattern = new GMacMultivectorBinding(mv.FrameMultivector); foreach (var term in mv.AssociatedMultivectorValue.MultivectorCoefficients) { if (ignoreZeroCoefs && term.Value.IsZero()) { continue; } if (term.Value.IsConstant()) { mvPattern.BindCoefToConstant(term.Key, term.Value.MathExpr); } } return(mvPattern); }
/// <summary> /// Create a multivector pattern from the given multivector value using only constant components /// from the multivector. All the created bindings are variable bindings /// </summary> /// <param name="mv"></param> /// <param name="ignoreZeroCoefs"></param> /// <returns></returns> public static GMacMultivectorBinding CreateConstantsFreeFromConstants(AstValueMultivector mv, bool ignoreZeroCoefs = true) { var mvPattern = new GMacMultivectorBinding(mv.FrameMultivector); foreach (var term in mv.AssociatedMultivectorValue.SymbolicMultivector.NonZeroTerms) { if (ignoreZeroCoefs && term.Value.IsZero()) { continue; } if (term.Value.IsConstant()) { mvPattern.BindCoefToVariable(term.Key); } } return(mvPattern); }