Package org.ojalgo.tensor
Class MatrixTensor<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.tensor.ArrayBasedTensor<N,MatrixTensor<N>>
-
- org.ojalgo.tensor.MatrixTensor<N>
-
- All Implemented Interfaces:
java.util.function.Consumer<Access2D<?>>
,Group
,Group.Additive<MatrixTensor<N>>
,NormedVectorSpace<MatrixTensor<N>,N>
,Operation
,Operation.Addition<MatrixTensor<N>>
,ScalarOperation
,ScalarOperation.Multiplication<MatrixTensor<N>,N>
,VectorSpace<MatrixTensor<N>,N>
,Access1D<N>
,Access2D<N>
,Mutate1D
,Mutate1D.Fillable<N>
,Mutate2D
,Mutate2D.Fillable<N>
,Mutate2D.Receiver<N>
,Structure1D
,Structure2D
,Tensor<N,MatrixTensor<N>>
public final class MatrixTensor<N extends java.lang.Comparable<N>> extends ArrayBasedTensor<N,MatrixTensor<N>> implements Access2D<N>, Mutate2D.Receiver<N>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
MatrixTensor.Factory<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access2D
Access2D.Aggregatable<N extends java.lang.Comparable<N>>, Access2D.Collectable<N extends java.lang.Comparable<N>,R extends Mutate2D>, Access2D.ColumnView<N extends java.lang.Comparable<N>>, Access2D.ElementView<N extends java.lang.Comparable<N>>, Access2D.RowView<N extends java.lang.Comparable<N>>, Access2D.SelectionView<N extends java.lang.Comparable<N>>, Access2D.Sliceable<N extends java.lang.Comparable<N>>, Access2D.Visitable<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Group
Group.Additive<T>, Group.Multiplicative<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate1D
Mutate1D.Fillable<N extends java.lang.Comparable<N>>, Mutate1D.Mixable<N extends java.lang.Comparable<N>>, Mutate1D.Modifiable<N extends java.lang.Comparable<N>>, Mutate1D.ModifiableReceiver<N extends java.lang.Comparable<N>>, Mutate1D.Receiver<N extends java.lang.Comparable<N>>, Mutate1D.Sortable
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate2D
Mutate2D.Exchangeable, Mutate2D.Fillable<N extends java.lang.Comparable<N>>, Mutate2D.Mixable<N extends java.lang.Comparable<N>>, Mutate2D.Modifiable<N extends java.lang.Comparable<N>>, Mutate2D.ModifiableReceiver<N extends java.lang.Comparable<N>>, Mutate2D.Receiver<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Operation
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.ScalarOperation
ScalarOperation.Addition<T,N extends java.lang.Comparable<N>>, ScalarOperation.Division<T,N extends java.lang.Comparable<N>>, ScalarOperation.Multiplication<T,N extends java.lang.Comparable<N>>, ScalarOperation.Subtraction<T,N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,B>>, Structure1D.LongIndex, Structure1D.LoopCallback
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,B extends Structure2D.Logical<S,B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnKey<R,C>, Structure2D.RowColumnMapper<R,C>
-
-
Constructor Summary
Constructors Constructor Description MatrixTensor(Array2D.Factory<N> factory, int dimensions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixTensor<N>
add(MatrixTensor<N> addend)
byte
byteValue(int row, int col)
byte
byteValue(long row, long col)
MatrixTensor<N>
conjugate()
This method will (most likely) be moved to some other interface in the future! Just have to figure out where it fits...long
count()
count() == countRows() * countColumns()long
countColumns()
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.long
countRows()
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.double
doubleValue(int row, int col)
Extracts one element of this matrix as a double.double
doubleValue(long row, long col)
boolean
equals(java.lang.Object obj)
static <N extends java.lang.Comparable<N>>
TensorFactory2D<N,MatrixTensor<N>>factory(DenseArray.Factory<N> arrayFactory)
float
floatValue(int row, int col)
float
floatValue(long row, long col)
N
get(long row, long col)
(package private) Array2D<N>
getArray()
int
getColDim()
int
getRowDim()
int
hashCode()
int
intValue(int row, int col)
int
intValue(long row, long col)
long
longValue(int row, int col)
long
longValue(long row, long col)
MatrixTensor<N>
multiply(double scalarMultiplicand)
MatrixTensor<N>
multiply(N scalarMultiplicand)
MatrixTensor<N>
negate()
The additive inverse of this.(package private) MatrixTensor<N>
newSameShape()
double
norm()
this == this.signum().multiply(this.norm())
void
set(int row, int col, byte value)
void
set(int row, int col, double value)
void
set(int row, int col, float value)
void
set(int row, int col, int value)
void
set(int row, int col, long value)
void
set(int row, int col, short value)
void
set(long row, long col, byte value)
void
set(long row, long col, double value)
void
set(long row, long col, float value)
void
set(long row, long col, int value)
void
set(long row, long col, long value)
void
set(long row, long col, short value)
void
set(long row, long col, java.lang.Comparable<?> value)
short
shortValue(int row, int col)
short
shortValue(long row, long col)
java.lang.String
toString()
-
Methods inherited from class org.ojalgo.tensor.ArrayBasedTensor
add, dimensions, multiply, multiply, negate, norm, rank, signum
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, axpy, dot, select, supplyTo, toRawCopy1D
-
Methods inherited from interface org.ojalgo.structure.Access2D
asCollectable2D, asKeyed2D, byteValue, byteValue, columns, columns, columns, doubleValue, doubleValue, elements, floatValue, floatValue, get, intValue, intValue, longValue, longValue, nonzeros, rows, rows, rows, select, select, shortValue, shortValue, toRawCopy2D
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillAll, fillAll, fillCompatible, fillMatching, fillMatching, fillMatching, fillRange, fillRange
-
Methods inherited from interface org.ojalgo.structure.Mutate2D
set, set, set, set, set, set, set, set, set, set, set, set, set
-
Methods inherited from interface org.ojalgo.structure.Mutate2D.Fillable
fillColumn, fillColumn, fillColumn, fillColumn, fillColumn, fillColumn, fillCompatible, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillDiagonal, fillRow, fillRow, fillRow, fillRow, fillRow, fillRow
-
Methods inherited from interface org.ojalgo.structure.Mutate2D.Receiver
accept, isAcceptable
-
Methods inherited from interface org.ojalgo.algebra.NormedVectorSpace
isSmall
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Multiplication
multiply
-
Methods inherited from interface org.ojalgo.structure.Structure2D
firstInColumn, firstInRow, getMaxDim, getMinDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
Methods inherited from interface org.ojalgo.tensor.Tensor
components, isSameShape
-
-
-
-
Constructor Detail
-
MatrixTensor
MatrixTensor(Array2D.Factory<N> factory, int dimensions)
-
-
Method Detail
-
factory
public static <N extends java.lang.Comparable<N>> TensorFactory2D<N,MatrixTensor<N>> factory(DenseArray.Factory<N> arrayFactory)
-
add
public MatrixTensor<N> add(MatrixTensor<N> addend)
- Specified by:
add
in interfaceOperation.Addition<N extends java.lang.Comparable<N>>
- Parameters:
addend
- What to add- Returns:
this + addend
-
byteValue
public byte byteValue(int row, int col)
-
byteValue
public byte byteValue(long row, long col)
-
conjugate
public MatrixTensor<N> conjugate()
Description copied from interface:VectorSpace
This method will (most likely) be moved to some other interface in the future! Just have to figure out where it fits...
The conjugate transpose of a matrix and/or the conjugate of a scalar/field like ComplexNumber or Quaternion.
The conjugate transpose of a real matrix is simply its transpose.
- Specified by:
conjugate
in interfaceVectorSpace<MatrixTensor<N extends java.lang.Comparable<N>>,N extends java.lang.Comparable<N>>
-
count
public long count()
Description copied from interface:Structure2D
count() == countRows() * countColumns()- Specified by:
count
in interfaceStructure1D
- Specified by:
count
in interfaceStructure2D
-
countColumns
public long countColumns()
Description copied from interface:Structure2D
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Specified by:
countColumns
in interfaceStructure2D
- Returns:
- The number of columns
-
countRows
public long countRows()
Description copied from interface:Structure2D
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.- Specified by:
countRows
in interfaceStructure2D
- Returns:
- The number of rows
-
doubleValue
public double doubleValue(int row, int col)
Description copied from interface:Access2D
Extracts one element of this matrix as a double.- Specified by:
doubleValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
- Parameters:
row
- A row index.col
- A column index.- Returns:
- One matrix element
-
doubleValue
public double doubleValue(long row, long col)
- Specified by:
doubleValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classArrayBasedTensor<N extends java.lang.Comparable<N>,MatrixTensor<N extends java.lang.Comparable<N>>>
-
floatValue
public float floatValue(int row, int col)
- Specified by:
floatValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
-
floatValue
public float floatValue(long row, long col)
- Specified by:
floatValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
-
get
public N get(long row, long col)
-
getColDim
public int getColDim()
- Specified by:
getColDim
in interfaceStructure2D
- Returns:
- The number of columns
-
getRowDim
public int getRowDim()
- Specified by:
getRowDim
in interfaceStructure2D
- Returns:
- The number of rows
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classArrayBasedTensor<N extends java.lang.Comparable<N>,MatrixTensor<N extends java.lang.Comparable<N>>>
-
intValue
public int intValue(int row, int col)
-
intValue
public int intValue(long row, long col)
-
longValue
public long longValue(int row, int col)
-
longValue
public long longValue(long row, long col)
-
multiply
public MatrixTensor<N> multiply(double scalarMultiplicand)
- Specified by:
multiply
in interfaceScalarOperation.Multiplication<MatrixTensor<N extends java.lang.Comparable<N>>,N extends java.lang.Comparable<N>>
- Returns:
this * scalarMultiplicand
.
-
multiply
public MatrixTensor<N> multiply(N scalarMultiplicand)
- Specified by:
multiply
in interfaceScalarOperation.Multiplication<MatrixTensor<N extends java.lang.Comparable<N>>,N extends java.lang.Comparable<N>>
- Returns:
this * multiplicand
.
-
negate
public MatrixTensor<N> negate()
Description copied from interface:Group.Additive
The additive inverse of this.- Specified by:
negate
in interfaceGroup.Additive<N extends java.lang.Comparable<N>>
- Returns:
-this
.
-
norm
public double norm()
Description copied from interface:NormedVectorSpace
this == this.signum().multiply(this.norm())
- Specified by:
norm
in interfaceNormedVectorSpace<MatrixTensor<N extends java.lang.Comparable<N>>,N extends java.lang.Comparable<N>>
- Returns:
- The norm
-
set
public void set(long row, long col, java.lang.Comparable<?> value)
-
shortValue
public short shortValue(int row, int col)
- Specified by:
shortValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
-
shortValue
public short shortValue(long row, long col)
- Specified by:
shortValue
in interfaceAccess2D<N extends java.lang.Comparable<N>>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
newSameShape
MatrixTensor<N> newSameShape()
- Specified by:
newSameShape
in classArrayBasedTensor<N extends java.lang.Comparable<N>,MatrixTensor<N extends java.lang.Comparable<N>>>
-
-