/// <summary> /// Odd Versor Product of a list of basis blades given by their IDs /// </summary> /// <param name="oddVersor"></param> /// <param name="basisBladeIDs"></param> /// <returns></returns> public IEnumerable <GaNumMultivector> OddVersorProduct(GaNumMultivector oddVersor, IEnumerable <int> basisBladeIDs) { var oddVersorReverse = oddVersor.Reverse(); var oddVersorNorm2Inverse = 1.0d / Sp[oddVersor, oddVersorReverse][0]; var oddVersorInverse = oddVersorReverse * oddVersorNorm2Inverse; return(basisBladeIDs.Select(id => { var mv = GaNumMultivector.CreateTerm( GaSpaceDimension, id, id.BasisBladeIdHasNegativeGradeInv() ? -1.0d : 1.0d ); return Gp[Gp[oddVersor, mv], oddVersorInverse] .GetKVectorPart(id.BasisBladeGrade()); })); }
/// <summary> /// Create a derived frame system where the derived frame is the reciprocal of the base frame /// </summary> /// <param name="baseFrame"></param> /// <returns></returns> public static GaNumMetricNonOrthogonal CreateReciprocalCbmFrameSystem(GaNumFrame baseFrame) { if (baseFrame.IsOrthogonal) { var cbmat = baseFrame.Ipm.Inverse(); var b2DOm = baseFrame.Ipm.ToOutermorphismTree(); var d2BOm = (cbmat as Matrix).ToOutermorphismTree(); var derivedFrame = CreateOrthogonal(cbmat.Diagonal()); return(new GaNumMetricNonOrthogonal(baseFrame, derivedFrame, d2BOm, b2DOm)); } var cbmArray = new double[baseFrame.VSpaceDimension, baseFrame.VSpaceDimension]; var mv2 = baseFrame.CreateInverseUnitPseudoScalar(); for (var i = 0; i < baseFrame.VSpaceDimension; i++) { var id = (1 << i) ^ baseFrame.MaxBasisBladeId; var mv1 = GaNumMultivector.CreateTerm(baseFrame.GaSpaceDimension, id, 1.0d); var mv = baseFrame.Lcp[mv1, mv2]; foreach (var term in mv.NonZeroTerms) { var j = term.Key.BasisBladeIndex(); if ((i & 1) == 1) { cbmArray[i, j] = term.Value; } else { cbmArray[i, j] = -term.Value; } } } var cbm = DenseMatrix.OfArray(cbmArray); return(CreateDerivedCbmFrameSystem(baseFrame, cbm)); }
public GaNumMultivector CreateInverseUnitPseudoScalar() { return(GaNumMultivector.CreateTerm(GaSpaceDimension, MaxBasisBladeId, UnitPseudoScalarCoef)); }