Package org.djunits.value.vdouble.vector
Class DOUBLEVECTOR
java.lang.Object
org.djunits.value.vdouble.vector.DOUBLEVECTOR
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 Summary
Modifier and TypeMethodDescriptionstatic double[]
denseArray
(int size) Return an array with all values !static <U extends Unit<U>,
S extends DoubleScalar<U, S>>
S[]denseScalarArray
(int size, Class<S> scalarClass) Return a scalar array with all values !static double[]
sparseArray
(int size) Return an array with nonzero values in every 10th place.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.
-
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[] denseScalarArrayS>> (int size, Class<S> scalarClass) Return a scalar array with all values != 0.- Type Parameters:
U
- the unit typeS
- the scalar type- Parameters:
size
- the number of cellsscalarClass
- 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[] sparseScalarArrayS>> (int size, Class<S> scalarClass) Return a scalar array with nonzero values in every 10th place.- Type Parameters:
U
- the unit typeS
- the scalar type- Parameters:
size
- the number of cellsscalarClass
- the class of scalars to use- Returns:
- an array with only nonzero values on the diagonal
-