Package org.djunits.vecmat.dn
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>>
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,V,SI,H,VT>
- Type Parameters:
Q- the quantity typeV- the vector type (Row or Col)SI- the vector type with generics <SIQuantity, SIUnit<H- the generic vector type with generics <?, ?< for Hadamard operationsVT- the type of the transposed version of the vector
- All Implemented Interfaces:
Serializable,Iterable<Q>,Additive<V>,Scalable<V>,Value<V,,Q> Hadamard<H,,SI> Normed<Q>
- Direct Known Subclasses:
VectorN.Col,VectorN.Row
public abstract 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>>
extends Vector<Q,V,SI,H,VT>
VectorN.java.
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 ClassesModifier and TypeClassDescriptionstatic classVectorN.Col<Q extends Quantity<Q>>VectorN.Col implements a column vector with real-valued entries.static classVectorN.Row<Q extends Quantity<Q>>VectorN.Row implements a row vector with real-valued entries. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DataGridSi<?>The data of the matrix, in SI unit. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVectorN(DataGridSi<?> dataSi, Unit<?, Q> displayUnit) Create a new VectorN with a unit, based on a DataGridSi storage object that contains SI data. -
Method Summary
Modifier and TypeMethodDescriptionintcols()Return the number of columns.booleanQ[]Return the vector as an array of scalars.double[]Return a row-major array of SI-values for this matrix or vector.inthashCode()iterator()Create and return an iterator over the scalars in this vector in proper sequence.intReturn the number of non-zero entries in the vector, matrix or table.normL1()Return the L1-norm of this element, expressed as a quantity.normL2()Return the L2-norm of this element, expressed as a quantity.normLinf()Return the L∞-norm of this element, expressed as a quantity.normLp(int p) Return the Lp-norm of this element, expressed as a quantity.introws()Return the number of rows.double[]Return a row-major possibly UNSAFE array of SI-values for this matrix or vector.Methods inherited from class org.djunits.vecmat.def.Vector
get, isColumnVector, isRowVector, mget, msi, si, sizeMethods 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, divideEntries, getDisplayUnit, instantiateSi, instantiateSi, invertEntries, isRelative, max, mean, median, min, multiplyElements, multiplyEntries, multiplyEntries, negate, nnz, scaleBy, setDisplayUnit, subtract, subtract, sum, toString, transposeMethods 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
format, format, isAbsolute, setDisplayUnit
-
Field Details
-
dataSi
The data of the matrix, in SI unit.
-
-
Constructor Details
-
VectorN
Create a new 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
-
-
Method Details
-
iterator
Description copied from class:VectorCreate and return an iterator over the scalars in this vector in proper sequence.- Specified by:
iteratorin interfaceIterable<Q extends Quantity<Q>>- Specified by:
iteratorin classVector<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>> - Returns:
- an iterator over the scalars in this vector in proper sequence
-
getScalarArray
Description copied from class:VectorReturn the vector as an array of scalars. -
normL1
Description copied from interface:NormedReturn the L1-norm of this element, expressed as a quantity. The L1-norm is |x1| + |x2| + ... + |xn|.- Returns:
- the L1-norm of this element, expressed as a quantity
-
normL2
Description copied from interface:NormedReturn the L2-norm of this element, expressed as a quantity. The L2-norm is sqrt(x1^2 + x2^2 + ... + xn^2).- Returns:
- the L2-norm of this element, expressed as a quantity
-
normLp
Description copied from interface:NormedReturn the Lp-norm of this element, expressed as a quantity. The Ln-norm is (x1^p + x2^p + ... + xn^p)^(1/p).- Parameters:
p- the rank of the norm- Returns:
- the Lp-norm of this element, expressed as a quantity
-
normLinf
Description copied from interface:NormedReturn the L∞-norm of this element, expressed as a quantity. The L∞-norm is max(|x1|, |x2|, ..., |xn|).- Returns:
- the L∞-norm of this element, expressed as a quantity
-
rows
public int rows()Description copied from class:VectorMatrixReturn the number of rows. -
cols
public int cols()Description copied from class:VectorMatrixReturn the number of columns. -
getSiArray
public double[] getSiArray()Description copied from class:VectorMatrixReturn a row-major array of SI-values for this matrix or vector. This is guaranteed to be a safe copy. -
unsafeSiArray
public double[] unsafeSiArray()Description copied from class:VectorMatrixReturn a row-major possibly UNSAFE array of SI-values for this matrix or vector. The method might give access to the underlying data structure, so treat the data carefully. -
nonZeroCount
public int nonZeroCount()Description copied from class:VectorMatrixReturn the number of non-zero entries in the vector, matrix or table. Note that NaN and Infinity count as a non-zero element. The value -0.0 counts as 0.0. -
hashCode
public int hashCode() -
equals
-