Class DOUBLEVECTOR

java.lang.Object
org.djunits.value.vdouble.vector.DOUBLEVECTOR

public final class DOUBLEVECTOR extends Object
DOUBLEVECTOR for creating different test vectors.

Copyright (c) 2019-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.

Author:
Alexander Verbraeck
  • Method Details

    • denseArray

      public static double[] denseArray(int size)
      Return an array with all values != 0.
      Parameters:
      size - the number of cells
      Returns:
      an array with all nonzero values
    • sparseArray

      public static double[] sparseArray(int size)
      Return an array with nonzero values in every 10th place.
      Parameters:
      size - the number of cells
      Returns:
      an array with only nonzero values on the diagonal
    • denseScalarArray

      public static <U extends Unit<U>, S extends DoubleScalar<U, S>> S[] denseScalarArray(int size, Class<S> scalarClass)
      Return a scalar array with all values != 0.
      Type Parameters:
      U - the unit type
      S - the scalar type
      Parameters:
      size - the number of cells
      scalarClass - the class of scalars to use
      Returns:
      an array with all nonzero values
    • sparseScalarArray

      public static <U extends Unit<U>, S extends DoubleScalar<U, S>> S[] sparseScalarArray(int size, Class<S> scalarClass)
      Return a scalar array with nonzero values in every 10th place.
      Type Parameters:
      U - the unit type
      S - the scalar type
      Parameters:
      size - the number of cells
      scalarClass - the class of scalars to use
      Returns:
      an array with only nonzero values on the diagonal