Class Vector2.Col<Q extends Quantity<Q>>

Type Parameters:
Q - the quantity type
All Implemented Interfaces:
Serializable, Iterable<Q>, Additive<Vector2.Col<Q>>, Scalable<Vector2.Col<Q>>, Value<Vector2.Col<Q>,Q>, Vector.Col<Vector2.Col<Q>,Q>, Hadamard<Vector2.Col<?>,Vector2.Col<SIQuantity>>, Normed<Q>
Enclosing class:
Vector2<Q extends Quantity<Q>,V extends Vector2<Q,V,SI,H,VT>,SI extends Vector2<SIQuantity,SI,?,?,?>,H extends Vector2<?,?,?,?,?>,VT extends Vector2<Q,VT,?,?,V>>

public static class Vector2.Col<Q extends Quantity<Q>> extends Vector2<Q,Vector2.Col<Q>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q>> implements Vector.Col<Vector2.Col<Q>,Q>
Vector2.Col implements a column vector with two 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:
  • Constructor Details

    • Col

      public Col(double xSi, double ySi, Unit<?,Q> displayUnit)
      Create a new 2 column vector with a display unit.
      Parameters:
      xSi - the x-value expressed in the SI unit
      ySi - the y-value expressed in the SI unit
      displayUnit - the display unit to use
  • Method Details

    • isColumnVector

      public boolean isColumnVector()
      Description copied from class: Vector2
      Return whether this vector is a column vector.
      Specified by:
      isColumnVector in class Vector2<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q extends Quantity<Q>>>
      Returns:
      whether this vector is a column vector
    • rows

      public int rows()
      Description copied from class: VectorMatrix
      Return the number of rows.
      Specified by:
      rows in class VectorMatrix<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q extends Quantity<Q>>>
      Returns:
      the number of rows
    • cols

      public int cols()
      Description copied from class: VectorMatrix
      Return the number of columns.
      Specified by:
      cols in class VectorMatrix<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q extends Quantity<Q>>>
      Returns:
      the number of columns
    • instantiateSi

      protected Vector2.Col<Q> instantiateSi(double xSi, double ySi)
      Description copied from class: Vector2
      Return a column or row vector with x and y values in SI or BASE units.
      Specified by:
      instantiateSi in class Vector2<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q extends Quantity<Q>>>
      Parameters:
      xSi - the x value in SI or BASE units
      ySi - the y value in SI or BASE units
      Returns:
      a new column or row vector with adapted x and y values
    • instantiateSi

      public Vector2.Col<SIQuantity> instantiateSi(double[] siNew, SIUnit siUnit)
      Description copied from class: VectorMatrix
      Return a new vector or matrix in SI-units with the given SI or BASE values.
      Specified by:
      instantiateSi in class VectorMatrix<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q extends Quantity<Q>>>
      Parameters:
      siNew - the values for the new vector or matrix in row-major format
      siUnit - the new unit for the new vector or matrix
      Returns:
      a new matrix with the provided SI or BASE values
    • transpose

      public Vector2.Row<Q> transpose()
      Description copied from class: VectorMatrix
      Return a transposed vector or matrix, where rows and columns have been swapped.
      Specified by:
      transpose in class VectorMatrix<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<Q extends Quantity<Q>>>
      Returns:
      a transposed vector or matrix, where rows and columns have been swapped
    • multiply

      public Matrix2x2<SIQuantity> multiply(Vector2.Row<?> otherVec)
      Multiply this column vector with a row vector, resulting in a square matrix.
      Parameters:
      otherVec - the row vector to multiply with
      Returns:
      the resulting matrix from the multiplication
    • multiplyEntries

      public Vector2.Col<SIQuantity> multiplyEntries(Quantity<?> quantity)
      Description copied from interface: Hadamard
      Multiply the entries of this vector, matrix or table by the given quantity.
      Specified by:
      multiplyEntries in interface Hadamard<Vector2.Col<?>,Vector2.Col<SIQuantity>>
      Overrides:
      multiplyEntries in class VectorMatrix<Q extends Quantity<Q>,Vector2.Col<Q extends Quantity<Q>>,Vector2.Col<SIQuantity>,Vector2.Col<?>,Vector2.Row<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

      public static <Q extends Quantity<Q>> Vector2.Col<Q> of(double xInUnit, double yInUnit, Unit<?,Q> unit)
      Create a Vector2.Col without needing generics.
      Type Parameters:
      Q - the quantity type
      Parameters:
      xInUnit - the x-value expressed in the unit
      yInUnit - the y-value expressed in the unit
      unit - the unit of the data, which will also be used as the display unit
      Returns:
      a new Vector2.Col with a unit
    • of

      public static <Q extends Quantity<Q>> Vector2.Col<Q> of(Q x, Q y)
      Create a Vector2.Col without needing generics. The display unit will be taken from the x-quantity.
      Type Parameters:
      Q - the quantity type
      Parameters:
      x - the x-value expressed as a quantity
      y - the y-value expressed as a quantity
      Returns:
      a new Vector2.Col with a unit
    • of

      public static <Q extends Quantity<Q>> Vector2.Col<Q> of(double[] dataInUnit, Unit<?,Q> unit)
      Create a Vector2.Col without needing generics.
      Type Parameters:
      Q - the quantity type
      Parameters:
      dataInUnit - the vector entries expressed as an array in the unit
      unit - the unit of the data, which will also be used as the display unit
      Returns:
      a new Vector2.Col with a unit
    • ofSi

      public static <Q extends Quantity<Q>> Vector2.Col<Q> ofSi(double[] dataSi, Unit<?,Q> displayUnit)
      Create a Vector2.Col without needing generics.
      Type Parameters:
      Q - the quantity type
      Parameters:
      dataSi - the vector entries expressed as an array in the SI units
      displayUnit - the display unit to use
      Returns:
      a new Vector2.Col with a unit
    • ofSi

      public static <Q extends Quantity<Q>> Vector2.Col<Q> ofSi(double xSi, double ySi, Unit<?,Q> displayUnit)
      Create a Vector2.Col without needing generics.
      Type Parameters:
      Q - the quantity type
      Parameters:
      xSi - the x vector entry expressed in the SI unit
      ySi - the y vector entry expressed in the SI unit
      displayUnit - the display unit to use
      Returns:
      a new Vector2.Col with a unit
    • of

      public static <Q extends Quantity<Q>> Vector2.Col<Q> of(Q[] data)
      Create a Vector2.Col without needing generics. The display unit will be taken from the first quantity in the array.
      Type Parameters:
      Q - the quantity type
      Parameters:
      data - the vector entries expressed as an array of quantities
      Returns:
      a new Vector2.Col with a unit
    • as

      public <TQ extends Quantity<TQ>> Vector2.Col<TQ> as(Unit<?,TQ> targetUnit) throws IllegalArgumentException
      Return 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.
      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