/** * Creates a vector from the given map of indices to values. * * @param dimensionality * The dimensionality of the vector. Cannot be negative. * @param map * The map of indices to values to fill in the vector. All indices * must be 0-based and between 0 (inclusive) and dimensionality * (exclusive). Cannot be null. * @return * A new vector with elements initialized to the ones in the map. */ public VectorType copyMap( final int dimensionality, final Map<Integer, ? extends Number> map) { ArgumentChecker.assertIsNotNull("map", map); final VectorType result = this.createVectorCapacity(dimensionality, map.size()); for (final Map.Entry<Integer, ? extends Number> entry : map.entrySet()) { result.set(entry.getKey(), entry.getValue().doubleValue()); } return result; }
/** * Creates a vector from the given map of indices to values. * * @param dimensionality * The dimensionality of the vector. Cannot be negative. * @param map * The map of indices to values to fill in the vector. All indices * must be 0-based and between 0 (inclusive) and dimensionality * (exclusive). Cannot be null. * @return * A new vector with elements initialized to the ones in the map. */ public VectorType copyMap( final int dimensionality, final Map<Integer, ? extends Number> map) { ArgumentChecker.assertIsNotNull("map", map); final VectorType result = this.createVectorCapacity(dimensionality, map.size()); for (final Map.Entry<Integer, ? extends Number> entry : map.entrySet()) { result.set(entry.getKey(), entry.getValue().doubleValue()); } return result; }
/** * Creates a vector from the given map of indices to values. * * @param dimensionality * The dimensionality of the vector. Cannot be negative. * @param map * The map of indices to values to fill in the vector. All indices * must be 0-based and between 0 (inclusive) and dimensionality * (exclusive). Cannot be null. * @return * A new vector with elements initialized to the ones in the map. */ public VectorType copyMap( final int dimensionality, final Map<Integer, ? extends Number> map) { ArgumentChecker.assertIsNotNull("map", map); final VectorType result = this.createVectorCapacity(dimensionality, map.size()); for (final Map.Entry<Integer, ? extends Number> entry : map.entrySet()) { result.set(entry.getKey(), entry.getValue().doubleValue()); } return result; }
final Vector output = this.vectorFactory.createVectorCapacity( this.outputDimensionality, input.getEntryCount()); for (final VectorEntry entry : input)
final Vector output = this.vectorFactory.createVectorCapacity( this.outputDimensionality, input.getEntryCount()); for (final VectorEntry entry : input)
final Vector output = this.vectorFactory.createVectorCapacity( this.outputDimensionality, input.getEntryCount()); for (final VectorEntry entry : input)