Class Matrix<Q extends Quantity<Q>,M extends Matrix<Q,M,SI,H,MT>,SI extends Matrix<SIQuantity,SI,?,?,?>,H extends Matrix<?,?,?,?,?>,MT extends Matrix<Q,MT,?,?,M>>

java.lang.Object
org.djunits.vecmat.def.VectorMatrix<Q,T,SI,H,TT>
org.djunits.vecmat.def.Table<Q,M,SI,H,MT>
org.djunits.vecmat.def.Matrix<Q,M,SI,H,MT>
Type Parameters:
Q - the quantity type
M - the 'SELF' matrix type
SI - the matrix type with generics <SIQuantity, SIUnit<
H - the generic matrix type with generics <?, ?< for Hadamard operations
MT - the type of the transposed version of the matrix
All Implemented Interfaces:
Serializable, Additive<M>, Scalable<M>, Value<M,Q>, Hadamard<H,SI>
Direct Known Subclasses:
MatrixNxM, SquareMatrix

public abstract class Matrix<Q extends Quantity<Q>,M extends Matrix<Q,M,SI,H,MT>,SI extends Matrix<SIQuantity,SI,?,?,?>,H extends Matrix<?,?,?,?,?>,MT extends Matrix<Q,MT,?,?,M>> extends Table<Q,M,SI,H,MT>
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(Unit<?,Q> displayUnit)
      Create a new matrix with a unit.
      Parameters:
      displayUnit - the display unit to use
  • Method Details

    • multiply

      public MatrixNxM<SIQuantity> multiply(MatrixNxM<?> matrix)
      Multiply this 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 to multiply with
    • format

      public String format()
      Concise description of this matrix.
      Returns:
      a String with the matrix, with the unit attached.
    • format

      public String format(MatrixFormat format)
      String representation of this matrix after applying the format.
      Parameters:
      format - the format to apply for the matrix
      Returns:
      a String representation of this matrix, formatted according to the given format
    • format

      public String format(Unit<?,Q> targetUnit)
      String representation of this matrix, expressed in the specified unit.
      Parameters:
      targetUnit - the unit into which the values of the matrix are converted for display
      Returns:
      printable string with the matrix's values expressed in the specified unit