Package org.djunits.vecmat.d2
Class AbsMatrix2x2<A extends AbsQuantity<A,Q,?>,Q extends Quantity<Q>>
java.lang.Object
org.djunits.vecmat.def.AbsVectorMatrix<A,Q,MA,MQ,MAT>
org.djunits.vecmat.def.AbsTable<A,Q,MA,MQ,MAT>
org.djunits.vecmat.def.AbsMatrix<A,Q,MA,MQ,MA>
org.djunits.vecmat.def.AbsSquareMatrix<A,Q,AbsMatrix2x2<A,Q>,Matrix2x2<Q>>
org.djunits.vecmat.d2.AbsMatrix2x2<A,Q>
- Type Parameters:
A- the absolute quantity typeQ- the corresponding relative quantity type
- All Implemented Interfaces:
Serializable,Value<AbsMatrix2x2<A,Q>, Q>
public class AbsMatrix2x2<A extends AbsQuantity<A,Q,?>,Q extends Quantity<Q>>
extends AbsSquareMatrix<A,Q,AbsMatrix2x2<A,Q>,Matrix2x2<Q>>
AbsMatrix2x2 implements a matrix with 2x2 absolute quantities with a reference point. The matrix is immutable, except for the
display unit, which can be changed.
Copyright (c) 2026-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 TypeMethodDescriptiongetColumnVector(int col) Return a quantity column (0-based) from the vector or matrix.Retrieve the main diagonal of the matrix as a column vector.getRowVector(int row) Return a quantity row (0-based) from the vector or matrix.Return a new vector or matrix with the given SI or BASE values for the relative vector or matrix.mgetColumnVector(int mCol) Return a quantity column (1-based) from the vector or matrix.mgetRowVector(int mRow) Return a quantity row (1-based) from the vector or matrix.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> Create an AbsMatrix2x2 with a unit, based on a 2-dimensional grid.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> Create an AbsMatrix2x2 without needing generics.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> of(A[] absData) Create an AbsMatrix2x2 without needing generics.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> of(A[][] absGrid) Create an AbsMatrix2x2 without needing generics.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> Create an AbsMatrix2x2 without needing generics.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> of(Q[][] grid, R reference) Create an AbsMatrix2x2 without needing generics.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> of(Q[] data, R reference) Create an AbsMatrix2x2 without needing generics.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> Create an AbsMatrix2x2 with a unit, based on a 2-dimensional grid with SI-values.static <A extends AbsQuantity<A,Q, R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>>
AbsMatrix2x2<A,Q> Create an AbsMatrix2x2 without needing generics.Methods inherited from class org.djunits.vecmat.def.AbsSquareMatrix
getDiagonalScalars, getDiagonalSi, isSkewSymmetric, isSkewSymmetric, isSymmetric, isSymmetric, order, transposeMethods inherited from class org.djunits.vecmat.def.AbsTable
get, getColumnScalars, getColumnSi, getRowScalars, getRowSi, getScalarArray, getScalarGrid, getSiArray, getSiGrid, mget, mgetColumnScalars, mgetColumnSi, mgetRowScalars, mgetRowSi, msi, siMethods inherited from class org.djunits.vecmat.def.AbsVectorMatrix
add, add, asAbsMatrix1x1, asAbsMatrix2x2, asAbsMatrix3x3, asAbsMatrixNxM, asAbsMatrixNxN, asAbsQuantityTable, asAbsVector1, asAbsVector2Col, asAbsVector2Row, asAbsVector3Col, asAbsVector3Row, asAbsVectorNCol, asAbsVectorNRow, checkCol, checkRow, cols, equals, getDisplayUnit, getReference, getRelativeVecMat, hashCode, instantiateSi, isRelative, max, mcheckCol, mcheckRow, median, min, rows, setDisplayUnit, subtract, subtract, subtract, subtract, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.value.Value
isAbsolute, setDisplayUnit
-
Constructor Details
-
AbsMatrix2x2
Create a new AbsMatrix2x2 with a display unit and a reference point.- Parameters:
relativeMatrix- the matrix values {a11} expressed in the displayUnitreference- the reference point for the absolute values
-
-
Method Details
-
instantiate
Description copied from class:AbsVectorMatrixReturn a new vector or matrix with the given SI or BASE values for the relative vector or matrix.- Specified by:
instantiatein classAbsVectorMatrix<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, Matrix2x2<Q extends Quantity<Q>>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
relativeMatrix- the underlying relative vector or matrix with SI values relative to the reference pointreference- the reference point for the relative SI values- Returns:
- a new matrix with the provided SI or BASE values
-
getRowVector
Description copied from class:AbsTableReturn a quantity row (0-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
getRowVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, Matrix2x2<Q extends Quantity<Q>>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
row- the row number to retrieve (0-based)- Returns:
- a row vector with the data at the given row
-
mgetRowVector
Description copied from class:AbsTableReturn a quantity row (1-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
mgetRowVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, Matrix2x2<Q extends Quantity<Q>>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
mRow- the row number to retrieve (1-based)- Returns:
- a row vector with the data at the given row
-
getColumnVector
Description copied from class:AbsTableReturn a quantity column (0-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
getColumnVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, Matrix2x2<Q extends Quantity<Q>>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
col- the column number to retrieve (0-based)- Returns:
- a column vector with the data at the given column
-
mgetColumnVector
Description copied from class:AbsTableReturn a quantity column (1-based) from the vector or matrix. Note that the specific vector to return can be tightened by the implementing class.- Specified by:
mgetColumnVectorin classAbsTable<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, Matrix2x2<Q extends Quantity<Q>>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>> - Parameters:
mCol- the column number to retrieve (1-based)- Returns:
- a column vector with the data at the given column
-
getDiagonalVector
Description copied from class:AbsSquareMatrixRetrieve the main diagonal of the matrix as a column vector.- Specified by:
getDiagonalVectorin classAbsSquareMatrix<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>, AbsMatrix2x2<A extends AbsQuantity<A, Q, ?>, Q extends Quantity<Q>>, Matrix2x2<Q extends Quantity<Q>>> - Returns:
- the main diagonal as a Vector
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(double[] dataInUnit, Unit<?, Q> unit, R reference) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
dataInUnit- the matrix values {a11, a12, a21, a22} expressed as an array in the display unitunit- the unit of the data, which will also be used as the display unitreference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
ofSi
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> ofSi(double[] dataSi, Unit<?, Q> displayUnit, R reference) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
dataSi- the matrix values {a11, a12, a21, a22} expressed as an array in the SI unitsdisplayUnit- the display unit to usereference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(Q[] data, R reference) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
data- the matrix values {a11, a12, a21, a22} expressed as an array of quantitiesreference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(A[] absData) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
absData- the {a11, a12, a21, a22} values expressed as an array of absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
ofSi
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> ofSi(double[][] gridSi, Unit<?, Q> displayUnit, R reference) Create an AbsMatrix2x2 with a unit, based on a 2-dimensional grid with SI-values.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
gridSi- the matrix values {{a11, a12}, {a21, a22}} expressed in the SI or base unitdisplayUnit- the unit of the data, which will also be used as the display unitreference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(double[][] gridInUnit, Unit<?, Q> unit, R reference) Create an AbsMatrix2x2 with a unit, based on a 2-dimensional grid.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
gridInUnit- the matrix values {{a11, a12}, {a21, a22}} expressed in the unitunit- the unit of the data, which will also be used as the display unitreference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(Q[][] grid, R reference) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
grid- the matrix values {{a11, a12}, {a21, a22}} expressed as an array of quantitiesreference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(A[][] absGrid) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
absGrid- the {{a11, a12}, {a21, a22}} values expressed as an grid [][] of absolute quantities- Returns:
- a new Matrix2x2 with a unit
-
of
public static <A extends AbsQuantity<A,Q, AbsMatrix2x2<A,R>, Q extends Quantity<Q>, R extends Reference<R, A, Q>> Q> of(Matrix2x2<Q> relativeMatrix, R reference) Create an AbsMatrix2x2 without needing generics.- Type Parameters:
A- the absolute quantity typeQ- the quantity typeR- the reference type- Parameters:
relativeMatrix- the relative matrix with values relative to the reference pointreference- the reference point for the absolute quantities- Returns:
- a new Matrix2x2 with a unit
-