public abstract class BasicMatrix<N extends Comparable<N>,M extends BasicMatrix<N,M>> extends Object implements Matrix2D<N,M>, Structure2D.ReducibleTo1D<M>, NumberContext.Enforceable<M>, Access2D.Collectable<N,TransformableRegion<N>>, Provider2D.Inverse<M>, Provider2D.Condition, Provider2D.Rank, Provider2D.Symmetric, Provider2D.Hermitian, Provider2D.Trace<N>, Provider2D.Determinant<N>, Provider2D.Solution<M>, Provider2D.Eigenpairs, Structure2D.Logical<Access2D<N>,M>, Operate2D<N,M>
Access2D.Aggregatable<N extends Comparable<N>>, Access2D.Collectable<N extends Comparable<N>,R extends Mutate2D>, Access2D.ElementView<N extends Comparable<N>>, Access2D.Sliceable<N extends Comparable<N>>, Access2D.Visitable<N extends Comparable<N>>
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,B extends Structure2D.Logical<S,B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnCallback, Structure2D.RowColumnKey<R,C>, Structure2D.RowColumnMapper<R,C>
Structure1D.BasicMapper<T>, Structure1D.IndexCallback, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallback
Group.Additive<T>, Group.Multiplicative<T>
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
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>>
Provider2D.Condition, Provider2D.Determinant<N extends Comparable<N>>, Provider2D.Eigenpairs, Provider2D.Hermitian, Provider2D.Inverse<M>, Provider2D.Rank, Provider2D.Solution<M>, Provider2D.Symmetric, Provider2D.Trace<N extends Comparable<N>>
Modifier and Type | Method and Description |
---|---|
M |
above(Access2D<N>... above) |
M |
above(Access2D<N> above) |
M |
above(long numberOfRows) |
M |
add(double scalarAddend) |
M |
add(M addend) |
M |
add(N scalarAddend) |
N |
aggregateColumn(long row,
long col,
Aggregator aggregator) |
N |
aggregateDiagonal(long row,
long col,
Aggregator aggregator) |
N |
aggregateRange(long first,
long limit,
Aggregator aggregator) |
N |
aggregateRow(long row,
long col,
Aggregator aggregator) |
M |
below(Access2D<N>... below) |
M |
below(Access2D<N> below) |
M |
below(long numberOfRows) |
M |
bidiagonal(boolean upper) |
static <M extends BasicMatrix<?,M>> |
calculateFrobeniusNorm(M matrix)
The Frobenius norm is the square root of the sum of the squares of each element, or the square root of
the sum of the square of the singular values.
|
static <M extends BasicMatrix<?,M>> |
calculateInfinityNorm(M matrix) |
static <M extends BasicMatrix<?,M>> |
calculateOneNorm(M matrix) |
M |
columns(int[] columns)
A selection (re-ordering) of columns.
|
M |
conjugate()
This method will (most likely) be moved to some other interface in the future! Just have to figure
out where it fits...
|
abstract org.ojalgo.matrix.Mutator2D<N,M,PhysicalStore<N>> |
copy()
The returned instance can be have its elements mutated in various ways, while the size/shape is fixed.
|
long |
count()
count() == countRows() * countColumns()
|
long |
countColumns() |
long |
countRows() |
M |
diagonal() |
M |
diagonally(Access2D<N>... diagonally) |
M |
divide(double scalarDivisor) |
M |
divide(N scalarDivisor) |
double |
doubleValue(long index) |
double |
doubleValue(long row,
long col)
Extracts one element of this matrix as a double.
|
M |
enforce(NumberContext context) |
boolean |
equals(Object other)
true if "other" is an
Access2D of the same size/shape and the elements are equal to high
precision (12 significant digits). |
void |
flushCache()
Deprecated.
v50 Caching, if necessary, is handled for you. If you want control of this then use the
lower level stuff in org.ojagl.matrix.store and org.ojagl.matrix.decomposition instead.
|
M |
get()
Deprecated.
v50 No need for this!
|
N |
get(long index) |
N |
get(long row,
long col) |
double |
getCondition()
Matrix condition (2-norm)
|
N |
getDeterminant() |
List<Eigenvalue.Eigenpair> |
getEigenpairs() |
int |
getRank()
The rank of a matrix is the (maximum) number of linearly independent rows or columns it contains.
|
N |
getTrace()
The sum of the diagonal elements.
|
int |
hashCode() |
M |
hermitian(boolean upper)
Similar to
Structure2D.Logical.symmetric(boolean) but in addition the mirrored elements are conjugated. |
M |
hessenberg(boolean upper) |
long |
indexOfLargest() |
M |
invert()
About inverting matrices:
|
boolean |
isFullRank()
Deprecated.
v50 Just use
getRank() |
boolean |
isHermitian() |
boolean |
isSmall(double comparedTo) |
boolean |
isSymmetric() |
M |
left(Access2D<N>... left) |
M |
left(Access2D<N> left) |
M |
left(long numberOfColumns) |
M |
limits(long rowLimit,
long columnLimit)
Setting either limit to < 0 is interpreted as "no limit" (useful when you only want to limit
either the rows or columns, and don't know the size of the other)
|
M |
logical()
Deprecated.
v50 No need for this!
|
M |
multiply(double scalarMultiplicand) |
M |
multiply(M multiplicand) |
M |
multiply(N scalarMultiplicand) |
M |
negate()
The additive inverse of this.
|
double |
norm()
The Frobenius norm is the square root of the sum of the squares of each element, or the square root of
the sum of the square of the singular values.
|
M |
offsets(long rowOffset,
long columnOffset) |
M |
onAll(UnaryFunction<N> operator) |
M |
onAny(Transformation2D<N> operator) |
M |
onColumns(BinaryFunction<N> operator,
Access1D<N> right) |
M |
onMatching(Access2D<N> left,
BinaryFunction<N> operator) |
M |
onMatching(BinaryFunction<N> operator,
Access2D<N> right) |
M |
onRows(BinaryFunction<N> operator,
Access1D<N> right) |
M |
power(int power)
Multiply by itself
power times. |
M |
reduceColumns(Aggregator aggregator) |
M |
reduceRows(Aggregator aggregator) |
M |
repeat(int rowsRepetitions,
int columnsRepetitions)
Will repeat this structure creating a new structure with a multiple of rows and columns.
|
M |
right(Access2D<N>... right) |
M |
right(Access2D<N> right) |
M |
right(long numberOfColumns) |
M |
rows(int[] rows)
A selection (re-ordering) of rows.
|
M |
signum()
this == this.signum().multiply(this.norm()) |
M |
solve(Access2D<?> rhs)
This method solves a system of linear equations: [this][X]=[rhs].
|
M |
subtract(double scalarSubtrahend) |
M |
subtract(M subtrahend) |
M |
subtract(N scalarSubtrahend) |
M |
superimpose(long row,
long col,
Access2D<N> matrix) |
void |
supplyTo(TransformableRegion<N> receiver) |
M |
symmetric(boolean upper)
Defines a symmetric
Structure2D (matrix) by mirroring one half (diagonally) on the other. |
Scalar<N> |
toScalar(long row,
long col)
Deprecated.
v50 Use
get(long, long) instead |
String |
toString() |
M |
transpose()
Transposes this matrix.
|
M |
triangular(boolean upper,
boolean assumeOne) |
M |
tridiagonal() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asCollectable2D, asPrimitive2D, byteValue, byteValue, columns, elements, equals, floatValue, floatValue, intValue, intValue, isHermitian, longValue, longValue, newPrimitiveColumnCollectable, newPrimitiveRowCollectable, nonzeros, rows, shortValue, shortValue, toRawCopy2D, toString, wrap, wrap
asCollectable1D, asPrimitive1D, axpy, dot, equals, hashCode, supplyTo, toRawCopy1D, toString, wrap, wrap, wrap
aggregateColumn, aggregateDiagonal, aggregateRow, reduceColumns, reduceRows
column, column, column, column, column, count, firstInColumn, firstInColumn, firstInColumn, firstInRow, firstInRow, firstInRow, getColDim, getMaxDim, getMinDim, getRowDim, index, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfColumn, limitOfColumn, limitOfRow, limitOfRow, limitOfRow, loopAll, loopColumn, loopColumn, loopDiagonal, loopMatching, loopRow, loopRow, mapperOf, row, row, row, row, row
aggregateAll
index, loopAll, loopMatching, loopRange, mapper, size, toIntIndexes
multiply
add
subtract
divide
collect
column, column, columns, row, row, rows, superimpose
public static <M extends BasicMatrix<?,M>> double calculateFrobeniusNorm(M matrix)
public static <M extends BasicMatrix<?,M>> double calculateInfinityNorm(M matrix)
public static <M extends BasicMatrix<?,M>> double calculateOneNorm(M matrix)
public M above(Access2D<N>... above)
above
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M above(Access2D<N> above)
above
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M above(long numberOfRows)
above
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M add(double scalarAddend)
add
in interface ScalarOperation.Addition<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this + scalarAddend
.public M add(M addend)
add
in interface Operation.Addition<M extends BasicMatrix<N,M>>
addend
- What to addthis + addend
public M add(N scalarAddend)
add
in interface ScalarOperation.Addition<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this + scalarAddend
.public N aggregateColumn(long row, long col, Aggregator aggregator)
aggregateColumn
in interface Access2D.Aggregatable<N extends Comparable<N>>
public N aggregateDiagonal(long row, long col, Aggregator aggregator)
aggregateDiagonal
in interface Access2D.Aggregatable<N extends Comparable<N>>
public N aggregateRange(long first, long limit, Aggregator aggregator)
aggregateRange
in interface Access1D.Aggregatable<N extends Comparable<N>>
public N aggregateRow(long row, long col, Aggregator aggregator)
aggregateRow
in interface Access2D.Aggregatable<N extends Comparable<N>>
public M below(Access2D<N>... below)
below
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M below(Access2D<N> below)
below
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M below(long numberOfRows)
below
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M bidiagonal(boolean upper)
bidiagonal
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M columns(int[] columns)
Structure2D.Logical
columns
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M conjugate()
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.
conjugate
in interface VectorSpace<M extends BasicMatrix<N,M>,N extends Comparable<N>>
conjugate
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public abstract org.ojalgo.matrix.Mutator2D<N,M,PhysicalStore<N>> copy()
logical()
public long count()
Structure2D
count
in interface Structure1D
count
in interface Structure2D
public long countColumns()
countColumns
in interface Structure2D
public long countRows()
countRows
in interface Structure2D
public M diagonal()
diagonal
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M diagonally(Access2D<N>... diagonally)
diagonally
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M divide(double scalarDivisor)
divide
in interface ScalarOperation.Division<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this / scalarDivisor
.public M divide(N scalarDivisor)
divide
in interface ScalarOperation.Division<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this / scalarDivisor
.public double doubleValue(long index)
doubleValue
in interface Access1D<N extends Comparable<N>>
doubleValue
in interface Access2D<N extends Comparable<N>>
public double doubleValue(long row, long col)
Access2D
doubleValue
in interface Access2D<N extends Comparable<N>>
row
- A row index.col
- A column index.public M enforce(NumberContext context)
enforce
in interface NumberContext.Enforceable<M extends BasicMatrix<N,M>>
public boolean equals(Object other)
Access2D
of the same size/shape and the elements are equal to high
precision (12 significant digits).@Deprecated public void flushCache()
@Deprecated public M get()
public N get(long index)
get
in interface Access1D<N extends Comparable<N>>
get
in interface Access2D<N extends Comparable<N>>
public N get(long row, long col)
get
in interface Access2D<N extends Comparable<N>>
public double getCondition()
getCondition
in interface Provider2D.Condition
public N getDeterminant()
getDeterminant
in interface Provider2D.Determinant<N extends Comparable<N>>
public List<Eigenvalue.Eigenpair> getEigenpairs()
getEigenpairs
in interface Provider2D.Eigenpairs
public int getRank()
getRank
in interface Provider2D.Rank
MatrixDecomposition.RankRevealing
public N getTrace()
getTrace
in interface Provider2D.Trace<N extends Comparable<N>>
public M hermitian(boolean upper)
Structure2D.Logical
Structure2D.Logical.symmetric(boolean)
but in addition the mirrored elements are conjugated.hermitian
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M hessenberg(boolean upper)
hessenberg
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public long indexOfLargest()
indexOfLargest
in interface Access1D.Aggregatable<N extends Comparable<N>>
public M invert()
About inverting matrices:
invert
in interface Provider2D.Inverse<M extends BasicMatrix<N,M>>
@Deprecated public boolean isFullRank()
getRank()
MatrixDecomposition.RankRevealing
public boolean isHermitian()
isHermitian
in interface Provider2D.Hermitian
public boolean isSmall(double comparedTo)
isSmall
in interface NormedVectorSpace<M extends BasicMatrix<N,M>,N extends Comparable<N>>
comparedTo
- What to compare withpublic boolean isSymmetric()
isSymmetric
in interface Provider2D.Symmetric
public M left(Access2D<N>... left)
left
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M left(Access2D<N> left)
left
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M left(long numberOfColumns)
left
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M limits(long rowLimit, long columnLimit)
Structure2D.Logical
limits
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
@Deprecated public final M logical()
copy()
this does not create a copy – not initially anyway. The returned instance
is a starting point for logically composing a new matrix.copy()
public M multiply(double scalarMultiplicand)
multiply
in interface ScalarOperation.Multiplication<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this * scalarMultiplicand
.public M multiply(M multiplicand)
multiply
in interface Operation.Multiplication<M extends BasicMatrix<N,M>>
multiplicand
- The multiplicandthis * multiplicand
.public M multiply(N scalarMultiplicand)
multiply
in interface ScalarOperation.Multiplication<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this * multiplicand
.public M negate()
Group.Additive
negate
in interface Group.Additive<M extends BasicMatrix<N,M>>
-this
.public double norm()
norm
in interface NormedVectorSpace<M extends BasicMatrix<N,M>,N extends Comparable<N>>
public M offsets(long rowOffset, long columnOffset)
offsets
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M onAll(UnaryFunction<N> operator)
onAll
in interface Operate2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
public M onAny(Transformation2D<N> operator)
onAny
in interface Operate2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
public M onColumns(BinaryFunction<N> operator, Access1D<N> right)
onColumns
in interface Operate2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
public M onMatching(Access2D<N> left, BinaryFunction<N> operator)
onMatching
in interface Operate2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
public M onMatching(BinaryFunction<N> operator, Access2D<N> right)
onMatching
in interface Operate2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
public M onRows(BinaryFunction<N> operator, Access1D<N> right)
onRows
in interface Operate2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
public M power(int power)
Operation.Multiplication
power
times.power
in interface Operation.Multiplication<M extends BasicMatrix<N,M>>
public M reduceColumns(Aggregator aggregator)
reduceColumns
in interface Structure2D.ReducibleTo1D<M extends BasicMatrix<N,M>>
public M reduceRows(Aggregator aggregator)
reduceRows
in interface Structure2D.ReducibleTo1D<M extends BasicMatrix<N,M>>
public M repeat(int rowsRepetitions, int columnsRepetitions)
Structure2D.Logical
repeat
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
rowsRepetitions
- The number of times to repeat the rowscolumnsRepetitions
- The number of times to repeat the columnspublic M right(Access2D<N>... right)
right
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M right(Access2D<N> right)
right
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M right(long numberOfColumns)
right
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M rows(int[] rows)
Structure2D.Logical
rows
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M signum()
NormedVectorSpace
this == this.signum().multiply(this.norm())
signum
in interface NormedVectorSpace<M extends BasicMatrix<N,M>,N extends Comparable<N>>
public M solve(Access2D<?> rhs)
This method solves a system of linear equations: [this][X]=[rhs]. A combination of columns in [this] should produce a column(s) in [rhs]. It is ok for [rhs] to have more than 1 column.
Remember that: [X][this]=[rhs] is equivalent to [this]T[X]T=[rhs]T
solve
in interface Provider2D.Solution<M extends BasicMatrix<N,M>>
rhs
- The right hand side of the equation.public M subtract(double scalarSubtrahend)
subtract
in interface ScalarOperation.Subtraction<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this - scalarSubtrahend
.public M subtract(M subtrahend)
subtract
in interface Operation.Subtraction<M extends BasicMatrix<N,M>>
subtrahend
- The subtrahendthis - subtrahend
.public M subtract(N scalarSubtrahend)
subtract
in interface ScalarOperation.Subtraction<M extends BasicMatrix<N,M>,N extends Comparable<N>>
this - scalarSubtrahend
.public M superimpose(long row, long col, Access2D<N> matrix)
superimpose
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public void supplyTo(TransformableRegion<N> receiver)
supplyTo
in interface Access2D.Collectable<N extends Comparable<N>,TransformableRegion<N extends Comparable<N>>>
public M symmetric(boolean upper)
Structure2D.Logical
Structure2D
(matrix) by mirroring one half (diagonally) on the other.symmetric
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
upper
- From where are the elements read?@Deprecated public Scalar<N> toScalar(long row, long col)
get(long, long)
insteadrow
- A row index.col
- A column index.public M transpose()
transpose
in interface Matrix2D<N extends Comparable<N>,M extends BasicMatrix<N,M>>
transpose
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
conjugate()
public M triangular(boolean upper, boolean assumeOne)
triangular
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
public M tridiagonal()
tridiagonal
in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,M extends BasicMatrix<N,M>>
Copyright © 2022 Optimatika. All rights reserved.