Package org.ojalgo.tensor
Class MatrixTensor<N extends Comparable<N>>
java.lang.Object
org.ojalgo.tensor.ArrayBasedTensor<N,MatrixTensor<N>>
org.ojalgo.tensor.MatrixTensor<N>
- All Implemented Interfaces:
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 Comparable<N>>
extends ArrayBasedTensor<N,MatrixTensor<N>>
implements Access2D<N>, Mutate2D.Receiver<N>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
MatrixTensor.Factory<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access2D
Access2D.Aggregatable<N extends Comparable<N>>, Access2D.Collectable<N extends Comparable<N>,
R extends Mutate2D>, Access2D.ColumnView<N extends Comparable<N>>, Access2D.ElementView<N extends Comparable<N>>, Access2D.RowView<N extends Comparable<N>>, Access2D.SelectionView<N extends Comparable<N>>, Access2D.Sliceable<N extends Comparable<N>>, Access2D.Visitable<N extends 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 Comparable<N>>, Mutate1D.Mixable<N extends Comparable<N>>, Mutate1D.Modifiable<N extends Comparable<N>>, Mutate1D.ModifiableReceiver<N extends Comparable<N>>, Mutate1D.Receiver<N extends Comparable<N>>, Mutate1D.Sortable
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate2D
Mutate2D.Exchangeable, Mutate2D.Fillable<N extends Comparable<N>>, Mutate2D.Mixable<N extends Comparable<N>>, Mutate2D.Modifiable<N extends Comparable<N>>, Mutate2D.ModifiableReceiver<N extends Comparable<N>>, Mutate2D.Receiver<N extends 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 Comparable<N>>, ScalarOperation.Division<T, N extends Comparable<N>>, ScalarOperation.Multiplication<T, N extends Comparable<N>>, ScalarOperation.Subtraction<T, N extends 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> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(MatrixTensor<N> addend) byte
byteValue
(int row, int col) byte
byteValue
(long row, long col) 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
Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.long
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
static <N extends Comparable<N>>
TensorFactory2D<N, MatrixTensor<N>> factory
(DenseArray.Factory<N> arrayFactory) float
floatValue
(int row, int col) float
floatValue
(long row, long col) get
(long row, long col) getArray()
int
int
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) multiply
(double scalarMultiplicand) negate()
The additive inverse of this.(package private) MatrixTensor
<N> 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, Comparable<?> value) short
shortValue
(int row, int col) short
shortValue
(long row, long col) 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
-
Field Details
-
myArray
-
myFactory
-
-
Constructor Details
-
MatrixTensor
MatrixTensor(Array2D.Factory<N> factory, int dimensions)
-
-
Method Details
-
factory
public static <N extends Comparable<N>> TensorFactory2D<N,MatrixTensor<N>> factory(DenseArray.Factory<N> arrayFactory) -
add
- Specified by:
add
in interfaceOperation.Addition<N extends Comparable<N>>
- Parameters:
addend
- What to add- Returns:
this + addend
-
byteValue
public byte byteValue(int row, int col) - Specified by:
byteValue
in interfaceAccess2D<N extends Comparable<N>>
-
byteValue
public byte byteValue(long row, long col) - Specified by:
byteValue
in interfaceAccess2D<N extends Comparable<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 Comparable<N>>,
N extends 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 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 Comparable<N>>
-
equals
- Overrides:
equals
in classArrayBasedTensor<N extends Comparable<N>,
MatrixTensor<N extends Comparable<N>>>
-
floatValue
public float floatValue(int row, int col) - Specified by:
floatValue
in interfaceAccess2D<N extends Comparable<N>>
-
floatValue
public float floatValue(long row, long col) - Specified by:
floatValue
in interfaceAccess2D<N extends Comparable<N>>
-
get
- Specified by:
get
in interfaceAccess2D<N extends Comparable<N>>
-
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 Comparable<N>,
MatrixTensor<N extends Comparable<N>>>
-
intValue
public int intValue(int row, int col) - Specified by:
intValue
in interfaceAccess2D<N extends Comparable<N>>
-
intValue
public int intValue(long row, long col) - Specified by:
intValue
in interfaceAccess2D<N extends Comparable<N>>
-
longValue
public long longValue(int row, int col) - Specified by:
longValue
in interfaceAccess2D<N extends Comparable<N>>
-
longValue
public long longValue(long row, long col) - Specified by:
longValue
in interfaceAccess2D<N extends Comparable<N>>
-
multiply
- Specified by:
multiply
in interfaceScalarOperation.Multiplication<MatrixTensor<N extends Comparable<N>>,
N extends Comparable<N>> - Returns:
this * scalarMultiplicand
.
-
multiply
- Specified by:
multiply
in interfaceScalarOperation.Multiplication<MatrixTensor<N extends Comparable<N>>,
N extends Comparable<N>> - Returns:
this * multiplicand
.
-
negate
Description copied from interface:Group.Additive
The additive inverse of this.- Specified by:
negate
in interfaceGroup.Additive<N extends 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 Comparable<N>>,
N extends Comparable<N>> - Returns:
- The norm
-
set
public void set(int row, int col, byte value) -
set
public void set(int row, int col, double value) -
set
public void set(int row, int col, float value) -
set
public void set(int row, int col, int value) -
set
public void set(int row, int col, long value) -
set
public void set(int row, int col, short value) -
set
public void set(long row, long col, byte value) -
set
-
set
public void set(long row, long col, double value) -
set
public void set(long row, long col, float value) -
set
public void set(long row, long col, int value) -
set
public void set(long row, long col, long value) -
set
public void set(long row, long col, short value) -
shortValue
public short shortValue(int row, int col) - Specified by:
shortValue
in interfaceAccess2D<N extends Comparable<N>>
-
shortValue
public short shortValue(long row, long col) - Specified by:
shortValue
in interfaceAccess2D<N extends Comparable<N>>
-
toString
-
getArray
-
newSameShape
MatrixTensor<N> newSameShape()- Specified by:
newSameShape
in classArrayBasedTensor<N extends Comparable<N>,
MatrixTensor<N extends Comparable<N>>>
-