Interface FloatMatrixInterface<U extends Unit<U>,​S extends FloatScalarInterface<U,​S>,​V extends FloatVectorInterface<U,​S,​V>,​M extends FloatMatrixInterface<U,​S,​V,​M>>

Type Parameters:
U - the unit
S - the generic scalar type belonging to U
V - the vector type belonging to the matrix type
M - the generic matrix type
All Superinterfaces:
Cloneable, IndexedValue<U,​S,​M>, Matrix<U,​S,​V,​M>, Serializable, Value<U,​M>, ValueFunctions<U,​M>
All Known Implementing Classes:
AbstractFloatMatrix, AbstractFloatMatrixAbs, AbstractFloatMatrixRel, AbstractFloatMatrixRelWithAbs, FloatAbsoluteTemperatureMatrix, FloatAbsorbedDoseMatrix, FloatAccelerationMatrix, FloatAmountOfSubstanceMatrix, FloatAngleMatrix, FloatAngularAccelerationMatrix, FloatAngularVelocityMatrix, FloatAreaMatrix, FloatCatalyticActivityMatrix, FloatDensityMatrix, FloatDimensionlessMatrix, FloatDirectionMatrix, FloatDurationMatrix, FloatElectricalCapacitanceMatrix, FloatElectricalChargeMatrix, FloatElectricalConductanceMatrix, FloatElectricalCurrentMatrix, FloatElectricalInductanceMatrix, FloatElectricalPotentialMatrix, FloatElectricalResistanceMatrix, FloatEnergyMatrix, FloatEquivalentDoseMatrix, FloatFlowMassMatrix, FloatFlowVolumeMatrix, FloatForceMatrix, FloatFrequencyMatrix, FloatIlluminanceMatrix, FloatLengthMatrix, FloatLinearDensityMatrix, FloatLuminousFluxMatrix, FloatLuminousIntensityMatrix, FloatMagneticFluxDensityMatrix, FloatMagneticFluxMatrix, FloatMassMatrix, FloatMomentumMatrix, FloatPositionMatrix, FloatPowerMatrix, FloatPressureMatrix, FloatRadioActivityMatrix, FloatSIMatrix, FloatSolidAngleMatrix, FloatSpeedMatrix, FloatTemperatureMatrix, FloatTimeMatrix, FloatTorqueMatrix, FloatVolumeMatrix

public interface FloatMatrixInterface<U extends Unit<U>,​S extends FloatScalarInterface<U,​S>,​V extends FloatVectorInterface<U,​S,​V>,​M extends FloatMatrixInterface<U,​S,​V,​M>>
extends Matrix<U,​S,​V,​M>
Interface for the FloatMatrix classes, specifically defining the methods that deal with float values.

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

