public final class Array extends BaseShapedArray implements IStridedArray, IDenseArray
shape| Modifier and Type | Method and Description |
|---|---|
void |
abs()
Replaces all elements of this array with their absolute values, according to Math.abs(double)
|
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 densely packed elements of this array
Returns null if there is no such array
|
Vector |
asVector()
Constructs a view of all elements in the array as a single vector in row-major order.
|
protected void |
checkDimension(int dimension)
Checks if an array has the specified dimension.
|
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.
|
static Array |
create(INDArray a)
Crates a new Array with a copt of the data from the sepcified array, in the same shape
|
static Array |
createFromVector(AVector a,
int... shape)
Creates a new matrix using the elements in the specified vector.
|
int |
dimensionality()
Returns the dimensionality of the array (i.e.
|
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 |
elementSquaredSum()
Returns the sum of squared elements in this array.
|
double |
elementSum()
Returns the sum of all elements in this array.
|
boolean |
equals(INDArray a)
Checks if two arrays are equal exactly in terms of both value and shape
|
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
|
Array |
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
|
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
|
double[] |
getArray()
Gets the underlying data array for this strided array
Unsafe operation - may allow modification of otherwise immutable arrays
|
int |
getArrayOffset()
Gets the data array offset for the first element of this strided array
|
void |
getElements(double[] values,
int offset)
Gets all elements of the array, copying them into a double array at the specified offset
|
protected int |
getIndex(int... indexes)
Computes the array index of the specified index position in the underlyind data array
|
long[] |
getLongShape()
Returns the shape of the array as an array of longs.
|
List<?> |
getSlices()
Returns a list of all major slices of this array.
|
int |
getStride(int dim)
Gets the stide for a specific dimension in this strided array.
|
int[] |
getStrides()
Gets the strides for each dimension of this strided array.
|
INDArray |
getTranspose()
Returns the transpose of this array.
|
INDArray |
getTransposeView()
Returns a transposed view of the array.
|
INDArray |
immutable()
Returns an immutable version of this array.
|
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 |
isPackedArray()
Checks if this array is fully packed in row major order.
|
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)
|
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
|
static Array |
newArray(int... shape)
Creates a new zero-filled mutable Array of the specified shape
|
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.
|
void |
set(int[] indexes,
double value)
Sets the element at the given indexed position in a mutable array
|
void |
setElements(int pos,
double[] values,
int offset,
int length)
Sets elements in an array using the given double values.
|
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 |
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
|
void |
square()
Squares all elements of the array in place
|
INDArray |
subArray(int[] offsets,
int[] shape)
Returns a subarray view of a larger array
|
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
|
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.
|
static INDArray |
wrap(double[] data,
int... shape)
Wraps double[] array data in an Array of the specified shape.
|
static Array |
wrap(Matrix m)
Wraps the underlying data from a dense Matrix as an array with the same shape
|
static Array |
wrap(Vector v)
Wraps the underlying data from a dense Vector as an array with the same shape
|
getShape, getShape, getShapeClone, sliceCountabsCopy, add, add, add, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addOuterProduct, addPower, addPower, addToArray, applyOp, applyOp, applyOpCopy, asElementList, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, checkMutable, clamp, componentCount, copy, dense, denseClone, density, divide, divide, divideCopy, elementAbsPowSum, elementPowSum, elementProduct, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, equals, equals, equalsArray, fill, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, getSlices, getSliceViews, getTransposeCopy, hashCode, hasUncountable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isSameShape, isSparse, iterator, join, join, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonZeroCount, outerProduct, pow, reciprocal, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setElements, setElements, setInnerProduct, setMultiple, setMultiple, signumCopy, sliceValue, sparse, sparseClone, sqrt, squareCopy, sub, sub, sub, subCopy, toArray, toSliceArray, toString, toStringFull, withComponentsfinalize, getClass, notify, notifyAll, wait, wait, waitabsCopy, add, add, addAt, addCopy, addCopy, addInnerProduct, addMultiple, addOuterProduct, addPower, addPower, addToArray, applyOp, applyOp, applyOpCopy, asElementList, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, checkMutable, clamp, componentCount, copy, dense, denseClone, divide, divide, divideCopy, elementAbsPowSum, elementPowSum, elementProduct, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, equalsArray, fill, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, getShape, getShape, getShapeClone, getSlices, getSliceViews, getTransposeCopy, hasUncountable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isSameShape, isSparse, join, join, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonZeroCount, outerProduct, pow, reciprocal, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setElements, setElements, setInnerProduct, setMultiple, setMultiple, signumCopy, sliceCount, sliceValue, sparse, sparseClone, sqrt, squareCopy, sub, sub, subCopy, toArray, toSliceArray, withComponentsforEach, spliteratorpublic static INDArray wrap(double[] data, int... shape)
data - shape - public static Array wrap(Vector v)
v - public static Array wrap(Matrix m)
v - public static Array newArray(int... shape)
shape - public static Array create(INDArray a)
a - public int dimensionality()
INDArraydimensionality in interface INDArraydimensionality in class BaseShapedArrayprotected final void checkDimension(int dimension)
AbstractArraycheckDimension in class AbstractArray<INDArray>public long[] getLongShape()
INDArraygetLongShape in interface INDArraygetLongShape in class AbstractArray<INDArray>public int getStride(int dim)
IStridedArraygetStride in interface IStridedArrayprotected int getIndex(int... indexes)
indexes - public double get(int... indexes)
INDArraypublic void set(int[] indexes,
double value)
INDArraypublic Vector asVector()
INDArrayasVector in interface INDArrayasVector in class AbstractArray<INDArray>public Vector toVector()
INDArraytoVector in interface INDArraytoVector in class AbstractArray<INDArray>public INDArray slice(int majorSlice)
INDArraypublic INDArray slice(int dimension, int index)
INDArraypublic INDArray getTranspose()
INDArraygetTranspose in interface INDArraygetTranspose in class AbstractArray<INDArray>public INDArray getTransposeView()
INDArraygetTransposeView in interface INDArraygetTransposeView in class AbstractArray<INDArray>public INDArray subArray(int[] offsets, int[] shape)
INDArraysubArray in interface INDArraysubArray in class AbstractArray<INDArray>public long elementCount()
INDArrayelementCount in interface INDArrayelementCount in class BaseShapedArraypublic double elementSum()
INDArrayelementSum in interface INDArrayelementSum in class AbstractArray<INDArray>public double elementMax()
INDArrayelementMax in interface INDArrayelementMax in class AbstractArray<INDArray>public double elementMin()
INDArrayelementMin in interface INDArrayelementMin in class AbstractArray<INDArray>public double elementSquaredSum()
INDArrayelementSquaredSum in interface INDArrayelementSquaredSum in class AbstractArray<INDArray>public void abs()
INDArrayabs in interface INDArrayabs in class AbstractArray<INDArray>public void signum()
INDArraysignum in interface INDArraysignum in class AbstractArray<INDArray>public void square()
INDArraysquare in interface INDArraysquare in class AbstractArray<INDArray>public void exp()
INDArrayexp in interface INDArrayexp in class AbstractArray<INDArray>public void log()
INDArraylog in interface INDArraylog in class AbstractArray<INDArray>public boolean isMutable()
INDArrayisMutable in interface INDArrayisMutable in class AbstractArray<INDArray>public boolean isFullyMutable()
INDArrayisFullyMutable in interface INDArrayisFullyMutable in class AbstractArray<INDArray>public boolean isElementConstrained()
INDArrayisElementConstrained in interface INDArrayisElementConstrained in class AbstractArray<INDArray>public boolean isView()
INDArraypublic void applyOp(Op op)
INDArrayapplyOp in interface INDArrayapplyOp in class AbstractArray<INDArray>public double reduce(Op2 op)
INDArrayreduce in interface INDArrayreduce in class BaseShapedArraypublic double reduce(Op2 op, double init)
INDArrayreduce in interface INDArrayreduce in class BaseShapedArraypublic void applyOp(IOperator op)
INDArrayapplyOp in interface INDArrayapplyOp in class AbstractArray<INDArray>op - The operator to apply to the arraypublic boolean equals(INDArray a)
INDArrayequals in interface INDArrayequals in class AbstractArray<INDArray>public Array exactClone()
INDArrayexactClone in interface INDArraypublic void setElements(int pos,
double[] values,
int offset,
int length)
INDArraysetElements in interface INDArraysetElements in class AbstractArray<INDArray>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.public void getElements(double[] values,
int offset)
INDArraygetElements in interface INDArraygetElements in class AbstractArray<INDArray>public Iterator<Double> elementIterator()
INDArrayelementIterator in interface INDArrayelementIterator in class AbstractArray<INDArray>public void multiply(double factor)
INDArraymultiply in interface INDArraymultiply in class AbstractArray<INDArray>public List<?> getSlices()
INDArraygetSlices in interface INDArraygetSlices in class AbstractArray<INDArray>public void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AbstractArray<INDArray>public double[] toDoubleArray()
INDArraytoDoubleArray in interface INDArraytoDoubleArray in class AbstractArray<INDArray>public double[] asDoubleArray()
INDArrayasDoubleArray in interface INDArrayasDoubleArray in class AbstractArray<INDArray>public INDArray clone()
INDArrayclone in interface INDArrayclone in class AbstractArray<INDArray>public void validate()
INDArrayvalidate in interface INDArrayvalidate in class AbstractArray<INDArray>public static Array createFromVector(AVector a, int... shape)
data - rows - columns - public double[] getArray()
IStridedArraygetArray in interface IDenseArraygetArray in interface IStridedArraypublic int getArrayOffset()
IStridedArraygetArrayOffset in interface IDenseArraygetArrayOffset in interface IStridedArraypublic int[] getStrides()
IStridedArraygetStrides in interface IStridedArraypublic boolean isPackedArray()
IStridedArrayisPackedArray in interface IStridedArraypublic boolean isZero()
INDArrayisZero in interface INDArrayisZero in class BaseShapedArraypublic INDArray immutable()
INDArrayimmutable in interface INDArrayimmutable in class AbstractArray<INDArray>public double get()
INDArrayget in interface INDArrayget in class AbstractArray<INDArray>public double get(int x)
INDArrayget in interface INDArrayget in class AbstractArray<INDArray>public double get(int x,
int y)
INDArrayget in interface INDArrayget in class AbstractArray<INDArray>public boolean equalsArray(double[] data,
int offset)
INDArrayequalsArray in interface INDArrayequalsArray in class AbstractArray<INDArray>data - Array of double element values to check for equalityoffset - Offset into the data arrayCopyright © 2016. All rights reserved.