Example #1
0
        public static GaPoTNumFrame CreateGramSchmidtFrame(int vectorsCount, int refVectorIndex, out GaPoTNumFrame kirchhoffFrame)
        {
            kirchhoffFrame = CreateKirchhoffFrame(vectorsCount, refVectorIndex);

            var uPseudoScalar = new GaPoTNumMultivector()
                                .SetTerm(
                (1 << vectorsCount) - 1,
                1.0d
                );

            var cFrame = kirchhoffFrame.GetOrthogonalFrame(true);

            cFrame.AppendVector(
                -GaPoTNumUtils
                .OuterProduct(cFrame)
                .Gp(uPseudoScalar.CliffordConjugate())
                .GetVectorPart()
                );

            Debug.Assert(
                cFrame.IsOrthonormal()
                );

            Debug.Assert(
                CreateBasisFrame(vectorsCount).HasSameHandedness(cFrame)
                );

            return(cFrame);
        }
Example #2
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);
        }
Example #3
0
        public GaPoTNumBiversor GetTermPart(int id1, int id2)
        {
            (id1, id2) = GaPoTNumUtils.ValidateBiversorTermIDs(id1, id2);

            return(new GaPoTNumBiversor(
                       _termsDictionary.Values.Where(t => t.TermId1 == id1 && t.TermId2 == id2)
                       ));
        }
Example #4
0
        public double GetTermValue(int id1, int id2)
        {
            (id1, id2) = GaPoTNumUtils.ValidateBiversorTermIDs(id1, id2);

            return(_termsDictionary
                   .Values
                   .Where(t => t.TermId1 == id1 && t.TermId2 == id2)
                   .Select(v => v.Value)
                   .Sum());
        }
        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));
        }