Beispiel #1
0
        public static GaNumMetricOrthonormal Create(IReadOnlyList <int> basisVectorsSignaturesList)
        {
            var vSpaceDim = basisVectorsSignaturesList.Count;
            var bbsList   = new GaNumMetricOrthonormal(vSpaceDim);

            bbsList[0] = 1;

            for (var m = 0; m < vSpaceDim; m++)
            {
                var bvs = basisVectorsSignaturesList[m];

                if (bvs == 0)
                {
                    continue;
                }

                bbsList[1 << m] = bvs;
            }

            var idsSeq = GMacMathUtils.BasisBladeIDsSortedByGrade(vSpaceDim, 2);

            foreach (var id in idsSeq)
            {
                int id1, id2;
                id.SplitBySmallestBasisVectorId(out id1, out id2);

                bbsList[id] = bbsList[id1] * bbsList[id2];
            }

            return(bbsList);
        }
        public static GaSymMetricOrthogonal Create(IReadOnlyList <Expr> basisVectorsSignaturesList)
        {
            var vSpaceDim = basisVectorsSignaturesList.Count;
            var bbsList   = new GaSymMetricOrthogonal(vSpaceDim);

            bbsList[0] = Expr.INT_ONE;

            for (var m = 0; m < vSpaceDim; m++)
            {
                var bvs = basisVectorsSignaturesList[m];

                if (bvs.IsNullOrZero())
                {
                    continue;
                }

                bbsList[1 << m] = bvs;
            }

            var idsSeq = GMacMathUtils.BasisBladeIDsSortedByGrade(vSpaceDim, 2);

            foreach (var id in idsSeq)
            {
                int id1, id2;
                id.SplitBySmallestBasisVectorId(out id1, out id2);

                var bvs1 = bbsList[id1];
                if (bvs1.IsNullOrZero())
                {
                    continue;
                }

                var bvs2 = bbsList[id2];
                if (bvs2.IsNullOrZero())
                {
                    continue;
                }

                bbsList[id] = SymbolicUtils.Cas[Mfs.Times[bvs1, bvs2]];
            }

            return(bbsList);
        }
Beispiel #3
0
        //public static BinaryTreeNode<MathematicaScalar> ComputeBasisBladesSignatures(this IReadOnlyList<MathematicaScalar> basisVectorsSignaturesList)
        //{
        //    var vSpaceDim = basisVectorsSignaturesList.Count;
        //    var bbsList = new BinaryTreeNode<MathematicaScalar>(vSpaceDim);

        //    bbsList.SetValue(0ul, Constants.One);

        //    for (var m = 0; m < vSpaceDim; m++)
        //    {
        //        var bvs = basisVectorsSignaturesList[m];

        //        if (bvs.IsNullOrZero()) continue;

        //        bbsList.SetValue(1ul << m, bvs);
        //    }

        //    var idsSeq = FrameUtils.BasisBladeIDsSortedByGrade(vSpaceDim, 2);
        //    foreach (var id in idsSeq)
        //    {
        //        int id1, id2;
        //        id.SplitBySmallestBasisVectorId(out id1, out id2);

        //        var bvs1 = bbsList.GetValue((ulong)id1);
        //        if (bvs1.IsNullOrZero()) continue;

        //        var bvs2 = bbsList.GetValue((ulong)id2);
        //        if (bvs2.IsNullOrZero()) continue;

        //        bbsList.SetValue((ulong)id, bvs1 * bvs2);
        //    }

        //    return bbsList;
        //}

        public static GMacBinaryTree <int> ComputeBasisBladesSignatures(this IReadOnlyList <int> basisVectorsSignaturesList)
        {
            var vSpaceDim = basisVectorsSignaturesList.Count;
            var bbsList   = new GMacBinaryTree <int>(vSpaceDim);

            bbsList.SetLeafValue(0ul, 1);

            for (var m = 0; m < vSpaceDim; m++)
            {
                var bvs = basisVectorsSignaturesList[m];

                if (bvs == 0)
                {
                    continue;
                }

                bbsList.SetLeafValue(1ul << m, bvs);
            }

            var idsSeq = GMacMathUtils.BasisBladeIDsSortedByGrade(vSpaceDim, 2);

            foreach (var id in idsSeq)
            {
                int id1, id2;
                id.SplitBySmallestBasisVectorId(out id1, out id2);

                var bvs1 = bbsList.GetLeafValue((ulong)id1);
                if (bvs1 == 0)
                {
                    continue;
                }

                var bvs2 = bbsList.GetLeafValue((ulong)id2);
                if (bvs2 == 0)
                {
                    continue;
                }

                bbsList.SetLeafValue((ulong)id, bvs1 * bvs2);
            }

            return(bbsList);
        }