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 type
U - the unit type
V - the vector type
SI - 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>
Direct Known Subclasses:
Vector1, Vector2, Vector3, VectorN

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 Details

    • Vector

      public Vector(U 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
    • 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,U>>
      Returns:
      an iterator over the scalars in this vector in proper sequence