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 unitS
- the generic scalar type belonging to UV
- the vector type belonging to the matrix typeM
- 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
,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
,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-2019 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.djunits.value.base.Matrix
Matrix.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends Scalar<AU,A>,AV extends Vector.Abs<AU,A,AV,RU,R,RV>,AM extends Matrix.Abs<AU,A,AV,AM,RU,R,RV,RM>,RU extends Unit<RU>,R extends Scalar<RU,R>,RV extends Vector.RelWithAbs<AU,A,AV,RU,R,RV>,RM extends Matrix.RelWithAbs<AU,A,AV,AM,RU,R,RV,RM>>, Matrix.Rel<U extends Unit<U>,S extends Scalar<U,S>,V extends Vector<U,S,V>,RM extends Matrix.Rel<U,S,V,RM>>, Matrix.RelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends Scalar<AU,A>,AV extends Vector.Abs<AU,A,AV,RU,R,RV>,AM extends Matrix.Abs<AU,A,AV,AM,RU,R,RV,RM>,RU extends Unit<RU>,R extends Scalar<RU,R>,RV extends Vector.RelWithAbs<AU,A,AV,RU,R,RV>,RM extends Matrix.RelWithAbs<AU,A,AV,AM,RU,R,RV,RM>>
-
Method Summary
Modifier and Type Method Description M
assign(FloatFunction floatFunction)
Execute a function on a cell by cell basis.float
determinant()
Compute the determinant of the matrix.float[]
getColumnSI(int column)
Retrieve a column from the matrix as an array of float.float[]
getDiagonalSI()
Retrieve the main diagonal of the matrix as an array of float.float
getInUnit(int row, int column)
Retrieve the value stored at a specified row and column in the original unit.float
getInUnit(int row, int column, U targetUnit)
Retrieve the value stored at a specified row and column converted into a specified unit.float[]
getRowSI(int row)
Retrieve a row from the matrix as an array of float.float
getSI(int row, int column)
Retrieve the value stored at a specified row and column in the standard SI unit.float[][]
getValuesInUnit()
Create a dense float[][] array filled with the values in the original unit.float[][]
getValuesInUnit(U targetUnit)
Create a dense float[][] array filled with the values converted into a specified unit.float[][]
getValuesSI()
Create a dense float[][] array filled with the values in the standard SI unit.M
instantiateMatrix(FloatMatrixData fmd, U displayUnit)
Instantiate a new matrix of the class of this matrix.S
instantiateScalarSI(float valueSI, U displayUnit)
Instantiate a new scalar for the class of this matrix.V
instantiateVector(FloatVectorData fvd, U displayUnit)
Instantiate a new vector of the class of this matrix.void
set(int row, int column, S value)
Set the scalar value at the specified position.void
setInUnit(int row, int column, float valueInUnit)
Set the value, specified in the (current) display unit, at the specified position.void
setInUnit(int row, int column, float valueInUnit, U valueUnit)
Set the value, specified in thevalueUnit
, at the specified position.void
setSI(int row, int column, float valueSI)
Set the value, specified in the standard SI unit, at the specified position.Methods inherited from interface org.djunits.value.IndexedValue
cardinality, getScalarClass, getStorageType, immutable, isDense, isMutable, isSparse, mutable, toDense, toSparse
Methods inherited from interface org.djunits.value.base.Matrix
cols, get, getColumn, getColumnScalars, getDiagonal, getDiagonalScalars, getRow, getRowScalars, getScalars, getVectorClass, rows
Methods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit, toString, toString, toString, toString
-
Method Details
-
getSI
Retrieve the value stored at a specified row and column in the standard SI unit.- Parameters:
row
- int; row of the value to retrievecolumn
- 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
Retrieve the value stored at a specified row and column in the original unit.- Parameters:
row
- int; row of the value to retrievecolumn
- 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
Retrieve the value stored at a specified row and column converted into a specified unit.- Parameters:
row
- int; row of the value to retrievecolumn
- int; column of the value to retrievetargetUnit
- 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
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
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
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
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
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
Set the value, specified in the standard SI unit, at the specified position.- Parameters:
row
- int; row of the value to setcolumn
- int; column of the value to setvalueSI
- float; the value, specified in the standard SI unit- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
setInUnit
Set the value, specified in the (current) display unit, at the specified position.- Parameters:
row
- int; row of the value to setcolumn
- int; column of the value to setvalueInUnit
- float; the value, specified in the (current) display unit- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
setInUnit
Set the value, specified in thevalueUnit
, at the specified position.- Parameters:
row
- int; row of the value to setcolumn
- int; column of the value to setvalueInUnit
- float; the value, specified in the (current) display unitvalueUnit
- U; the unit in which thevalueInUnit
is expressed- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
set
Set the scalar value at the specified position.- Parameters:
row
- int; row of the value to setcolumn
- int; column of the value to setvalue
- S; the value to set- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
assign
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
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 matrixdisplayUnit
- U; the display unit of the matrix- Returns:
- V; a matrix of the correct type
-
instantiateVector
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 vectordisplayUnit
- U; the display unit of the vector- Returns:
- V; a vector of the correct type
-
instantiateScalarSI
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 scalardisplayUnit
- U; the unit in which the value will be displayed- Returns:
- S; a scalar of the correct type, belonging to the matrix type
-