Package org.djunits.vecmat.def
Class AbsVectorMatrix<A extends AbsQuantity<A,Q,?>,Q extends Quantity<Q>,VMA extends AbsVectorMatrix<A,Q,VMA,VMQ,VMAT>,VMQ extends VectorMatrix<Q,VMQ,?,?,?>,VMAT extends AbsVectorMatrix<A,Q,VMAT,?,VMA>>
java.lang.Object
org.djunits.vecmat.def.AbsVectorMatrix<A,Q,VMA,VMQ,VMAT>
- Type Parameters:
A- the absolute quantity typeQ- the quantity typeVMA- the absolute vector or matrix typeVMQ- the relative vector or matrix typeVMAT- the type of the transposed version of the absolute vector or matrix
- All Implemented Interfaces:
Serializable,Value<VMA,Q>
public abstract class AbsVectorMatrix<A extends AbsQuantity<A,Q,?>,Q extends Quantity<Q>,VMA extends AbsVectorMatrix<A,Q,VMA,VMQ,VMAT>,VMQ extends VectorMatrix<Q,VMQ,?,?,?>,VMAT extends AbsVectorMatrix<A,Q,VMAT,?,VMA>>
extends Object
implements Value<VMA,Q>
AbsVectorMatrix contains a number of standard operations on vectors and matrices of absolute 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 Summary
ConstructorsConstructorDescriptionAbsVectorMatrix(VMQ relativeVecMat, Reference<?, A, Q> reference) Create a new vector or matrix of absolute values with a reference point. -
Method Summary
Modifier and TypeMethodDescriptionReturn a vector or matrix with entries that contain the sum of the element and the increment.Return a vector or matrix with entries that contain the sum of the element and the increment.Convert this absolute vector, matrix or table to aAbsMatrix1x1.Convert this absolute vector, matrix or table to aAbsMatrix2x2.Convert this absolute vector, matrix or table to aAbsMatrix3x3.Convert this absolute vector or matrix to aAbsMatrixNxM.Convert this absolute vector, matrix or table to aAbsMatrixNxN.Convert this absolute vector or matrix to aAbsQuantityTable.AbsVector1<A,Q> Return this absolute vector, matrix or table as a 1-element column vector.Return this absolute vector, matrix or table as a 2-element column vector.Return this absolute vector, matrix or table as a 2-element row vector.Return this absolute vector, matrix or table as a 3-element column vector.Return this absolute vector, matrix or table as a 3-element row vector.Convert this absolute vector, matrix or table to an N-element column vector.Convert this absolute vector, matrix or table to an N-element row vector.protected voidcheckCol(int col) Check if the 0-based column is within bounds.protected voidcheckRow(int row) Check if the 0-based row is within bounds.intcols()Return the number of columns.booleanRetrieve the unit of this Value.Return the reference point for the absolute values.Return the underlying relative vector or matrix with SI values relative to the reference point.inthashCode()abstract VMAinstantiate(VMQ relVecMat, Reference<?, A, Q> newReference) Return a new vector or matrix with the given SI or BASE values for the relative vector or matrix.instantiateSi(double[] siNew, Reference<?, A, Q> newReference) Return a new vector or matrix with the given SI or BASE values for the relative vector or matrix.booleanIndicate whether this is a Relative Value.max()Return the maximum value of the entries of the vector or matrix.protected voidmcheckCol(int mCol) Check if the 1-based column is within bounds.protected voidmcheckRow(int mRow) Check if the 1-based row is within bounds.median()Return the median value of the entries of the vector or matrix.min()Return the minimum value of the entries of the vector or matrix.introws()Return the number of rows.setDisplayUnit(Unit<?, Q> newUnit) Set a new display unit for the value.Return a relative vector or matrix with entries that contain the absolute value minus the absolute decrement.Return a vector or matrix with entries that contain the value minus the decrement.Return a relative vector or matrix with entries that contain the absolute value minus the absolute decrement.Return a vector or matrix with entries that contain the value minus the decrement.toString()abstract VMATReturn a transposed absolute vector or matrix, where rows and columns have been swapped.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.value.Value
format, format, isAbsolute, setDisplayUnit
-
Constructor Details
-
AbsVectorMatrix
Create a new vector or matrix of absolute values with a reference point.- Parameters:
relativeVecMat- the underlying relative vector or matrix with SI values relative to the reference pointreference- the reference point for the absolute values
-
-
Method Details
-
getDisplayUnit
Description copied from interface:ValueRetrieve the unit of this Value.- Specified by:
getDisplayUnitin interfaceValue<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>> - Returns:
- the unit of this Value
-
setDisplayUnit
Description copied from interface:ValueSet a new display unit for the value. Internally, the value will not changed since it is stored in a base unit.- Specified by:
setDisplayUnitin interfaceValue<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>> - Parameters:
newUnit- the new display unit of this value- Returns:
- 'this' for fluent design
-
rows
public int rows()Return the number of rows.- Returns:
- the number of rows
-
cols
public int cols()Return the number of columns.- Returns:
- the number of columns
-
instantiateSi
Return a new vector or matrix with the given SI or BASE values for the relative vector or matrix.- Parameters:
siNew- the values for the new vector or matrix in row-major formatnewReference- the reference point for the relative SI values- Returns:
- a new matrix with the provided SI or BASE values
-
instantiate
Return a new vector or matrix with the given SI or BASE values for the relative vector or matrix.- Parameters:
relVecMat- the underlying relative vector or matrix with SI values relative to the reference pointnewReference- the reference point for the relative SI values- Returns:
- a new matrix with the provided SI or BASE values
-
getRelativeVecMat
Return the underlying relative vector or matrix with SI values relative to the reference point.- Returns:
- the underlying relative vector or matrix with SI values relative to the reference point
-
getReference
Return the reference point for the absolute values.- Returns:
- the reference point for the absolute values
-
transpose
Return a transposed absolute vector or matrix, where rows and columns have been swapped.- Returns:
- a transposed absolute vector or matrix, where rows and columns have been swapped
-
isRelative
public boolean isRelative()Description copied from interface:ValueIndicate whether this is a Relative Value.- Specified by:
isRelativein interfaceValue<A extends AbsQuantity<A,Q, ?>, Q extends Quantity<Q>> - Returns:
- whether this is a Relative Value
-
checkRow
protected void checkRow(int row) Check if the 0-based row is within bounds.- Parameters:
row- the 0-based row to check- Throws:
IndexOutOfBoundsException- when row is out of bounds
-
checkCol
protected void checkCol(int col) Check if the 0-based column is within bounds.- Parameters:
col- the 0-based column to check- Throws:
IndexOutOfBoundsException- when column is out of bounds
-
mcheckRow
protected void mcheckRow(int mRow) Check if the 1-based row is within bounds.- Parameters:
mRow- the 1-based row to check- Throws:
IndexOutOfBoundsException- when row is out of bounds
-
mcheckCol
protected void mcheckCol(int mCol) Check if the 1-based column is within bounds.- Parameters:
mCol- the 1-based column to check- Throws:
IndexOutOfBoundsException- when column is out of bounds
-
min
Return the minimum value of the entries of the vector or matrix.- Returns:
- the minimum value of the entries of the vector or matrix
-
max
Return the maximum value of the entries of the vector or matrix.- Returns:
- the maximum value of the entries of the vector or matrix
-
median
Return the median value of the entries of the vector or matrix.- Returns:
- the median value of the entries of the vector or matrix
-
add
Return a vector or matrix with entries that contain the sum of the element and the increment.- Parameters:
increment- the quantity by which to increase the values of the vector or matrix- Returns:
- a vector or matrix with entries that are incremented by the given quantity
-
subtract
Return a vector or matrix with entries that contain the value minus the decrement.- Parameters:
decrement- the quantity by which to decrease the values of the vector or matrix- Returns:
- a vector or matrix with entries that are decremented by the given quantity
-
add
Return a vector or matrix with entries that contain the sum of the element and the increment.- Parameters:
other- the vector or matrix that contains the values by which to increase the values of the vector or matrix- Returns:
- a vector or matrix with entries that are decremented by the given quantity
-
subtract
Return a vector or matrix with entries that contain the value minus the decrement.- Parameters:
other- the vector or matrix that contains the values by which to decrease the values of the vector or matrix- Returns:
- a vector or matrix with entries that are decremented by the given vector or matrix values
-
subtract
Return a relative vector or matrix with entries that contain the absolute value minus the absolute decrement.- Parameters:
other- the vector or matrix that contains the values by which to decrease the values of the vector or matrix- Returns:
- a vector or matrix with entries that are decremented by the given vector or matrix values
-
subtract
Return a relative vector or matrix with entries that contain the absolute value minus the absolute decrement.- Parameters:
decrement- the absolute quantity by which to decrease the values of the vector or matrix- Returns:
- a vector or matrix with entries that are decremented by the given decrement
-
asAbsMatrixNxM
Convert this absolute vector or matrix to aAbsMatrixNxM. The underlying data MIGHT be shared between this object and the new AbsMatrixNxM.- Returns:
- a
AbsMatrixNxNwith identical SI data, display unit, and reference point
-
asAbsQuantityTable
Convert this absolute vector or matrix to aAbsQuantityTable. The underlying data MIGHT be shared between this object and the new AbsQuantityTable.- Returns:
- a
AbsQuantityTablewith identical SI data, display unit, and reference point
-
asAbsVector1
Return this absolute vector, matrix or table as a 1-element column vector. Shape must be 1 x 1.- Returns:
- a
AbsVector1with identical SI data and display unit - Throws:
IllegalStateException- if shape is not 1 x 1
-
asAbsVector2Col
Return this absolute vector, matrix or table as a 2-element column vector. Shape must be 2 x 1.- Returns:
- a
AbsVector2.Colwith identical SI data and display unit - Throws:
IllegalStateException- if shape is not 2 x 1
-
asAbsVector3Col
Return this absolute vector, matrix or table as a 3-element column vector. Shape must be 3 x 1.- Returns:
- a
AbsVector3.Colwith identical SI data and display unit - Throws:
IllegalStateException- if shape is not 3 x 1
-
asAbsVectorNCol
Convert this absolute vector, matrix or table to an N-element column vector. Shape must be N x 1. The underlying data MIGHT be shared between this object and the AbsVectorN.Col.- Returns:
- a
AbsVectorN.Colwith identical SI data and display unit - Throws:
IllegalStateException- ifcols() != 1
-
asAbsVector2Row
Return this absolute vector, matrix or table as a 2-element row vector. Shape must be 1 x 2.- Returns:
- a
AbsVector2.Rowwith identical SI data and display unit - Throws:
IllegalStateException- if shape is not 1 x 2
-
asAbsVector3Row
Return this absolute vector, matrix or table as a 3-element row vector. Shape must be 1 x 3.- Returns:
- a
AbsVector3.Rowwith identical SI data and display unit - Throws:
IllegalStateException- if shape is not 1 x 3
-
asAbsVectorNRow
Convert this absolute vector, matrix or table to an N-element row vector. Shape must be 1 x N. The underlying data MIGHT be shared between this object and the AbsVectorN.Row.- Returns:
- a
AbsVectorN.Rowwith identical SI data and display unit - Throws:
IllegalStateException- ifrows() != 1
-
asAbsMatrix1x1
Convert this absolute vector, matrix or table to aAbsMatrix1x1. The shape must be 1 x 1.- Returns:
- a
AbsMatrix1x1with identical SI data and display unit - Throws:
IllegalStateException- if this matrix is not 1 x 1
-
asAbsMatrix2x2
Convert this absolute vector, matrix or table to aAbsMatrix2x2. The shape must be 2 x 2.- Returns:
- a
AbsMatrix2x2with identical SI data and display unit - Throws:
IllegalStateException- if this matrix is not 2 x 2
-
asAbsMatrix3x3
Convert this absolute vector, matrix or table to aAbsMatrix3x3. The shape must be 3 x 3.- Returns:
- a
AbsMatrix3x3with identical SI data and display unit - Throws:
IllegalStateException- if this matrix is not 3 x 3
-
asAbsMatrixNxN
Convert this absolute vector, matrix or table to aAbsMatrixNxN. The shape must be square. The underlying data MIGHT be shared between this object and the AbsMatrixNxN.- Returns:
- a
AbsMatrixNxNwith identical SI data and display unit - Throws:
IllegalStateException- if this matrix is not square
-
hashCode
public int hashCode() -
equals
-
toString
-