Package org.djunits.vecmat.def
Class Matrix<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>,M extends Matrix<Q,U,M,SI,H>,SI extends Matrix<SIQuantity,SIUnit,SI,?,?>,H extends Matrix<?,?,?,?,?>>
java.lang.Object
org.djunits.vecmat.def.VectorMatrix<Q,U,M,SI,H>
org.djunits.vecmat.def.Matrix<Q,U,M,SI,H>
- Type Parameters:
Q- the quantity typeU- the unit typeM- the 'SELF' matrix typeSI- the matrix type with generics <SIQuantity, SIUnit<H- the generic matrix type with generics <?, ?< for Hadamard operations
- All Implemented Interfaces:
Serializable,Additive<M>,Scalable<M>,Value<U,,M> Hadamard<H,SI>
- Direct Known Subclasses:
MatrixNxM,SquareMatrix,Vector
public abstract class Matrix<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>,M extends Matrix<Q,U,M,SI,H>,SI extends Matrix<SIQuantity,SIUnit,SI,?,?>,H extends Matrix<?,?,?,?,?>>
extends VectorMatrix<Q,U,M,SI,H>
Matrix contains a number of standard operations on matrices of relative quantities.
Copyright (c) 2025-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.
- Author:
- Alexander Verbraeck
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckMultiply(Matrix<?, ?, ?, ?, ?> matrix) Check if the multiplication with the other matrix is valid.protected voidcheckMultiply(Vector<?, ?, ?, ?, ?> vector) Check if the multiplication with the other matrix is valid.Multiply this vector or matrix with a MatrixNxM, resulting in a MatrixNxM.Methods inherited from class org.djunits.vecmat.def.VectorMatrix
abs, add, add, asMatrixNxM, asQuantityTable, checkCol, checkRow, cols, divideElements, divideElements, get, getColumnScalars, getColumnSi, getColumnVector, getDisplayUnit, getRowScalars, getRowSi, getRowVector, getScalarGrid, instantiateSi, instantiateSi, invertElements, isRelative, max, mcheckCol, mcheckRow, mean, median, mget, mgetColumnScalars, mgetColumnSi, mgetColumnVector, mgetRowScalars, mgetRowSi, mgetRowVector, min, mode, msi, multiplyElements, multiplyElements, multiplyElements, negate, rows, scaleBy, setDisplayUnit, si, si, subtract, subtract, sum, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.vecmat.operations.Hadamard
divideElementsMethods inherited from interface org.djunits.value.Value
isAbsolute, setDisplayUnit
-
Constructor Details
-
Matrix
Create a new matrix with a unit.- Parameters:
displayUnit- the display unit to use
-
-
Method Details
-
checkMultiply
Check if the multiplication with the other matrix is valid. A valid matrix multiplication is (M x N) x (N x P).- Parameters:
matrix- the other matrix- Throws:
IllegalArgumentException- when this.cols() != other.rows()
-
checkMultiply
Check if the multiplication with the other matrix is valid. A valid matrix multiplication is (M x N) x (N x P).- Parameters:
vector- the other matrix- Throws:
IllegalArgumentException- when this.cols() != other.rows()
-
multiply
Multiply this vector or matrix with a MatrixNxM, resulting in a MatrixNxM. The multiplication is a (NxM) x (MxP) matrix multiplication resulting in an (NxP) matrix.- Parameters:
matrix- the matrix to multiply with- Returns:
- a MatrixNxM of an SIQuantity as the result of the matrix multiplication
- Throws:
IllegalArgumentException- when the number of columns of this matrix does not equal the number of rows of the matrix or vector to multiply with
-