public abstract class BaseNDArray extends Object implements INDArray
Modifier and Type | Field and Description |
---|---|
protected int |
columns |
protected DataBuffer |
data |
protected int |
length |
protected INDArray |
linearView |
protected int |
offset |
protected char |
ordering |
protected int |
rows |
protected int[] |
shape |
protected int[] |
stride |
Constructor and Description |
---|
BaseNDArray() |
BaseNDArray(DataBuffer buffer) |
BaseNDArray(DataBuffer data,
int[] shape) |
BaseNDArray(DataBuffer buffer,
int[] shape,
int offset) |
BaseNDArray(DataBuffer data,
int[] shape,
int[] stride,
int offset) |
BaseNDArray(DataBuffer buffer,
int[] shape,
int[] stride,
int offset,
char ordering) |
BaseNDArray(double[][] data) |
BaseNDArray(double[] data,
int[] shape,
char ordering) |
BaseNDArray(double[] data,
int[] shape,
int[] stride,
int offset,
char ordering) |
BaseNDArray(float[] data) |
BaseNDArray(float[][] data) |
BaseNDArray(float[] data,
char order) |
BaseNDArray(float[] data,
int[] shape)
Create this ndarray with the given data and shape and 0 offset
|
BaseNDArray(float[] data,
int[] shape,
char ordering)
Create this ndarray with the given data and shape and 0 offset
|
BaseNDArray(float[] data,
int[] shape,
int offset) |
BaseNDArray(float[] data,
int[] shape,
int[] stride) |
BaseNDArray(float[] data,
int[] shape,
int[] stride,
char ordering) |
BaseNDArray(float[] data,
int[] shape,
int[] stride,
int offset) |
BaseNDArray(float[] data,
int[] shape,
int[] stride,
int offset,
char ordering) |
BaseNDArray(float[] data,
int[] shape,
int offset,
char ordering) |
BaseNDArray(FloatBuffer floatBuffer,
char order) |
BaseNDArray(int[] shape) |
BaseNDArray(int[] shape,
char ordering) |
BaseNDArray(int[] shape,
DataBuffer buffer)
Create with the specified shape and buffer
|
BaseNDArray(int[] shape,
int offset) |
BaseNDArray(int[] shape,
int[] stride)
Create the ndarray with
the specified shape and stride and an offset of 0
|
BaseNDArray(int[] shape,
int[] stride,
char ordering)
Create the ndarray with
the specified shape and stride and an offset of 0
|
BaseNDArray(int[] shape,
int[] stride,
int offset)
Construct an ndarray of the specified shape
with an empty data array
|
BaseNDArray(int[] shape,
int[] stride,
int offset,
char ordering)
Construct an ndarray of the specified shape
with an empty data array
|
BaseNDArray(int[] shape,
int offset,
char ordering) |
BaseNDArray(int newRows,
int newColumns)
Creates a new n times m DoubleMatrix.
|
BaseNDArray(int newRows,
int newColumns,
char ordering)
Creates a new n times m DoubleMatrix.
|
BaseNDArray(List<INDArray> slices,
int[] shape)
Create an ndarray from the specified slices.
|
BaseNDArray(List<INDArray> slices,
int[] shape,
char ordering)
Create an ndarray from the specified slices.
|
BaseNDArray(List<INDArray> slices,
int[] shape,
int[] stride)
Create an ndarray from the specified slices.
|
BaseNDArray(List<INDArray> slices,
int[] shape,
int[] stride,
char ordering)
Create an ndarray from the specified slices.
|
Modifier and Type | Method and Description |
---|---|
IComplexNDArray |
add(IComplexNumber n) |
IComplexNDArray |
add(IComplexNumber n,
IComplexNDArray result) |
INDArray |
add(INDArray other)
copy addition of two matrices
|
INDArray |
add(INDArray other,
INDArray result)
copy addition of two matrices
|
INDArray |
add(Number n)
Scalar addition (cloning)
|
INDArray |
add(Number n,
INDArray result) |
INDArray |
addColumnVector(INDArray columnVector)
In place addition of a column vector
|
IComplexNDArray |
addi(IComplexNumber n) |
IComplexNDArray |
addi(IComplexNumber n,
IComplexNDArray result) |
INDArray |
addi(INDArray other)
in place addition of two matrices
|
INDArray |
addi(INDArray other,
INDArray result)
in place addition of two matrices
|
INDArray |
addi(Number n)
In place scalar addition
|
INDArray |
addi(Number n,
INDArray result)
In place addition
|
INDArray |
addiColumnVector(INDArray columnVector)
In place addition of a column vector
|
INDArray |
addiRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
addRowVector(INDArray rowVector)
In place addition of a column vector
|
protected void |
assertColumnVector(INDArray column) |
protected void |
assertRowVector(INDArray rowVector) |
protected void |
assertSlice(INDArray put,
int slice) |
INDArray |
assign(INDArray arr)
Assign all of the elements in the given
ndarray to this ndarray
|
INDArray |
assign(Number value)
Set the value of the ndarray to the specified value
|
INDArray |
broadcast(int[] shape)
Broadcasts this ndarray to be the specified shape
|
protected void |
checkArrangeArray(int[] arr) |
void |
checkDimensions(INDArray other)
Validate dimensions are equal
|
int |
columns()
Number of columns (shape[1]), throws an exception when
called when not 2d
|
INDArray |
cond(Condition condition)
1 in the ndarray if the element matches
the condition 0 otherwise
|
INDArray |
condi(Condition condition)
1 in the ndarray if the element matches
the condition 0 otherwise
|
protected void |
copyRealTo(INDArray arr) |
INDArray |
cumsum(int dimension)
Cumulative sum along a dimension (in place)
|
INDArray |
cumsumi(int dimension)
Cumulative sum along a dimension
|
DataBuffer |
data()
Returns a linear double array representation of this ndarray
|
INDArray |
dimShuffle(Object[] rearrange,
int[] newOrder,
boolean[] broadCastable)
Dimshuffle: an extension of permute that adds the ability
to broadcast various dimensions.
|
double |
distance1(INDArray other)
Returns the (1-norm) distance.
|
double |
distance2(INDArray other)
Returns the (euclidean) distance.
|
IComplexNDArray |
div(IComplexNumber n) |
IComplexNDArray |
div(IComplexNumber n,
IComplexNDArray result) |
INDArray |
div(INDArray other)
in place (element wise) division of two matrices
|
INDArray |
div(INDArray other,
INDArray result)
copy (element wise) division of two matrices
|
INDArray |
div(Number n)
Division by a number
|
INDArray |
div(Number n,
INDArray result) |
INDArray |
divColumnVector(INDArray columnVector)
In place addition of a column vector
|
IComplexNDArray |
divi(IComplexNumber n) |
IComplexNDArray |
divi(IComplexNumber n,
IComplexNDArray result) |
INDArray |
divi(INDArray other)
in place (element wise) division of two matrices
|
INDArray |
divi(INDArray other,
INDArray result)
in place (element wise) division of two matrices
|
INDArray |
divi(Number n)
In place scalar division
|
INDArray |
divi(Number n,
INDArray result)
In place division of this ndarray
|
INDArray |
diviColumnVector(INDArray columnVector)
In place addition of a column vector
|
INDArray |
diviRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
divRowVector(INDArray rowVector)
In place addition of a column vector
|
protected INDArray |
doColumnWise(INDArray columnVector,
char operation)
Do a row wise op (a,s,m,d)
a : add
s : subtract
m : multiply
d : divide
h : reverse subtraction
t : reverse division
|
protected INDArray |
doDimensionWise(com.google.common.base.Function<INDArray,INDArray> baseCase,
SliceOp sliceOp,
INDArray arr,
int[] newShape,
int dimension,
boolean modify) |
protected int[] |
doPermuteSwap(int[] shape,
int[] rearrange) |
protected INDArray |
doRowWise(INDArray rowVector,
char operation)
Do a row wise op (a,s,m,d)
a : add
s : subtract
m : multiply
d : divide
h : reverse subtraction
t : reverse division
|
INDArray |
dup()
Return a copy of this ndarray
|
Object |
element()
Returns a scalar (individual element)
of a scalar ndarray
|
int[] |
endsForSlices()
Gives the indices for the ending of each slice
|
INDArray |
eps(INDArray other)
epsilon equals than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
eps(Number other)
Returns an ndarray with 1 if the element is epsilon equals
|
INDArray |
epsi(INDArray other)
In place epsilon equals than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
epsi(Number other)
Returns an ndarray with 1 if the element is epsilon equals
|
INDArray |
eq(INDArray other)
equal than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
eq(Number other)
Returns an ndarray with 1 if the element is less than
the given element 0 other wise
|
INDArray |
eqi(INDArray other)
In place equal than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
eqi(Number other)
In place less than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
boolean |
equals(Object o)
Compare two matrices.
|
INDArray |
get(NDArrayIndex... indexes)
Returns a subset of this array based on the specified
indexes
|
INDArray |
getColumn(int c)
Get the specified column
|
INDArray |
getColumns(int[] cindices)
Get whole columns from the passed indices.
|
double |
getDouble(int... indices)
Returns the elements at the the specified indices
|
double |
getDouble(int i) |
double |
getDouble(int i,
int j) |
<E> E |
getElement(int i) |
<E> E |
getElement(int i,
int j) |
float |
getFloat(int... indices)
Returns the elements at the the specified indices
|
float |
getFloat(int i)
Return the item at the linear index i
|
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}
|
static int |
getIndex(int offset,
int[] stride,
int... indexes)
Mainly an internal method (public for testing)
for given an offset and stride, and index,
calculating the beginning index of a query given indices
|
int |
getInt(int... indices)
Returns the elements at the the specified indices
|
INDArray |
getRow(int r)
Get a copy of a row.
|
INDArray |
getRows(int[] rindices)
Get whole rows from the passed indices.
|
INDArray |
getScalar(int... indexes)
Fetch a particular number on a multi dimensional scale.
|
INDArray |
getScalar(int i)
Returns the element at the specified index
|
INDArray |
getScalar(int row,
int column)
Returns the element at the specified row/column
This will throw an exception if the
|
INDArray |
gt(INDArray other)
greater than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
gt(Number other)
Greater than boolean (copying)(
|
INDArray |
gti(INDArray other)
In place greater than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
gti(Number other)
In place greater than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
int |
index(int row,
int column)
Return the linear index of the specified row and column
|
protected void |
initShape(int[] shape) |
boolean |
isColumnVector()
Checks whether the matrix is a column vector.
|
boolean |
isMatrix()
Returns true if this ndarray is 2d
or 3d with a singleton element
|
boolean |
isRowVector()
Checks whether the matrix is a row vector.
|
boolean |
isScalar()
Test whether a matrix is scalar.
|
boolean |
isSquare()
Returns whether the matrix
has the same rows and columns
|
boolean |
isVector()
Checks whether the matrix is a vector.
|
void |
iterateOverAllColumns(SliceOp op)
Iterate over every column of every slice
|
void |
iterateOverAllRows(SliceOp op)
Iterate over every row of every slice
|
void |
iterateOverDimension(int dimension,
SliceOp op,
boolean modify)
Iterate along a dimension.
|
int |
length()
Returns the total number of elements in the ndarray
|
int |
linearIndex(int i)
Get the linear index of the data in to
the array
|
INDArray |
linearView()
Returns a linear view reference of shape
1,length(ndarray)
|
INDArray |
linearViewColumnOrder()
Returns a linear view reference of shape
1,length(ndarray)
|
INDArray |
lt(INDArray other)
less than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
lt(Number other)
Returns an ndarray with 1 if the element is less than
the given element 0 other wise
|
INDArray |
lti(INDArray other)
In place less than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
INDArray |
lti(Number other)
In place less than comparison:
If the given number is less than the
comparison number the item is 0 otherwise 1
|
int |
majorStride()
Return the major stride for an ndarray
|
INDArray |
max(int dimension)
Returns the overall max of this ndarray
|
INDArray |
mean(int dimension)
Returns the overall mean of this ndarray
|
INDArray |
min(int dimension)
Returns the overall min of this ndarray
|
INDArray |
mmul(INDArray other)
Perform a copy matrix multiplication
|
INDArray |
mmul(INDArray other,
INDArray result)
Perform an copy matrix multiplication
|
INDArray |
mmuli(INDArray other)
Perform an copy matrix multiplication
|
INDArray |
mmuli(INDArray other,
INDArray result)
Perform an copy matrix multiplication
|
IComplexNDArray |
mul(IComplexNumber n) |
IComplexNDArray |
mul(IComplexNumber n,
IComplexNDArray result) |
INDArray |
mul(INDArray other)
copy (element wise) multiplication of two matrices
|
INDArray |
mul(INDArray other,
INDArray result)
copy (element wise) multiplication of two matrices
|
INDArray |
mul(Number n)
Scalar multiplication (copy)
|
INDArray |
mul(Number n,
INDArray result) |
INDArray |
mulColumnVector(INDArray columnVector)
In place addition of a column vector
|
IComplexNDArray |
muli(IComplexNumber n) |
IComplexNDArray |
muli(IComplexNumber n,
IComplexNDArray result) |
INDArray |
muli(INDArray other)
in place (element wise) multiplication of two matrices
|
INDArray |
muli(INDArray other,
INDArray result)
in place (element wise) multiplication of two matrices
|
INDArray |
muli(Number n)
In place scalar multiplication
|
INDArray |
muli(Number n,
INDArray result)
In place multiplication of this ndarray
|
INDArray |
muliColumnVector(INDArray columnVector)
In place addition of a column vector
|
INDArray |
muliRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
mulRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
neg()
Negate each element.
|
INDArray |
negi()
Negate each element (in-place).
|
INDArray |
neq(INDArray other) |
INDArray |
neq(Number other) |
INDArray |
neqi(INDArray other) |
INDArray |
neqi(Number other) |
protected INDArray |
newShape(int[] newShape,
char ordering) |
protected int[] |
noCopyReshape(int[] newShape,
char ordering)
Return the new strides based on the shape and ordering or null
if we can't do a reshape
|
INDArray |
norm1(int dimension)
Returns the norm1 along the specified dimension
|
INDArray |
norm2(int dimension)
Returns the norm2 along the specified dimension
|
INDArray |
normmax(int dimension)
Returns the normmax along the specified dimension
|
int |
offset()
Returns the start of where the ndarray is
for the underlying data
|
char |
ordering() |
INDArray |
permute(int[] rearrange)
See: http://www.mathworks.com/help/matlab/ref/permute.htsliceml
|
INDArray |
prod(int dimension)
Returns the product along a given dimension
|
INDArray |
put(int[] indices,
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 |
put(NDArrayIndex[] indices,
INDArray element)
Put the elements of the ndarray
in to the specified indices
|
INDArray |
put(NDArrayIndex[] indices,
Number element)
Put the elements of the ndarray
in to the specified indices
|
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 |
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[] indexes,
float value) |
INDArray |
putScalar(int[] indexes,
int value) |
INDArray |
putScalar(int i,
double value)
Insert the number linearly in to the ndarray
|
INDArray |
putScalar(int i,
float value) |
INDArray |
putScalar(int i,
int value) |
INDArray |
putSlice(int slice,
INDArray put)
Assigns the given matrix (put) to the specified slice
|
INDArray |
ravel()
Flattens the array for linear indexing
|
IComplexNDArray |
rdiv(IComplexNumber n) |
IComplexNDArray |
rdiv(IComplexNumber n,
IComplexNDArray result) |
INDArray |
rdiv(INDArray other)
Reverse division
|
INDArray |
rdiv(INDArray other,
INDArray result)
Reverse division
|
INDArray |
rdiv(Number n)
Reverse division
|
INDArray |
rdiv(Number n,
INDArray result)
Reverse division (number / ndarray)
|
INDArray |
rdivColumnVector(INDArray columnVector)
In place reverse division of a column vector
|
IComplexNDArray |
rdivi(IComplexNumber n) |
IComplexNDArray |
rdivi(IComplexNumber n,
IComplexNDArray result) |
INDArray |
rdivi(INDArray other)
Reverse divsion (in place)
|
INDArray |
rdivi(INDArray other,
INDArray result)
Reverse division (in-place)
|
INDArray |
rdivi(Number n)
In place reverse division
|
INDArray |
rdivi(Number n,
INDArray result)
Reverse in place division
|
INDArray |
rdiviColumnVector(INDArray columnVector)
In place reverse divison of a column vector
|
INDArray |
rdiviRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
rdivRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
reduce(Ops.DimensionOp op,
int dimension)
http://docs.scipy.org/doc/numpy/reference/generated/numpy.ufunc.reduce.html
|
protected double |
reduceVector(Ops.DimensionOp op,
INDArray vector) |
INDArray |
repmat(int[] shape)
Replicate and tile array to fill out to the given shape
|
INDArray |
reshape(int[] shape)
Reshape the ndarray in to the specified dimensions,
possible errors being thrown for invalid shapes
|
INDArray |
reshape(int newRows,
int newColumns)
Reshape the matrix.
|
int |
rows()
Returns the number of rows
in the array (only 2d) throws an exception when
called when not 2d
|
IComplexNDArray |
rsub(IComplexNumber n) |
IComplexNDArray |
rsub(IComplexNumber n,
IComplexNDArray result) |
INDArray |
rsub(INDArray other) |
INDArray |
rsub(INDArray other,
INDArray result)
Reverse subtraction
|
INDArray |
rsub(Number n)
Reverse subtraction with duplicates
|
INDArray |
rsub(Number n,
INDArray result)
Reverse subtraction
|
INDArray |
rsubColumnVector(INDArray columnVector)
In place addition of a column vector
|
IComplexNDArray |
rsubi(IComplexNumber n) |
IComplexNDArray |
rsubi(IComplexNumber n,
IComplexNDArray result) |
INDArray |
rsubi(INDArray other) |
INDArray |
rsubi(INDArray other,
INDArray result)
Reverse subtraction (in-place)
|
INDArray |
rsubi(Number n) |
INDArray |
rsubi(Number n,
INDArray result)
Reverse in place subtraction
|
INDArray |
rsubiColumnVector(INDArray columnVector)
In place addition of a column vector
|
INDArray |
rsubiRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
rsubRowVector(INDArray rowVector)
In place addition of a column vector
|
int |
secondaryStride()
Return the second stride for an ndarray.
|
void |
setData(DataBuffer data) |
void |
setData(float[] data) |
void |
setStride(int[] stride) |
int[] |
shape()
Returns the shape(dimensions) of this array
|
int |
size(int dimension)
Returns the size of this array
along a particular dimension
|
INDArray |
slice(int slice)
Returns the specified slice of this matrix.
|
INDArray |
slice(int slice,
int dimension)
Returns the slice of this from the specified dimension
|
int |
slices()
Number of slices: aka shape[0]
|
void |
sliceVectors(List<INDArray> list)
Flattens the array for linear indexing
|
double |
squaredDistance(INDArray other)
Returns the squared (Euclidean) distance.
|
INDArray |
std(int dimension)
Standard deviation of an ndarray along a dimension
|
int[] |
stride()
Returns the stride(indices along the linear index for which each slice is accessed) of this array
|
IComplexNDArray |
sub(IComplexNumber n) |
IComplexNDArray |
sub(IComplexNumber n,
IComplexNDArray result) |
INDArray |
sub(INDArray other)
copy subtraction of two matrices
|
INDArray |
sub(INDArray other,
INDArray result)
copy subtraction of two matrices
|
INDArray |
sub(Number n)
Scalar subtraction (copied)
|
INDArray |
sub(Number n,
INDArray result) |
INDArray |
subArray(int[] offsets,
int[] shape,
int[] stride) |
INDArray |
subColumnVector(INDArray columnVector)
In place addition of a column vector
|
IComplexNDArray |
subi(IComplexNumber n) |
IComplexNDArray |
subi(IComplexNumber n,
IComplexNDArray result) |
INDArray |
subi(INDArray other)
in place subtraction of two matrices
|
INDArray |
subi(INDArray other,
INDArray result)
in place subtraction of two matrices
|
INDArray |
subi(Number n)
In place scalar subtraction
|
INDArray |
subi(Number n,
INDArray result)
In place subtraction of this ndarray
|
INDArray |
subiColumnVector(INDArray columnVector)
In place addition of a column vector
|
INDArray |
subiRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
subRowVector(INDArray rowVector)
In place addition of a column vector
|
INDArray |
sum(int dimension)
Returns the sum along the last dimension of this ndarray
|
INDArray |
swapAxes(int dimension,
int with)
Mainly here for people coming from numpy.
|
String |
toString()
Generate string representation of the matrix.
|
INDArray |
transpose()
Return transposed copy of this matrix.
|
INDArray |
var(int dimension)
Returns the overall variance of this ndarray
|
INDArray |
vectorAlongDimension(int index,
int dimension)
Get the vector along a particular dimension
|
DimensionSlice |
vectorForDimensionAndOffset(int dimension,
int offset) |
int |
vectorsAlongDimension(int dimension)
Returns the number of possible vectors for a given dimension
|
protected int[] shape
protected int[] stride
protected int offset
protected char ordering
protected DataBuffer data
protected int rows
protected int columns
protected int length
protected INDArray linearView
public BaseNDArray()
public BaseNDArray(DataBuffer buffer)
public BaseNDArray(DataBuffer buffer, int[] shape, int[] stride, int offset, char ordering)
public BaseNDArray(double[][] data)
public BaseNDArray(int[] shape, DataBuffer buffer)
shape
- the shapebuffer
- the bufferpublic BaseNDArray(float[] data, int[] shape, char ordering)
data
- the data to useshape
- the shape of the ndarraypublic BaseNDArray(float[] data, int[] shape, int offset, char ordering)
data
- the data to useshape
- the shape of the ndarrayoffset
- the desired offsetordering
- the ordering of the ndarraypublic BaseNDArray(int[] shape, int[] stride, int offset, char ordering)
shape
- the shape of the ndarraystride
- the stride of the ndarrayoffset
- the desired offsetordering
- the ordering of the ndarraypublic BaseNDArray(int[] shape, int[] stride, char ordering)
shape
- the shape of the ndarraystride
- the stride of the ndarrayordering
- the ordering of the ndarraypublic BaseNDArray(int[] shape, int offset, char ordering)
public BaseNDArray(int[] shape)
public BaseNDArray(int newRows, int newColumns, char ordering)
newRows
- the number of rows (n) of the new matrix.newColumns
- the number of columns (m) of the new matrix.public BaseNDArray(List<INDArray> slices, int[] shape, char ordering)
slices
- the slices to mergeshape
- the shape of the ndarraypublic BaseNDArray(List<INDArray> slices, int[] shape, int[] stride, char ordering)
slices
- the slices to mergeshape
- the shape of the ndarraypublic BaseNDArray(float[] data, int[] shape, int[] stride, char ordering)
public BaseNDArray(float[] data, int[] shape, int[] stride, int offset, char ordering)
public BaseNDArray(DataBuffer data, int[] shape, int[] stride, int offset)
public BaseNDArray(DataBuffer data, int[] shape)
public BaseNDArray(DataBuffer buffer, int[] shape, int offset)
public BaseNDArray(double[] data, int[] shape, char ordering)
public BaseNDArray(double[] data, int[] shape, int[] stride, int offset, char ordering)
public BaseNDArray(float[] data, char order)
public BaseNDArray(FloatBuffer floatBuffer, char order)
public BaseNDArray(float[] data, int[] shape)
data
- the data to useshape
- the shape of the ndarraypublic BaseNDArray(float[] data, int[] shape, int offset)
public BaseNDArray(int[] shape, int[] stride, int offset)
shape
- the shape of the ndarraystride
- the stride of the ndarrayoffset
- the desired offsetpublic BaseNDArray(int[] shape, int[] stride)
shape
- the shape of the ndarraystride
- the stride of the ndarraypublic BaseNDArray(int[] shape, int offset)
public BaseNDArray(int[] shape, char ordering)
public BaseNDArray(int newRows, int newColumns)
newRows
- the number of rows (n) of the new matrix.newColumns
- the number of columns (m) of the new matrix.public BaseNDArray(List<INDArray> slices, int[] shape)
slices
- the slices to mergeshape
- the shape of the ndarraypublic BaseNDArray(List<INDArray> slices, int[] shape, int[] stride)
slices
- the slices to mergeshape
- the shape of the ndarraypublic BaseNDArray(float[] data, int[] shape, int[] stride)
public BaseNDArray(float[] data, int[] shape, int[] stride, int offset)
public BaseNDArray(float[] data)
public BaseNDArray(float[][] data)
public INDArray linearViewColumnOrder()
INDArray
linearViewColumnOrder
in interface INDArray
public INDArray linearView()
linearView
in interface INDArray
public int majorStride()
INDArray
majorStride
in interface INDArray
public int secondaryStride()
INDArray
secondaryStride
in interface INDArray
public int vectorsAlongDimension(int dimension)
vectorsAlongDimension
in interface INDArray
dimension
- the dimension to calculate the number of vectors forpublic INDArray vectorAlongDimension(int index, int dimension)
vectorAlongDimension
in interface INDArray
index
- the index of the vector to getScalardimension
- the dimension to getScalar the vector frompublic INDArray cumsumi(int dimension)
public INDArray cumsum(int dimension)
public INDArray assign(INDArray arr)
public INDArray putScalar(int i, double value)
INDArray
public INDArray putScalar(int i, float value)
public INDArray putScalar(int[] indexes, double value)
INDArray
public INDArray putScalar(int[] indexes, float value)
public INDArray putScalar(int[] indexes, int value)
public INDArray eps(INDArray other)
public INDArray epsi(INDArray other)
public INDArray lt(Number other)
INDArray
public INDArray lti(Number other)
INDArray
public INDArray eq(Number other)
INDArray
public INDArray eqi(Number other)
INDArray
public INDArray gt(Number other)
INDArray
public INDArray gti(Number other)
INDArray
public INDArray lt(INDArray other)
INDArray
public INDArray lti(INDArray other)
INDArray
public INDArray eq(INDArray other)
INDArray
public INDArray eqi(INDArray other)
INDArray
public INDArray gt(INDArray other)
INDArray
public INDArray gti(INDArray other)
INDArray
public INDArray negi()
public INDArray rdiv(Number n, INDArray result)
INDArray
public INDArray rdivi(Number n, INDArray result)
INDArray
public INDArray rsub(Number n, INDArray result)
INDArray
public INDArray rsubi(Number n, INDArray result)
INDArray
public INDArray divi(Number n, INDArray result)
INDArray
public INDArray muli(Number n, INDArray result)
INDArray
public INDArray subi(Number n, INDArray result)
INDArray
public INDArray addi(Number n, INDArray result)
INDArray
public INDArray getScalar(int row, int column)
public int getInt(int... indices)
public double getDouble(int... indices)
public float getFloat(int... indices)
public boolean isScalar()
public INDArray putSlice(int slice, INDArray put)
protected void assertSlice(INDArray put, int slice)
public boolean isMatrix()
public INDArray reduce(Ops.DimensionOp op, int dimension)
public DimensionSlice vectorForDimensionAndOffset(int dimension, int offset)
public int index(int row, int column)
INDArray
protected INDArray newShape(int[] newShape, char ordering)
protected int[] noCopyReshape(int[] newShape, char ordering)
newShape
- the new shapeordering
- the ordering of the new shapeprotected double reduceVector(Ops.DimensionOp op, INDArray vector)
public double squaredDistance(INDArray other)
squaredDistance
in interface INDArray
public double distance2(INDArray other)
public double distance1(INDArray other)
public INDArray put(NDArrayIndex[] indices, INDArray element)
INDArray
public INDArray put(NDArrayIndex[] indices, Number element)
INDArray
public void iterateOverAllColumns(SliceOp op)
iterateOverAllColumns
in interface INDArray
op
- the operation to applypublic void iterateOverAllRows(SliceOp op)
iterateOverAllRows
in interface INDArray
op
- the operation to applypublic INDArray swapAxes(int dimension, int with)
public int[] endsForSlices()
endsForSlices
in interface INDArray
public DataBuffer data()
INDArray
public void setData(DataBuffer data)
public int slices()
public INDArray subArray(int[] offsets, int[] shape, int[] stride)
public INDArray cond(Condition condition)
INDArray
public INDArray condi(Condition condition)
INDArray
public void iterateOverDimension(int dimension, SliceOp op, boolean modify)
iterateOverDimension
in interface INDArray
dimension
- the dimension to iterate overop
- the operation to applymodify
- whether to modify this array while iteratingprotected void initShape(int[] shape)
public INDArray getScalar(int i)
INDArray
protected void assertColumnVector(INDArray column)
protected INDArray doColumnWise(INDArray columnVector, char operation)
columnVector
- the column vectoroperation
- the operationprotected void assertRowVector(INDArray rowVector)
protected INDArray doRowWise(INDArray rowVector, char operation)
rowVector
- the row vectoroperation
- the operationpublic INDArray rdiviColumnVector(INDArray columnVector)
INDArray
rdiviColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray rdivColumnVector(INDArray columnVector)
INDArray
rdivColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray rdiviRowVector(INDArray rowVector)
INDArray
rdiviRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray rdivRowVector(INDArray rowVector)
INDArray
rdivRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray rsubiColumnVector(INDArray columnVector)
INDArray
rsubiColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray rsubColumnVector(INDArray columnVector)
INDArray
rsubColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray rsubiRowVector(INDArray rowVector)
INDArray
rsubiRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray rsubRowVector(INDArray rowVector)
INDArray
rsubRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray diviColumnVector(INDArray columnVector)
diviColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray divColumnVector(INDArray columnVector)
divColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray diviRowVector(INDArray rowVector)
diviRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray divRowVector(INDArray rowVector)
divRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray muliColumnVector(INDArray columnVector)
muliColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray mulColumnVector(INDArray columnVector)
mulColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray muliRowVector(INDArray rowVector)
muliRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray mulRowVector(INDArray rowVector)
mulRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray subiColumnVector(INDArray columnVector)
subiColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray subColumnVector(INDArray columnVector)
subColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray subiRowVector(INDArray rowVector)
subiRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray subRowVector(INDArray rowVector)
subRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray addiColumnVector(INDArray columnVector)
addiColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray addColumnVector(INDArray columnVector)
addColumnVector
in interface INDArray
columnVector
- the column vector to addpublic INDArray addiRowVector(INDArray rowVector)
addiRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray addRowVector(INDArray rowVector)
addRowVector
in interface INDArray
rowVector
- the column vector to addpublic INDArray div(INDArray other, INDArray result)
public INDArray mul(INDArray other, INDArray result)
public INDArray divi(INDArray other, INDArray result)
public INDArray muli(INDArray other, INDArray result)
public INDArray normmax(int dimension)
public int linearIndex(int i)
INDArray
linearIndex
in interface INDArray
i
- the index to getScalarpublic INDArray slice(int slice)
public INDArray slice(int slice, int dimension)
public INDArray getScalar(int... indexes)
public INDArray rdivi(Number n)
INDArray
public INDArray rsub(Number n)
INDArray
public INDArray divi(Number n)
INDArray
public INDArray mul(Number n)
INDArray
public INDArray muli(Number n)
INDArray
public INDArray sub(Number n)
INDArray
public INDArray subi(Number n)
INDArray
public INDArray add(Number n)
INDArray
public INDArray addi(Number n)
INDArray
public INDArray repmat(int[] shape)
public INDArray putRow(int row, INDArray toPut)
public INDArray putColumn(int column, INDArray toPut)
public <E> E getElement(int i)
getElement
in interface INDArray
public <E> E getElement(int i, int j)
getElement
in interface INDArray
public float getFloat(int i)
INDArray
public float getFloat(int i, int j)
INDArray
public static int getIndex(int offset, int[] stride, int... indexes)
offset
- the desired offsetstride
- the desired strideindexes
- the desired indexes to test onpublic INDArray transpose()
public INDArray reshape(int[] shape)
public void checkDimensions(INDArray other)
INDArray
checkDimensions
in interface INDArray
other
- the other ndarray to comparepublic INDArray prod(int dimension)
public INDArray mean(int dimension)
public INDArray var(int dimension)
public INDArray max(int dimension)
public INDArray min(int dimension)
public INDArray sum(int dimension)
public INDArray norm1(int dimension)
public INDArray std(int dimension)
public INDArray norm2(int dimension)
public int columns()
public int rows()
protected INDArray doDimensionWise(com.google.common.base.Function<INDArray,INDArray> baseCase, SliceOp sliceOp, INDArray arr, int[] newShape, int dimension, boolean modify)
public INDArray ravel()
public void sliceVectors(List<INDArray> list)
sliceVectors
in interface INDArray
public INDArray reshape(int newRows, int newColumns)
public INDArray getColumn(int c)
public INDArray getRows(int[] rindices)
public INDArray get(NDArrayIndex... indexes)
public INDArray getColumns(int[] cindices)
getColumns
in interface INDArray
cindices
- public INDArray getRow(int r)
public boolean equals(Object o)
public int[] shape()
public int[] stride()
public int offset()
INDArray
public int size(int dimension)
public int length()
public INDArray broadcast(int[] shape)
public INDArray dimShuffle(Object[] rearrange, int[] newOrder, boolean[] broadCastable)
dimShuffle
in interface INDArray
rearrange
- the dimensions to swap tonewOrder
- the new order (think permute)broadCastable
- (whether the dimension is broadcastable) (must be same length as new order)public INDArray permute(int[] rearrange)
protected void copyRealTo(INDArray arr)
protected int[] doPermuteSwap(int[] shape, int[] rearrange)
protected void checkArrangeArray(int[] arr)
public boolean isVector()
public boolean isSquare()
INDArray
public boolean isRowVector()
isRowVector
in interface INDArray
public boolean isColumnVector()
isColumnVector
in interface INDArray
public String toString()
public Object element()
public IComplexNDArray rdiv(IComplexNumber n)
public IComplexNDArray rdivi(IComplexNumber n)
public IComplexNDArray rsub(IComplexNumber n)
public IComplexNDArray rsubi(IComplexNumber n)
public IComplexNDArray div(IComplexNumber n)
public IComplexNDArray divi(IComplexNumber n)
public IComplexNDArray mul(IComplexNumber n)
public IComplexNDArray muli(IComplexNumber n)
public IComplexNDArray sub(IComplexNumber n)
public IComplexNDArray subi(IComplexNumber n)
public IComplexNDArray add(IComplexNumber n)
public IComplexNDArray addi(IComplexNumber n)
public IComplexNDArray rdiv(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray rdivi(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray rsub(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray rsubi(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray div(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray divi(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray mul(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray muli(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray sub(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray subi(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray add(IComplexNumber n, IComplexNDArray result)
public IComplexNDArray addi(IComplexNumber n, IComplexNDArray result)
Copyright © 2014. All Rights Reserved.