Interface Matrix<E>
- All Superinterfaces:
AbelianGroup<Matrix<E>>, AbelianMonoid<Matrix<E>>, Group<Matrix<E>>, Magma<Matrix<E>>, Module<Matrix<E>, E>, Monoid<Matrix<E>>, Ring<Matrix<E>>, Semiring<Matrix<E>>, Set<Matrix<E>>
- All Known Implementing Classes:
DenseMatrix, GenericMatrix, MMapMatrix, NativeRealDoubleMatrix, NativeRealFloatMatrix, RealDoubleMatrix, SIMDRealDoubleMatrix, SIMDRealFloatMatrix, SparseMatrix, TiledMatrix
Represents a matrix of scalar elements.
A matrix is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. Square matrices form a Ring.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionReturns the sum of this matrix and another.Returns the sum of two elements (additive notation).cholesky()Computes the Cholesky decomposition of this matrix.intcols()Returns the number of columns in this matrix.Returns the determinant of this matrix.eigen()Computes the eigenvalue decomposition of this matrix.get(int row, int col) Returns the element at the specified row and column.getColumn(int col) Returns the column at the specified index as a vector.default LinearAlgebraProvider<E> Returns the provider that created or manages this matrix.getRow(int row) Returns the row at the specified index as a vector.Returns the ring of scalars for this module.Returns the underlying storage of this matrix.getSubMatrix(int rowStart, int rowEnd, int colStart, int colEnd) Returns a submatrix of this matrix.identity()Returns the identity element of this monoid.static <E> Matrix<E> Creates an identity matrix.inverse()Returns the multiplicative inverse of this matrix.Returns the inverse of the given element.default booleanAbelian groups are always commutative by definition.default booleanisEmpty()Returnstrueif this set contains no elements.default booleanTests whether multiplication is commutative in this semiring.lu()Computes the LU decomposition of this matrix.Applies a mapping function to each element of this matrix.Returns the product of this matrix and another.Returns the product of two elements.Multiplies this matrix by a vector.negate()Returns the negation of this matrix (-this).static <E> Matrix<E> Creates a matrix from a 2D array.static <E> Matrix<E> Creates a matrix from a 2D list.Performs the binary operation on two elements.qr()Computes the QR decomposition of this matrix.introws()Returns the number of rows in this matrix.Convenience scalar multiplication (scalar × this).Scalar multiplication (r × m).Returns the difference of this matrix and another.svd()Computes the Singular Value Decomposition (SVD) of this matrix.toTensor()Converts this matrix to a rank-2 tensor.trace()Returns the trace of this matrix (sum of diagonal elements).Returns the transpose of this matrix.static <E> Matrix<E> triangular(List<List<E>> data, Ring<E> ring) Creates a triangular matrix from a 2D list.static <E> Matrix<E> tridiagonal(List<List<E>> data, Ring<E> ring) Creates a tridiagonal matrix from a 2D list.zero()Returns the zero matrix of the same dimensions.static <E> Matrix<E> Creates a matrix of zeros.Methods inherited from interface AbelianGroup
negate, subtractMethods inherited from interface Monoid
isAssociativeMethods inherited from interface Set
contains, description
-
Method Details
-
of
-
of
-
triangular
-
tridiagonal
-
identity
-
zeros
-
rows
int rows()Returns the number of rows in this matrix. -
cols
int cols()Returns the number of columns in this matrix. -
get
Returns the element at the specified row and column. -
getStorage
MatrixStorage<E> getStorage()Returns the underlying storage of this matrix.- Returns:
- the matrix storage
-
getProvider
Returns the provider that created or manages this matrix.- Returns:
- the linear algebra provider
-
map
-
add
-
subtract
-
multiply
-
transpose
-
trace
E trace()Returns the trace of this matrix (sum of diagonal elements). -
getSubMatrix
-
getRow
-
getColumn
-
determinant
E determinant()Returns the determinant of this matrix. -
inverse
-
multiply
-
negate
-
zero
Returns the zero matrix of the same dimensions.- Specified by:
zeroin interfaceAbelianMonoid<E>- Returns:
- the zero element
-
lu
-
qr
-
svd
-
cholesky
CholeskyResult<E> cholesky()Computes the Cholesky decomposition of this matrix. -
eigen
EigenResult<E> eigen()Computes the eigenvalue decomposition of this matrix. -
isMultiplicationCommutative
default boolean isMultiplicationCommutative()Description copied from interface:SemiringTests whether multiplication is commutative in this semiring.- Specified by:
isMultiplicationCommutativein interfaceSemiring<E>- Returns:
trueif multiplication commutes
-
isCommutative
default boolean isCommutative()Description copied from interface:AbelianGroupAbelian groups are always commutative by definition.- Specified by:
isCommutativein interfaceAbelianGroup<E>- Specified by:
isCommutativein interfaceAbelianMonoid<E>- Specified by:
isCommutativein interfaceGroup<E>- Specified by:
isCommutativein interfaceMagma<E>- Returns:
- always
true
-
isEmpty
-
inverse
Description copied from interface:GroupReturns the inverse of the given element.For element a, returns a⻹ such that: a ∗ a⻹ = a⻹ ∗ a = e (identity).
-
identity
-
operate
Description copied from interface:MagmaPerforms the binary operation on two elements.This is the fundamental operation of a magma. The result must be an element of this magma (closure property).
Properties: None required (not necessarily associative or commutative)
-
add
Description copied from interface:AbelianMonoidReturns the sum of two elements (additive notation).Delegates to
Magma.operate(Object, Object).- Specified by:
addin interfaceAbelianMonoid<E>- Parameters:
a- the first addendb- the second addend- Returns:
- a + b
-
multiply
Description copied from interface:SemiringReturns the product of two elements.Multiplication must be associative and distribute over addition.
-
getScalarRing
-
scale
-
scale
-
toTensor
-