//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); }
public override IGaSymMultivectorTemp MapToTemp(int id1) { return(_basisBladeMaps.GetLeafValue((ulong)id1)?.ToTempMultivector() ?? GaSymMultivector.CreateZeroTemp(TargetGaSpaceDimension)); }