Class AbstractDoubleMatrixRel<U extends Unit<U>,​S extends AbstractDoubleScalarRel<U,​S>,​RV extends AbstractDoubleVectorRel<U,​S,​RV>,​RM extends AbstractDoubleMatrixRel<U,​S,​RV,​RM>>

java.lang.Object
org.djunits.value.AbstractValue<U,​T>
org.djunits.value.AbstractIndexedValue<U,​S,​M,​DoubleMatrixData>
org.djunits.value.vdouble.matrix.base.AbstractDoubleMatrix<U,​S,​RV,​RM>
org.djunits.value.vdouble.matrix.base.AbstractDoubleMatrixRel<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, Matrix<U,​S,​RV,​RM>, Matrix.Rel<U,​S,​RV,​RM>, ValueFunctions<U,​RM>, IndexedValue<U,​S,​RM>, Relative<U,​RM>, Value<U,​RM>, DoubleMatrixInterface<U,​S,​RV,​RM>
Direct Known Subclasses:
AbsorbedDoseMatrix, AbstractDoubleMatrixRelWithAbs, AccelerationMatrix, AmountOfSubstanceMatrix, AreaMatrix, CatalyticActivityMatrix, DensityMatrix, DimensionlessMatrix, ElectricalCapacitanceMatrix, ElectricalChargeMatrix, ElectricalConductanceMatrix, ElectricalCurrentMatrix, ElectricalInductanceMatrix, ElectricalPotentialMatrix, ElectricalResistanceMatrix, EnergyMatrix, EquivalentDoseMatrix, FlowMassMatrix, FlowVolumeMatrix, ForceMatrix, FrequencyMatrix, IlluminanceMatrix, LinearDensityMatrix, LuminousFluxMatrix, LuminousIntensityMatrix, MagneticFluxDensityMatrix, MagneticFluxMatrix, MassMatrix, PowerMatrix, PressureMatrix, RadioActivityMatrix, SIMatrix, SolidAngleMatrix, SpeedMatrix, TorqueMatrix, VolumeMatrix

public abstract class AbstractDoubleMatrixRel<U extends Unit<U>,​S extends AbstractDoubleScalarRel<U,​S>,​RV extends AbstractDoubleVectorRel<U,​S,​RV>,​RM extends AbstractDoubleMatrixRel<U,​S,​RV,​RM>>
extends AbstractDoubleMatrix<U,​S,​RV,​RM>
implements Matrix.Rel<U,​S,​RV,​RM>, Relative<U,​RM>
AbstractDoubleMatrixRel.java.

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
See Also:
Serialized Form
  • Constructor Details

    • AbstractDoubleMatrixRel

      protected AbstractDoubleMatrixRel​(DoubleMatrixData data, U unit)
      Construct a new Relative Mutable DoubleMatrix.
      Parameters:
      data - DoubleMatrixData; 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 SI values of this matrix with the same display unit as this matrix
    • plus

      public final RM plus​(RM rel) throws ValueRuntimeException
      Add a relative matrix to this relative mutable matrix. A new matrix is returned. The display unit of the result is the display unit of this relative matrix. The addition is done value by value and the result is stored in a new matrix. If both operands are sparse, the result is a sparse matrix, otherwise the result is a dense matrix.
      Specified by:
      plus in interface Matrix.Rel<U extends Unit<U>,​S extends AbstractDoubleScalarRel<U,​S>,​RV extends AbstractDoubleVectorRel<U,​S,​RV>,​RM extends AbstractDoubleMatrixRel<U,​S,​RV,​RM>>
      Parameters:
      rel - RV; the relative matrix (mutable or immutable, sparse or dense) to add
      Returns:
      RMV; the sum of this matrix and the operand as a new relative, mutable matrix
      Throws:
      ValueRuntimeException - in case this matrix and the operand have a different size
    • minus

      public final RM minus​(RM rel) throws ValueRuntimeException
      Subtract a relative matrix from this relative mutable matrix. The display unit of the result is the display unit of this relative matrix. The subtraction is done value by value and the result is stored in a new matrix. If both operands are sparse, the result is a sparse matrix, otherwise the result is a dense matrix.
      Specified by:
      minus in interface Matrix.Rel<U extends Unit<U>,​S extends AbstractDoubleScalarRel<U,​S>,​RV extends AbstractDoubleVectorRel<U,​S,​RV>,​RM extends AbstractDoubleMatrixRel<U,​S,​RV,​RM>>
      Parameters:
      rel - RV; the value to subtract
      Returns:
      RMV; the difference of this matrix and the operand as a new relative, mutable matrix
      Throws:
      ValueRuntimeException - in case this matrix and the operand have a different size
    • incrementBy

      public RM incrementBy​(S increment)
      Increment all values of this matrix by the increment. This only works if this 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
      ValueRuntimeException - when the sizes of the matrices differ, or increment is null
    • 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
      ValueRuntimeException - when the sizes of the matrices differ, or decrement is null
    • times

      public final <UT extends Unit<UT>,​ ST extends AbstractDoubleScalar<UT,​ ST>,​ VT extends AbstractDoubleVector<UT,​ ST,​ VT>,​ MT extends AbstractDoubleMatrix<UT,​ ST,​ VT,​ MT> & Relative<UT,​ MT>> SIMatrix 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 - VT; the right operand, which can be any matrix type
      Returns:
      SIMatrix; 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​(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 AbstractDoubleScalarRel<U,​S>>
      Parameters:
      multiplier - double; the multiplier
      Returns:
      T; a new scalar/vector/matrix
    • 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 AbstractDoubleScalarRel<U,​S>>
      Parameters:
      multiplier - float; the multiplier
      Returns:
      T; a new scalar/vector/matrix
    • multiplyBy

      public final RM multiplyBy​(double multiplier)
      Multiply all values of this matrix by the multiplier. This only works if the matrix is mutable.
      Specified by:
      multiplyBy in interface Matrix.Rel<U extends Unit<U>,​S extends AbstractDoubleScalarRel<U,​S>,​RV extends AbstractDoubleVectorRel<U,​S,​RV>,​RM extends AbstractDoubleMatrixRel<U,​S,​RV,​RM>>
      Parameters:
      multiplier - double; the factor by which to multiply all values
      Returns:
      V; this modified matrix
    • divide

      public final <UT extends Unit<UT>,​ ST extends AbstractDoubleScalar<UT,​ ST>,​ VT extends AbstractDoubleVector<UT,​ ST,​ VT>,​ MT extends AbstractDoubleMatrix<UT,​ ST,​ VT,​ MT> & Relative<UT,​ MT>> SIMatrix 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 - VT; the right operand, which can be any matrix type
      Returns:
      SIMatrix; 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​(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 AbstractDoubleScalarRel<U,​S>>
      Parameters:
      divisor - float; the divisor
      Returns:
      T; the modified T
    • 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 AbstractDoubleScalarRel<U,​S>>
      Parameters:
      divisor - double; the divisor
      Returns:
      T; the modified T
    • divideBy

      public final RM divideBy​(double divisor)
      Divide all values of this matrix by the divisor. This only works if the matrix is mutable.
      Specified by:
      divideBy in interface Matrix.Rel<U extends Unit<U>,​S extends AbstractDoubleScalarRel<U,​S>,​RV extends AbstractDoubleVectorRel<U,​S,​RV>,​RM extends AbstractDoubleMatrixRel<U,​S,​RV,​RM>>
      Parameters:
      divisor - double; the value by which to divide all values
      Returns:
      V; this modified matrix