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 unit
S - the scalar type belonging to the matrix type
V - the corresponding vector type
M - 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, AreaMatrix, CatalyticActivityMatrix, DensityMatrix, DimensionlessMatrix, DirectionMatrix, DurationMatrix, ElectricalCapacitanceMatrix, ElectricalChargeMatrix, ElectricalConductanceMatrix, ElectricalCurrentMatrix, ElectricalInductanceMatrix, ElectricalPotentialMatrix, ElectricalResistanceMatrix, EnergyMatrix, EquivalentDoseMatrix, 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, FlowMassMatrix, FlowVolumeMatrix, ForceMatrix, FrequencyMatrix, IlluminanceMatrix, LengthMatrix, LinearDensityMatrix, LuminousFluxMatrix, LuminousIntensityMatrix, MagneticFluxDensityMatrix, MagneticFluxMatrix, MassMatrix, 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:
 class LengthMatrix implements Matrix<LengthUnit, Length, LengthMatrix>
 
Copyright (c) 2019-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
  • 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

      Class<V> getVectorClass()
      Return the class of the corresponding vector.
      Returns:
      Class<V>; the class of the corresponding vector
    • get

      S get​(int row, int column) throws ValueRuntimeException
      Retrieve a value from the matrix.
      Parameters:
      row - int; row of the value to retrieve
      column - 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

      V getRow​(int row) throws ValueRuntimeException
      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

      V getColumn​(int column) throws ValueRuntimeException
      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

      V getDiagonal() throws ValueRuntimeException
      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

      S[] getRowScalars​(int row) throws ValueRuntimeException
      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

      S[] getColumnScalars​(int column) throws ValueRuntimeException
      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

      S[] getDiagonalScalars() throws ValueRuntimeException
      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