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)
|
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 |
applyOp(IOperator op)
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)
|
double[] |
asDoubleArray()
Returns the underlying double array representing the packed elements of this array
Returns nil if there is no such underlying array
|
List<Double> |
asElementList()
Returns a list containing all elements of this array
|
AVector |
asVector()
Constructs a view of 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 clone of the array, broadcasted if necessary to match the shape of the target
|
INDArray |
broadcastLike(INDArray target)
Broadcasts to match the shape of the target
|
void |
clamp(double min,
double max)
Clamps all the elments of this array within the specified [min,max] range
|
INDArray |
clone()
Returns a clone of the array, as a new array which will be fully mutable
and may be of a different class to the original.
|
void |
copyTo(double[] arr)
Copies all the elements of this INDArray to the specified double array
|
int |
dimensionality()
Returns the dimensionality of the array (number of dimensions in the array shape)
e.g.
|
void |
divide(double factor)
Divides all elements by a given factor
|
void |
divide(INDArray a)
Divides all elements by the equivalent elements in a second array
|
long |
elementCount()
Returns the total number of elements in this array.
|
Iterator<Double> |
elementIterator()
Returns an iterator over all elements in this array.
|
double |
elementMax()
Returns the maximum element value in this array.
|
double |
elementMin()
Returns the maximum element value in this array.
|
double |
elementSquaredSum()
Returns the total sum of elements in this array.
|
double |
elementSum()
Returns the total sum of elements in this array.
|
INDArray |
ensureMutable()
Ensures the array is a fully mutable, efficient representation that is not
a view.
|
boolean |
epsilonEquals(INDArray a)
Tests is 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)
Returns true if the two arrays are exactly equal in value and shape
|
INDArray |
exactClone()
Returns an exact deep clone of an array (i.e.
|
void |
exp()
Computes the function e^x (in-place) for all array elements
|
void |
fill(double value)
Fills the array with asingle double value
|
double |
get()
Returns the double value of a scalar 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
|
void |
getElements(double[] dest,
int offset)
Gets all elements of the array, copying them into a double array
|
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
|
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.
|
INDArray |
immutable()
Returns an immutable version of this INDArray's data
|
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 |
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 |
isView()
Return true if this array is a view type
|
boolean |
isZero()
Returns true if the array is zero (all elements equal to zero)
|
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 d)
Multiplies all elements of the array by a given double value
|
void |
multiply(INDArray a)
Multiplies all elements by the equivalent elements in a second array
|
INDArray |
mutable()
Coerces this INDArray to a fully mutable format.
|
void |
negate()
Negates all elements in the 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
|
void |
reciprocal()
Replaces all elements in the array with their reciprocal
|
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 d)
Scales all elements of the array 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 vale
|
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[] indexes,
double value) |
void |
set(int i,
double value) |
void |
set(int i,
int j,
double value) |
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,
int length)
Sets all elements in an array using the given double values
|
void |
signum()
Calculates the signum of all elements of the array
|
INDArray |
slice(int majorSlice)
Returns the specified major slice of this array as a view (slice along dimension 0)
|
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.
|
INDArray |
sparse()
Coerces this INDArray to a sparse format, without changing its element values.
|
void |
sqrt()
Computes the square root of all elements in the array
|
void |
square()
Squares all elements of the 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
|
Array |
toArray()
Converts the array into a packed mutable Array instance
|
double[] |
toDoubleArray()
Copies the elements of this INDArray to a new double array
|
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
Vector |
toVector()
Converts the array into a flattened vector
|
void |
validate()
Validates the internal data structure of the INDArray.
|
int dimensionality()
int[] getShape()
int[] getShapeClone()
int getShape(int dim)
dim
- long[] getLongShape()
double get()
double get(int x)
double get(int x, int y)
double get(int... indexes)
void set(double value)
value
- void set(int i, double value)
void set(int i, int j, double value)
void set(int[] indexes, double value)
void set(INDArray a)
a
- void set(Object o)
a
- void add(double a)
void sub(double a)
void add(INDArray a)
a
- void sub(INDArray a)
a
- void fill(double value)
value
- void negate()
void reciprocal()
void clamp(double min, double max)
min
- max
- INDArray innerProduct(INDArray a)
a
- INDArray outerProduct(INDArray a)
a
- AVector asVector()
List<Double> asElementList()
INDArray reshape(int... shape)
shape
- INDArray rotateView(int dimension, int shift)
INDArray broadcast(int... shape)
shape
- INDArray broadcastLike(INDArray target)
target
- INDArray broadcastCloneLike(INDArray target)
target
- INDArray slice(int majorSlice)
majorSlice
- INDArray join(INDArray a, int dimension)
majorSlice
- INDArray slice(int dimension, int index)
majorSlice
- INDArray subArray(int[] offsets, int[] shape)
majorSlice
- 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)
void divide(INDArray a)
void divide(double factor)
long nonZeroCount()
boolean isMutable()
boolean isBoolean()
boolean isFullyMutable()
boolean isElementConstrained()
boolean isSameShape(INDArray a)
boolean isView()
boolean isZero()
INDArray clone()
INDArray ensureMutable()
void applyOp(Op op)
op
- void applyOp(IOperator op)
op
- boolean equals(INDArray a)
a
- INDArray exactClone()
void setElements(double[] values)
void setElements(double[] values, int offset, int length)
void getElements(double[] dest, int offset)
d
- void scale(double d)
d
- void scaleAdd(double factor, double constant)
d
- void multiply(double d)
d
- void pow(double exponent)
exponent
- void square()
void sqrt()
void signum()
List<?> getSlices()
List<?> getSlices(int dimension)
void validate()
void copyTo(double[] arr)
arr
- void toDoubleBuffer(DoubleBuffer dest)
arr
- double[] toDoubleArray()
arr
- double[] asDoubleArray()
arr
- List<INDArray> getSliceViews()
Vector toVector()
Array toArray()
boolean epsilonEquals(INDArray a)
a
- boolean epsilonEquals(INDArray a, double epsilon)
a
- void abs()
void log()
void exp()
INDArray immutable()
INDArray mutable()
INDArray sparse()
Copyright © 2014. All Rights Reserved.