Package org.djunits.value.vdouble.vector
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-2020 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 Type Method Description static double[]
denseArray(int size)
Return an array with all values != 0.static <U extends org.djunits.unit.Unit<U>, S extends org.djunits.value.vdouble.scalar.base.DoubleScalarInterface<U, S>>
S[]denseScalarArray(int size, Class<S> scalarClass)
Return a scalar array with all values != 0.static double[]
sparseArray(int size)
Return an array with nonzero values in every 10th place.static <U extends org.djunits.unit.Unit<U>, S extends org.djunits.value.vdouble.scalar.base.DoubleScalarInterface<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 org.djunits.unit.Unit<U>, S extends org.djunits.value.vdouble.scalar.base.DoubleScalarInterface<U, S>> S[] denseScalarArray(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 org.djunits.unit.Unit<U>, S extends org.djunits.value.vdouble.scalar.base.DoubleScalarInterface<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 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
-