Package org.djunits.value.base
Interface Matrix<U extends Unit<U>,S extends Scalar<U,S>,V extends Vector<U,S,V>,M extends Matrix<U,S,V,M>>
- Type Parameters:
U
- the unitS
- the scalar type belonging to the matrix typeV
- the corresponding vector typeM
- the matrix type with the given unit
- All Superinterfaces:
Cloneable
,IndexedValue<U,S,M>
,Serializable
,Value<U,M>
,ValueFunctions<U,M>
- All Known Subinterfaces:
DoubleMatrixInterface<U,S,V,M>
,FloatMatrixInterface<U,S,V,M>
,Matrix.Abs<AU,A,AV,AM,RU,R,RV,RM>
,Matrix.Rel<U,S,V,RM>
,Matrix.RelWithAbs<AU,A,AV,AM,RU,R,RV,RM>
- All Known Implementing Classes:
AbsoluteTemperatureMatrix
,AbsorbedDoseMatrix
,AbstractDoubleMatrix
,AbstractDoubleMatrixAbs
,AbstractDoubleMatrixRel
,AbstractDoubleMatrixRelWithAbs
,AbstractFloatMatrix
,AbstractFloatMatrixAbs
,AbstractFloatMatrixRel
,AbstractFloatMatrixRelWithAbs
,AccelerationMatrix
,AmountOfSubstanceMatrix
,AngleMatrix
,AngularAccelerationMatrix
,AngularVelocityMatrix
,AreaMatrix
,CatalyticActivityMatrix
,DensityMatrix
,DimensionlessMatrix
,DirectionMatrix
,DurationMatrix
,ElectricalCapacitanceMatrix
,ElectricalChargeMatrix
,ElectricalConductanceMatrix
,ElectricalCurrentMatrix
,ElectricalInductanceMatrix
,ElectricalPotentialMatrix
,ElectricalResistanceMatrix
,EnergyMatrix
,EquivalentDoseMatrix
,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
,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 Matrix<U extends Unit<U>,S extends Scalar<U,S>,V extends Vector<U,S,V>,M extends Matrix<U,S,V,M>> extends IndexedValue<U,S,M>
Matrix to distinguish a matrix from scalars and matrixs. A possible way to implement this interface is:
BSD-style license. See DJUNITS License.
class LengthMatrix implements Matrix<LengthUnit, Length, LengthMatrix>Copyright (c) 2019-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
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>>
Methods for Absolute Matrix.static interface
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>>
Methods for Relative Matrix.static interface
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>>
Additional methods for Relative Matrix that has a corresponding Absolute Matrix. -
Method Summary
Modifier and Type Method Description int
cols()
Retrieve the number of columns of the matrix.S
get(int row, int column)
Retrieve a value from the matrix.V
getColumn(int column)
Retrieve a column from the matrix as a vector.S[]
getColumnScalars(int column)
Retrieve a column from the matrix as an array of scalars.V
getDiagonal()
Retrieve the main diagonal of the matrix as a vector.S[]
getDiagonalScalars()
Retrieve the main diagonal of the matrix as an array of scalars.V
getRow(int row)
Retrieve a row from the matrix as a vector.S[]
getRowScalars(int row)
Retrieve a row from the matrix as an array of scalars.S[][]
getScalars()
Return the vector as a 2D-array of scalars.Class<V>
getVectorClass()
Return the class of the corresponding vector.int
rows()
Retrieve the number of rows of the matrix.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.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit, toString, toString, toString, toString
-
Method Details
-
rows
int rows()Retrieve the number of rows of the matrix.- Returns:
- int; the number of rows of the matrix
-
cols
int cols()Retrieve the number of columns of the matrix.- Returns:
- int; the number of columns of the matrix
-
getVectorClass
Return the class of the corresponding vector.- Returns:
- Class<V>; the class of the corresponding vector
-
get
Retrieve a value from the matrix.- Parameters:
row
- int; row of the value to retrievecolumn
- int; column of the value to retrieve- Returns:
- S; the value as a Scalar
- Throws:
ValueRuntimeException
- in case row or column is out of bounds
-
getScalars
S[][] getScalars()Return the vector as a 2D-array of scalars.- Returns:
- S[][]; the vector as a 2D-array of scalars
-
getRow
Retrieve a row from the matrix as a vector.- Parameters:
row
- int; row of the values to retrieve- Returns:
- V; the row as a Vector
- Throws:
ValueRuntimeException
- in case row is out of bounds
-
getColumn
Retrieve a column from the matrix as a vector.- Parameters:
column
- int; column of the values to retrieve- Returns:
- V; the column as a Vector
- Throws:
ValueRuntimeException
- in case column is out of bounds
-
getDiagonal
Retrieve the main diagonal of the matrix as a vector.- Returns:
- V; the main diagonal as a Vector
- Throws:
ValueRuntimeException
- in case the matrix is not square
-
getRowScalars
Retrieve a row from the matrix as an array of scalars.- Parameters:
row
- int; row of the values to retrieve- Returns:
- S[]; the row as a Scalar array
- Throws:
ValueRuntimeException
- in case row is out of bounds
-
getColumnScalars
Retrieve a column from the matrix as an array of scalars.- Parameters:
column
- int; column of the values to retrieve- Returns:
- S[]; the column as a Scalar array
- Throws:
ValueRuntimeException
- in case column is out of bounds
-
getDiagonalScalars
Retrieve the main diagonal of the matrix as an array of scalars.- Returns:
- V; the main diagonal as a Scalar array
- Throws:
ValueRuntimeException
- in case the matrix is not square
-