Author:
Alexander Verbraeck, Peter Knoppers
  • Method Details

    • getSI

      float getSI​(int row, int column) throws ValueRuntimeException
      Retrieve the value stored at a specified row and column in the standard SI unit.
      Parameters:
      row - int; row of the value to retrieve
      column - int; column of the value to retrieve
      Returns:
      float; value at position row, column in the standard SI unit
      Throws:
      ValueRuntimeException - when row or column out of range (row < 0 or row >= rows() or column < 0 or column >= columns())
    • getInUnit

      float getInUnit​(int row, int column) throws ValueRuntimeException
      Retrieve the value stored at a specified row and column in the original unit.
      Parameters:
      row - int; row of the value to retrieve
      column - int; column of the value to retrieve
      Returns:
      float; value at position row, column in the original unit
      Throws:
      ValueRuntimeException - when row or column out of range (row < 0 or row >= rows() or column < 0 or column >= columns())
    • getInUnit

      float getInUnit​(int row, int column, U targetUnit) throws ValueRuntimeException
      Retrieve the value stored at a specified row and column converted into a specified unit.
      Parameters:
      row - int; row of the value to retrieve
      column - int; column of the value to retrieve
      targetUnit - U; the unit for the result
      Returns:
      float; value at position row, column converted into the specified unit
      Throws:
      ValueRuntimeException - when row or column out of range (row < 0 or row >= rows() or column < 0 or column >= columns())
    • getRowSI

      float[] getRowSI​(int row) throws ValueRuntimeException
      Retrieve a row from the matrix as an array of float.
      Parameters:
      row - int; row of the values to retrieve
      Returns:
      S[]; the row as a float array
      Throws:
      ValueRuntimeException - in case row is out of bounds
    • getColumnSI

      float[] getColumnSI​(int column) throws ValueRuntimeException
      Retrieve a column from the matrix as an array of float.
      Parameters:
      column - int; column of the values to retrieve
      Returns:
      S[]; the column as a float array
      Throws:
      ValueRuntimeException - in case column is out of bounds
    • getDiagonalSI

      float[] getDiagonalSI() throws ValueRuntimeException
      Retrieve the main diagonal of the matrix as an array of float.
      Returns:
      V; the main diagonal as a float array
      Throws:
      ValueRuntimeException - in case the matrix is not square
    • getValuesSI

      float[][] getValuesSI()
      Create a dense float[][] array filled with the values in the standard SI unit.
      Returns:
      float[][]; array of values in the standard SI unit
    • getValuesInUnit

      float[][] getValuesInUnit()
      Create a dense float[][] array filled with the values in the original unit.
      Returns:
      float[][]; the values in the original unit
    • getValuesInUnit

      float[][] getValuesInUnit​(U targetUnit)
      Create a dense float[][] array filled with the values converted into a specified unit.
      Parameters:
      targetUnit - U; the unit into which the values are converted for use
      Returns:
      float[][]; the values converted into the specified unit
    • determinant

      float determinant() throws ValueRuntimeException
      Compute the determinant of the matrix.
      Returns:
      float; the determinant of the matrix
      Throws:
      ValueRuntimeException - when matrix is neither sparse, nor dense, or not square
    • setSI

      void setSI​(int row, int column, float valueSI) throws ValueRuntimeException
      Set the value, specified in the standard SI unit, at the specified position.
      Parameters:
      row - int; row of the value to set
      column - int; column of the value to set
      valueSI - float; the value, specified in the standard SI unit
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • setInUnit

      void setInUnit​(int row, int column, float valueInUnit) throws ValueRuntimeException
      Set the value, specified in the (current) display unit, at the specified position.
      Parameters:
      row - int; row of the value to set
      column - int; column of the value to set
      valueInUnit - float; the value, specified in the (current) display unit
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • setInUnit

      void setInUnit​(int row, int column, float valueInUnit, U valueUnit) throws ValueRuntimeException
      Set the value, specified in the valueUnit, at the specified position.
      Parameters:
      row - int; row of the value to set
      column - int; column of the value to set
      valueInUnit - float; the value, specified in the (current) display unit
      valueUnit - U; the unit in which the valueInUnit is expressed
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • set

      void set​(int row, int column, S value) throws ValueRuntimeException
      Set the scalar value at the specified position.
      Parameters:
      row - int; row of the value to set
      column - int; column of the value to set
      value - S; the value to set
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • assign

      M assign​(FloatFunction floatFunction)
      Execute a function on a cell by cell basis. Note: May be expensive when used on sparse data.
      Parameters:
      floatFunction - FloatFunction; the function to apply
      Returns:
      M; this updated matrix
    • instantiateMatrix

      M instantiateMatrix​(FloatMatrixData fmd, U displayUnit)
      Instantiate a new matrix of the class of this matrix. This can be used instead of the FloatMatrix.instiantiate() methods in case another matrix of this class is known. The method is faster than FloatMatrix.instantiate, and it will also work if the matrix is user-defined.
      Parameters:
      fmd - FloatMatrixData; the data used to instantiate the matrix
      displayUnit - U; the display unit of the matrix
      Returns:
      V; a matrix of the correct type
    • instantiateVector

      V instantiateVector​(FloatVectorData fvd, U displayUnit)
      Instantiate a new vector of the class of this matrix. This can be used instead of the FloatVector.instiantiate() methods in case another matrix of this class is known. The method is faster than FloatVector.instantiate, and it will also work if the matrix and/or vector are user-defined.
      Parameters:
      fvd - FloatVectorData; the data used to instantiate the vector
      displayUnit - U; the display unit of the vector
      Returns:
      V; a vector of the correct type
    • instantiateScalarSI

      S instantiateScalarSI​(float valueSI, U displayUnit)
      Instantiate a new scalar for the class of this matrix. This can be used instead of the FloatScalar.instiantiate() methods in case a matrix of this class is known. The method is faster than FloatScalar.instantiate, and it will also work if the matrix and/or scalar are user-defined.
      Parameters:
      valueSI - float; the SI value of the scalar
      displayUnit - U; the unit in which the value will be displayed
      Returns:
      S; a scalar of the correct type, belonging to the matrix type