Example #1
0
        public GaSymMultivector GetSymMultivector(int gaSpaceDim, string baseCoefName)
        {
            //Randomly select the number of terms in the multivector
            var termsCount = GetInteger(gaSpaceDim - 1);

            //Randomly select the terms basis blades in the multivectors
            var basisBladeIDs = GetRangePermutation(gaSpaceDim - 1).Take(termsCount);

            //Generate the multivector's symbolic coefficients
            return(GaSymMultivector.CreateSymbolic(gaSpaceDim, baseCoefName, basisBladeIDs));
        }
Example #2
0
        public string Execute()
        {
            LogComposer.Clear();

            //var randGen = new GMacRandomGenerator(10);
            //var mvA = randGen.GetSymbolicMultivector(Frame.GaSpaceDimension, "A");
            //var mvB = randGen.GetSymbolicMultivector(Frame.GaSpaceDimension, "B");
            var mvA = GaSymMultivector.CreateSymbolic(Frame.GaSpaceDimension, "A");
            var mvB = GaSymMultivector.CreateSymbolic(Frame.GaSpaceDimension, "B");

            LogComposer
            .AppendAtNewLine("A = ")
            .AppendLine(mvA.ToString());

            LogComposer
            .AppendAtNewLine("B = ")
            .AppendLine(mvB.ToString())
            .AppendLine();

            var coefSumsTable = GaSymMapBilinearCoefSums.CreateFromOuterProduct(Frame);

            LogComposer
            .AppendAtNewLine("A op B = ")
            .AppendLine(coefSumsTable[mvA, mvB].ToString())
            .AppendLine()
            .AppendLineAtNewLine("A op B Coef Sums:")
            .AppendLine(coefSumsTable.ToMarkdownTable());

            var mv1  = mvA.ToTreeMultivector();
            var mv2  = mvB.ToTreeMultivector();
            var opMv = mv1.Op(mv2);

            LogComposer
            .AppendAtNewLine("Tree: A = ")
            .AppendLine(mv1.ToTreeString())
            .AppendAtNewLine("Tree: B = ")
            .AppendLine(mv2.ToTreeString())
            .AppendAtNewLine("Tree: A op B = ")
            .AppendLine(opMv.ToTreeString())
            .AppendLine();

            coefSumsTable = Frame.Gp.ToCoefSumsMap();
            LogComposer
            .AppendAtNewLine("A gp B = ")
            .AppendLine(coefSumsTable[mvA, mvB].ToString())
            .AppendLine()
            .AppendLineAtNewLine("A gp B Coef Sums:")
            .AppendLine(coefSumsTable.ToMarkdownTable());

            var gpMv = mv1.EGp(mv2);

            LogComposer
            .AppendAtNewLine("Tree: A = ")
            .AppendLine(mv1.ToTreeString())
            .AppendAtNewLine("Tree: B = ")
            .AppendLine(mv2.ToTreeString())
            .AppendAtNewLine("Tree: A gp B = ")
            .AppendLine(gpMv.ToTreeString())
            .AppendLine();

            coefSumsTable = Frame.Sp.ToCoefSumsMap();
            LogComposer
            .AppendAtNewLine("A sp B = ")
            .AppendLine(coefSumsTable[mvA, mvB].ToString())
            .AppendLine()
            .AppendLineAtNewLine("A sp B Coef Sums:")
            .AppendLine(coefSumsTable.ToMarkdownTable());

            coefSumsTable = Frame.Lcp.ToCoefSumsMap();
            LogComposer
            .AppendAtNewLine("A lcp B = ")
            .AppendLine(coefSumsTable[mvA, mvB].ToString())
            .AppendLine()
            .AppendLineAtNewLine("A lcp B Coef Sums:")
            .AppendLine(coefSumsTable.ToMarkdownTable());

            return(LogComposer.ToString());
        }
