public interface Matrix extends Tensor, Iterable<MatrixTuple>
Tensor
s.
Matrices have immutable sizes and immutable indices (so DenseSparseMatrix
can't grow).
Modifier and Type | Method and Description |
---|---|
void |
add(int i,
int j,
double value)
Adds the argument value to the value at the supplied index.
|
double |
get(int i,
int j)
Gets an element from this
Matrix . |
int |
getDimension1Size()
The size of the first dimension.
|
int |
getDimension2Size()
The size of the second dimension.
|
SGDVector |
getRow(int i)
Extract a row as an
SGDVector . |
SGDVector |
leftMultiply(SGDVector input)
Multiplies this Matrix by a
SGDVector returning a vector of the appropriate size. |
Matrix |
matrixMultiply(Matrix input)
Multiplies this Matrix by another
Matrix returning a matrix of the appropriate size. |
Matrix |
matrixMultiply(Matrix input,
boolean transposeThis,
boolean transposeOther)
Multiplies this Matrix by another
Matrix returning a matrix of the appropriate size. |
int |
numActiveElements(int row)
The number of non-zero elements in that row.
|
SGDVector |
rightMultiply(SGDVector input)
Multiplies this Matrix by a
SGDVector returning a vector of the appropriate size. |
void |
rowScaleInPlace(DenseVector scalingCoefficients)
Scales each row by the appropriate value in the
DenseVector . |
DenseVector |
rowSum()
Generates a
DenseVector representing the sum of each row. |
void |
set(int i,
int j,
double value)
Sets an element at the supplied location.
|
foreachInPlace, getShape, hadamardProductInPlace, hadamardProductInPlace, intersectAndAddInPlace, intersectAndAddInPlace, reshape, scalarAddInPlace, scaleInPlace, shapeCheck, shapeSum, twoNorm
forEach, iterator, spliterator
double get(int i, int j)
Matrix
.i
- The index for the first dimension.j
- The index for the second dimension.void set(int i, int j, double value)
i
- The index for the first dimension.j
- The index for the second dimension.value
- The value to be stored at matrix[i][j].void add(int i, int j, double value)
i
- The index for the first dimension.j
- The index for the second dimension.value
- The value to add.int getDimension1Size()
int getDimension2Size()
int numActiveElements(int row)
An element could be active and zero, if it was active on construction.
row
- The index of the row.SGDVector leftMultiply(SGDVector input)
SGDVector
returning a vector of the appropriate size.
The input must have dimension equal to getDimension2Size()
.
input
- The input vector.SGDVector
of size getDimension1Size()
.SGDVector rightMultiply(SGDVector input)
SGDVector
returning a vector of the appropriate size.
The input must have dimension equal to getDimension1Size()
.
input
- The input vector.SGDVector
of size getDimension2Size()
.Matrix matrixMultiply(Matrix input)
Matrix
returning a matrix of the appropriate size.
The input must have dimension 1 equal to getDimension2Size()
.
input
- The input matrix.Matrix
of size getDimension1Size()
, input.getDimension2Size()
.Matrix matrixMultiply(Matrix input, boolean transposeThis, boolean transposeOther)
Matrix
returning a matrix of the appropriate size.
Must obey the rules of matrix multiplication after the transposes are applied.
input
- The input matrix.transposeThis
- Implicitly transposes this matrix just for the multiplication.transposeOther
- Implicitly transposes other just for the multiplication.Matrix
.DenseVector rowSum()
DenseVector
representing the sum of each row.DenseVector
of size getDimension1Size()
.void rowScaleInPlace(DenseVector scalingCoefficients)
DenseVector
.scalingCoefficients
- A DenseVector
with size getDimension1Size()
.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.