public class SimpleTensor extends Object implements Serializable
Constructor and Description |
---|
SimpleTensor(int numRows,
int numCols,
int numSlices)
Creates a zero initialized tensor
|
SimpleTensor(org.ejml.simple.SimpleMatrix[] slices)
Copies the data in the slices.
|
Modifier and Type | Method and Description |
---|---|
org.ejml.simple.SimpleMatrix |
bilinearProducts(org.ejml.simple.SimpleMatrix in)
Returns a column vector where each entry is the nth bilinear
product of the nth slices of the two tensors.
|
SimpleTensor |
elementMult(SimpleTensor other)
Performs elementwise multiplication on the tensors.
|
double |
elementSum()
Returns the sum of all elements in the tensor.
|
int |
getNumElements()
Total number of elements in the tensor
|
org.ejml.simple.SimpleMatrix |
getSlice(int slice)
Returns the SimpleMatrix at
slice . |
boolean |
isZero()
Returns true iff every element of the tensor is 0
|
Iterator<org.ejml.simple.SimpleMatrix> |
iteratorSimpleMatrix()
Returns an iterator over the
SimpleMatrix objects contained in the tensor. |
static Iterator<org.ejml.simple.SimpleMatrix> |
iteratorSimpleMatrix(Iterator<SimpleTensor> tensors)
Returns an Iterator which returns the SimpleMatrices represented
by an Iterator over tensors.
|
int |
numCols()
Number of columns in the tensor
|
int |
numRows()
Number of rows in the tensor
|
int |
numSlices()
Number of slices in the tensor
|
SimpleTensor |
plus(SimpleTensor other)
Returns
other added to the current object, which is unaffected. |
static SimpleTensor |
random(int numRows,
int numCols,
int numSlices,
double minValue,
double maxValue,
Random rand)
Returns a randomly initialized tensor with values draft from the
uniform distribution between minValue and maxValue.
|
SimpleTensor |
scale(double scaling)
Returns a new tensor which has the values of the original tensor
scaled by
scaling . |
void |
set(double value) |
void |
setSlice(int slice,
org.ejml.simple.SimpleMatrix matrix)
Use the given
matrix in place of slice . |
String |
toString() |
public SimpleTensor(int numRows, int numCols, int numSlices)
public SimpleTensor(org.ejml.simple.SimpleMatrix[] slices)
public static SimpleTensor random(int numRows, int numCols, int numSlices, double minValue, double maxValue, Random rand)
public int numRows()
public int numCols()
public int numSlices()
public int getNumElements()
public void set(double value)
public SimpleTensor scale(double scaling)
scaling
. The original object is
unaffected.public SimpleTensor plus(SimpleTensor other)
other
added to the current object, which is unaffected.public SimpleTensor elementMult(SimpleTensor other)
public double elementSum()
public void setSlice(int slice, org.ejml.simple.SimpleMatrix matrix)
matrix
in place of slice
.
Does not copy the matrix
, but rather uses the actual object.public org.ejml.simple.SimpleMatrix getSlice(int slice)
slice
.
public org.ejml.simple.SimpleMatrix bilinearProducts(org.ejml.simple.SimpleMatrix in)
public boolean isZero()
public Iterator<org.ejml.simple.SimpleMatrix> iteratorSimpleMatrix()
SimpleMatrix
objects contained in the tensor.public static Iterator<org.ejml.simple.SimpleMatrix> iteratorSimpleMatrix(Iterator<SimpleTensor> tensors)