Example #3
0
        public string Execute()
        {
            LogComposer.Clear();

            for (var vSpaceDim = 3; vSpaceDim <= 5; vSpaceDim++)
            {
                Frame = GaSymFrame.CreateConformal(vSpaceDim);

                //var randGen = new GMacRandomGenerator(10);
                var mvList = new List <GaSymMultivector>();

                mvList.Add(GaSymMultivector.CreateSymbolic(Frame.GaSpaceDimension, "A"));
                mvList.Add(GaSymMultivector.CreateSymbolic(Frame.GaSpaceDimension, "B"));

                //var treeMvList = mvList.Select(mv => mv.ToTreeMultivector()).ToList();

                var i = 0;
                var j = 1;

                var computedOp  = Frame.ComputedOp[mvList[i], mvList[j]];
                var computedGp  = Frame.ComputedGp[mvList[i], mvList[j]];
                var computedSp  = Frame.ComputedSp[mvList[i], mvList[j]];
                var computedLcp = Frame.ComputedLcp[mvList[i], mvList[j]];
                var computedRcp = Frame.ComputedRcp[mvList[i], mvList[j]];
                var computedFdp = Frame.ComputedFdp[mvList[i], mvList[j]];
                var computedHip = Frame.ComputedHip[mvList[i], mvList[j]];
                var computedAcp = Frame.ComputedAcp[mvList[i], mvList[j]];
                var computedCp  = Frame.ComputedCp[mvList[i], mvList[j]];

                Frame.SetProductsImplementation(GaBilinearProductImplementation.LookupHash);
                var hashOp  = Frame.Op[mvList[i], mvList[j]];
                var hashGp  = Frame.Gp[mvList[i], mvList[j]];
                var hashSp  = Frame.Sp[mvList[i], mvList[j]];
                var hashLcp = Frame.Lcp[mvList[i], mvList[j]];
                var hashRcp = Frame.Rcp[mvList[i], mvList[j]];
                var hashFdp = Frame.Fdp[mvList[i], mvList[j]];
                var hashHip = Frame.Hip[mvList[i], mvList[j]];
                var hashAcp = Frame.Acp[mvList[i], mvList[j]];
                var hashCp  = Frame.Cp[mvList[i], mvList[j]];

                Frame.SetProductsImplementation(GaBilinearProductImplementation.LookupArray);
                var arrayOp  = Frame.Op[mvList[i], mvList[j]];
                var arrayGp  = Frame.Gp[mvList[i], mvList[j]];
                var arraySp  = Frame.Sp[mvList[i], mvList[j]];
                var arrayLcp = Frame.Lcp[mvList[i], mvList[j]];
                var arrayRcp = Frame.Rcp[mvList[i], mvList[j]];
                var arrayFdp = Frame.Fdp[mvList[i], mvList[j]];
                var arrayHip = Frame.Hip[mvList[i], mvList[j]];
                var arrayAcp = Frame.Acp[mvList[i], mvList[j]];
                var arrayCp  = Frame.Cp[mvList[i], mvList[j]];

                Frame.SetProductsImplementation(GaBilinearProductImplementation.LookupTree);
                var treeOp  = Frame.Op[mvList[i], mvList[j]];
                var treeGp  = Frame.Gp[mvList[i], mvList[j]];
                var treeSp  = Frame.Sp[mvList[i], mvList[j]];
                var treeLcp = Frame.Lcp[mvList[i], mvList[j]];
                var treeRcp = Frame.Rcp[mvList[i], mvList[j]];
                var treeFdp = Frame.Fdp[mvList[i], mvList[j]];
                var treeHip = Frame.Hip[mvList[i], mvList[j]];
                var treeAcp = Frame.Acp[mvList[i], mvList[j]];
                var treeCp  = Frame.Cp[mvList[i], mvList[j]];

                Frame.SetProductsImplementation(GaBilinearProductImplementation.LookupCoefSums);
                var combinationsOp  = Frame.Op[mvList[i], mvList[j]];
                var combinationsGp  = Frame.Gp[mvList[i], mvList[j]];
                var combinationsSp  = Frame.Sp[mvList[i], mvList[j]];
                var combinationsLcp = Frame.Lcp[mvList[i], mvList[j]];
                var combinationsRcp = Frame.Rcp[mvList[i], mvList[j]];
                var combinationsFdp = Frame.Fdp[mvList[i], mvList[j]];
                var combinationsHip = Frame.Hip[mvList[i], mvList[j]];
                var combinationsAcp = Frame.Acp[mvList[i], mvList[j]];
                var combinationsCp  = Frame.Cp[mvList[i], mvList[j]];


                LogComposer
                .AppendLineAtNewLine("VSpaceDimension: " + vSpaceDim)
                .AppendLine();

                VerifyProductResults("Outer Product - Hash Table", hashOp, computedOp);
                VerifyProductResults("Geometric Product - Hash Table", hashGp, computedGp);
                VerifyProductResults("Scalar Product - Hash Table", hashSp, computedSp);
                VerifyProductResults("Left Contraction Product - Hash Table", hashLcp, computedLcp);
                VerifyProductResults("Right Contraction Product - Hash Table", hashRcp, computedRcp);
                VerifyProductResults("Fat-Dot Product - Hash Table", hashFdp, computedFdp);
                VerifyProductResults("Hestenes Inner Product - Hash Table", hashHip, computedHip);
                VerifyProductResults("Anti-Commutator Product - Hash Table", hashAcp, computedAcp);
                VerifyProductResults("Commutator Product - Hash Table", hashCp, computedCp);

                VerifyProductResults("Outer Product - Array Table Table", arrayOp, computedOp);
                VerifyProductResults("Geometric Product - Array Table Table", arrayGp, computedGp);
                VerifyProductResults("Scalar Product - Array Table Table", arraySp, computedSp);
                VerifyProductResults("Left Contraction Product - Array Table Table", arrayLcp, computedLcp);
                VerifyProductResults("Right Contraction Product - Array Table Table", arrayRcp, computedRcp);
                VerifyProductResults("Fat-Dot Product - Array Table Table", arrayFdp, computedFdp);
                VerifyProductResults("Hestenes Inner Product - Array Table Table", arrayHip, computedHip);
                VerifyProductResults("Anti-Commutator Product - Array Table Table", arrayAcp, computedAcp);
                VerifyProductResults("Commutator Product - Array Table Table", arrayCp, computedCp);

                VerifyProductResults("Outer Product - Tree Table", treeOp, computedOp);
                VerifyProductResults("Geometric Product - Tree Table", treeGp, computedGp);
                VerifyProductResults("Scalar Product - Tree Table", treeSp, computedSp);
                VerifyProductResults("Left Contraction Product - Tree Table", treeLcp, computedLcp);
                VerifyProductResults("Right Contraction Product - Tree Table", treeRcp, computedRcp);
                VerifyProductResults("Fat-Dot Product - Tree Table", treeFdp, computedFdp);
                VerifyProductResults("Hestenes Inner Product - Tree Table", treeHip, computedHip);
                VerifyProductResults("Anti-Commutator Product - Tree Table", treeAcp, computedAcp);
                VerifyProductResults("Commutator Product - Tree Table", treeCp, computedCp);

                VerifyProductResults("Outer Product - Combinations Table", combinationsOp, computedOp);
                VerifyProductResults("Geometric Product - Combinations Table", combinationsGp, computedGp);
                VerifyProductResults("Scalar Product - Combinations Table", combinationsSp, computedSp);
                VerifyProductResults("Left Contraction Product - Combinations Table", combinationsLcp, computedLcp);
                VerifyProductResults("Right Contraction Product - Combinations Table", combinationsRcp, computedRcp);
                VerifyProductResults("Fat-Dot Product - Combinations Table", combinationsFdp, computedFdp);
                VerifyProductResults("Hestenes Inner Product - Combinations Table", combinationsHip, computedHip);
                VerifyProductResults("Anti-Commutator Product - Combinations Table", combinationsAcp, computedAcp);
                VerifyProductResults("Commutator Product - Combinations Table", combinationsCp, computedCp);

                LogComposer.AppendLine().AppendLine();
            }


            return(LogComposer.ToString());
        }