public class BaseSparseNDArrayCOO extends BaseSparseNDArray
Modifier and Type | Field and Description |
---|---|
protected static SparseFormat |
format |
protected DataBuffer |
indices |
protected boolean |
isSorted |
protected DataBuffer |
values |
columns, isMatrix, isScalar, isSparse, isVector, javaShapeInformation, length, rank, rows, shape, shapeInformation, sparseInformation, stride, THRESHOLD_MEMORY_ALLOCATION
Constructor and Description |
---|
BaseSparseNDArrayCOO(DataBuffer values,
DataBuffer indices,
DataBuffer sparseInformation,
int[] shape) |
BaseSparseNDArrayCOO(DataBuffer values,
DataBuffer indices,
int[] shape) |
BaseSparseNDArrayCOO(DataBuffer values,
DataBuffer indices,
long[] sparseOffsets,
int[] flags,
int[] hiddenDimensions,
int underlyingRank,
int[] shape) |
BaseSparseNDArrayCOO(double[] values,
int[][] indices,
int[] shape) |
BaseSparseNDArrayCOO(float[] values,
int[][] indices,
int[] shape) |
Modifier and Type | Method and Description |
---|---|
void |
addOrUpdate(int[] indexes,
double value)
Add a new element in the ndarray or update the value if there is already a non-null element at this position
|
INDArray |
assign(INDArray arr)
Assign all of the elements in the given
ndarray to this ndarray
|
boolean |
canInsert(DataBuffer buffer,
int length)
Return if there is enough allocated memory space to add data of a given length in the databuffer
|
INDArray |
convertToDoubles() |
INDArray |
convertToFloats() |
long |
countNNZ()
Count the number of value that are included in the ndarray (view) according to the sparse offsets and the shape
|
DataBuffer |
data()
Returns a linear double array representation of this ndarray
|
int[] |
filterOutFixedDimensions(int[] flags,
List<Integer> idx) |
INDArray |
get(INDArrayIndex... indexes)
Returns a subset of this array based on the specified
indexes
|
double |
getDouble(int... indices)
Get a double value at the specified indices.
|
double |
getDouble(int i)
Get the double value at the specified linear index in the array
|
double |
getDouble(int i,
int j)
Get the double value at the specified indices.
|
float |
getFloat(int i)
Return the item at the linear index i
|
float |
getFloat(int[] indices)
Returns the elements at the the specified indices
|
float |
getFloat(int i,
int j)
Return the item at row i column j
Note that this is the same as calling getScalar(new int[]{i,j}
|
SparseFormat |
getFormat()
Return the sparse format (i.e COO, CSR, ...)
|
DataBuffer |
getIncludedIndices()
Return a copy of the indices included in the view.
|
DataBuffer |
getIncludedValues()
Return a copy of the values included in the array.
|
DataBuffer |
getIndices() |
DataBuffer |
getIndicesOf(int i)
Returns the indices of the element of the given index in the array context
|
int |
getInt(int... indices)
Get an integer value at the specified indices.
|
int |
getNumHiddenDimension() |
INDArray |
getScalar(int... indices)
Returns the elements at the the specified indices
|
DataBuffer |
getUnderlyingIndices()
Return the indices buffer
|
DataBuffer |
getUnderlyingIndicesOf(int i)
Returns the underlying indices of the element of the given index
such as there really are in the original ndarray
|
DataBuffer |
getUnderlyingValues()
Return the values buffer
|
DataBuffer |
getValues() |
DataBuffer |
getVectorCoordinates()
Returns the indices of non-zero element of the vector
|
int |
indexesBinarySearch(int lowerBound,
int upperBound,
int[] idx)
Return the position of the idx array into the indexes buffer between the lower and upper bound.
|
boolean |
isDimensionFixed(int i)
Return if the dimension in argument is a fixed dimension.
|
boolean |
isSorted() |
boolean |
isView()
Returns true if this array is a view or not
|
boolean |
isZero(int... indexes) |
INDArray |
mmul(INDArray other,
INDArray result,
MMulTranspose mMulTranspose)
Perform an copy matrix multiplication
|
INDArray |
mmul(INDArray other,
MMulTranspose mMulTranspose) |
INDArray |
mmuli(INDArray other,
INDArray result,
MMulTranspose transpose) |
INDArray |
mmuli(INDArray other,
MMulTranspose transpose) |
INDArray |
put(INDArrayIndex[] indices,
INDArray element)
Put the elements of the ndarray
in to the specified indices
|
INDArray |
put(INDArrayIndex[] indices,
Number element)
Put the elements of the ndarray
in to the specified indices
|
INDArray |
put(int[] indexes,
INDArray element)
Inserts the element at the specified index
|
INDArray |
put(int i,
INDArray element)
Inserts the element at the specified index
|
INDArray |
put(int i,
int j,
INDArray element)
Inserts the element at the specified index
|
INDArray |
put(int i,
int j,
Number element)
Inserts the element at the specified index
|
INDArray |
putColumn(int column,
INDArray toPut)
Insert a column in to this array
Will throw an exception if this
ndarray is not a matrix
|
INDArray |
putiColumnVector(INDArray columnVector)
In place assignment of a column vector
|
INDArray |
putiRowVector(INDArray rowVector)
in place assignment of row vector, to each row of this array
|
INDArray |
putRow(int row,
INDArray toPut)
Insert a row in to this array
Will throw an exception if this
ndarray is not a matrix
|
INDArray |
putScalar(int[] indexes,
double value)
Insert the item at the specified indices
|
INDArray |
putScalar(int i,
double value)
Insert the number linearly in to the ndarray
|
INDArray |
putScalar(int i,
float value)
Insert a scalar float at the specified index
|
INDArray |
putScalar(int i,
int value)
Insert a scalar int at the specified index
|
INDArray |
putScalar(int row,
int col,
double value)
Insert the value at the specified indices, in a 2d (rank 2) NDArray
Equivalent to INDArray.putScalar(int[], double) but avoids int[] creation |
INDArray |
putScalar(int dim0,
int dim1,
int dim2,
double value)
Insert the value at the specified indices, in a 3d (rank 3) NDArray
Equivalent to INDArray.putScalar(int[], double) but avoids int[] creation |
INDArray |
putScalar(int dim0,
int dim1,
int dim2,
int dim3,
double value)
Insert the value at the specified indices, in a 4d (rank 4) NDArray
Equivalent to INDArray.putScalar(int[], double) but avoids int[] creation |
INDArray |
removeEntry(int idx)
Remove an element of the ndarray
|
int |
reverseIndexes(int... indexes)
Return the index of the value corresponding to the indexes
|
DataBuffer |
shapeInfoDataBuffer()
Shape info
|
DataBuffer |
shiftLeft(DataBuffer buffer,
int from,
int offset,
long datalength) |
void |
sort()
Sort the indexes and the values buffers
|
INDArray |
subArray(long[] offsets,
int[] shape,
int[] stride) |
INDArray |
subArray(ShapeOffsetResolution resolution)
Sub array based on the
pre calculated shape,strides, offsets
|
INDArray |
subArray(ShapeOffsetResolution resolution,
ShapeOffsetResolution resolutionWithoutNewAxis) |
INDArray |
toDense()
Converts the sparse ndarray into a dense one
|
int |
toFlatArray(com.google.flatbuffers.FlatBufferBuilder builder)
Add an
INDArray
to flatbuffers builder |
int[] |
translateToPhysical(int[] virtualIndexes)
Translate the view index to the corresponding index of the original ndarray
|
int |
underlyingRank() |
add, add, add, add, add, add, addColumnVector, addi, addi, addi, addi, addi, addi, addiColumnVector, addiRowVector, addRowVector, amax, amaxNumber, amean, ameanNumber, amin, aminNumber, argMax, assign, assignIf, broadcast, broadcast, checkDimensions, cleanup, clone, columns, cond, condi, cumsum, cumsumi, detach, dimShuffle, distance1, distance2, div, div, div, div, div, div, divColumnVector, divi, divi, divi, divi, divi, divi, diviColumnVector, diviRowVector, divRowVector, dup, dup, element, elementStride, elementWiseStride, entropy, entropyNumber, eps, eps, epsi, epsi, eq, eq, eqi, eqi, equals, equalsWithEps, flags, fmod, fmod, fmod, fmod, fmodi, fmodi, get, get, getColumn, getColumns, getDoubleUnsafe, getLeadingOnes, getPercentile, getRow, getRows, getScalar, getScalar, getTrailingOnes, getWhere, getWhere, gt, gt, gte, gtei, gti, gti, hiddenDimensions, index, init, innerMostStride, isAttached, isCleanedUp, isColumnVector, isColumnVectorOrScalar, isCompressed, isInScope, isMatrix, isRowVector, isRowVectorOrScalar, isScalar, isSparse, isSquare, isVector, isVectorOrScalar, isWrapAround, javaTensorAlongDimension, length, lengthLong, leverage, leverageOrDetach, leverageTo, leverageTo, linearIndex, linearView, linearViewColumnOrder, logEntropy, logEntropyNumber, lt, lt, lte, ltei, lti, lti, majorStride, markAsCompressed, match, match, max, maxComplex, maxNumber, mean, mean, meanComplex, meanNumber, median, medianNumber, migrate, migrate, min, minComplex, minNumber, mmul, mmul, mmuli, mmuli, mul, mul, mul, mul, mul, mul, mulColumnVector, muli, muli, muli, muli, muli, muli, muliColumnVector, muliRowVector, mulRowVector, neg, negi, neq, neq, neqi, neqi, nnz, norm1, norm1Complex, norm1Number, norm2, norm2Complex, norm2Number, normmax, normmaxComplex, normmaxNumber, offset, ordering, originalOffset, percentile, percentileNumber, permute, permutei, prod, prodComplex, prodNumber, put, put, putScalar, putScalar, putScalarUnsafe, putSlice, putWhere, putWhere, putWhere, putWhereWithMask, putWhereWithMask, rank, ravel, ravel, rdiv, rdiv, rdiv, rdiv, rdiv, rdiv, rdivColumnVector, rdivi, rdivi, rdivi, rdivi, rdivi, rdivi, rdiviColumnVector, rdiviRowVector, rdivRowVector, reallocate, remainder, remainder, remainder, remainder, remainderi, remainderi, repeat, replaceWhere, repmat, resetLinearView, reshape, reshape, reshape, reshape, rows, rsub, rsub, rsub, rsub, rsub, rsub, rsubColumnVector, rsubi, rsubi, rsubi, rsubi, rsubi, rsubi, rsubiColumnVector, rsubiRowVector, rsubRowVector, scan, secondaryStride, setData, setOrder, setShape, setShapeAndStride, setShapeInformation, setStride, setWrapAround, shannonEntropy, shannonEntropyNumber, shape, shapeInfo, shapeInfoToString, shapeOf, size, slice, slice, slices, sliceVectors, sparseInfoDataBuffer, sparseOffsets, squaredDistance, std, std, stdComplex, stdNumber, stdNumber, stride, stride, strideOf, sub, sub, sub, sub, sub, sub, subColumnVector, subi, subi, subi, subi, subi, subi, subiColumnVector, subiRowVector, subRowVector, sum, sum, sumComplex, sumNumber, swapAxes, tensorAlongDimension, tensorssAlongDimension, toDoubleMatrix, toDoubleVector, toFloatMatrix, toFloatVector, toIntMatrix, toIntVector, transpose, transposei, unsafeDuplication, unsafeDuplication, var, var, varComplex, varNumber, vectorAlongDimension, vectorsAlongDimension
protected static final SparseFormat format
protected transient volatile DataBuffer values
protected transient volatile DataBuffer indices
protected transient volatile boolean isSorted
public BaseSparseNDArrayCOO(double[] values, int[][] indices, int[] shape)
public BaseSparseNDArrayCOO(DataBuffer values, DataBuffer indices, int[] shape)
public BaseSparseNDArrayCOO(float[] values, int[][] indices, int[] shape)
public BaseSparseNDArrayCOO(DataBuffer values, DataBuffer indices, DataBuffer sparseInformation, int[] shape)
public BaseSparseNDArrayCOO(DataBuffer values, DataBuffer indices, long[] sparseOffsets, int[] flags, int[] hiddenDimensions, int underlyingRank, int[] shape)
public int toFlatArray(com.google.flatbuffers.FlatBufferBuilder builder)
INDArray
INDArray
to flatbuffers builderbuilder
- the builder to usepublic long countNNZ()
public INDArray assign(INDArray arr)
INDArray
assign
in interface INDArray
assign
in class BaseSparseNDArray
arr
- the elements to assignpublic void sort()
public int[] translateToPhysical(int[] virtualIndexes)
virtualIndexes
- the view indexespublic boolean isDimensionFixed(int i)
public INDArray putScalar(int i, double value)
INDArray
putScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
i
- the index to insert intovalue
- the value to insertpublic INDArray putScalar(int i, float value)
INDArray
putScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
i
- The index to insert intovalue
- Value to insertpublic INDArray putScalar(int i, int value)
INDArray
putScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
i
- The index to insert intovalue
- Value to insertpublic INDArray putScalar(int[] indexes, double value)
INDArray
putScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
indexes
- the indices to insert atvalue
- the number to insertpublic INDArray putScalar(int row, int col, double value)
INDArray
INDArray.putScalar(int[], double)
but avoids int[] creationputScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
row
- Row (dimension 0) indexcol
- Column (dimension 1) indexvalue
- Value to putpublic INDArray putScalar(int dim0, int dim1, int dim2, double value)
INDArray
INDArray.putScalar(int[], double)
but avoids int[] creationputScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
dim0
- Dimension 0 indexdim1
- Dimension 1 indexdim2
- Dimension 2 indexvalue
- Value to putpublic INDArray putScalar(int dim0, int dim1, int dim2, int dim3, double value)
INDArray
INDArray.putScalar(int[], double)
but avoids int[] creationputScalar
in interface INDArray
putScalar
in class BaseSparseNDArray
dim0
- Dimension 0 indexdim1
- Dimension 1 indexdim2
- Dimension 2 indexdim3
- Dimension 3 indexvalue
- Value to putpublic INDArray putRow(int row, INDArray toPut)
INDArray
putRow
in interface INDArray
putRow
in class BaseSparseNDArray
row
- the row insert intotoPut
- the row to insertpublic INDArray putColumn(int column, INDArray toPut)
INDArray
putColumn
in interface INDArray
putColumn
in class BaseSparseNDArray
column
- the column to inserttoPut
- the array to putpublic INDArray put(INDArrayIndex[] indices, INDArray element)
INDArray
put
in interface INDArray
put
in class BaseSparseNDArray
indices
- the indices to put the ndarray in toelement
- the ndarray to putpublic INDArray put(INDArrayIndex[] indices, Number element)
INDArray
put
in interface INDArray
put
in class BaseSparseNDArray
indices
- the indices to put the ndarray in toelement
- the ndarray to putpublic INDArray put(int[] indexes, INDArray element)
INDArray
put
in interface INDArray
put
in class BaseSparseNDArray
indexes
- the indices to insert intoelement
- a scalar ndarraypublic INDArray put(int i, int j, INDArray element)
INDArray
put
in interface INDArray
put
in class BaseSparseNDArray
i
- the row insert intoj
- the column to insert intoelement
- a scalar ndarraypublic INDArray put(int i, int j, Number element)
INDArray
put
in interface INDArray
put
in class BaseSparseNDArray
i
- the row insert intoj
- the column to insert intoelement
- a scalar ndarraypublic INDArray put(int i, INDArray element)
INDArray
put
in interface INDArray
put
in class BaseSparseNDArray
i
- the index insert intoelement
- a scalar ndarraypublic void addOrUpdate(int[] indexes, double value)
indexes
- the indexes of the element to be addedvalue
- the value of the element to be addedpublic boolean canInsert(DataBuffer buffer, int length)
buffer
- a databuffer in which we want to add datalength
- the length of the datapublic DataBuffer shiftLeft(DataBuffer buffer, int from, int offset, long datalength)
public INDArray removeEntry(int idx)
idx
- the index of the element to be removedpublic INDArray get(INDArrayIndex... indexes)
get
in interface INDArray
get
in class BaseSparseNDArray
indexes
- the indexes in to the arraypublic int reverseIndexes(int... indexes)
indexes
- public int indexesBinarySearch(int lowerBound, int upperBound, int[] idx)
idx
- a set of coordinateslowerBound
- the lower bound of the positionupperBound
- the upper bound of the positionpublic INDArray getScalar(int... indices)
INDArray
getScalar
in interface INDArray
getScalar
in class BaseSparseNDArray
indices
- the indices to getScalarpublic int getInt(int... indices)
INDArray
getInt
in interface INDArray
getInt
in class BaseSparseNDArray
indices
- Indices to get the integer at. Number of indices must match the array rank.public double getDouble(int... indices)
INDArray
getDouble
in interface INDArray
getDouble
in class BaseSparseNDArray
indices
- Indices to get the double at. Number of indices must match the array rank.public float getFloat(int[] indices)
INDArray
getFloat
in interface INDArray
getFloat
in class BaseSparseNDArray
indices
- the indices to getScalarpublic double getDouble(int i)
INDArray
getDouble
in interface INDArray
getDouble
in class BaseSparseNDArray
i
- Indexpublic double getDouble(int i, int j)
INDArray
getDouble
in interface INDArray
getDouble
in class BaseSparseNDArray
i
- Dimension 0 (row) indexj
- Dimension 1 (column) indexpublic float getFloat(int i)
INDArray
getFloat
in interface INDArray
getFloat
in class BaseSparseNDArray
i
- the index of the item to getScalarpublic float getFloat(int i, int j)
INDArray
getFloat
in interface INDArray
getFloat
in class BaseSparseNDArray
i
- the row to getScalarj
- the column to getScalarpublic SparseFormat getFormat()
ISparseNDArray
SparseFormat
public int underlyingRank()
public DataBuffer data()
INDArray
public DataBuffer getUnderlyingIndices()
public DataBuffer getIncludedIndices()
public DataBuffer getUnderlyingValues()
public DataBuffer getIncludedValues()
public DataBuffer getVectorCoordinates()
public INDArray toDense()
toDense
in interface INDArray
toDense
in interface ISparseNDArray
toDense
in class BaseSparseNDArray
public DataBuffer shapeInfoDataBuffer()
INDArray
shapeInfoDataBuffer
in interface INDArray
shapeInfoDataBuffer
in class BaseSparseNDArray
public INDArray subArray(ShapeOffsetResolution resolution)
INDArray
subArray
in interface INDArray
subArray
in class BaseSparseNDArray
resolution
- the resolution to usepublic INDArray subArray(ShapeOffsetResolution resolution, ShapeOffsetResolution resolutionWithoutNewAxis)
public INDArray subArray(long[] offsets, int[] shape, int[] stride)
subArray
in interface INDArray
subArray
in class BaseSparseNDArray
public DataBuffer getUnderlyingIndicesOf(int i)
i
- the index of the element+public DataBuffer getIndicesOf(int i)
i
- the index of the elementpublic boolean isZero(int... indexes)
public boolean isView()
INDArray
public int getNumHiddenDimension()
public boolean isSorted()
public DataBuffer getValues()
public DataBuffer getIndices()
public INDArray putiColumnVector(INDArray columnVector)
INDArray
columnVector
- the column vector to addpublic INDArray putiRowVector(INDArray rowVector)
INDArray
rowVector
- Row vector to putpublic INDArray mmul(INDArray other, MMulTranspose mMulTranspose)
public INDArray mmul(INDArray other, INDArray result, MMulTranspose mMulTranspose)
other
- the other matrix to perform matrix multiply withresult
- the result ndarraymMulTranspose
- the transpose status of each arraypublic INDArray mmuli(INDArray other, MMulTranspose transpose)
public INDArray mmuli(INDArray other, INDArray result, MMulTranspose transpose)
public INDArray convertToFloats()
public INDArray convertToDoubles()
Copyright © 2018. All rights reserved.