private static IEnumerable <uint> CoordinateSequence( int[] dimensionIndices , uint[] sparseCoordinates , int dimensions , uint[] missingValues , UniqueSeedRandom randomNumbers) { var iSparse = 0; var iDim = 0; var r = randomNumbers.Sequence(missingValues.Length); foreach (var iMissing in r) { while (iSparse < dimensionIndices.Length && iDim == dimensionIndices[iSparse]) { yield return(sparseCoordinates[iSparse]); iSparse++; iDim++; } if (iDim < dimensions) { yield return(missingValues[iMissing]); iDim++; } if (iDim >= dimensions) { break; } } }
private HyperContrastedPoint(UniqueSeedRandom randomNumbers, int[] dimensionIndices, uint[] sparseCoordinates, int dimensions, uint[] missingValues, int optionalId) : base(CoordinateSequence(dimensionIndices, sparseCoordinates, dimensions, missingValues, randomNumbers).ToArray(), optionalId) { RandomNumbers = randomNumbers; DimensionIndices = dimensionIndices; SparseCoordinates = sparseCoordinates; MissingValues = missingValues; CoordinateHolder = Cache.Add(_coordinates); _coordinates = null; }