public interface INDArray extends Cloneable, Serializable
| Modifier and Type | Method and Description |
|---|---|
void |
abs()
Replaces all elements of this array with their absolute values, according to Math.abs(double)
|
INDArray |
absCopy()
Returns a copy of the array with the abs operator applied to each element
|
void |
add(double a)
Adds a double value to all elements in this array.
|
void |
add(INDArray a)
Adds all the elements of another array to this array, in an elementwise order.
|
void |
addAt(long i,
double v)
Adds to a mutable array, indexed by element position in row major order.
|
INDArray |
addCopy(double d)
Creates a new array equal to this array with a constant value added to every element
|
INDArray |
addCopy(INDArray a)
Creates a new array equal to the sum of this array with another array.
|
void |
addInnerProduct(INDArray a,
INDArray b)
Adds the inner product of two arrays to this array.
|
void |
addMultiple(INDArray src,
double factor)
Adds a scaled multiple of another array to this array
|
void |
addOuterProduct(INDArray a,
INDArray b)
Adds the outer product of two arrays to this array.
|
void |
addPower(INDArray src,
double exponent)
Adds an array with all elements raised to the specified power
|
void |
addPower(INDArray src,
double exponent,
double factor)
Adds an array with all elements raised to the specified power and scaled by the given factor
|
void |
addToArray(double[] data,
int offset)
Adds all the elements of this array to a double array, in row-major order
|
void |
applyOp(IOperator operator)
Applies a unary operator to all elements of the array (in-place)
|
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
void |
applyOp(Op2 op,
double b)
Applies a binary operator to this array and a double value.
|
void |
applyOp(Op2 op,
INDArray b)
Applies a binary operator to this array and a second array.
|
INDArray |
applyOpCopy(Op op)
Applies a unary operator to all elements of the array (creating a new array)
|
double[] |
asDoubleArray()
Returns the underlying double array representing the densely packed elements of this array
Returns null if there is no such array
|
List<Double> |
asElementList()
Returns a List
|
AVector |
asVector()
Constructs a view of all elements in the array as a single vector in row-major order.
|
INDArray |
broadcast(int... shape)
Returns a view of this array broadcasted up to a larger shape
|
INDArray |
broadcastCloneLike(INDArray target)
Creates a mutable clone of the array, broadcasted upwards if necessary to match the shape of the target.
|
INDArray |
broadcastCopyLike(INDArray target)
Creates a copy of the array, broadcasted upwards if necessary to match the shape of the target
Like broadCastCloneLike, but does not guarantee a mutable clone - hence may be faster
when used with immutable or specialized arrays
|
AMatrix |
broadcastLike(AMatrix target)
Broadcasts an array to match the shape of the target matrix
|
AVector |
broadcastLike(AVector target)
Broadcasts an array to match the shape of the target vector
|
INDArray |
broadcastLike(INDArray target)
Broadcasts an array to match the shape of the target
|
void |
checkMutable()
Checks if an array is mutable.
|
void |
clamp(double min,
double max)
Clamps all the elements of this array within the specified [min,max] range
|
INDArray |
clone()
Returns a clone of the array data, as a new array which will be fully mutable
and may be of a different class to the original.
|
int |
componentCount()
Returns the number of components of this array.
|
INDArray |
copy()
Returns a defensive copy of the array data.
|
INDArray |
dense()
Coerces this INDArray to a dense format, without changing its element values.
|
INDArray |
denseClone()
Creates a fully mutable dense clone of this array.
|
int |
dimensionality()
Returns the dimensionality of the array (i.e.
|
void |
divide(double factor)
Divides all elements by a given factor
|
void |
divide(INDArray a)
Divides all elements in place by the equivalent elements in a second array
|
INDArray |
divideCopy(INDArray a)
Divides all elements by the equivalent elements in a second array.
|
double |
elementAbsPowSum(double p)
Returns the sum of the absolute values of all the elements raised to a specified power
|
long |
elementCount()
Returns the total number of elements in this array.
|
Iterator<Double> |
elementIterator()
Returns an iterator over all elements in this array, in row-major order
|
double |
elementMax()
Returns the maximum element value in this array.
|
double |
elementMin()
Returns the maximum element value in this array.
|
double |
elementPowSum(double p)
Returns the sum of all the elements raised to a specified power
|
double |
elementProduct()
Returns the product of all elements in the array.
|
boolean |
elementsEqual(double value)
Returns true if all elements are equal to a specific value
|
double |
elementSquaredSum()
Returns the sum of squared elements in this array.
|
double |
elementSum()
Returns the sum of all elements in this array.
|
INDArray |
ensureMutable()
Deprecated.
|
boolean |
epsilonEquals(INDArray a)
Tests if this array is approximately equal to another array.
|
boolean |
epsilonEquals(INDArray a,
double epsilon)
Tests is this array is approximately equal to another array, up to a given tolerance (epsilon)
The arrays must have the same shape
|
boolean |
equals(INDArray a)
Checks if two arrays are equal exactly in terms of both value and shape
|
boolean |
equalsArray(double[] data)
Returns true if the elements in this array exactly match the elements in the given array, in
row-major order
|
boolean |
equalsArray(double[] data,
int offset)
Returns true if the elements in this array exactly match the elements in the given array, in
row-major order
|
INDArray |
exactClone()
Creates a deep clone of an array, using the same class implementation as the original array
|
void |
exp()
Computes the function e^x (in-place) for all array elements
|
void |
fill(double value)
Fills this array with a single double value.
|
double |
get()
Returns the double value of a scalar array
|
double |
get(AIndex ix)
Returns the double value at the specified position in the array
|
double |
get(Index ix)
Returns the double value at the specified position in the array
|
double |
get(int... indexes)
Returns the double value at the specified index position in an array
|
double |
get(int x)
Returns the double value at the specified position in a 1D vector
|
double |
get(int x,
int y)
Returns the double value at the specified position in a 2D matrix
|
double |
get(long x)
Returns the double value at the specified position in a 1D vector
|
double |
get(long[] indexes)
Returns the double value at the specified index position in an array
|
double |
get(long x,
long y)
Returns the double value at the specified position in a 2D matrix
|
INDArray |
getComponent(int k)
Gets a component from the array at the specified index
Will throw an error if components are not supported, or if the component is out of bounds as defined by 0 <= k |
INDArray[] |
getComponents()
Gets all components in a new array, with length componentCount();
|
double[] |
getElements()
Gets all elements of the array as a Java double[] array
|
void |
getElements(double[] arr)
Copies all the elements of this INDArray to the specified double array
|
void |
getElements(double[] dest,
int offset)
Gets all elements of the array, copying them into a double array at the specified offset
|
void |
getElements(Object[] dest,
int offset)
Gets all elements of the array, copying them into an object array at the specified offset
|
long[] |
getLongShape()
Returns the shape of the array as an array of longs.
|
int[] |
getShape()
Returns the shape of the array as an array of ints.
|
int |
getShape(int dim)
Returns the dimension size for a specific dimension in the array's shape
|
int[] |
getShapeClone()
Returns the shape of the array as an array of ints, guaranteed to be a new array
i.e.
|
List<?> |
getSlices()
Returns a list of all major slices of this array.
|
List<?> |
getSlices(int dimension)
Returns a list of all slices of this array along a given dimension.
|
List<INDArray> |
getSliceViews()
Returns a list of slices as mutable INDArray views.
|
INDArray |
getTranspose()
Returns the transpose of this array.
|
INDArray |
getTransposeCopy()
Returns a transposed copy of the array.
|
INDArray |
getTransposeView()
Returns a transposed view of the array.
|
boolean |
hasUncountable()
Checks if the array has any uncountable element values (i.e.
|
INDArray |
immutable()
Returns an immutable version of this array.
|
INDArray |
innerProduct(AScalar a)
Calculates the inner product of this array with a scalar
|
INDArray |
innerProduct(AVector v)
Computes the inner product of this array with a vector
|
INDArray |
innerProduct(double a)
Calculates the inner product of this array with a double value
|
INDArray |
innerProduct(INDArray a)
Calculates the inner product of this array with another array.
|
boolean |
isBoolean()
Returns true if the array is boolean (contains only 0.0 or 1.0 values)
|
boolean |
isDense()
Returns true if the array is in a dense format.
|
boolean |
isElementConstrained()
Returns true if this array has some constraints on element values
|
boolean |
isFullyMutable()
If this method returns true, the INDArray is guaranteed to be fully mutable
in all positions i.e.
|
boolean |
isMutable()
Returns true if the INDArray is mutable (at least partially)
|
boolean |
isSameShape(INDArray a)
Returns true if this array is the same shape as another array
|
boolean |
isSparse()
Returns true if the array is in a sparse format
|
boolean |
isView()
Return true if this array is considered as a view type.
|
boolean |
isZero()
Returns true if the array is zero (all elements equal to zero)
|
INDArray |
join(INDArray a)
Joins an array with another array along the major dimension
|
INDArray |
join(INDArray a,
int dimension)
Joins an array with another array along a specified dimension
|
void |
log()
Computes the natural logarithm (in-place) for all array elements
|
void |
multiply(double factor)
Multiplies all elements of the array in place by a given double value
|
void |
multiply(INDArray a)
Multiplies all elements by the equivalent elements in a second array, i.e.
|
INDArray |
multiplyCopy(double factor)
Returns a copy of the array with all elements multiplied by a single constant value
|
INDArray |
multiplyCopy(INDArray a)
Multiplies all elements by the equivalent elements in a second array, i.e.
|
INDArray |
mutable()
Coerces this INDArray to a fully mutable format.
|
void |
negate()
Negates all elements in the array in place
|
INDArray |
negateCopy()
Negates all elements in the array, returning a new array
|
long |
nonZeroCount()
Returns the number of non-zero elements in the array.
|
INDArray |
outerProduct(INDArray a)
Calculates the outer product of this array with another array.
|
void |
pow(double exponent)
Raises all elements of the array to a specified power in place
|
void |
reciprocal()
Replaces all elements in the array with their reciprocal
|
INDArray |
reciprocalCopy()
Returns a new array where every element is the reciprocal of the corresponding element in this array
|
double |
reduce(Op2 op)
Reduces over all elements of the array in row-major order.
|
double |
reduce(Op2 op,
double init)
Reduces over all elements of the array in row-major order.
|
AVector |
reduceSlices(Op2 op)
Reduces each slice of the array by the given operator
|
AVector |
reduceSlices(Op2 op,
double init)
Reduces each slice of the array by the given operator
Uses the specified init value for reduction of each slice
|
INDArray |
reorder(int[] order)
Returns a re-ordered array by taking the specified order of slices along dimension 0
|
INDArray |
reorder(int dimension,
int[] order)
Returns a re-ordered array by taking the specified order of slices along a given dimension
May or may not use views of underlying slices (i.e.
|
INDArray |
reshape(int... shape)
Returns a new array by rearranging the elements of this array into the desired shape
Truncates or zero-pads the elements as required to fill the new shape
|
INDArray |
rotateView(int dimension,
int shift)
Returns rotated view of this array
|
void |
scale(double factor)
Scales all elements of the array in place by a given double value
|
void |
scaleAdd(double factor,
double constant)
Scales all elements of the array by a given double value and adds a constant value
|
void |
scaleAdd(double factor,
INDArray b,
double bfactor,
double constant)
Scales all elements of the array by a given double value, adds a scaled second array and adds a constant value
|
INDArray |
scaleCopy(double factor)
Deprecated.
|
void |
set(double value)
Sets all elements of an array to a specific double value
|
void |
set(INDArray a)
Sets this array to the element values contained in another array.
|
void |
set(int[] index,
double value)
Sets the element at the given indexed position in a mutable array
|
void |
set(int i,
double value)
Sets a value at a given position in a mutable 1D array
|
void |
set(int i,
int j,
double value)
Sets a value at a given position in a mutable 2D array
|
void |
set(long[] index,
double value)
Sets the element at the given indexed position in a mutable array
|
void |
set(Object o)
Sets this array to the element values contained in the given object.
|
void |
setElements(double... values)
Sets all elements in an array using the given double values
|
void |
setElements(double[] values,
int offset)
Sets all elements in an array using the given double values
|
void |
setElements(int pos,
double[] values,
int offset,
int length)
Sets elements in an array using the given double values.
|
void |
setInnerProduct(INDArray a,
INDArray b)
Sets this array to the inner product of two arrays.
|
void |
setMultiple(INDArray a,
double b)
Sets this array to be the multiple of another array.
|
void |
setMultiple(INDArray a,
INDArray b)
Sets this array to the element-wise multiple of two arrays.
|
void |
signum()
Calculates the signum of all elements of this mutable array
Sets each component of the array to its sign value (-1, 0 or 1)
|
INDArray |
signumCopy()
Returns a copy of the array with the signum operator applied to each element
|
INDArray |
slice(int majorSlice)
Returns the specified major slice of this array as a view (slice along dimension 0)
0 dimensional slice results are permitted, but attempting to slice a 0 dimensional array
will result in an error.
|
INDArray |
slice(int dimension,
int index)
Returns a slice view of this array along the specified dimension
|
int |
sliceCount()
Returns the number of major slices in this array (i.e.
|
Object |
sliceValue(int majorSlice)
Returns the value of a major slice of this array (slice along dimension 0)
Like 'slice', except returns a Double value for slices of 1D vectors
|
INDArray |
sparse()
Coerces this INDArray to a sparse format, without changing its element values.
|
INDArray |
sparseClone()
Creates a fully mutable clone of this array.
|
void |
sqrt()
Computes the square root of all elements in the array
|
void |
square()
Squares all elements of the array in place
|
INDArray |
squareCopy()
Squares all elements of the array, returning a new array
|
void |
sub(double a)
Subtracts a double value from all elements in this array
|
void |
sub(INDArray a)
Subtracts all the elements of another array from this array, in an elementwise order.
|
INDArray |
subArray(int[] offsets,
int[] shape)
Returns a subarray view of a larger array
|
INDArray |
subCopy(INDArray a)
Creates a new array equal to the subtraction of another array from this array
|
Array |
toArray()
Coerces the array into a packed mutable Array instance
May return the same array if it is already a dense Array instance
|
double[] |
toDoubleArray()
Copies the elements of this array to a new double[] array.
|
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
INDArray[] |
toSliceArray()
Copies the slices of this array to a new INDArray[]
|
Vector |
toVector()
Coerces the array into a flattened dense Vector, in row-major order
May return the same array if it is already a Vector instance
|
void |
validate()
Validates the internal data structure of the INDArray.
|
INDArray |
withComponents(INDArray... components)
Returns a new array of the same shape/structure as the original but with the specified components.
|
int dimensionality()
int[] getShape()
int[] getShapeClone()
int getShape(int dim)
IndexOutOfBoundsException - if the dimension does not exist.long[] getLongShape()
double get(AIndex ix)
double get(Index ix)
double get()
double get(int x)
double get(long x)
double get(int x,
int y)
double get(long x,
long y)
double get(int... indexes)
double get(long[] indexes)
void set(double value)
void set(int i,
double value)
i - value - void set(int i,
int j,
double value)
i - value - void set(int[] index,
double value)
index - value - void set(long[] index,
double value)
index - value - void set(INDArray a)
void set(Object o)
void add(double a)
INDArray addCopy(INDArray a)
a - INDArray addCopy(double d)
a - void addToArray(double[] data,
int offset)
void sub(double a)
INDArray subCopy(INDArray a)
a - void add(INDArray a)
void addAt(long i,
double v)
void sub(INDArray a)
void fill(double value)
void negate()
INDArray negateCopy()
void reciprocal()
INDArray reciprocalCopy()
void clamp(double min,
double max)
INDArray innerProduct(INDArray a)
INDArray innerProduct(double a)
INDArray innerProduct(AScalar a)
INDArray outerProduct(INDArray a)
AVector asVector()
INDArray reshape(int... shape)
INDArray reorder(int dimension, int[] order)
INDArray reorder(int[] order)
INDArray rotateView(int dimension, int shift)
INDArray broadcast(int... shape)
INDArray broadcastLike(INDArray target)
target - The target arrayIllegalArgumentException - if this array cannot be broadcasted to match the targetAMatrix broadcastLike(AMatrix target)
target - The target matrixIllegalArgumentException - if this array cannot be broadcasted to match the targetAVector broadcastLike(AVector target)
target - The target vectorIllegalArgumentException - if this array cannot be broadcasted to match the targetINDArray broadcastCloneLike(INDArray target)
target - The target arrayIllegalArgumentException - if the array cannot be broadcasted to match the target or vice versaINDArray broadcastCopyLike(INDArray target)
target - The target arrayIllegalArgumentException - if the array cannot be broadcasted to match the target or vice versaINDArray slice(int majorSlice)
RuntimeException - if the slice does not existObject sliceValue(int majorSlice)
IndexOutOfBoundsException - if the slice does not existINDArray join(INDArray a, int dimension)
INDArray slice(int dimension, int index)
INDArray subArray(int[] offsets, int[] shape)
INDArray getTranspose()
INDArray getTransposeView()
INDArray getTransposeCopy()
int sliceCount()
long elementCount()
double elementSum()
double elementMax()
double elementMin()
double elementSquaredSum()
Iterator<Double> elementIterator()
void multiply(INDArray a)
INDArray multiplyCopy(INDArray a)
void divide(INDArray a)
INDArray divideCopy(INDArray a)
void divide(double factor)
long nonZeroCount()
boolean isMutable()
boolean isBoolean()
boolean isSparse()
boolean isDense()
boolean isFullyMutable()
boolean isElementConstrained()
boolean isSameShape(INDArray a)
boolean isView()
boolean isZero()
INDArray clone()
INDArray copy()
@Deprecated INDArray ensureMutable()
void applyOp(Op op)
INDArray applyOpCopy(Op op)
void applyOp(IOperator operator)
operator - The operator to apply to the arraydouble reduce(Op2 op, double init)
double reduce(Op2 op)
boolean equals(INDArray a)
boolean elementsEqual(double value)
INDArray exactClone()
void setElements(double... values)
values - Element values in a double[] array. There must be at least as many element values as elements in this array.void setElements(double[] values,
int offset)
values - Element values in a double[] array. There must be at least as many element values as elements in this array.offset - Position in the values array from which to start taking values.void setElements(int pos,
double[] values,
int offset,
int length)
pos - Offset into this array, expressed in terms of number of elements in row major ordervalues - Element values in a double[] array. There must be at least as many element values as elements in this array.offset - Position in the values array from which to start taking values.length - Number of elements to set.void getElements(double[] dest,
int offset)
void getElements(Object[] dest, int offset)
void getElements(double[] arr)
void scale(double factor)
@Deprecated INDArray scaleCopy(double factor)
void scaleAdd(double factor,
double constant)
void scaleAdd(double factor,
INDArray b,
double bfactor,
double constant)
void addMultiple(INDArray src, double factor)
src - factor - void addPower(INDArray src, double exponent)
src - factor - void addPower(INDArray src, double exponent, double factor)
src - factor - void addInnerProduct(INDArray a, INDArray b)
a - b - IllegalArgumentException - if the inner product is a different shape to this arrayvoid addOuterProduct(INDArray a, INDArray b)
a - b - IllegalArgumentException - if the inner product is a different shape to this arrayvoid setInnerProduct(INDArray a, INDArray b)
a - b - IllegalArgumentException - if the inner product is a different shape to this arrayvoid setMultiple(INDArray a, INDArray b)
a - b - IllegalArgumentException - if the inner product is a different shape to this arrayvoid setMultiple(INDArray a, double b)
a - b - IllegalArgumentException - if the inner product is a different shape to this arrayvoid multiply(double factor)
void pow(double exponent)
void square()
INDArray squareCopy()
void sqrt()
void signum()
List<?> getSlices()
List<?> getSlices(int dimension)
void validate()
void toDoubleBuffer(DoubleBuffer dest)
double[] toDoubleArray()
INDArray[] toSliceArray()
double[] asDoubleArray()
List<INDArray> getSliceViews()
Vector toVector()
Array toArray()
boolean epsilonEquals(INDArray a)
boolean epsilonEquals(INDArray a, double epsilon)
void abs()
void log()
void exp()
INDArray immutable()
INDArray mutable()
INDArray sparse()
INDArray dense()
INDArray sparseClone()
INDArray denseClone()
boolean equalsArray(double[] data)
data - Array of double element values to check for equalityboolean equalsArray(double[] data,
int offset)
data - Array of double element values to check for equalityoffset - Offset into the data arrayINDArray innerProduct(AVector v)
v - A vectorINDArray absCopy()
INDArray signumCopy()
double[] getElements()
double elementProduct()
INDArray multiplyCopy(double factor)
factor - A scalar factorboolean hasUncountable()
double elementPowSum(double p)
double elementAbsPowSum(double p)
int componentCount()
INDArray getComponent(int k)
k - INDArray withComponents(INDArray... components)
INDArray[] getComponents()
void applyOp(Op2 op, INDArray b)
op - b - void applyOp(Op2 op, double b)
op - b - AVector reduceSlices(Op2 op)
op - b - AVector reduceSlices(Op2 op, double init)
op - b - void checkMutable()
dimension - Copyright © 2016. All rights reserved.