Package org.djunits.vecmat.dn
Class VectorN.Col<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>>
java.lang.Object
org.djunits.vecmat.def.VectorMatrix<Q,U,M,SI,H>
org.djunits.vecmat.def.Matrix<Q,U,V,SI,H>
org.djunits.vecmat.def.Vector<Q,U,V,SI,H>
org.djunits.vecmat.dn.VectorN<Q,U,VectorN.Col<Q,U>,VectorN.Col<SIQuantity,SIUnit>,VectorN.Col<?,?>>
org.djunits.vecmat.dn.VectorN.Col<Q,U>
- Type Parameters:
Q- the quantity typeU- the unit type
- All Implemented Interfaces:
Serializable,Iterable<Q>,Additive<VectorN.Col<Q,,U>> Scalable<VectorN.Col<Q,,U>> Value<U,,VectorN.Col<Q, U>> Hadamard<VectorN.Col<?,,?>, VectorN.Col<SIQuantity, SIUnit>> Normed<Q,,U> VectorTransposable<VectorN.Row<Q,U>>
- Enclosing class:
- VectorN<Q extends Quantity<Q,
U>, U extends UnitInterface<U, Q>, V extends VectorN<Q, U, V, SI, H>, SI extends VectorN<SIQuantity, SIUnit, SI, ?, ?>, H extends VectorN<?, ?, ?, ?, ?>>
public static class VectorN.Col<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>>
extends VectorN<Q,U,VectorN.Col<Q,U>,VectorN.Col<SIQuantity,SIUnit>,VectorN.Col<?,?>>
implements VectorTransposable<VectorN.Row<Q,U>>
VectorN.Col implements a column vector with real-valued entries. The vector 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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.djunits.vecmat.dn.VectorN
VectorN.Col<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>>, VectorN.Row<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>> -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCol(DataGridSi<?> dataSi, U displayUnit) Create a new column VectorN with a unit, based on a DataGridSi storage object that contains SI data. -
Method Summary
Modifier and TypeMethodDescription<TQ extends Quantity<TQ,TU>, TU extends UnitInterface<TU, TQ>>
VectorN.Col<TQ,TU> as(TU targetUnit) Return the vector 'as' a vector with a known quantity, using a unit to express the result in.Return this matrix as a 1-element column vector.Return this matrix as a 2-element column vector.Return this matrix as a 3-element column vector.divideElements(VectorN.Col<?, ?> other) Divide the elements of this vector, matrix or table on an element-by-element basis with those of another collection of the same type (but possibly representing another quantity).double[]getColumnSi(int col) Return an array with SI-values for the given column (0-based) from the vector or matrix.getColumnVector(int col) Return a quantity 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.getRowVector(int row) Return a quantity row (0-based) from the vector or matrix.instantiateSi(double[] data) 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.Invert the vector, matrix or table on an element-by-element basis.booleanReturn whether this vector is a column vector.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.multiplyElements(Quantity<?, ?> quantity) Multiply the elements of this vector, matrix or table by the given quantity.multiplyElements(VectorN.Col<?, ?> other) Multiply the elements of this vector, matrix or table on an element-by-element basis with those of another collection of the same type (but possibly representing another quantity).static <Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>>
VectorN.Col<Q,U> of(double[] data, U unit) Create a new column VectorN with a unit, based on a double[] array that contains data in the given unit.static <Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>>
VectorN.Col<Q,U> Create a new column VectorN with a unit, based on a quantity list that contains data.static <Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>>
VectorN.Col<Q,U> of(Q[] data, U displayUnit) Create a new column VectorN with a unit, based on a quantity array that contains data.static <Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>>
VectorN.Col<Q,U> ofSi(double[] dataSi, U displayUnit) Create a new column VectorN with a unit, based on a double[] array that contains SI data.static <Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>>
VectorN.Col<Q,U> ofSi(DataGridSi<?> dataSi, U displayUnit) Create a new column VectorN with a unit, based on a DataGridSi storage object that contains SI data.doublesi(int index) Retrieve an si-value from the vector.intsize()Retrieve the size of the vector.Transpose the vector (swap rows and columns).Methods inherited from class org.djunits.vecmat.dn.VectorN
cols, equals, getScalarArray, hashCode, iterator, normL1, normL2, normLinf, normLp, rows, si, si, toString, toStringMethods 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, get, getColumnScalars, getDisplayUnit, getRowScalars, getScalarGrid, isRelative, max, mcheckCol, mcheckRow, mean, median, mget, mgetColumnScalars, mgetColumnSi, mgetRowScalars, mgetRowSi, min, mode, msi, multiplyElements, negate, scaleBy, setDisplayUnit, subtract, subtract, sumMethods 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 java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.djunits.value.Value
isAbsolute, setDisplayUnit
-
Constructor Details
-
Col
Create a new column VectorN with a unit, based on a DataGridSi storage object that contains SI data.- Parameters:
dataSi- the data of the vector, in SI unit.displayUnit- the display unit to use- Throws:
IllegalArgumentException- when the number of rows or columns does not have a positive value or when the vector is initialized with more than one row
-
-
Method Details
-
ofSi
public static <Q extends Quantity<Q,U>, VectorN.Col<Q,U extends UnitInterface<U, Q>> U> ofSi(DataGridSi<?> dataSi, U displayUnit) Create a new column VectorN with a unit, based on a DataGridSi storage object that contains SI data.- Type Parameters:
Q- the quantity typeU- the unit type- Parameters:
dataSi- the data of the vector, in SI unit.displayUnit- the display unit to use- Returns:
- a new column VectorN with a unit, based on a DataGridSi storage object that contains SI data
- Throws:
IllegalArgumentException- when the number of rows or columns does not have a positive value or when the vector is initialized with more than one row
-
ofSi
public static <Q extends Quantity<Q,U>, VectorN.Col<Q,U extends UnitInterface<U, Q>> U> ofSi(double[] dataSi, U displayUnit) Create a new column VectorN with a unit, based on a double[] array that contains SI data.- Type Parameters:
Q- the quantity typeU- the unit type- Parameters:
dataSi- the data of the vector, in SI unit.displayUnit- the display unit to use- Returns:
- a new column VectorN with a unit, based on a double[] array that contains SI data
-
of
public static <Q extends Quantity<Q,U>, VectorN.Col<Q,U extends UnitInterface<U, Q>> U> of(double[] data, U unit) Create a new column VectorN with a unit, based on a double[] array that contains data in the given unit.- Type Parameters:
Q- the quantity typeU- the unit type- Parameters:
data- the data of the vector, in the given unit.unit- the unit of the data- Returns:
- a new column VectorN with a unit, based on a double[] array expressed in the given unit
-
of
public static <Q extends Quantity<Q,U>, VectorN.Col<Q,U extends UnitInterface<U, Q>> U> of(Q[] data, U displayUnit) Create a new column VectorN with a unit, based on a quantity array that contains data.- Type Parameters:
Q- the quantity typeU- the display unit type- Parameters:
data- the data of the vector, in the given unit.displayUnit- the display unit of the vector- Returns:
- a new column VectorN with a display unit, based on a quantity array
-
of
public static <Q extends Quantity<Q,U>, VectorN.Col<Q,U extends UnitInterface<U, Q>> U> of(List<Q> data, U displayUnit) Create a new column VectorN with a unit, based on a quantity list that contains data.- Type Parameters:
Q- the quantity typeU- the display unit type- Parameters:
data- the data of the vector, in the given unit.displayUnit- the display unit of the vector- Returns:
- a new column VectorN with a display unit, based on a quantity list
-
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,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
data- 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,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - 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:VectorMatrixReturn 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 classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - 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:VectorMatrixReturn 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 classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - 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:VectorMatrixReturn 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 classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - 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:VectorMatrixReturn 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 classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
mCol- the column number to retrieve (1-based)- Returns:
- a column vector with the data at the given column
-
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>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - 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>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
col- the column number to retrieve (0-based)- Returns:
- an array with SI-values with the data at the given column
-
isColumnVector
public boolean isColumnVector()Description copied from class:VectorReturn whether this vector is a column vector.- Specified by:
isColumnVectorin classVector<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Returns:
- whether this vector is a column vector
-
size
public int size()Description copied from class:VectorRetrieve the size of the vector.- Specified by:
sizein classVector<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Returns:
- the size of the vector
-
si
Description copied from class:VectorRetrieve an si-value from the vector.- Specified by:
siin classVector<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
index- the index (0-based) to retrieve the value from- Returns:
- the value as a Scalar
- Throws:
IndexOutOfBoundsException- in case index is out of bounds
-
transpose
Description copied from interface:VectorTransposableTranspose the vector (swap rows and columns). -
invertElements
Description copied from interface:HadamardInvert the vector, matrix or table on an element-by-element basis.- Specified by:
invertElementsin interfaceHadamard<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>> - Overrides:
invertElementsin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Returns:
- a vector, matrix or table with an element-by-element inversion (1/value) of the elements
-
multiplyElements
Description copied from interface:HadamardMultiply the elements of this vector, matrix or table on an element-by-element basis with those of another collection of the same type (but possibly representing another quantity).- Specified by:
multiplyElementsin interfaceHadamard<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>> - Overrides:
multiplyElementsin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
other- the other collection of the same type- Returns:
- a vector, matrix or table with an element-by-element multiplication of its elements
-
divideElements
Description copied from interface:HadamardDivide the elements of this vector, matrix or table on an element-by-element basis with those of another collection of the same type (but possibly representing another quantity).- Specified by:
divideElementsin interfaceHadamard<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>> - Overrides:
divideElementsin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
other- the other collection of the same type- Returns:
- a vector, matrix or table with an element-by-element division of this collection's elements and other's elements
-
multiplyElements
Description copied from interface:HadamardMultiply the elements of this vector, matrix or table by the given quantity.- Specified by:
multiplyElementsin interfaceHadamard<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>> - Overrides:
multiplyElementsin classVectorMatrix<Q extends Quantity<Q,U>, U extends UnitInterface<U, Q>, VectorN.Col<Q extends Quantity<Q, U>, U extends UnitInterface<U, Q>>, VectorN.Col<SIQuantity, SIUnit>, VectorN.Col<?, ?>> - Parameters:
quantity- the scalar quantity to multiply by- Returns:
- a vector, matrix or table where the elements have been multiplied by the given quantity
-
as
public <TQ extends Quantity<TQ,TU>, VectorN.Col<TQ,TU extends UnitInterface<TU, TQ>> TU> as(TU targetUnit) throws IllegalArgumentException Return the vector 'as' a vector 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. The dataSi object containing the vector values is NOT copied.- Type Parameters:
TQ- target quantity typeTU- target unit type- Parameters:
targetUnit- the unit to convert the vector to- Returns:
- a quantity typed in the target vector class
- Throws:
IllegalArgumentException- when the units do not match
-
asVector1
Return this matrix as a 1-element column vector. Shape must be 1 x 1.- Returns:
- a
Vector1with identical SI data and display unit - Throws:
IllegalStateException- if shape is not 1 x 1
-
asVector2Col
Return this matrix as a 2-element column vector. Shape must be 2 x 1.- Returns:
- a
Vector2.Colwith identical SI data and display unit - Throws:
IllegalStateException- if shape is not 2 x 1
-
asVector3Col
Return this matrix as a 3-element column vector. Shape must be 3 x 1.- Returns:
- a
Vector3.Colwith identical SI data and display unit - Throws:
IllegalStateException- if shape is not 3 x 1
-