Class Vector<Q extends Quantity<Q>,V extends Vector<Q,V,SI,H,VT>,SI extends Vector<SIQuantity,SI,?,?,?>,H extends Vector<?,?,?,?,?>,VT extends Vector<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>
Type Parameters:
Q - the quantity type
V - the vector type
SI - the vector type with generics <SIQuantity, SIUnit<
H - the generic vector type with generics <?, ?< for Hadamard operations
VT - 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:
Vector1, Vector2, Vector3, VectorN

public abstract class Vector<Q extends Quantity<Q>,V extends Vector<Q,V,SI,H,VT>,SI extends Vector<SIQuantity,SI,?,?,?>,H extends Vector<?,?,?,?,?>,VT extends Vector<Q,VT,?,?,V>> extends VectorMatrix<Q,V,SI,H,VT> implements Iterable<Q>, Normed<Q>
Vector contains the contract for Vector classes that contain relative quantity values.

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 Details

    • Vector

      public Vector(Unit<?,Q> displayUnit)
      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
    • isRowVector

      public boolean isRowVector()
      Return whether this vector is a row vector.
      Returns:
      whether this vector is a row vector
    • si

      public abstract double si(int index) throws IndexOutOfBoundsException
      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

      public double msi(int mIndex) throws IndexOutOfBoundsException
      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

      public Q get(int index) throws IndexOutOfBoundsException
      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

      public Q mget(int mIndex) throws IndexOutOfBoundsException
      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

      public abstract Q[] getScalarArray()
      Return the vector as an array of scalars.
      Returns:
      the vector as an array of scalars
    • iterator

      public abstract Iterator<Q> iterator()
      Create and return an iterator over the scalars in this vector in proper sequence.
      Specified by:
      iterator in interface Iterable<Q extends Quantity<Q>>
      Returns:
      an iterator over the scalars in this vector in proper sequence