Class FloatMatrixRel<U extends Unit<U>,S extends FloatScalarRel<U,S>,RV extends FloatVectorRel<U,S,RV>,RM extends FloatMatrixRel<U,S,RV,RM>>

Type Parameters:
U - the unit
S - the scalar type belonging to the matrix type
RV - the relative vector type belonging to the relative matrix type
RM - the relative matrix type with this unit
All Implemented Interfaces:
Serializable, Cloneable, Relative<U,RM>, Value<U,RM>
Direct Known Subclasses:
FloatAbsorbedDoseMatrix, FloatAccelerationMatrix, FloatAmountOfSubstanceMatrix, FloatAngularAccelerationMatrix, FloatAngularVelocityMatrix, FloatAreaMatrix, FloatCatalyticActivityMatrix, FloatDensityMatrix, FloatDimensionlessMatrix, FloatElectricalCapacitanceMatrix, FloatElectricalChargeMatrix, FloatElectricalConductanceMatrix, FloatElectricalCurrentMatrix, FloatElectricalInductanceMatrix, FloatElectricalPotentialMatrix, FloatElectricalResistanceMatrix, FloatEnergyMatrix, FloatEquivalentDoseMatrix, FloatFlowMassMatrix, FloatFlowVolumeMatrix, FloatForceMatrix, FloatFrequencyMatrix, FloatIlluminanceMatrix, FloatLinearDensityMatrix, FloatLuminousFluxMatrix, FloatLuminousIntensityMatrix, FloatMagneticFluxDensityMatrix, FloatMagneticFluxMatrix, FloatMassMatrix, FloatMatrixRelWithAbs, FloatMomentumMatrix, FloatPowerMatrix, FloatPressureMatrix, FloatRadioActivityMatrix, FloatSIMatrix, FloatSolidAngleMatrix, FloatSpeedMatrix, FloatTorqueMatrix, FloatVolumeMatrix

public abstract class FloatMatrixRel<U extends Unit<U>,S extends FloatScalarRel<U,S>,RV extends FloatVectorRel<U,S,RV>,RM extends FloatMatrixRel<U,S,RV,RM>> extends FloatMatrix<U,S,RV,RM> implements Relative<U,RM>
FloatMatrixRel.java.

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

