Interface SparseNdArray<T, U extends NdArray<T>>
- Type Parameters:
T- the type that the array containsU- the type of dense NdArray
- All Known Implementing Classes:
AbstractSparseNdArray, BooleanSparseNdArray, BooleanSparseSlice, ByteSparseNdArray, ByteSparseSlice, DoubleSparseNdArray, DoubleSparseSlice, FloatSparseNdArray, FloatSparseSlice, IntSparseNdArray, IntSparseSlice, LongSparseNdArray, LongSparseSlice, ObjectSparseSlice, ShortSparseNdArray, ShortSparseSlice, SparseNdArray, SparseSlice
-
Method Summary
Modifier and TypeMethodDescriptionGets the IndicesGets the values.Methods inherited from interface NdArray
copyFrom, copyTo, copyTo, elements, equals, get, getObject, scalars, set, setObject, slice, streamOfObjects, withShapeModifier and TypeMethodDescriptioncopyFrom(DataBuffer<T> src) Copy the content of the source buffer into this N-dimensional array.copyTo(DataBuffer<T> dst) Copy the content of this N-dimensional array into the destination buffer.Copy the content of this array to the destination array.NdArraySequence<? extends NdArray<T>> elements(int dimensionIdx) Returns a sequence of all elements at a given dimension.booleanChecks equality between n-dimensional arrays.get(long... coordinates) Returns the N-dimensional element of this array at the given coordinates.getObject(long... coordinates) Returns the value of the scalar found at the given coordinates.NdArraySequence<? extends NdArray<T>> scalars()Returns a sequence of all scalars in this array.Assigns the value of the N-dimensional element found at the given coordinates.Assigns the value of the scalar found at the given coordinates.Creates a multi-dimensional view (or slice) of this array by mapping one or more dimensions to the given index selectors.Retrieve all scalar values of this array as a stream of objects.Returns a new N-dimensional view of this array with the givenshape.
-
Method Details
-
getIndices
LongNdArray getIndices()Gets the IndicesIndices are a A 2-D long array of shape
[N, ndims], that specifies the indices of the elements in the sparse array that contain nonzero values (elements are zero-indexed).For example,
indices=[[1,3], [2,4]]specifies that the elements with indexes of coordinates[1,3]and[2,4]have nonzero values.- Returns:
- the Indices
-
getValues
U getValues()Gets the values.Values are a 1-D array of any type and shape
[N], that supplies the values for each element in indices.For example, given
indices=[[1,3], [2,4]], andvalues=[18, 3.6]specifies that element[1,3]of the sparse array has a value of18, and element[2,4]of the sparse array has a value of3.6.- Returns:
- the values
-