Example #1
0
        public static GaNumMultivector SetTerms(this GaNumMultivector mv, IEnumerable <KeyValuePair <int, double> > terms)
        {
            foreach (var term in terms)
            {
                mv.SetTermCoef(term.Key, term.Value);
            }

            return(mv);
        }
Example #2
0
        public GaNumMultivector GetPart(Func <int, bool> idSelectionFunc)
        {
            var resultMv = new GaNumMultivector(GaSpaceDimension);

            foreach (var term in NonZeroTerms.Where(t => idSelectionFunc(t.Key)))
            {
                resultMv.SetTermCoef(term.Key, term.Value);
            }

            return(resultMv);
        }
Example #3
0
        public GaNumMultivector GetOddPart()
        {
            var resultMv = new GaNumMultivector(GaSpaceDimension);

            foreach (var term in NonZeroTerms.Where(t => (t.Key.BasisBladeGrade() & 1) == 1))
            {
                resultMv.SetTermCoef(term.Key, term.Value);
            }

            return(resultMv);
        }
Example #4
0
        public static GaNumMultivector CreateVectorFromScalars(double[] scalars)
        {
            var gaSpaceDim = scalars.Length.ToGaSpaceDimension();

            var mv = new GaNumMultivector(gaSpaceDim);

            for (var index = 0; index < scalars.Length; index++)
            {
                mv.SetTermCoef(1, index, scalars[index]);
            }

            return(mv);
        }