Esempio n. 1
0
        public static GaMultivector OuterProduct(this GaMultivector mv1, GaMultivector mv2)
        {
            if (mv1.GaSpaceDim != mv2.GaSpaceDim)
            {
                throw new GMacSymbolicException("Multivector size mismatch");
            }

            var terms1 = mv1.ToStringsDictionary();

            var terms2 = mv2.ToStringsDictionary();

            var accumExprDict = new Dictionary <int, ListComposer>();

            foreach (var term1 in terms1)
            {
                var id1   = term1.Key;
                var coef1 = term1.Value;

                foreach (var term2 in terms2.FilterTermsForOp(id1))
                {
                    var id2   = term2.Key;
                    var coef2 = term2.Value;

                    var resultId = id1 ^ id2;

                    var resultCoefDelta =
                        Times(coef1, coef2, FrameUtils.IsNegativeEGp(id1, id2));

                    accumExprDict.AddTerm(resultId, resultCoefDelta);
                }
            }

            return(accumExprDict.ToMultivector(mv1.GaSpaceDim));
        }
Esempio n. 2
0
 /// <summary>
 /// Return true if the anti-commutator product of the given euclidean basis blades ids is always zero
 /// </summary>
 /// <param name="id1"></param>
 /// <param name="id2"></param>
 /// <returns></returns>
 public static bool IsZeroEuclideanAcp(int id1, int id2)
 {
     return(FrameUtils.IsNegativeEGp(id1, id2) == !FrameUtils.IsNegativeEGp(id2, id1));
 }