Example #1
0
        public GaPoTNumMultivector Sp(GaPoTNumMultivector mv2)
        {
            var result = new GaPoTNumMultivector();

            foreach (var term1 in _termsDictionary.Values)
            {
                if (!mv2._termsDictionary.TryGetValue(term1.IDsPattern, out var term2))
                {
                    continue;
                }

                var value = term1.Value * term2.Value;

                if (value == 0)
                {
                    continue;
                }

                if (GaPoTNumUtils.ComputeIsNegativeEGp(term1.IDsPattern, term2.IDsPattern))
                {
                    value = -value;
                }

                result.AddTerm(new GaPoTNumMultivectorTerm(0, value));
            }

            return(result);
        }
        public GaPoTNumMultivectorTerm Gp(GaPoTNumMultivectorTerm term2)
        {
            var term1 = this;

            var idsPattern = term1.IDsPattern ^ term2.IDsPattern;
            var value      = term1.Value * term2.Value;

            if (value == 0.0d)
            {
                return(new GaPoTNumMultivectorTerm(idsPattern, 0.0d));
            }

            if (GaPoTNumUtils.ComputeIsNegativeEGp(term1.IDsPattern, term2.IDsPattern))
            {
                value = -value;
            }

            return(new GaPoTNumMultivectorTerm(idsPattern, value));
        }