public abstract class AMatrix extends ALinearTransform implements IMatrix, Iterable<AVector>
| Constructor and Description |
|---|
AMatrix() |
| 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(AMatrix m)
Adds another matrix to this matrix.
|
void |
add(AScalar a) |
void |
add(AVector v) |
void |
add(double d)
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(int i,
int j,
double d) |
void |
addMultiple(AMatrix m,
double factor) |
void |
addRowMultiple(int src,
int dst,
double factor)
Adds a multiple of a source row to a destination row
This is an elementary row operation
|
void |
applyOp(IOp 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()
Returns the matrix values as a single reference Vector in the form [row0
row1 row2....]
|
int |
bandIndex(int i,
int j)
Returns the band index number for a specified position in the matrix.
|
int |
bandLength(int band)
Returns the length of a band of the matrix.
|
protected static int |
bandLength(int rc,
int cc,
int band) |
int |
bandPosition(int i,
int j)
Returns the band position for a specified (i,j) index in the matrix.
|
INDArray |
broadcast(int... targetShape)
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(AMatrix target) |
INDArray |
broadcastLike(INDArray target)
Broadcasts to match the shape of the target
|
double |
calculateElement(int i,
AVector v)
Calculates a single element of the output.
|
double |
calculateElement(int i,
Vector v) |
void |
clamp(double min,
double max)
Clamps all the elments of this array within the specified [min,max] range
|
AMatrix |
clone()
Clones the transform, performing a deep copy where needed
|
AVector |
cloneRow(int row) |
abstract int |
columnCount()
Returns the number of columns in the matrix
|
AMatrix |
compose(AMatrix a)
Composes this matrix with another matrix (matrix multiplication)
Returns a new matrix that represents the compose transformation.
|
ATransform |
compose(ATransform a)
Composes this transformation with another transformation, returning
a new combined transformation
|
void |
composeWith(AMatrix a) |
void |
composeWith(ATransform a)
Composes this transformation with a given transformation,
mutating the transformation to represent the combined transform
|
void |
copyColumnTo(int col,
double[] dest,
int destOffset) |
AMatrix |
copyOfMatrix()
Returns a deep copy of the transformation matrix for this affine transform
|
AVector |
copyOfTranslationVector()
Returns a deep copy of the translation vector for this affine transform
|
void |
copyRowTo(int row,
double[] dest,
int destOffset) |
void |
copyTo(double[] arr)
Copies all the elements of this INDArray to the specified double array
|
double |
determinant()
Calculates the determinant of the matrix.
|
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.
|
void |
elementDiv(AMatrix m)
Divides this matrix in-place by another in an entrywise manner (Hadamard product).
|
Iterator<Double> |
elementIterator()
Returns an iterator over all elements in this array.
|
void |
elementMul(AMatrix m)
Multiplies this matrix in-place by another in an entrywise manner (Hadamard product).
|
double |
elementSquaredSum()
Returns the squared sum of all elements in the matrix
|
double |
elementSum()
Returns the sum of all elements in the matrix
|
INDArray |
ensureMutable()
Ensures the array is a fully mutable, efficient representation that is not
a view.
|
boolean |
epsilonEquals(AMatrix a)
Returns true if this matrix is approximately equal to
a second matrix, up to a default tolerance level
|
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(AAffineTransform a) |
boolean |
equals(AMatrix a) |
boolean |
equals(INDArray v)
Returns true if the two arrays are exactly equal in value and shape
|
boolean |
equals(Object o) |
abstract AMatrix |
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 row)
Returns the double value at the specified position in a 1D vector
|
abstract double |
get(int row,
int column)
Returns a specified element in the matrix
|
AVector |
getBand(int band)
Gets a specific band of the matrix, as a view vector.
|
AVector |
getBandWrapped(int band) |
AVector |
getColumn(int column)
Returns a column of the matrix as a vector view
|
void |
getElements(double[] dest,
int offset)
Gets all elements of the array, copying them into a double array
|
AVector |
getLeadingDiagonal()
Returns a vector view of the leading diagonal values of the matrix
|
long[] |
getLongShape()
Returns the shape of the array as an array of longs.
|
AMatrix |
getMatrixComponent() |
AVector |
getRow(int row)
Returns a row of the matrix as a vector view
|
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
|
List<AVector> |
getSlices()
Returns a list of all major slices of this array.
|
List<INDArray> |
getSliceViews()
Returns a list of slices as mutable INDArray views.
|
AMatrix |
getTranspose()
Returns a transposed version of this matrix.
|
Matrix |
getTransposeCopy()
Returns a transposed copy of the array.
|
AMatrix |
getTransposeView()
Returns a transposed view of the array.
|
int |
hashCode() |
boolean |
hasOrthonormalColumns() |
boolean |
hassOrthonormalRows() |
AMatrix |
innerProduct(AMatrix a) |
AMatrix |
innerProduct(AScalar s) |
AVector |
innerProduct(AVector v) |
INDArray |
innerProduct(INDArray a)
Calculates the inner product of this array with another array.
|
Matrix |
innerProduct(Matrix a) |
Vector |
innerProduct(Vector v) |
int |
inputDimensions()
Returns the number of dimensions required for input vectors
|
AMatrix |
inverse()
Return the inverse of this transformation if possible
|
boolean |
isBoolean()
Returns true if the array is boolean (contains only 0.0 or 1.0 values)
|
boolean |
isDiagonal()
Returns true iff a matrix is a square diagonal matrix
|
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 |
isHermitian()
Returns true if a matrix is Hermitian
This is equivalent to isSymmetric(), since all Vectorz matrices have real values.
|
boolean |
isIdentity()
Returns true if this transform is known to be the identity function, i.e.
|
boolean |
isInvertible()
Returns true if this transform is invertible
|
boolean |
isLowerTriangular()
Returns true if a matrix is lower triangular
|
boolean |
isMutable()
Returns true if the INDArray is mutable (at least partially)
|
boolean |
isOrthogonal() |
void |
isPositiveDefinite()
Returns true if a matrix is positive definite
|
boolean |
isRectangularDiagonal() |
boolean |
isSameShape(AMatrix a) |
boolean |
isSameShape(INDArray a)
Returns true if this array is the same shape as another array
|
boolean |
isSquare()
Returns true if the transform is square (same number of input and output dimensions)
|
boolean |
isSymmetric()
Returns true if a matrix is symmetric
|
boolean |
isUpperTriangular()
Returns true if a matrix is upper triangular
|
boolean |
isView()
Return true if this array is a view type
|
boolean |
isZero()
Returns true if the matrix is the zero matrix (all components zero)
|
Iterator<AVector> |
iterator()
Returns an iterator over rows in this Matrix
|
void |
log()
Computes the natural logarithm (in-place) for all array elements
|
int |
lowerBandwidth()
Computes the lower bandwidth of a matrix
|
int |
lowerBandwidthLimit()
A limit on the lower bandwidth of the banded matrix.
|
void |
mul(AMatrix a)
"Multiplies" this matrix by another, composing the transformation
|
void |
multiply(double factor)
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
|
void |
multiplyRow(int i,
double factor)
Multiplies a row by a constant factor
This is an elementary row operation
|
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.
|
int |
outputDimensions()
Returns the number of dimensions required for output vectors
|
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... dimensions)
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
|
Matrix |
reshape(int rows,
int cols) |
abstract int |
rowCount()
Returns the number of rows in the matrix
|
void |
scale(double factor)
Scales a matrix by a constant scalar factor.
|
void |
scaleAdd(double factor,
double constant)
Scales all elements of the array by a given double value and adds a constant vale
|
void |
set(AMatrix a) |
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 row,
double value) |
abstract void |
set(int row,
int column,
double value)
Sets a specified element in the matrix
|
void |
set(Object o)
Sets this array to the element values contained in the given object.
|
void |
setColumn(int i,
AVector col) |
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 |
setRow(int i,
AVector row) |
void |
signum()
Calculates the signum of all elements of the array
|
AVector |
slice(int rowNumber)
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.
|
void |
sqrt()
Computes the square root of all elements in the array
|
void |
square()
Squares all elements of the array
|
void |
sub(AMatrix m)
Subtracts another matrix from this one
|
void |
sub(AScalar a) |
void |
sub(AVector v) |
void |
sub(double d)
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.
|
AMatrix |
subMatrix(int rowStart,
int rows,
int colStart,
int cols) |
void |
swapColumns(int i,
int j)
Swaps two columns of the matrix in place
|
void |
swapRows(int i,
int j)
Swaps two rows of the matrix in place
This is an elementary row operation
|
AAffineTransform |
toAffineTransform() |
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
|
Matrix |
toMatrix()
Coerces the matrix to the standard mutable Matrix type
in row major order.
|
Matrix |
toMatrixTranspose()
Coerces the transpose of a matrix to the standard mutable Matrix type
in row major order.
|
AMatrix |
toMutableMatrix()
Creates a fully mutable deep copy of this matrix
|
String |
toString() |
Vector |
toVector()
Converts the matrix to a single flattened vector
in row major order.
|
double |
trace() |
AVector |
transform(AVector source)
Transforms a vector, returning a new transformed vector
|
void |
transform(AVector source,
AVector dest)
Transforms the source vector, storing the result in the given destination vector
|
Vector |
transform(Vector source)
Transforms a vector, returning a new transformed vector
|
void |
transform(Vector source,
Vector dest) |
void |
transformInPlace(AArrayVector v) |
void |
transformInPlace(AVector v)
Transforms a vector destructively.
|
AMatrix |
transposeInnerProduct(AMatrix s) |
Matrix |
transposeInnerProduct(Matrix s) |
void |
transposeInPlace() |
double |
unsafeGet(int row,
int column)
Gets an element in the matrix in an unsafe fashion, without performing bound checks
The result is undefined if the row and column are out of bounds.
|
void |
unsafeSet(int row,
int column,
double value)
Sets an element value in the matrix in an unsafe fashion, without performing bound checks
The result is undefined if the row and column are out of bounds.
|
int |
upperBandwidth()
Computes the upper bandwidth of a matrix
|
int |
upperBandwidthLimit()
A limit on the upper bandwidth of the banded matrix.
|
void |
validate()
Validates the internal data structure of the INDArray.
|
getTranslationComponent, isLinearcompose, transformNormaltakeComponents, takeComponents, takeComponentspublic abstract int rowCount()
public abstract int columnCount()
columnCount in interface IMatrixpublic abstract double get(int row,
int column)
public abstract void set(int row,
int column,
double value)
public final double get(int row)
INDArraypublic final double get()
INDArraypublic void set(double value)
INDArraypublic void fill(double value)
INDArraypublic void unsafeSet(int row,
int column,
double value)
row - column - public double unsafeGet(int row,
int column)
row - column - public void clamp(double min,
double max)
INDArraypublic void pow(double exponent)
INDArraypublic void square()
INDArraypublic int dimensionality()
INDArraydimensionality in interface INDArraypublic long elementCount()
INDArrayelementCount in interface INDArraypublic AVector slice(int rowNumber)
INDArraypublic INDArray slice(int dimension, int index)
INDArraypublic int sliceCount()
INDArraysliceCount in interface INDArraypublic List<AVector> getSlices()
INDArraypublic List<INDArray> getSliceViews()
INDArraygetSliceViews in interface INDArraypublic int[] getShape()
INDArraypublic int getShape(int dim)
INDArraypublic long[] getLongShape()
INDArraygetLongShape in interface INDArraypublic double get(int... indexes)
INDArraypublic AVector getLeadingDiagonal()
public double calculateElement(int i,
AVector v)
ATransformcalculateElement in class AAffineTransformpublic double calculateElement(int i,
Vector v)
public AAffineTransform toAffineTransform()
toAffineTransform in class AAffineTransformpublic AMatrix getMatrixComponent()
getMatrixComponent in class AAffineTransformpublic boolean isIdentity()
ATransformisIdentity in class AAffineTransformpublic boolean isSquare()
ATransformisSquare in class ATransformpublic boolean isOrthogonal()
public boolean hasOrthonormalColumns()
public boolean hassOrthonormalRows()
public int inputDimensions()
ATransforminputDimensions in interface ITransforminputDimensions in class ATransformpublic int outputDimensions()
ATransformoutputDimensions in interface ITransformoutputDimensions in class ATransformpublic INDArray reshape(int... dimensions)
INDArraypublic Matrix reshape(int rows, int cols)
public AMatrix subMatrix(int rowStart, int rows, int colStart, int cols)
public AVector transform(AVector source)
ATransformtransform in class ATransformpublic Vector transform(Vector source)
ATransformtransform in class ATransformpublic void transform(AVector source, AVector dest)
ATransformtransform in interface ITransformtransform in class AAffineTransformpublic void transformInPlace(AVector v)
ATransformtransformInPlace in class AAffineTransformpublic void transformInPlace(AArrayVector v)
public AVector getRow(int row)
public AVector getColumn(int column)
public AVector cloneRow(int row)
public void set(AMatrix a)
public void set(INDArray a)
INDArraypublic void set(Object o)
INDArraypublic void setElements(double[] values,
int offset,
int length)
INDArraysetElements in interface INDArraypublic void getElements(double[] dest,
int offset)
INDArraygetElements in interface INDArraypublic void copyTo(double[] arr)
INDArraypublic void setElements(double[] values)
INDArraysetElements in interface INDArraypublic boolean isFullyMutable()
INDArrayisFullyMutable in interface INDArraypublic boolean isMutable()
INDArraypublic boolean isElementConstrained()
INDArrayisElementConstrained in interface INDArraypublic AMatrix clone()
ATransformclone in interface INDArrayclone in class ATransformpublic INDArray ensureMutable()
INDArrayensureMutable in interface INDArraypublic double determinant()
public AMatrix toMutableMatrix()
public void transposeInPlace()
public AMatrix getTranspose()
getTranspose in interface INDArraypublic AMatrix getTransposeView()
INDArraygetTransposeView in interface INDArraypublic Matrix getTransposeCopy()
INDArraygetTransposeCopy in interface INDArraypublic void add(AMatrix m)
m - public void add(AVector v)
public void sub(AVector v)
public void sub(double d)
INDArraypublic final void scale(double factor)
public final void scaleAdd(double factor,
double constant)
INDArraypublic void multiply(double factor)
INDArraypublic double elementSum()
elementSum in interface INDArraym - public double elementSquaredSum()
elementSquaredSum in interface INDArraym - public Iterator<Double> elementIterator()
INDArrayelementIterator in interface INDArraypublic boolean isBoolean()
INDArraypublic long nonZeroCount()
INDArraynonZeroCount in interface INDArraypublic void sub(AMatrix m)
m - public void sub(AScalar a)
public void add(AScalar a)
public void negate()
INDArraypublic void reciprocal()
INDArrayreciprocal in interface INDArraypublic void abs()
INDArraypublic void sqrt()
INDArraypublic void log()
INDArraypublic void exp()
INDArraypublic void signum()
INDArraypublic void elementMul(AMatrix m)
m - public void elementDiv(AMatrix m)
m - public void mul(AMatrix a)
a - public void multiplyRow(int i,
double factor)
public void addRowMultiple(int src,
int dst,
double factor)
public void swapRows(int i,
int j)
public void swapColumns(int i,
int j)
public void composeWith(ATransform a)
ATransformcomposeWith in class ATransformpublic void composeWith(AMatrix a)
public boolean isView()
INDArraypublic AMatrix copyOfMatrix()
AAffineTransformcopyOfMatrix in class AAffineTransformpublic AVector copyOfTranslationVector()
AAffineTransformcopyOfTranslationVector in class AAffineTransformpublic void addMultiple(AMatrix m, double factor)
public boolean epsilonEquals(INDArray a)
INDArrayepsilonEquals in interface INDArraypublic boolean epsilonEquals(INDArray a, double epsilon)
INDArrayepsilonEquals in interface INDArraypublic boolean equals(Object o)
equals in class AAffineTransformpublic boolean equals(AMatrix a)
public boolean equals(INDArray v)
INDArraypublic boolean epsilonEquals(AMatrix a)
public boolean equals(AAffineTransform a)
equals in class AAffineTransformpublic int hashCode()
hashCode in class AAffineTransformpublic AVector asVector()
public List<Double> asElementList()
INDArrayasElementList in interface INDArraypublic ATransform compose(ATransform a)
ATransformcompose in class AAffineTransformpublic final AMatrix compose(AMatrix a)
a - public INDArray innerProduct(INDArray a)
INDArrayinnerProduct in interface INDArraypublic INDArray outerProduct(INDArray a)
INDArrayouterProduct in interface INDArraypublic AMatrix inverse()
ATransforminverse in class AAffineTransformpublic double trace()
public boolean isInvertible()
ATransformisInvertible in class AAffineTransformpublic Vector toVector()
public Array toArray()
INDArraypublic Matrix toMatrix()
public Matrix toMatrixTranspose()
public void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraypublic double[] toDoubleArray()
INDArraytoDoubleArray in interface INDArraypublic double[] asDoubleArray()
INDArrayasDoubleArray in interface INDArraypublic void applyOp(Op op)
INDArraypublic void applyOp(IOp op)
INDArraypublic void add(INDArray a)
INDArraypublic void multiply(INDArray a)
INDArraypublic void divide(INDArray a)
INDArraypublic void divide(double factor)
INDArraypublic void sub(INDArray a)
INDArraypublic void add(double d)
INDArraypublic void addAt(int i,
int j,
double d)
public INDArray broadcast(int... targetShape)
INDArraypublic INDArray broadcastLike(INDArray target)
INDArraybroadcastLike in interface INDArraypublic INDArray broadcastCloneLike(INDArray target)
INDArraybroadcastCloneLike in interface INDArraypublic boolean isZero()
public void isPositiveDefinite()
public boolean isDiagonal()
public boolean isSameShape(INDArray a)
INDArrayisSameShape in interface INDArraypublic boolean isSameShape(AMatrix a)
public boolean isRectangularDiagonal()
public boolean isSymmetric()
public final boolean isHermitian()
public boolean isUpperTriangular()
public boolean isLowerTriangular()
public int upperBandwidthLimit()
public int lowerBandwidthLimit()
public int bandLength(int band)
band - protected static final int bandLength(int rc,
int cc,
int band)
public int bandIndex(int i,
int j)
i - j - public int bandPosition(int i,
int j)
i - j - public int upperBandwidth()
public int lowerBandwidth()
public AVector getBand(int band)
band - public AVector getBandWrapped(int band)
public void setRow(int i,
AVector row)
public void setColumn(int i,
AVector col)
public abstract AMatrix exactClone()
INDArrayexactClone in interface INDArraypublic void validate()
INDArraypublic void copyRowTo(int row,
double[] dest,
int destOffset)
public void copyColumnTo(int col,
double[] dest,
int destOffset)
Copyright © 2013. All Rights Reserved.