public GaSymMultivector GetPartByGrade(Func <int, bool> gradeSelectionFunc) { var resultMv = new GaSymMultivector(GaSpaceDimension); foreach (var term in NonZeroTerms.Where(t => gradeSelectionFunc(t.Key.BasisBladeGrade()))) { resultMv.SetTermCoef(term.Key, term.Value); } return(resultMv); }
public GaSymMultivector GetOddPart() { var resultMv = new GaSymMultivector(GaSpaceDimension); foreach (var term in NonZeroTerms.Where(t => (t.Key.BasisBladeGrade() & 1) == 1)) { resultMv.SetTermCoef(term.Key, term.Value); } return(resultMv); }
public void Simplify() { var terms = NonZeroTerms.ToArray(); ResetToZero(); foreach (var term in terms) { term.Value.Simplify(); SetTermCoef(term.Key, term.Value.Expression); } }
public GaSymMultivector GetKVectorPart(int grade) { var resultMv = new GaSymMultivector(GaSpaceDimension); if (grade < 0 || grade > VSpaceDimension) { return(resultMv); } foreach (var term in NonZeroTerms.Where(t => t.Key.BasisBladeGrade() == grade)) { resultMv.SetTermCoef(term.Key, term.Value); } return(resultMv); }