Author:
Alexander Verbraeck
See Also:
  • Constructor Details

    • FloatMatrixRel

      protected FloatMatrixRel(FloatMatrixData data, U unit)
      Construct a new Relative Mutable FloatMatrix.
      Parameters:
      data - FloatMatrixData; an internal data object
      unit - U; the unit
  • Method Details

    • zSum

      public final S zSum()
      Compute the sum of all SI values of this matrix.
      Returns:
      S; the sum of all values of this matrix with the same display unit as this matrix
    • plus

      public final RM plus(RM rel) throws ValueRuntimeException
      Add a Relative value to this Relative value. A new value is returned due to immutability.
      Specified by:
      plus in interface Relative<U extends Unit<U>,S extends FloatScalarRel<U,S>>
      Parameters:
      rel - R; the value to add
      Returns:
      R; the sum of this value and the operand as a new object
      Throws:
      ValueRuntimeException
    • minus

      public final RM minus(RM rel) throws ValueRuntimeException
      Subtract a Relative value from this Relative value. A new value is returned due to immutability.
      Specified by:
      minus in interface Relative<U extends Unit<U>,S extends FloatScalarRel<U,S>>
      Parameters:
      rel - R; the value to subtract
      Returns:
      R; the difference of this value and the operand
      Throws:
      ValueRuntimeException
    • incrementBy

      public RM incrementBy(S increment)
      Increment all values of this matrix by the increment. This only works if the matrix is mutable.
      Parameters:
      increment - S; the scalar by which to increment all values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case this matrix is immutable
    • incrementBy

      public RM incrementBy(RM increment)
      Increment all values of this matrix by the increment on a value by value basis. This only works if this matrix is mutable.
      Parameters:
      increment - RM; the matrix that contains the values by which to increment the corresponding values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case this matrix is immutable or when the sizes of the matrices differ
    • decrementBy

      public RM decrementBy(S decrement)
      Decrement all values of this matrix by the decrement. This only works if this matrix is mutable.
      Parameters:
      decrement - S; the scalar by which to decrement all values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case this matrix is immutable
    • decrementBy

      public final RM decrementBy(RM decrement)
      Decrement this Relative matrix by another Relative matrix. The operation is done value by value. This is only allowed if this matrix is mutable.
      Parameters:
      decrement - RM; the matrix that contains the values by which to decrement the corresponding values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case this matrix is immutable or when the sizes of the matrices differ
    • multiplyBy

      public RM multiplyBy(float multiplier)
      Multiply all values of this matrix by the multiplier. This only works if the matrix is mutable.
      Parameters:
      multiplier - float; the factor by which to multiply all values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case the matrix is immutable
    • divideBy

      public RM divideBy(float divisor)
      Divide all values of this matrix by the divisor. This only works if the matrix is mutable.
      Parameters:
      divisor - float; the value by which to divide all values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case the matrix is immutable
    • multiplyBy

      public RM multiplyBy(double multiplier)
      Multiply all values of this matrix by the multiplier. This only works if the matrix is mutable.
      Parameters:
      multiplier - float; the factor by which to multiply all values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case the matrix is immutable
    • divideBy

      public RM divideBy(double divisor)
      Divide all values of this matrix by the divisor. This only works if the matrix is mutable.
      Parameters:
      divisor - float; the value by which to divide all values
      Returns:
      RM; this modified matrix
      Throws:
      ValueRuntimeException - in case the matrix is immutable
    • times

      public final <UT extends Unit<UT>, ST extends FloatScalar<UT, ST>, VT extends FloatVector<UT, ST, VT>, MT extends FloatMatrix<UT, ST, VT, MT> & Relative<UT, MT>> FloatSIMatrix times(MT rel) throws ValueRuntimeException, UnitException
      Multiply a Relative value with this Relative value for a matrix or matrix. The multiplication is done value by value and store the result in a new Relative value. If both operands are dense, the result is a dense matrix or matrix, otherwise the result is a sparse matrix or matrix.
      Type Parameters:
      UT - the unit type of the multiplier
      ST - the scalar type of the multiplier
      VT - the vector type of the multiplier
      MT - the matrix type of the multiplier
      Parameters:
      rel - MT; the right operand, which can be any matrix type
      Returns:
      FloatSIMatrix; the multiplication of this matrix and the operand
      Throws:
      ValueRuntimeException - in case this matrix or matrix and the operand have a different size
      UnitException - on unit error
    • times

      public final RM times(float multiplier)
      Returns a new scalar/vector/matrix with value(s) multiplied by a factor.
      Specified by:
      times in interface Relative<U extends Unit<U>,S extends FloatScalarRel<U,S>>
      Parameters:
      multiplier - float; the multiplier
      Returns:
      T; a new scalar/vector/matrix
    • times

      public final RM times(double multiplier)
      Returns a new scalar/vector/matrix with value(s) multiplied by a factor.
      Specified by:
      times in interface Relative<U extends Unit<U>,S extends FloatScalarRel<U,S>>
      Parameters:
      multiplier - double; the multiplier
      Returns:
      T; a new scalar/vector/matrix
    • divide

      public final <UT extends Unit<UT>, ST extends FloatScalar<UT, ST>, VT extends FloatVector<UT, ST, VT>, MT extends FloatMatrix<UT, ST, VT, MT> & Relative<UT, MT>> FloatSIMatrix divide(MT rel) throws ValueRuntimeException, UnitException
      Divide this Relative matrix by another Relative matrix. The operation is done value by value and store the result is stored in a new Relative matrix. If both operands are dense, the result is a dense matrix, otherwise the result is a sparse matrix. TODO discuss dense or sparseness of result.
      Type Parameters:
      UT - the unit type of the multiplier
      ST - the scalar type of the multiplier
      VT - the vector type of the multiplier
      MT - the matrix type of the multiplier
      Parameters:
      rel - MT; the right operand, which can be any matrix type
      Returns:
      FloatSIMatrix; the division of this matrix and the operand
      Throws:
      ValueRuntimeException - in case this matrix or matrix and the operand have a different size
      UnitException - on unit error
    • divide

      public final RM divide(double divisor)
      Returns a new scalar/vector/matrix with value(s) divided by a factor.
      Specified by:
      divide in interface Relative<U extends Unit<U>,S extends FloatScalarRel<U,S>>
      Parameters:
      divisor - double; the divisor
      Returns:
      T; the modified T
    • divide

      public final RM divide(float divisor)
      Returns a new scalar/vector/matrix with value(s) divided by a factor.
      Specified by:
      divide in interface Relative<U extends Unit<U>,S extends FloatScalarRel<U,S>>
      Parameters:
      divisor - float; the divisor
      Returns:
      T; the modified T