} // end of WriteFunction /// <summary> /// Computes the return type for exp(smv). /// Sets m_returnTypeName and m_returnType. /// </summary> protected void ComputeReturnTypeExpSmv(G25.CG.Shared.FuncArgInfo[] FAI, G25.FloatType FT) { m_returnTypeName = m_fgs.ReturnTypeName; if (m_returnTypeName.Length == 0) { // find out returntype G25.SMV inputType = FAI[0].Type as G25.SMV; { // determine tight return type (i.e., keep repeating the geometric product of the input type until no more new basis blades are found) // We want to known which basis blades are present in inputType-to-the-power-of-infinity // So which bases blades will be present in the return type? bool[] present = new bool[1 << m_specification.m_dimension]; { bool[] tried = new bool[(1 << m_specification.m_dimension) * (1 << m_specification.m_dimension)]; // init 'present' with the inputType for (int i = 0; i < inputType.NbCoordinates; i++) { present[inputType.Group(0)[i].bitmap] = true; } // combine bitmaps (gp) until no more new bitmaps found bool newBBfound = true; while (newBBfound) { newBBfound = false; for (uint i = 0; i < present.Length; i++) { if (!present[i]) { continue; } for (uint j = 0; j < present.Length; j++) { if (!present[j]) { continue; } if (tried[j * (1 << m_specification.m_dimension) + i]) { continue; } // remember that we tried this combo of input blades: tried[j * (1 << m_specification.m_dimension) + i] = true; RefGA.Multivector M = RefGA.Multivector.gp(new RefGA.Multivector(new RefGA.BasisBlade(i)), new RefGA.Multivector(new RefGA.BasisBlade(j)), m_G25M.m_metric); for (int k = 0; k < M.BasisBlades.Length; k++) { uint b = M.BasisBlades[k].bitmap; if (!present[b]) { // this bitmap wasn't found yet, so mark it as present newBBfound = true; present[b] = true; } } } } } // end of combine bitmaps (gp) until no more new bitmaps found } // construct multivector of return type, get return type { System.Collections.ArrayList L = new System.Collections.ArrayList(); for (uint i = 0; i < present.Length; i++) { if (!present[i]) { continue; } else { L.Add(new RefGA.BasisBlade(i, 1.0, "c" + i)); } } RefGA.Multivector RTMV = new RefGA.Multivector(L); m_returnType = CG.Shared.SpecializedReturnType.GetReturnType(m_specification, m_cgd, m_fgs, FT, RTMV) as G25.SMV; m_returnTypeName = m_returnType.GetName(); } } } // end of 'find out return type name' else { m_returnType = m_specification.GetType(m_returnTypeName); } } // end of ComputeReturnTypeExpSmv()