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 type
U - the unit type
M - the 'SELF' matrix type
SI - 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 Details

    • Matrix

      public Matrix(U displayUnit)
      Create a new matrix with a unit.
      Parameters:
      displayUnit - the display unit to use
  • Method Details

    • checkMultiply

      protected void checkMultiply(Matrix<?,?,?,?,?> matrix)
      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

      protected void checkMultiply(Vector<?,?,?,?,?> vector)
      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

      public MatrixNxM<SIQuantity,SIUnit> multiply(MatrixNxM<?,?> matrix)
      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