Class FloatMatrix

java.lang.Object
org.djunits.value.vfloat.matrix.base.FloatMatrix

public final class FloatMatrix
extends Object
FloatMatrix utility methods, e.g., for creating FloatMatrixs 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 Details

    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(float[][] valuesInUnit, U unit, StorageType storageType)
      Instantiate the FloatMatrix based on its unit. Rigid check on types for the compiler. The float array is of the form f[rows][columns] so each value can be found with f[row][column].
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      valuesInUnit - float[][]; the values in the given unit
      unit - U; the unit in which the values are expressed and displayed
      storageType - StorageType; whether the matrix is SPARSE or DENSE
      Returns:
      M; an instantiated FloatMatrix with the values expressed in their unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(float[][] valuesInUnit, U unit, StorageType storageType, Class<M> matrixClass)
      Instantiate the FloatMatrix 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 float array is of the form f[rows][columns] so each value can be found with f[row][column].
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      valuesInUnit - float[][]; the values in the given unit
      unit - U; the unit in which the values are expressed and displayed
      storageType - StorageType; whether the matrix is SPARSE or DENSE
      matrixClass - Class<M>; the class of the matrix to instantiate
      Returns:
      M; an instantiated FloatMatrix with the values expressed in their unit
    • instantiateSI

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiateSI​(float[][] valuesSI, U displayUnit, StorageType storageType)
      Instantiate the FloatMatrix based on its unit. Rigid check on types for the compiler. The float array is of the form f[rows][columns] so each value can be found with f[row][column].
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      valuesSI - float[][]; the values in the SI unit
      displayUnit - U; the unit in which the values will be displayed
      storageType - StorageType; whether the matrix is SPARSE or DENSE
      Returns:
      M; an instantiated FloatMatrix with the SI values and display unit
    • instantiateSI

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiateSI​(float[][] valuesSI, U displayUnit, StorageType storageType, Class<M> matrixClass)
      Instantiate the FloatMatrix 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 float array is of the form f[rows][columns] so each value can be found with f[row][column].
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      valuesSI - float[][]; the values in the SI unit
      displayUnit - U; the unit in which the values will be displayed
      storageType - StorageType; whether the matrix is SPARSE or DENSE
      matrixClass - Class<M>; the class of the matrix to instantiate
      Returns:
      M; an instantiated FloatMatrix with the SI values and display unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(FloatMatrixData values, U unit)
      Instantiate the Mutable FloatMatrix based on its unit. Rigid check on types for the compiler.
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - FloatMatrixData; the values
      unit - U; the unit in which the values are expressed
      Returns:
      M; an instantiated mutable FloatMatrix with the values expressed in their unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(FloatMatrixData values, U unit, Class<M> matrixClass)
      Instantiate the Mutable FloatMatrix 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 unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - FloatMatrixData; the values
      unit - U; the unit in which the values are expressed
      matrixClass - Class<M>; the class of the matrix to instantiate
      Returns:
      M; an instantiated mutable FloatMatrix with the values expressed in their unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(S[][] values, U displayUnit, StorageType storageType)
      Construct a new Relative Immutable Float Matrix. Rigid check on types for the compiler. The FloatScalar array is of the form fs[rows][columns] so each value can be found with fs[row][column].
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - S[][]; the values of the entries in the new Relative Immutable Float Matrix
      displayUnit - U; the unit in which the values will be displayed
      storageType - StorageType; the data type to use (e.g., DENSE or SPARSE)
      Returns:
      M; an instantiated mutable FloatMatrix with the values expressed in their unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(S[][] values, U displayUnit, StorageType storageType, Class<M> matrixClass)
      Construct a new Relative Immutable Float Matrix. Rigid check on types for the compiler. The class for the matrix is explicitly provided, e.g., for user-defined matrix classes. The FloatScalar array is of the form fs[rows][columns] so each value can be found with fs[row][column].
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - S[][]; the values of the entries in the new Relative Immutable Float Matrix
      displayUnit - U; the unit in which the values will be displayed
      storageType - 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 FloatMatrix with the values expressed in their unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(Collection<FloatSparseValue<U,​S>> values, int rows, int cols, U displayUnit, StorageType storageType)
      Construct a new Relative Immutable Float Matrix. Rigid check on types for the compiler.
      Type Parameters:
      U - the unit type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - Collection<FloatSparseValue<U, S>>; the (sparse [X, Y, SI]) values to store
      rows - int; the number of rows of the matrix
      cols - int; the number of columns of the matrix
      displayUnit - U; the unit in which the values will be displayed
      storageType - StorageType; the data type to use (e.g., DENSE or SPARSE)
      Returns:
      M; an instantiated mutable FloatMatrix with the values expressed in their unit
    • instantiate

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiate​(Collection<FloatSparseValue<U,​S>> values, int rows, int cols, U displayUnit, StorageType storageType, Class<M> matrixClass)
      Construct a new Relative Immutable Float 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 type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - Collection<FloatSparseValue<U, S>>; the (sparse [X, Y, SI]) values to store
      rows - int; the number of rows of the matrix
      cols - int; the number of columns of the matrix
      displayUnit - U; the unit in which the values will be displayed
      storageType - 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 FloatMatrix with the values expressed in their unit
    • instantiateAnonymous

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiateAnonymous​(FloatMatrixData values, Unit<?> unit)
      Instantiate the Immutable FloatMatrix 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 type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - FloatMatrixData; the values
      unit - Unit<?>; the unit in which the values are expressed
      Returns:
      M; an instantiated FloatMatrix with the values expressed in their unit
    • instantiateAnonymous

      public static <U extends Unit<U>,​ S extends FloatScalarInterface<U,​ S>,​ V extends FloatVectorInterface<U,​ S,​ V>,​ M extends FloatMatrixInterface<U,​ S,​ V,​ M>> M instantiateAnonymous​(FloatMatrixData values, Unit<?> unit, Class<M> matrixClass)
      Instantiate the Immutable FloatMatrix 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 type
      S - the corresponding scalar type
      V - the corresponding vector type
      M - the corresponding matrix type
      Parameters:
      values - FloatMatrixData; the values
      unit - Unit<?>; the unit in which the values are expressed
      matrixClass - Class<M>; the class of the matrix to instantiate
      Returns:
      M; an instantiated FloatMatrix with the values expressed in their unit