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

    • Constructor Detail

      • 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 Detail

      • 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 - RM; 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 - RM; 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 - MT; 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
      • 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 - MT; 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