public abstract class AMatrix extends ALinearTransform implements IMatrix, Iterable<AVector>
| Constructor and Description |
|---|
AMatrix() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AMatrix m)
Adds another matrix to this matrix.
|
void |
add(AVector v) |
void |
add(double d) |
void |
add(INDArray a) |
void |
addAt(int i,
int j,
double d) |
void |
addMultiple(AMatrix m,
double factor) |
void |
addRowMultiple(int src,
int dst,
double factor) |
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)
|
AVector |
asVector()
Returns the matrix values as a single reference Vector in the form [row0
row1 row2....]
|
INDArray |
broadcast(int... targetShape) |
double |
calculateElement(int i,
AVector v)
Calculates a single element of the output.
|
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
|
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 |
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.
|
long |
elementCount()
Returns the total number of 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
|
boolean |
epsilonEquals(AMatrix a)
Returns true if this matrix is approximately equal to
a second matrix, up to a default tolerance level
|
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.
|
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 |
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 new vector that contains 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.
|
int |
hashCode() |
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.
|
int |
inputDimensions()
Returns the number of dimensions required for input vectors
|
AMatrix |
inverse()
Return the inverse of this transformation if possible
|
boolean |
isDiagonal()
Returns true if a matrix is diagonal
|
boolean |
isElementConstrained()
Returns true if the IND has additional constraints on element values
|
boolean |
isFullyMutable()
Returns true if the INDArray is 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)
|
void |
isPositiveDefinite()
Returns true if a matrix is positive definite
|
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 is a view
|
boolean |
isZeroMatrix()
Returns true if the matrix is the zero matrix (all components zero)
|
Iterator<AVector> |
iterator()
Returns an iterator over rows in this 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) |
void |
negate() |
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
|
INDArray |
reshape(int... dimensions) |
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) |
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) |
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
|
AVector |
slice(int rowNumber) |
INDArray |
slice(int dimension,
int index) |
int |
sliceCount() |
void |
sub(AMatrix m)
Subtracts another matrix from this one
|
void |
sub(AVector v) |
void |
sub(double d) |
void |
sub(INDArray a) |
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
|
AAffineTransform |
toAffineTransform() |
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
AMatrix |
toMutableMatrix()
Creates a fully mutable deep copy of this matrix
|
String |
toString() |
AVector |
toVector()
Converts the matrix to a single flattened vector
in row major order.
|
double |
trace() |
void |
transform(AVector source,
AVector dest)
Transforms the source vector, storing the result in the given destination vector
|
void |
transformInPlace(ArrayVector v) |
void |
transformInPlace(AVector v)
Transforms a vector destructively.
|
void |
transposeInPlace() |
void |
validate()
Validates the internal data structure of the INDArray.
|
getTranslationComponent, isLinearcompose, transformNormaltakeComponents, takeComponents, takeComponents, transformpublic 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 int dimensionality()
INDArraydimensionality in interface INDArraypublic long elementCount()
INDArrayelementCount in interface INDArraypublic int sliceCount()
sliceCount 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 AAffineTransform toAffineTransform()
toAffineTransform in class AAffineTransformpublic AMatrix getMatrixComponent()
getMatrixComponent in class AAffineTransformpublic boolean isIdentity()
ATransformisIdentity in class AAffineTransformpublic boolean isSquare()
ATransformisSquare in class ATransformpublic int inputDimensions()
ATransforminputDimensions in interface ITransforminputDimensions in class ATransformpublic int outputDimensions()
ATransformoutputDimensions in interface ITransformoutputDimensions 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(ArrayVector v)
public AVector getRow(int row)
public AVector getColumn(int column)
public AVector cloneRow(int row)
public void set(AMatrix a)
public 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 double determinant()
public AMatrix toMutableMatrix()
public void transposeInPlace()
public AMatrix getTranspose()
public void add(AMatrix m)
m - public void add(AVector v)
public void sub(AVector v)
public 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 long nonZeroCount()
INDArraynonZeroCount in interface INDArraypublic void sub(AMatrix m)
m - public void elementMul(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 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 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 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 void swapRows(int i,
int j)
public void swapColumns(int i,
int j)
public AVector toVector()
public void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraypublic void applyOp(Op op)
INDArraypublic void applyOp(IOp op)
INDArraypublic void multiply(INDArray a)
INDArraypublic void addAt(int i,
int j,
double d)
public INDArray broadcast(int... targetShape)
public boolean isZeroMatrix()
public void isPositiveDefinite()
public boolean isDiagonal()
public boolean isSymmetric()
public final boolean isHermitian()
public boolean isUpperTriangular()
public boolean isLowerTriangular()
public abstract AMatrix exactClone()
INDArrayexactClone in interface INDArrayCopyright © 2013. All Rights Reserved.