public GaNumMapUnilinearComposed ResetToMapping(IGaNumMapUnilinear firstMapping) { _mappingsList.Clear(); _mappingsList.Add(firstMapping); return(this); }
/// <summary> /// Extract the basis vectors mappings from the given linear map and convert them into a /// linear map on the base vector space of the frame. This should only be used if basis vectors /// of the domain are mapped to vectors of the target domain. /// </summary> /// <param name="linearMap"></param> /// <returns></returns> public static double[,] BasisVectorMapsToScalarsArray(this IGaNumMapUnilinear linearMap) { var resultArray = new double[ linearMap.TargetVSpaceDimension, linearMap.DomainVSpaceDimension ]; foreach (var basisVectorMap in linearMap.BasisVectorMaps()) { var col = basisVectorMap.Item1; var terms = basisVectorMap .Item2 .NonZeroTerms .Where(t => t.Key.IsValidBasisVectorId()); foreach (var term in terms) { var row = term.Key; resultArray[row, col] = term.Value; } } return(resultArray); }
public GaNumMapUnilinearComposed AddMapping(IGaNumMapUnilinear map) { if (_mappingsList.Count > 0 && TargetVSpaceDimension != map.DomainVSpaceDimension) { throw new InvalidOperationException("Mapping space dimensions mismatch"); } _mappingsList.Add(map); return(this); }
public GaNumMapUnilinearCombined AddMap(double coef, IGaNumMapUnilinear linearMap) { if ( linearMap.DomainVSpaceDimension != DomainVSpaceDimension || linearMap.TargetVSpaceDimension != TargetVSpaceDimension ) { throw new InvalidOperationException("Linear map dimensions mismatch"); } _mappingsList.Add(new GaNumMapUnilinearCombinedTerm(coef, linearMap)); return(this); }
public static GaNumMapUnilinearCoefSums ToCoefSumsMap(this IGaNumMapUnilinear linearMap) { var resultMap = GaNumMapUnilinearCoefSums.Create( linearMap.DomainVSpaceDimension, linearMap.TargetVSpaceDimension ); foreach (var basisBladeMap in linearMap.BasisBladeMaps()) { resultMap.SetBasisBladeMap(basisBladeMap.Item1, basisBladeMap.Item2); } return(resultMap); }
public static GaNumMapUnilinearHash Create(IGaNumMapUnilinear linearMap, IEnumerable <int> idsList) { var table = new GaNumMapUnilinearHash( linearMap.DomainVSpaceDimension, linearMap.TargetVSpaceDimension ); foreach (var id1 in idsList) { var resultMv = linearMap[id1]; if (!resultMv.IsNullOrZero()) { table._basisBladeMaps[id1] = resultMv; } } return(table); }
public static double[,] ToScalarsArray(this IGaNumMapUnilinear linearMap) { var resultArray = new double[ linearMap.TargetGaSpaceDimension, linearMap.DomainGaSpaceDimension ]; foreach (var basisBladeMap in linearMap.BasisBladeMaps()) { var col = basisBladeMap.Item1; foreach (var term in basisBladeMap.Item2.NonZeroTerms) { var row = term.Key; resultArray[row, col] = term.Value; } } return(resultArray); }
internal GaNumMapUnilinearCombinedTerm(double coef, IGaNumMapUnilinear linearMap) { Coef = coef; LinearMap = linearMap; }
private GaNumMapUnilinearComposed(IGaNumMapUnilinear firstMapping) { _mappingsList.Add(firstMapping); }
public static GaNumMapUnilinearComposed Create(IGaNumMapUnilinear firstMappings) { return(new GaNumMapUnilinearComposed(firstMappings)); }
public static Matrix ToMatrix(this IGaNumMapUnilinear linearMap) { return(DenseMatrix.OfArray( ToScalarsArray(linearMap) )); }
public static GaNumMapUnilinearMatrix ToMatrixMap(this IGaNumMapUnilinear linearMap) { return(GaNumMapUnilinearMatrix.Create(linearMap.ToMatrix())); }
public static IEnumerable <double[]> ToScalarColumnsList(this IGaNumMapUnilinear linearMap) { return(Enumerable .Range(0, linearMap.DomainGaSpaceDimension) .Select(id => linearMap[id].TermsToArray())); }
public static IEnumerable <IGaNumMultivector> ToColumnsList(this IGaNumMapUnilinear linearMap) { return(Enumerable .Range(0, linearMap.DomainGaSpaceDimension) .Select(id => linearMap[id])); }
public static Dictionary <int, IGaNumMultivector> ToDictionary(this IGaNumMapUnilinear linearMap) { return(linearMap .BasisBladeMaps() .ToDictionary(t => t.Item1, t => t.Item2)); }