Package org.djunits.vecmat.def
Class SquareDenseMatrix<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>,M extends SquareDenseMatrix<Q,U,M,SI,H>,SI extends SquareDenseMatrix<SIQuantity,SIUnit,SI,?,?>,H extends SquareDenseMatrix<?,?,?,?,?>>
java.lang.Object
org.djunits.vecmat.def.VectorMatrix<Q,U,M,SI,H>
org.djunits.vecmat.def.Matrix<Q,U,M,SI,H>
org.djunits.vecmat.def.SquareMatrix<Q,U,M,SI,H>
org.djunits.vecmat.def.SquareDenseMatrix<Q,U,M,SI,H>
- Type Parameters:
Q- the quantity typeU- the unit typeM- the 'SELF' square dense matrix typeSI- the square dense matrix type with generics <SIQuantity, SIUnit<H- the generic square dense matrix type with generics <?, ?< for Hadamard operations
- All Implemented Interfaces:
Serializable,Additive<M>,Scalable<M>,Value<U,,M> Hadamard<H,SI>
public abstract class SquareDenseMatrix<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>,M extends SquareDenseMatrix<Q,U,M,SI,H>,SI extends SquareDenseMatrix<SIQuantity,SIUnit,SI,?,?>,H extends SquareDenseMatrix<?,?,?,?,?>>
extends SquareMatrix<Q,U,M,SI,H>
SquareDenseMatrix implements the core functions for a matrix with n x n real-valued entries. The data is stored in a dense
double[] field. The matrix is immutable, except for the display unit, which can be changed.
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
ConstructorsModifierConstructorDescriptionprotectedSquareDenseMatrix(double[] dataInUnit, U displayUnit, int order) Create a new SquareDenseMatrix with a unit. -
Method Summary
Modifier and TypeMethodDescriptionintcols()Return the number of columns.booleandouble[]getColumnSi(int col) Return an array with SI-values for the given column (0-based) from the vector or matrix.double[]getRowSi(int row) Return an array with SI-values for the given row (0-based) from the vector or matrix.inthashCode()introws()Return the number of rows.double[]si()Return a row-major array of SI-values for this matrix or vector.doublesi(int row, int col) Return the si-value at position (row, col), where both row and col are 0-based values.Methods inherited from class org.djunits.vecmat.def.SquareMatrix
adjugate, determinant, determinantScalar, getDiagonalScalars, getDiagonalSi, getDiagonalVector, inverse, isSkewSymmetric, isSkewSymmetric, isSymmetric, isSymmetric, normFrobenius, order, trace, transposeMethods inherited from class org.djunits.vecmat.def.Matrix
checkMultiply, checkMultiply, multiplyMethods inherited from class org.djunits.vecmat.def.VectorMatrix
abs, add, add, asMatrixNxM, asQuantityTable, checkCol, checkRow, divideElements, divideElements, get, getColumnScalars, getColumnVector, getDisplayUnit, getRowScalars, 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, scaleBy, setDisplayUnit, subtract, subtract, sum, toString, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, 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
-
SquareDenseMatrix
Create a new SquareDenseMatrix with a unit.- Parameters:
dataInUnit- the matrix values {a11, a12, ..., a21, a22, ...} expressed in the display unitdisplayUnit- the display unit to useorder- the order of the square matrix (number of rows/columns)
-
-
Method Details
-
si
public double[] si()Description copied from class:VectorMatrixReturn a row-major array of SI-values for this matrix or vector. Note that this is NOT a safe copy.- Specified by:
siin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, M extends SquareDenseMatrix<Q, U, M, SI, H>, SI extends SquareDenseMatrix<SIQuantity, SIUnit, SI, ?, ?>, H extends SquareDenseMatrix<?, ?, ?, ?, ?>> - Returns:
- the row-major array of SI-values
-
si
public double si(int row, int col) Description copied from class:VectorMatrixReturn the si-value at position (row, col), where both row and col are 0-based values.- Specified by:
siin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, M extends SquareDenseMatrix<Q, U, M, SI, H>, SI extends SquareDenseMatrix<SIQuantity, SIUnit, SI, ?, ?>, H extends SquareDenseMatrix<?, ?, ?, ?, ?>> - Parameters:
row- the row (0-based)col- the column (0-based)- Returns:
- the si-value at position (row, col)
-
rows
public int rows()Description copied from class:VectorMatrixReturn the number of rows.- Specified by:
rowsin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, M extends SquareDenseMatrix<Q, U, M, SI, H>, SI extends SquareDenseMatrix<SIQuantity, SIUnit, SI, ?, ?>, H extends SquareDenseMatrix<?, ?, ?, ?, ?>> - Returns:
- the number of rows
-
cols
public int cols()Description copied from class:VectorMatrixReturn the number of columns.- Specified by:
colsin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, M extends SquareDenseMatrix<Q, U, M, SI, H>, SI extends SquareDenseMatrix<SIQuantity, SIUnit, SI, ?, ?>, H extends SquareDenseMatrix<?, ?, ?, ?, ?>> - Returns:
- the number of columns
-
getRowSi
public double[] getRowSi(int row) Description copied from class:VectorMatrixReturn an array with SI-values for the given row (0-based) from the vector or matrix.- Specified by:
getRowSiin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, M extends SquareDenseMatrix<Q, U, M, SI, H>, SI extends SquareDenseMatrix<SIQuantity, SIUnit, SI, ?, ?>, H extends SquareDenseMatrix<?, ?, ?, ?, ?>> - Parameters:
row- the row number to retrieve (0-based)- Returns:
- an array with SI-values with the data at the given row
-
getColumnSi
public double[] getColumnSi(int col) Description copied from class:VectorMatrixReturn an array with SI-values for the given column (0-based) from the vector or matrix.- Specified by:
getColumnSiin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, M extends SquareDenseMatrix<Q, U, M, SI, H>, SI extends SquareDenseMatrix<SIQuantity, SIUnit, SI, ?, ?>, H extends SquareDenseMatrix<?, ?, ?, ?, ?>> - Parameters:
col- the column number to retrieve (0-based)- Returns:
- an array with SI-values with the data at the given column
-
hashCode
public int hashCode() -
equals
-