Interface DoubleMatrixInterface<U extends Unit<U>,S extends DoubleScalarInterface<U,S>,V extends DoubleVectorInterface<U,S,V>,M extends DoubleMatrixInterface<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:
AbsoluteTemperatureMatrix
,AbsorbedDoseMatrix
,AbstractDoubleMatrix
,AbstractDoubleMatrixAbs
,AbstractDoubleMatrixRel
,AbstractDoubleMatrixRelWithAbs
,AccelerationMatrix
,AmountOfSubstanceMatrix
,AngleMatrix
,AngularAccelerationMatrix
,AngularVelocityMatrix
,AreaMatrix
,CatalyticActivityMatrix
,DensityMatrix
,DimensionlessMatrix
,DirectionMatrix
,DurationMatrix
,ElectricalCapacitanceMatrix
,ElectricalChargeMatrix
,ElectricalConductanceMatrix
,ElectricalCurrentMatrix
,ElectricalInductanceMatrix
,ElectricalPotentialMatrix
,ElectricalResistanceMatrix
,EnergyMatrix
,EquivalentDoseMatrix
,FlowMassMatrix
,FlowVolumeMatrix
,ForceMatrix
,FrequencyMatrix
,IlluminanceMatrix
,LengthMatrix
,LinearDensityMatrix
,LuminousFluxMatrix
,LuminousIntensityMatrix
,MagneticFluxDensityMatrix
,MagneticFluxMatrix
,MassMatrix
,MomentumMatrix
,PositionMatrix
,PowerMatrix
,PressureMatrix
,RadioActivityMatrix
,SIMatrix
,SolidAngleMatrix
,SpeedMatrix
,TemperatureMatrix
,TimeMatrix
,TorqueMatrix
,VolumeMatrix
public interface DoubleMatrixInterface<U extends Unit<U>,S extends DoubleScalarInterface<U,S>,V extends DoubleVectorInterface<U,S,V>,M extends DoubleMatrixInterface<U,S,V,M>> extends Matrix<U,S,V,M>
Interface for the DoubleMatrix classes, specifically defining the methods that deal with double 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
-
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(DoubleFunction doubleFunction)
Execute a function on a cell by cell basis.double
determinant()
Compute the determinant of the matrix.double[]
getColumnSI(int column)
Retrieve a column from the matrix as an array of double.double[]
getDiagonalSI()
Retrieve the main diagonal of the matrix as an array of double.double
getInUnit(int row, int column)
Retrieve the value stored at a specified row and column in the original unit.double
getInUnit(int row, int column, U targetUnit)
Retrieve the value stored at a specified row and column converted into a specified unit.double[]
getRowSI(int row)
Retrieve a row from the matrix as an array of double.double
getSI(int row, int column)
Retrieve the value stored at a specified row and column in the standard SI unit.double[][]
getValuesInUnit()
Create a dense double[][] array filled with the values in the original unit.double[][]
getValuesInUnit(U targetUnit)
Create a dense double[][] array filled with the values converted into a specified unit.double[][]
getValuesSI()
Create a dense double[][] array filled with the values in the standard SI unit.M
instantiateMatrix(DoubleMatrixData dmd, U displayUnit)
Instantiate a new matrix of the class of this matrix.S
instantiateScalarSI(double valueSI, U displayUnit)
Instantiate a new scalar for the class of this matrix.V
instantiateVector(DoubleVectorData dvd, 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, double valueInUnit)
Set the value, specified in the (current) display unit, at the specified position.void
setInUnit(int row, int column, double valueInUnit, U valueUnit)
Set the value, specified in thevalueUnit
, at the specified position.void
setSI(int row, int column, double 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:
- double; 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:
- double; 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:
- double; 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 double.- Parameters:
row
- int; row of the values to retrieve- Returns:
- S[]; the row as a double array
- Throws:
ValueRuntimeException
- in case row is out of bounds
-
getColumnSI
Retrieve a column from the matrix as an array of double.- Parameters:
column
- int; column of the values to retrieve- Returns:
- S[]; the column as a double array
- Throws:
ValueRuntimeException
- in case column is out of bounds
-
getDiagonalSI
Retrieve the main diagonal of the matrix as an array of double.- Returns:
- V; the main diagonal as a double array
- Throws:
ValueRuntimeException
- in case the matrix is not square
-
getValuesSI
double[][] getValuesSI()Create a dense double[][] array filled with the values in the standard SI unit.- Returns:
- double[][]; array of values in the standard SI unit
-
getValuesInUnit
double[][] getValuesInUnit()Create a dense double[][] array filled with the values in the original unit.- Returns:
- double[][]; the values in the original unit
-
getValuesInUnit
Create a dense double[][] array filled with the values converted into a specified unit.- Parameters:
targetUnit
- U; the unit into which the values are converted for use- Returns:
- double[][]; the values converted into the specified unit
-
determinant
Compute the determinant of the matrix.- Returns:
- double; 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
- double; 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
- double; 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
- double; 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:
doubleFunction
- DoubleFunction; 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 DoubleMatrix.instiantiate() methods in case another matrix of this class is known. The method is faster than DoubleMatrix.instantiate, and it will also work if the matrix is user-defined.- Parameters:
dmd
- DoubleMatrixData; 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 DoubleVector.instiantiate() methods in case another matrix of this class is known. The method is faster than DoubleVector.instantiate, and it will also work if the matrix and/or vector are user-defined.- Parameters:
dvd
- DoubleVectorData; 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 DoubleScalar.instiantiate() methods in case a matrix of this class is known. The method is faster than DoubleScalar.instantiate, and it will also work if the matrix and/or scalar are user-defined.- Parameters:
valueSI
- double; 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
-