Class DoubleMatrix
java.lang.Object
org.djunits.value.vdouble.matrix.base.DoubleMatrix
public final class DoubleMatrix extends Object
DoubleMatrix utility methods, e.g., for creating DoubleMatrixs from different types of data.
Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Method Summary
Modifier and Type Method Description static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(double[][] valuesInUnit, U unit, StorageType storageType)
Instantiate the DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(double[][] valuesInUnit, U unit, StorageType storageType, Class<M> matrixClass)
Instantiate the DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(Collection<DoubleSparseValue<U,S>> values, int rows, int cols, U displayUnit, StorageType storageType)
Construct a new Relative Immutable Double Matrix.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(Collection<DoubleSparseValue<U,S>> values, int rows, int cols, U displayUnit, StorageType storageType, Class<M> matrixClass)
Construct a new Relative Immutable Double Matrix.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(DoubleMatrixData values, U unit)
Instantiate the Mutable DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(DoubleMatrixData values, U unit, Class<M> matrixClass)
Instantiate the Mutable DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(S[][] values, U displayUnit, StorageType storageType)
Construct a new Relative Immutable Double Matrix.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
Minstantiate(S[][] values, U displayUnit, StorageType storageType, Class<M> matrixClass)
Construct a new Relative Immutable Double Matrix.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
MinstantiateAnonymous(DoubleMatrixData values, Unit<?> unit)
Instantiate the Immutable DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
MinstantiateAnonymous(DoubleMatrixData values, Unit<?> unit, Class<M> matrixClass)
Instantiate the Immutable DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
MinstantiateSI(double[][] valuesSI, U displayUnit, StorageType storageType)
Instantiate the DoubleMatrix based on its unit.static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>>
MinstantiateSI(double[][] valuesSI, U displayUnit, StorageType storageType, Class<M> matrixClass)
Instantiate the DoubleMatrix based on its unit.
-
Method Details
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(double[][] valuesInUnit, U unit, StorageType storageType)Instantiate the DoubleMatrix based on its unit. Rigid check on types for the compiler. The double array is of the form d[rows][columns] so each value can be found with d[row][column].- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
valuesInUnit
- double[][]; the values in the given unitunit
- U; the unit in which the values are expressed and displayedstorageType
- StorageType; whether the matrix is SPARSE or DENSE- Returns:
- M; an instantiated DoubleMatrix with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(double[][] valuesInUnit, U unit, StorageType storageType, Class<M> matrixClass)Instantiate the DoubleMatrix based on its unit. Rigid check on types for the compiler. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes. The double array is of the form d[rows][columns] so each value can be found with d[row][column].- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
valuesInUnit
- double[]; the values in the given unitunit
- U; the unit in which the values are expressed and displayedstorageType
- StorageType; whether the matrix is SPARSE or DENSEmatrixClass
- Class<M>; the class of the matrix to instantiate- Returns:
- M; an instantiated DoubleMatrix with the values expressed in their unit
-
instantiateSI
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiateSI(double[][] valuesSI, U displayUnit, StorageType storageType)Instantiate the DoubleMatrix based on its unit. Rigid check on types for the compiler. The double array is of the form d[rows][columns] so each value can be found with d[row][column].- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
valuesSI
- double[][]; the values in the SI unit.displayUnit
- U; the unit in which the values will be displayedstorageType
- StorageType; whether the matrix is SPARSE or DENSE- Returns:
- M; an instantiated DoubleMatrix with the SI values and display unit
-
instantiateSI
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiateSI(double[][] valuesSI, U displayUnit, StorageType storageType, Class<M> matrixClass)Instantiate the DoubleMatrix based on its unit. Rigid check on types for the compiler. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes. The double array is of the form d[rows][columns] so each value can be found with d[row][column].- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
valuesSI
- double[][]; the values in the SI unitdisplayUnit
- U; the unit in which the values will be displayedstorageType
- StorageType; whether the matrix is SPARSE or DENSEmatrixClass
- Class<M>; the class of the matrix to instantiate- Returns:
- M; an instantiated DoubleMatrix with the SI values and display unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(DoubleMatrixData values, U unit)Instantiate the Mutable DoubleMatrix based on its unit. Rigid check on types for the compiler.- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
values
- DoubleMatrixData; the valuesunit
- U; the unit in which the values are expressed- Returns:
- M; an instantiated mutable DoubleMatrix with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(DoubleMatrixData values, U unit, Class<M> matrixClass)Instantiate the Mutable DoubleMatrix based on its unit. Rigid check on types for the compiler. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes.- Type Parameters:
U
- the unitS
- the corresponding scalar typeV
- the corresponding vector typeM
- the matrix type- Parameters:
values
- DoubleMatrixData; the valuesunit
- U; the unit in which the values are expressedmatrixClass
- Class<M>; the class of the matrix to instantiate- Returns:
- M; an instantiated mutable DoubleMatrix with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(S[][] values, U displayUnit, StorageType storageType)Construct a new Relative Immutable Double Matrix. Rigid check on types for the compiler. The scalar array is of the form s[rows][columns] so each value can be found with s[row][column].- Type Parameters:
U
- the unitS
- the corresponding scalar typeV
- the corresponding vector typeM
- the matrix type- Parameters:
values
- S[][]; the values of the entries in the new Relative Immutable Double MatrixdisplayUnit
- U; the unit in which the values will be displayedstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)- Returns:
- M; an instantiated mutable DoubleMatrix with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(S[][] values, U displayUnit, StorageType storageType, Class<M> matrixClass)Construct a new Relative Immutable Double Matrix. Rigid check on types for the compiler. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes. The scalar array is of the form s[rows][columns] so each value can be found with s[row][column].- Type Parameters:
U
- the unitS
- the corresponding scalar typeV
- the corresponding vector typeM
- the matrix type- Parameters:
values
- S[][]; the values of the entries in the new Relative Immutable Double MatrixdisplayUnit
- U; the unit in which the values will be displayedstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)matrixClass
- Class<M>; the class of the matrix to instantiate- Returns:
- M; an instantiated mutable DoubleMatrix with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(Collection<DoubleSparseValue<U,S>> values, int rows, int cols, U displayUnit, StorageType storageType)Construct a new Relative Immutable Double Matrix. Rigid check on types for the compiler.- Type Parameters:
U
- the unitS
- the corresponding scalar typeV
- the corresponding vector typeM
- the matrix type- Parameters:
values
- Collection<DoubleSparseValue<U, S>>; the (sparse [X, Y, SI]) values to storerows
- int; the number of rows of the matrixcols
- int; the number of columns of the matrixdisplayUnit
- U; the unit in which the values will be displayedstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)- Returns:
- M; an instantiated mutable DoubleMatrix with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiate(Collection<DoubleSparseValue<U,S>> values, int rows, int cols, U displayUnit, StorageType storageType, Class<M> matrixClass)Construct a new Relative Immutable Double Matrix. Rigid check on types for the compiler. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes.- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
values
- Collection<DoubleSparseValue<U, S>>; the (sparse [X, Y, SI]) values to storerows
- int; the number of rows of the matrixcols
- int; the number of columns of the matrixdisplayUnit
- U; the unit in which the values will be displayedstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)matrixClass
- Class<M>; the class of the matrix to instantiate- Returns:
- M; an instantiated mutable DoubleMatrix with the values expressed in their unit
-
instantiateAnonymous
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiateAnonymous(DoubleMatrixData values, Unit<?> unit)Instantiate the Immutable DoubleMatrix based on its unit. Loose check for types on the compiler. This allows the unit to be specified as a Unit<?> type.
Note that it is possible to make mistakes with anonymous units.- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
values
- DoubleMatrixData; the valuesunit
- Unit<?>; the unit in which the values are expressed- Returns:
- M; an instantiated DoubleMatrix with the values expressed in their unit
-
instantiateAnonymous
public static <U extends Unit<U>, S extends DoubleScalarInterface<U, S>, V extends DoubleVectorInterface<U, S, V>, M extends DoubleMatrixInterface<U, S, V, M>> M instantiateAnonymous(DoubleMatrixData values, Unit<?> unit, Class<M> matrixClass)Instantiate the Immutable DoubleMatrix based on its unit. Loose check for types on the compiler. This allows the unit to be specified as a Unit<?> type. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes.
Note that it is possible to make mistakes with anonymous units.- Type Parameters:
U
- the unit typeS
- the corresponding scalar typeV
- the corresponding vector typeM
- the corresponding matrix type- Parameters:
values
- DoubleMatrixData; the valuesunit
- Unit<?>; the unit in which the values are expressedmatrixClass
- Class<M>; the class of the matrix to instantiate- Returns:
- M; an instantiated DoubleMatrix with the values expressed in their unit
-