Package org.djunits.vecmat.def
Class Vector<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>,V extends Vector<Q,U,V,SI,H>,SI extends Vector<SIQuantity,SIUnit,SI,?,?>,H extends Vector<?,?,?,?,?>>
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>
- Type Parameters:
Q- the quantity typeU- the unit typeV- the vector typeSI- the vector type with generics <SIQuantity, SIUnit<H- the generic vector type with generics <?, ?< for Hadamard operations
- All Implemented Interfaces:
Serializable,Iterable<Q>,Additive<V>,Scalable<V>,Value<U,,V> Hadamard<H,,SI> Normed<Q,U>
public abstract class Vector<Q extends Quantity<Q,U>,U extends UnitInterface<U,Q>,V extends Vector<Q,U,V,SI,H>,SI extends Vector<SIQuantity,SIUnit,SI,?,?>,H extends Vector<?,?,?,?,?>>
extends Matrix<Q,U,V,SI,H>
implements Iterable<Q>, Normed<Q,U>
Vector contains the contract for Vector classes. In addition, Vector classes can implement other interfaces as well, such
as VectorTransposable.
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 TypeMethodDescriptionget(int index) Retrieve a value from the vector.abstract Q[]Return the vector as an array of scalars.abstract booleanReturn whether this vector is a column vector.iterator()Create and return an iterator over the scalars in this vector in proper sequence.mget(int mIndex) Retrieve a value from the vector, based on a 1-valued index.doublemsi(int mIndex) Retrieve an si-value from the vector, based on a 1-valued index.abstract doublesi(int index) Retrieve an si-value from the vector.abstract intsize()Retrieve the size of the vector.Methods 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, cols, divideElements, divideElements, get, getColumnScalars, getColumnSi, getColumnVector, getDisplayUnit, getRowScalars, getRowSi, getRowVector, getScalarGrid, instantiateSi, instantiateSi, invertElements, isRelative, max, mcheckCol, mcheckRow, mean, median, mget, mgetColumnScalars, mgetColumnSi, mgetColumnVector, mgetRowScalars, mgetRowSi, mgetRowVector, min, mode, msi, multiplyElements, multiplyElements, multiplyElements, negate, rows, scaleBy, setDisplayUnit, si, si, subtract, subtract, sum, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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.vecmat.operations.Normed
norm, normL1, normL2, normLinf, normLpMethods inherited from interface org.djunits.value.Value
isAbsolute, setDisplayUnit
-
Constructor Details
-
Vector
Create a new Vector with a unit, as an extension of Matrix.- Parameters:
displayUnit- the display unit to use
-
-
Method Details
-
size
public abstract int size()Retrieve the size of the vector.- Returns:
- the size of the vector
-
isColumnVector
public abstract boolean isColumnVector()Return whether this vector is a column vector.- Returns:
- whether this vector is a column vector
-
si
Retrieve an si-value from the vector.- 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
-
msi
Retrieve an si-value from the vector, based on a 1-valued index.- Parameters:
mIndex- the index (1-based) to retrieve the value from- Returns:
- the value as a Scalar
- Throws:
IndexOutOfBoundsException- in case index is out of bounds
-
get
Retrieve a value from the vector.- 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
-
mget
Retrieve a value from the vector, based on a 1-valued index.- Parameters:
mIndex- the index (1-based) to retrieve the value from- Returns:
- the value as a Scalar
- Throws:
IndexOutOfBoundsException- in case index is out of bounds
-
getScalarArray
Return the vector as an array of scalars.- Returns:
- the vector as an array of scalars
-
iterator
Create and return an iterator over the scalars in this vector in proper sequence.
-