35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_ 111 template<
typename MT
114 class SMatScalarDivExpr :
public SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO >
115 ,
private MatScalarDivExpr
116 ,
private Computation
149 template<
typename MT2 >
152 enum :
bool { value = useAssign };
165 template<
typename MT2 >
166 struct UseSMPAssign {
167 enum :
bool { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
323 enum :
bool { smpAssignable =
false };
360 inline ReturnType
at(
size_t i,
size_t j )
const {
398 inline size_t rows() const noexcept {
499 template<
typename T >
500 inline bool canAlias(
const T* alias )
const noexcept {
501 return matrix_.canAlias( alias );
511 template<
typename T >
512 inline bool isAliased(
const T* alias )
const noexcept {
513 return matrix_.isAliased( alias );
537 template<
typename MT2
547 assign( ~lhs, rhs.matrix_ );
548 (~lhs) /= rhs.scalar_;
567 template<
typename MT2
577 assign( ~lhs, rhs.matrix_ );
578 (~lhs) /= rhs.scalar_;
597 template<
typename MT2
599 friend inline EnableIf_< UseAssign<MT2> >
610 const ResultType tmp(
serial( rhs ) );
611 addAssign( ~lhs, tmp );
634 template<
typename MT2
636 friend inline EnableIf_< UseAssign<MT2> >
647 const ResultType tmp(
serial( rhs ) );
648 subAssign( ~lhs, tmp );
687 template<
typename MT2
689 friend inline EnableIf_< UseSMPAssign<MT2> >
700 const ResultType tmp( rhs );
724 template<
typename MT2
726 friend inline EnableIf_< UseSMPAssign<MT2> >
737 const ResultType tmp( rhs );
799 template<
typename T1
802 inline const EnableIf_< IsNumeric<T2>, DivExprTrait_<T1,T2> >
813 return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
843 template<
typename MT
853 return mat.leftOperand() * ( scalar / mat.rightOperand() );
872 template<
typename ST1
882 return mat.leftOperand() * ( scalar / mat.rightOperand() );
901 template<
typename MT
918 return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
921 return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
938 template<
typename MT,
typename ST,
bool SO >
939 struct Rows< SMatScalarDivExpr<MT,ST,SO> > :
public Columns<MT>
955 template<
typename MT,
typename ST,
bool SO >
956 struct Columns< SMatScalarDivExpr<MT,ST,SO> > :
public Rows<MT>
972 template<
typename MT,
typename ST,
bool SO >
990 template<
typename MT,
typename ST,
bool SO >
1008 template<
typename MT,
typename ST,
bool SO >
1009 struct IsLower< SMatScalarDivExpr<MT,ST,SO> >
1026 template<
typename MT,
typename ST,
bool SO >
1044 template<
typename MT,
typename ST,
bool SO >
1045 struct IsUpper< SMatScalarDivExpr<MT,ST,SO> >
1062 template<
typename MT,
typename ST,
bool SO >
1080 template<
typename MT,
typename ST1,
typename ST2 >
1112 template<
typename MT,
typename ST1,
typename ST2 >
1144 template<
typename MT,
typename ST,
bool SO,
bool AF >
1166 template<
typename MT,
typename ST,
bool SO >
1188 template<
typename MT,
typename ST,
bool SO >
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:315
Evaluation of the expression type of a transpose sparse matrix/scalar multiplication.Via this type trait it is possible to evaluate the resulting expression type of a transpose sparse matrix/scalar multiplication. Given the column-major sparse matrix type MT and the scalar type ST, the nested type Type corresponds to the resulting expression type. In case either MT is not a column-major sparse matrix type or ST is not a scalar type, the resulting Type is set to INVALID_TYPE.
Definition: TSMatScalarMultExprTrait.h:126
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarDivExpr.h:223
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
Constraint on the data type.
ReturnType_< MT > RN
Return type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:121
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:255
Header file for the Rows type trait.
PointerType pointer
Pointer return type.
Definition: SMatScalarDivExpr.h:215
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarDivExpr.h:512
Header file for basic type definitions.
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:181
Compile time check whether the given type is a multiplication expression template.This type trait class tests whether or not the given type Type is a multiplication expression template (i.e. an expression representing an element-wise vector multiplication, a matrix/vector multiplication, a vector/matrix multiplication, or a matrix multiplication). In order to qualify as a valid multiplication expression template, the given type has to derive (publicly or privately) from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:73
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:178
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarDivExpr.h:360
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseMatrix type trait.
Header file for the serial shim.
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
If_< IsExpression< MT >, const MT, const MT &> LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:187
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:204
Header file for the ColumnExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
Header file for the And class template.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:408
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:190
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the Computation base class.
ResultType_< MT > RT
Result type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:120
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:176
Header file for the RequiresEvaluation type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:71
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:119
ValueType * PointerType
Pointer return type.
Definition: SMatScalarDivExpr.h:208
Constraint on the data type.
IfTrue_< useAssign, const ResultType, const SMatScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:184
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the SparseMatrix base class.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarDivExpr.h:500
Header file for the DivExprTrait class template.
Constraint on the data type.
typename MultExprTrait< T1, T2 >::Type MultExprTrait_
Auxiliary alias declaration for the MultExprTrait class template.The MultExprTrait_ alias declaration...
Definition: MultExprTrait.h:344
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
ReferenceType reference
Reference return type.
Definition: SMatScalarDivExpr.h:216
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
const EnableIf_< IsNumeric< T2 >, DivExprTrait_< T1, T2 > > operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:966
Header file for the ValueIndexPair class.
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarDivExpr.h:213
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarDivExpr.h:265
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarDivExpr.h:467
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:207
Compile time check for row-major matrix types.This type trait tests whether or not the given template...
Definition: IsRowMajorMatrix.h:83
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:196
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:286
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:488
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
Header file for the Or class template.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the Columns type trait.
SMatScalarDivExpr< MT, ST, SO > This
Type of this SMatScalarDivExpr instance.
Definition: SMatScalarDivExpr.h:174
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Evaluation of the expression type type of a submatrix operation.Via this type trait it is possible to...
Definition: SubmatrixExprTrait.h:80
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
Header file for the IsLower type trait.
LeftOperand matrix_
Left-hand side sparse matrix of the division expression.
Definition: SMatScalarDivExpr.h:519
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarDivExpr.h:210
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarDivExpr.h:388
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:245
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:316
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
Constraints on the storage order of matrix types.
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarDivExpr.h:429
Evaluation of the expression type type of a row operation.Via this type trait it is possible to evalu...
Definition: RowExprTrait.h:79
Constraint on the data type.
Header file for the RowExprTrait class template.
Expression object for sparse matrix-scalar multiplications.The SMatScalarMult class represents the co...
Definition: Forward.h:106
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
Header file for the IsNumeric type trait.
typename SMatScalarMultExprTrait< MT, ST >::Type SMatScalarMultExprTrait_
Auxiliary alias declaration for the SMatScalarMultExprTrait class template.The SMatScalarMultExprTrai...
Definition: SMatScalarMultExprTrait.h:164
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarDivExpr.h:441
Header file for the SubmatrixExprTrait class template.
ValueType value_type
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:214
Header file for run time assertion macros.
Compile time check for column-major matrix types.This type trait tests whether or not the given templ...
Definition: IsColumnMajorMatrix.h:83
Utility type for generic codes.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:297
Header file for the division trait.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:418
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:234
Expression object for sparse matrix-scalar divisions.The SMatScalarMult class represents the compile ...
Definition: Forward.h:105
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatScalarDivExpr.h:377
SMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:332
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:93
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:83
Evaluation of the expression type of a sparse matrix/scalar multiplication.Via this type trait it is ...
Definition: SMatScalarMultExprTrait.h:126
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:135
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatScalarDivExpr.h:454
Header file for the RemoveReference type trait.
Header file for the IsInvertible type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type...
Definition: FloatingPoint.h:81
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:201
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarDivExpr.h:209
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
Header file for the IsRowMajorMatrix type trait.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatScalarDivExpr.h:398
Header file for the IsComputation type trait class.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarDivExpr.h:478
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:196
Compile time logical or evaluation.The Or class template performs at compile time a logical or ('&&')...
Definition: Or.h:101
CompositeType_< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:122
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:345
Header file for the IntegralConstant class template.
Compile time evaluation of the number of columns of a matrix.The Columns type trait evaluates the num...
Definition: Columns.h:76
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarDivExpr.h:206
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:76
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:520
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:363
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsUpper type trait.
Header file for the MatScalarDivExpr base class.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarDivExpr.h:275
MultTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SMatScalarDivExpr.h:175
DifferenceType difference_type
Difference between two iterators.
Definition: SMatScalarDivExpr.h:217
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:177
Header file for the IsHermitian type trait.
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarDivExpr.h:308
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
Evaluation of the expression type type of a column operation.Via this type trait it is possible to ev...
Definition: ColumnExprTrait.h:78
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Header file for the function trace functionality.