Package org.djunits.vecmat.d1
Class Matrix1x1<Q extends Quantity<Q>>
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,M>
org.djunits.vecmat.def.SquareMatrix<Q,M,SI,H>
org.djunits.vecmat.def.SquareDenseMatrix<Q,Matrix1x1<Q>,Matrix1x1<SIQuantity>,Matrix1x1<?>>
org.djunits.vecmat.d1.Matrix1x1<Q>
- Type Parameters:
Q- the quantity type
- All Implemented Interfaces:
Serializable,Additive<Matrix1x1<Q>>,Scalable<Matrix1x1<Q>>,Value<Matrix1x1<Q>,,Q> Hadamard<Matrix1x1<?>,Matrix1x1<SIQuantity>>
public class Matrix1x1<Q extends Quantity<Q>>
extends SquareDenseMatrix<Q,Matrix1x1<Q>,Matrix1x1<SIQuantity>,Matrix1x1<?>>
Matrix1x1 implements a matrix with 1x1 real-valued entries. 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadjugate()Return the adjugate (classical adjoint) matrix for this matrix, often denoted as adj(M).Return the matrix 'as' a matrix with a known quantity, using a unit to express the result in.divideEntries(Matrix1x1<?> other) Divide the entries of this vector, matrix or table on an entry-by-entry basis with those of another collection of the same type (but possibly representing another quantity).getColumnVector(int col) Return a quantity column (0-based) from the table or matrix.Retrieve the main diagonal of the matrix as a column vector.getRowVector(int row) Return a quantity row (0-based) from the table or matrix.instantiateSi(double[] siNew) Return a new vector or matrix with the given SI or BASE values.instantiateSi(double[] siNew, SIUnit siUnit) Return a new vector or matrix in SI-units with the given SI or BASE values.inverse()Return the inverse of the square matrix, if the matrix is non-singular.Invert the vector, matrix or table on an entry-by-entry basis.mgetColumnVector(int mCol) Return a quantity column (1-based) from the table or matrix.mgetRowVector(int mRow) Return a quantity row (1-based) from the table or matrix.Multiply this matrix with another matrix using matrix multiplication and return the result.Multiply this matrix with a column vector, resulting in a column vector.multiply(Vector2.Row<?> otherVec) Multiply this matrix with a row vector, resulting in a row vector.multiply(Vector3.Row<?> otherVec) Multiply this matrix with a row vector, resulting in a row vector.multiply(VectorN.Row<?> otherVec) Multiply this matrix with a row vector, resulting in a row vector.multiplyEntries(Quantity<?> quantity) Multiply the entries of this vector, matrix or table by the given quantity.multiplyEntries(Matrix1x1<?> other) Multiply the entries of this vector, matrix or table on an entry-by-entry basis with those of another collection of the same type (but possibly representing another quantity).Create a new Matrix1x1 with a unit, based on a 2-dimensional grid.Create a Matrix1x1 without needing generics.Create a Matrix1x1 without needing generics.of(Q data) Create a Matrix1x1 without needing generics.of(Q[] data) Create a Matrix1x1 without needing generics.of(Q[][] grid) Create a Matrix1x1 without needing generics.Create a new Matrix1x1 with a unit, based on a 2-dimensional grid with SI-values.Create a Matrix1x1 without needing generics.Methods inherited from class org.djunits.vecmat.def.SquareDenseMatrix
cols, equals, getColumnSi, getRowSi, getSiArray, hashCode, nonZeroCount, rows, si, unsafeSiArrayMethods inherited from class org.djunits.vecmat.def.SquareMatrix
determinant, determinantSi, getDiagonalScalars, getDiagonalSi, isSkewSymmetric, isSkewSymmetric, isSymmetric, isSymmetric, normFrobenius, order, trace, transposeMethods inherited from class org.djunits.vecmat.def.Table
checkCol, checkRow, get, getColumnScalars, getRowScalars, getScalarArray, getScalarGrid, getSiGrid, mcheckCol, mcheckRow, mget, mgetColumnScalars, mgetColumnSi, mgetRowScalars, mgetRowSi, msiMethods inherited from class org.djunits.vecmat.def.VectorMatrix
abs, add, add, asMatrix1x1, asMatrix2x2, asMatrix3x3, asMatrixNxM, asMatrixNxN, asQuantityTable, asVector1, asVector2Col, asVector2Row, asVector3Col, asVector3Row, asVectorNCol, asVectorNRow, checkMultiply, checkMultiply, divideElements, getDisplayUnit, isRelative, max, mean, median, min, multiplyElements, negate, nnz, scaleBy, setDisplayUnit, subtract, subtract, sum, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.vecmat.operations.Hadamard
divideEntriesMethods inherited from interface org.djunits.value.Value
isAbsolute, setDisplayUnit
-
Constructor Details
-
Matrix1x1
Create a new Matrix1x1 with a display unit.- Parameters:
dataSi- the matrix values {a11} expressed in the SI unitdisplayUnit- the display unit for the matrix
-
-
Method Details
-
instantiateSi
Description copied from class:VectorMatrixReturn a new vector or matrix with the given SI or BASE values.- Specified by:
instantiateSiin classVectorMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>, Matrix1x1<Q extends Quantity<Q>>> - Parameters:
siNew- the values for the new vector or matrix in row-major format- Returns:
- a new matrix with the provided SI or BASE values
-
instantiateSi
Description copied from class:VectorMatrixReturn a new vector or matrix in SI-units with the given SI or BASE values.- Specified by:
instantiateSiin classVectorMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>, Matrix1x1<Q extends Quantity<Q>>> - Parameters:
siNew- the values for the new vector or matrix in row-major formatsiUnit- the new unit for the new vector or matrix- Returns:
- a new matrix with the provided SI or BASE values
-
getRowVector
Description copied from class:TableReturn a quantity row (0-based) from the table or matrix. Note that the specific vector to return can be tightened by the implementing class. -
mgetRowVector
Description copied from class:TableReturn a quantity row (1-based) from the table or matrix. Note that the specific vector to return can be tightened by the implementing class. -
getColumnVector
Description copied from class:TableReturn a quantity column (0-based) from the table or matrix. Note that the specific vector to return can be tightened by the implementing class. -
mgetColumnVector
Description copied from class:TableReturn a quantity column (1-based) from the table or matrix. Note that the specific vector to return can be tightened by the implementing class. -
getDiagonalVector
Description copied from class:SquareMatrixRetrieve the main diagonal of the matrix as a column vector.- Specified by:
getDiagonalVectorin classSquareMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>> - Returns:
- the main diagonal as a Vector
- Throws:
IllegalStateException
-
inverse
Description copied from class:SquareMatrixReturn the inverse of the square matrix, if the matrix is non-singular. The unit of the matrix is U^(-1).- Specified by:
inversein classSquareMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>> - Returns:
- the inverse of the square matrix, if the matrix is non-singular
- Throws:
NonInvertibleMatrixException- when the matrix is singular or cannot be inverted
-
adjugate
Description copied from class:SquareMatrixReturn the adjugate (classical adjoint) matrix for this matrix, often denoted as adj(M). The unit of adj(M) is U^(n-1) where n is the order of the matrix. -
invertEntries
Description copied from interface:HadamardInvert the vector, matrix or table on an entry-by-entry basis.- Specified by:
invertEntriesin interfaceHadamard<Matrix1x1<?>,Matrix1x1<SIQuantity>> - Overrides:
invertEntriesin classVectorMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>, Matrix1x1<Q extends Quantity<Q>>> - Returns:
- a new vector, matrix or table with an entry-by-entry inversion (1/value) of the entries
-
multiplyEntries
Description copied from interface:HadamardMultiply the entries of this vector, matrix or table on an entry-by-entry basis with those of another collection of the same type (but possibly representing another quantity).- Specified by:
multiplyEntriesin interfaceHadamard<Matrix1x1<?>,Matrix1x1<SIQuantity>> - Overrides:
multiplyEntriesin classVectorMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>, Matrix1x1<Q extends Quantity<Q>>> - Parameters:
other- the other collection of the same type- Returns:
- a new vector, matrix or table with an entry-by-entry multiplication of its entries
-
divideEntries
Description copied from interface:HadamardDivide the entries of this vector, matrix or table on an entry-by-entry basis with those of another collection of the same type (but possibly representing another quantity).- Specified by:
divideEntriesin interfaceHadamard<Matrix1x1<?>,Matrix1x1<SIQuantity>> - Overrides:
divideEntriesin classVectorMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>, Matrix1x1<Q extends Quantity<Q>>> - Parameters:
other- the other collection of the same type- Returns:
- a new vector, matrix or table with an entry-by-entry division of this collection's entries and other's entries
-
multiply
Multiply this matrix with another matrix using matrix multiplication and return the result.- Parameters:
otherMat- the matrix to multiply with.- Returns:
- the matrix from the multiplication with the correct unit
-
multiply
Multiply this matrix with a column vector, resulting in a column vector.- Parameters:
otherVec- the column vector to multiply with- Returns:
- the resulting vector from the multiplication
-
multiply
Multiply this matrix with a row vector, resulting in a row vector.- Parameters:
otherVec- the row vector to multiply with- Returns:
- the resulting vector from the multiplication
-
multiply
Multiply this matrix with a row vector, resulting in a row vector.- Parameters:
otherVec- the row vector to multiply with- Returns:
- the resulting vector from the multiplication
-
multiply
Multiply this matrix with a row vector, resulting in a row vector.- Parameters:
otherVec- the row vector to multiply with- Returns:
- the resulting vector from the multiplication
-
multiplyEntries
Description copied from interface:HadamardMultiply the entries of this vector, matrix or table by the given quantity.- Specified by:
multiplyEntriesin interfaceHadamard<Matrix1x1<?>,Matrix1x1<SIQuantity>> - Overrides:
multiplyEntriesin classVectorMatrix<Q extends Quantity<Q>,Matrix1x1<Q extends Quantity<Q>>, Matrix1x1<SIQuantity>, Matrix1x1<?>, Matrix1x1<Q extends Quantity<Q>>> - Parameters:
quantity- the scalar quantity to multiply by- Returns:
- a new vector, matrix or table where the entries have been multiplied by the given quantity
-
of
Create a Matrix1x1 without needing generics.- Type Parameters:
Q- the quantity type- Parameters:
xInUnit- the a11-value expressed in the given unitunit- the unit of the value- Returns:
- a new Matrix1x1 with a unit
-
of
Create a Matrix1x1 without needing generics.- Type Parameters:
Q- the quantity type- Parameters:
data- the a11-value expressed as a quantity- Returns:
- a new Matrix1x1 with a unit
-
of
Create a Matrix1x1 without needing generics.- Type Parameters:
Q- the quantity type- Parameters:
dataInUnit- the a11-value expressed as an array in the display unitunit- the unit of the data, which will also be used as the display unit- Returns:
- a new Matrix1x1 with a unit
-
ofSi
Create a Matrix1x1 without needing generics.- Type Parameters:
Q- the quantity type- Parameters:
dataSi- the a11-value expressed as an array in the SI unitsdisplayUnit- the display unit to use- Returns:
- a new Matrix1x1 with a unit
-
of
Create a Matrix1x1 without needing generics.- Type Parameters:
Q- the quantity type- Parameters:
data- the matrix values {a11} expressed as an array of quantities- Returns:
- a new Matrix1x1 with a unit
-
ofSi
Create a new Matrix1x1 with a unit, based on a 2-dimensional grid with SI-values.- Type Parameters:
Q- the quantity type- Parameters:
gridSi- the matrix values {{a11}} expressed in the SI or base unitdisplayUnit- the unit of the data, which will also be used as the display unit- Returns:
- a new Matrix1x1 with a unit
-
of
Create a new Matrix1x1 with a unit, based on a 2-dimensional grid.- Type Parameters:
Q- the quantity type- Parameters:
gridInUnit- the matrix values {{a11}} expressed in the unitunit- the unit of the data, which will also be used as the display unit- Returns:
- a new Matrix1x1 with a unit
-
of
Create a Matrix1x1 without needing generics.- Type Parameters:
Q- the quantity type- Parameters:
grid- the matrix values {{a11}} expressed as an array of quantities- Returns:
- a new Matrix1x1 with a unit
-
as
public <TQ extends Quantity<TQ>> Matrix1x1<TQ> as(Unit<?, TQ> targetUnit) throws IllegalArgumentExceptionReturn the matrix 'as' a matrix with a known quantity, using a unit to express the result in. Throw a Runtime exception when the SI units of this vector and the target vector do not match.- Type Parameters:
TQ- target quantity type- Parameters:
targetUnit- the unit to convert the matrix to- Returns:
- a matrix typed in the target matrix class
- Throws:
IllegalArgumentException- when the units do not match
-