Class AbstractFloatMatrixRel<U extends Unit<U>,S extends AbstractFloatScalarRel<U,S>,RV extends AbstractFloatVectorRel<U,S,RV>,RM extends AbstractFloatMatrixRel<U,S,RV,RM>>
java.lang.Object
org.djunits.value.AbstractValue<U,T>
org.djunits.value.AbstractIndexedValue<U,S,M,FloatMatrixData>
org.djunits.value.vfloat.matrix.base.AbstractFloatMatrix<U,S,RV,RM>
org.djunits.value.vfloat.matrix.base.AbstractFloatMatrixRel<U,S,RV,RM>
- Type Parameters:
U
- the unitS
- the scalar type belonging to the matrix typeRV
- the relative vector type belonging to the relative matrix typeRM
- 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>
,FloatMatrixInterface<U,S,RV,RM>
- Direct Known Subclasses:
AbstractFloatMatrixRelWithAbs
,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
,FloatMomentumMatrix
,FloatPowerMatrix
,FloatPressureMatrix
,FloatRadioActivityMatrix
,FloatSIMatrix
,FloatSolidAngleMatrix
,FloatSpeedMatrix
,FloatTorqueMatrix
,FloatVolumeMatrix
public abstract class AbstractFloatMatrixRel<U extends Unit<U>,S extends AbstractFloatScalarRel<U,S>,RV extends AbstractFloatVectorRel<U,S,RV>,RM extends AbstractFloatMatrixRel<U,S,RV,RM>> extends AbstractFloatMatrix<U,S,RV,RM> implements Matrix.Rel<U,S,RV,RM>
AbstractFloatMatrixRel.java.
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
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.djunits.value.base.Matrix
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>>, 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>>, 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>>
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractFloatMatrixRel(FloatMatrixData data, U unit)
Construct a new Relative Mutable FloatMatrix. -
Method Summary
Modifier and Type Method Description RM
decrementBy(RM decrement)
Decrement this Relative matrix by another Relative matrix.RM
decrementBy(S decrement)
Decrement all values of this matrix by the decrement.RM
divide(double divisor)
Returns a new scalar/vector/matrix with value(s) divided by a factor.RM
divide(float divisor)
Returns a new scalar/vector/matrix with value(s) divided by a factor.<UT extends Unit<UT>, ST extends AbstractFloatScalar<UT, ST>, VT extends AbstractFloatVector<UT, ST, VT>, MT extends AbstractFloatMatrix<UT, ST, VT, MT> & Relative<UT, MT>>
FloatSIMatrixdivide(MT rel)
Divide this Relative matrix by another Relative matrix.RM
divideBy(double divisor)
Divide all values of this matrix by the divisor.RM
incrementBy(RM increment)
Increment all values of this matrix by the increment on a value by value basis.RM
incrementBy(S increment)
Increment all values of this matrix by the increment.RM
minus(RM rel)
Subtract a relative matrix from this relative mutable matrix.RM
multiplyBy(double multiplier)
Multiply all values of this matrix by the multiplier.RM
plus(RM rel)
Add a relative matrix to this relative mutable matrix.RM
times(double multiplier)
Returns a new scalar/vector/matrix with value(s) multiplied by a factor.RM
times(float multiplier)
Returns a new scalar/vector/matrix with value(s) multiplied by a factor.<UT extends Unit<UT>, ST extends AbstractFloatScalar<UT, ST>, VT extends AbstractFloatVector<UT, ST, VT>, MT extends AbstractFloatMatrix<UT, ST, VT, MT> & Relative<UT, MT>>
FloatSIMatrixtimes(MT rel)
Multiply a Relative value with this Relative value for a matrix or matrix.S
zSum()
Compute the sum of all SI values of this matrix.Methods inherited from class org.djunits.value.vfloat.matrix.base.AbstractFloatMatrix
abs, assign, ceil, checkColumnIndex, checkIndex, checkRowIndex, checkSquare, cols, determinant, equals, floor, get, getColumn, getColumnScalars, getColumnSI, getData, getDiagonal, getDiagonalScalars, getDiagonalSI, getInUnit, getInUnit, getRow, getRowScalars, getRowSI, getScalars, getSI, getValuesInUnit, getValuesInUnit, getValuesSI, hashCode, neg, rint, rows, set, setData, setInUnit, setInUnit, setSI, toDense, toSparse, toString, toString, toString, toString
Methods inherited from class org.djunits.value.AbstractIndexedValue
cardinality, checkCopyOnWrite, clone, getStorageType, immutable, isCopyOnWrite, isDense, isMutable, isSparse, mutable, setCopyOnWrite, setMutable
Methods inherited from class org.djunits.value.AbstractValue
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djunits.value.vfloat.matrix.base.FloatMatrixInterface
instantiateMatrix, instantiateScalarSI, instantiateVector
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.base.Matrix
cols, get, getColumn, getColumnScalars, getDiagonal, getDiagonalScalars, getRow, getRowScalars, getScalars, getVectorClass, rows
Methods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit, toString, toString, toString, toString
-
Constructor Details
-
AbstractFloatMatrixRel
Construct a new Relative Mutable FloatMatrix.- Parameters:
data
- FloatMatrixData; an internal data objectunit
- U; the unit
-
-
Method Details
-
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
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 interfaceMatrix.Rel<U extends Unit<U>,S extends AbstractFloatScalarRel<U,S>,RV extends AbstractFloatVectorRel<U,S,RV>,RM extends AbstractFloatMatrixRel<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
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 interfaceMatrix.Rel<U extends Unit<U>,S extends AbstractFloatScalarRel<U,S>,RV extends AbstractFloatVectorRel<U,S,RV>,RM extends AbstractFloatMatrixRel<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
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
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
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
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
-
times
public final <UT extends Unit<UT>, ST extends AbstractFloatScalar<UT, ST>, VT extends AbstractFloatVector<UT, ST, VT>, MT extends AbstractFloatMatrix<UT, ST, VT, MT> & Relative<UT, MT>> FloatSIMatrix times(MT rel) throws ValueRuntimeException, UnitExceptionMultiply 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 multiplierST
- the scalar type of the multiplierVT
- the vector type of the multiplierMT
- 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 sizeUnitException
- on unit error
-
times
Returns a new scalar/vector/matrix with value(s) multiplied by a factor. -
times
Returns a new scalar/vector/matrix with value(s) multiplied by a factor. -
multiplyBy
Multiply all values of this matrix by the multiplier. This only works if the matrix is mutable.- Specified by:
multiplyBy
in interfaceMatrix.Rel<U extends Unit<U>,S extends AbstractFloatScalarRel<U,S>,RV extends AbstractFloatVectorRel<U,S,RV>,RM extends AbstractFloatMatrixRel<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 AbstractFloatScalar<UT, ST>, VT extends AbstractFloatVector<UT, ST, VT>, MT extends AbstractFloatMatrix<UT, ST, VT, MT> & Relative<UT, MT>> FloatSIMatrix divide(MT rel) throws ValueRuntimeException, UnitExceptionDivide 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 multiplierST
- the scalar type of the multiplierVT
- the vector type of the multiplierMT
- 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 sizeUnitException
- on unit error
-
divide
Returns a new scalar/vector/matrix with value(s) divided by a factor. -
divide
Returns a new scalar/vector/matrix with value(s) divided by a factor. -
divideBy
Divide all values of this matrix by the divisor. This only works if the matrix is mutable.- Specified by:
divideBy
in interfaceMatrix.Rel<U extends Unit<U>,S extends AbstractFloatScalarRel<U,S>,RV extends AbstractFloatVectorRel<U,S,RV>,RM extends AbstractFloatMatrixRel<U,S,RV,RM>>
- Parameters:
divisor
- double; the value by which to divide all values- Returns:
- V; this modified matrix
-