Package org.djunits.vecmat.dn
Class VectorN.Row<Q extends Quantity<Q>>
java.lang.Object
org.djunits.vecmat.def.VectorMatrix<Q,V,SI,H,VT>
org.djunits.vecmat.def.Vector<Q,V,SI,H,VT>
org.djunits.vecmat.dn.VectorN<Q,VectorN.Row<Q>,VectorN.Row<SIQuantity>,VectorN.Row<?>,VectorN.Col<Q>>
org.djunits.vecmat.dn.VectorN.Row<Q>
- Type Parameters:
Q- the quantity type
- All Implemented Interfaces:
Serializable,Iterable<Q>,Additive<VectorN.Row<Q>>,Scalable<VectorN.Row<Q>>,Value<VectorN.Row<Q>,,Q> Vector.Row<VectorN.Row<Q>,,Q> Hadamard<VectorN.Row<?>,,VectorN.Row<SIQuantity>> Normed<Q>
- Enclosing class:
- VectorN<Q extends Quantity<Q>,
V extends VectorN<Q, V, SI, H, VT>, SI extends VectorN<SIQuantity, SI, ?, ?, ?>, H extends VectorN<?, ?, ?, ?, ?>, VT extends VectorN<Q, VT, ?, ?, V>>
public static class VectorN.Row<Q extends Quantity<Q>>
extends VectorN<Q,VectorN.Row<Q>,VectorN.Row<SIQuantity>,VectorN.Row<?>,VectorN.Col<Q>>
implements Vector.Row<VectorN.Row<Q>,Q>
VectorN.Row implements a row 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>>, VectorN.Row<Q extends Quantity<Q>> -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionRow(DataGridSi<?> dataSi, Unit<?, Q> displayUnit) Create a new row VectorN with a unit, based on a DataGridSi storage object that contains SI data. -
Method Summary
Modifier and TypeMethodDescription<TQ extends Quantity<TQ>>
VectorN.Row<TQ>Return the vector 'as' a vector with a known quantity, using a unit to express the result in.divideEntries(VectorN.Row<?> 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).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 entry-by-entry basis.booleanReturn whether this vector is a column vector.multiplyEntries(Quantity<?> quantity) Multiply the entries of this vector, matrix or table by the given quantity.multiplyEntries(VectorN.Row<?> 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).static <Q extends Quantity<Q>>
VectorN.Row<Q>Create a new row VectorN with a unit, based on a double[] array that contains data in the given unit.static <Q extends Quantity<Q>>
VectorN.Row<Q>Create a new row VectorN with a unit, based on a quantity list that contains data.static <Q extends Quantity<Q>>
VectorN.Row<Q>of(Q[] data) Create a new row VectorN with a unit, based on a quantity array that contains data.static <Q extends Quantity<Q>>
VectorN.Row<Q>Create a new row VectorN with a unit, based on a double[] array that contains SI data.static <Q extends Quantity<Q>>
VectorN.Row<Q>ofSi(DataGridSi<?> dataSi, Unit<?, Q> displayUnit) Create a new row 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.Return a transposed vector or matrix, where rows and columns have been swapped.Methods inherited from class org.djunits.vecmat.dn.VectorN
cols, equals, getScalarArray, getSiArray, hashCode, iterator, nonZeroCount, normL1, normL2, normLinf, normLp, rows, unsafeSiArrayMethods inherited from class org.djunits.vecmat.def.Vector
get, isRowVector, mget, 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 java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit, setDisplayUnitMethods inherited from interface org.djunits.vecmat.def.Vector.Row
format, format, format
-
Constructor Details
-
Row
Create a new row 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
-
isColumnVector
public boolean isColumnVector()Description copied from class:VectorReturn whether this vector is a column vector.- Specified by:
isColumnVectorin classVector<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<Q extends Quantity<Q>>> - Returns:
- whether this vector is a column vector
-
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>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<Q extends Quantity<Q>>> - 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>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<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
-
size
public int size()Description copied from class:VectorRetrieve the size of the vector.- Specified by:
sizein classVector<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<Q extends Quantity<Q>>> - 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>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<Q extends Quantity<Q>>> - 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 class:VectorMatrixReturn a transposed vector or matrix, where rows and columns have been swapped.- Specified by:
transposein classVectorMatrix<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<Q extends Quantity<Q>>> - Returns:
- a transposed vector or matrix, where rows and columns have been swapped
-
invertEntries
Description copied from interface:HadamardInvert the vector, matrix or table on an entry-by-entry basis.- Specified by:
invertEntriesin interfaceHadamard<VectorN.Row<?>,VectorN.Row<SIQuantity>> - Overrides:
invertEntriesin classVectorMatrix<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<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<VectorN.Row<?>,VectorN.Row<SIQuantity>> - Overrides:
multiplyEntriesin classVectorMatrix<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<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<VectorN.Row<?>,VectorN.Row<SIQuantity>> - Overrides:
divideEntriesin classVectorMatrix<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<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
-
multiplyEntries
Description copied from interface:HadamardMultiply the entries of this vector, matrix or table by the given quantity.- Specified by:
multiplyEntriesin interfaceHadamard<VectorN.Row<?>,VectorN.Row<SIQuantity>> - Overrides:
multiplyEntriesin classVectorMatrix<Q extends Quantity<Q>,VectorN.Row<Q extends Quantity<Q>>, VectorN.Row<SIQuantity>, VectorN.Row<?>, VectorN.Col<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 new row VectorN with a unit, based on a double[] array that contains data in the given unit.- Type Parameters:
Q- the quantity type- Parameters:
dataInUnit- the data of the vector, in the given unit.unit- the unit of the data- Returns:
- a new row VectorN with a unit, based on a double[] array expressed in the given unit
-
ofSi
Create a new row VectorN with a unit, based on a double[] array that contains SI data.- Type Parameters:
Q- the quantity type- Parameters:
dataSi- the data of the vector, in SI unit.displayUnit- the display unit to use- Returns:
- a new row VectorN with a unit, based on a double[] array that contains SI data
-
of
Create a new row VectorN with a unit, based on a quantity array that contains data. The display unit will be taken from the first quantity in the array.- Type Parameters:
Q- the quantity type- Parameters:
data- the data of the vector, in the given unit.- Returns:
- a new row VectorN with a display unit, based on a quantity array
- Throws:
IllegalArgumentException- when data array length is less than 1
-
ofSi
public static <Q extends Quantity<Q>> VectorN.Row<Q> ofSi(DataGridSi<?> dataSi, Unit<?, Q> displayUnit) Create a new row VectorN with a unit, based on a DataGridSi storage object that contains SI data.- Type Parameters:
Q- the quantity type- Parameters:
dataSi- the data of the vector, in SI unit.displayUnit- the display unit to use- Returns:
- a new row VectorN with a unit, based on a DataGridSi storage object that contains SI data
- Throws:
IllegalArgumentException- when the number of rows or rows does not have a positive value or when the vector is initialized with more than one row
-
of
Create a new row VectorN with a unit, based on a quantity list that contains data. The display unit will be taken from the first quantity in the list.- Type Parameters:
Q- the quantity type- Parameters:
data- the data of the vector, in the given unit.- Returns:
- a new row VectorN with a display unit, based on a quantity list
- Throws:
IllegalArgumentException- when data size is less than 1
-
as
public <TQ extends Quantity<TQ>> VectorN.Row<TQ> as(Unit<?, TQ> targetUnit) throws IllegalArgumentExceptionReturn 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 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
-