Blaze 3.9
SMatScalarDivExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
69#include <blaze/util/Assert.h>
72#include <blaze/util/EnableIf.h>
75#include <blaze/util/mpl/If.h>
76#include <blaze/util/Types.h>
80
81
82namespace blaze {
83
84//=================================================================================================
85//
86// CLASS SMATSCALARDIVEXPR
87//
88//=================================================================================================
89
90//*************************************************************************************************
97template< typename MT // Type of the left-hand side sparse matrix
98 , typename ST // Type of the right-hand side scalar value
99 , bool SO > // Storage order
101 : public MatScalarDivExpr< SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO > >
102 , private Computation
103{
104 private:
105 //**Type definitions****************************************************************************
109 //**********************************************************************************************
110
111 //**Return type evaluation**********************************************************************
113
118 static constexpr bool returnExpr = !IsTemporary_v<RN>;
119
121 using ExprReturnType = decltype( std::declval<RN>() / std::declval<ST>() );
122 //**********************************************************************************************
123
124 //**Serial evaluation strategy******************************************************************
126
132 static constexpr bool useAssign = RequiresEvaluation_v<MT>;
133
136 template< typename MT2 >
137 static constexpr bool UseAssign_v = useAssign;
139 //**********************************************************************************************
140
141 //**Parallel evaluation strategy****************************************************************
143
149 template< typename MT2 >
150 static constexpr bool UseSMPAssign_v =
151 ( ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign );
153 //**********************************************************************************************
154
155 public:
156 //**Type definitions****************************************************************************
159
162
167
170
173
175 using LeftOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
176
178 using RightOperand = ST;
179 //**********************************************************************************************
180
181 //**ConstIterator class definition**************************************************************
185 {
186 public:
187 //**Type definitions*************************************************************************
190
193
194 using IteratorCategory = std::forward_iterator_tag;
198 using DifferenceType = ptrdiff_t;
199
200 // STL iterator requirements
206 //*******************************************************************************************
207
208 //**Constructor******************************************************************************
211 inline ConstIterator( IteratorType matrix, RightOperand scalar )
212 : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
213 , scalar_( scalar ) // Right-hand side scalar of the division expression
214 {}
215 //*******************************************************************************************
216
217 //**Prefix increment operator****************************************************************
223 ++matrix_;
224 return *this;
225 }
226 //*******************************************************************************************
227
228 //**Element access operator******************************************************************
233 inline const Element operator*() const {
234 return Element( matrix_->value() / scalar_, matrix_->index() );
235 }
236 //*******************************************************************************************
237
238 //**Element access operator******************************************************************
243 inline const ConstIterator* operator->() const {
244 return this;
245 }
246 //*******************************************************************************************
247
248 //**Value function***************************************************************************
253 inline ReturnType value() const {
254 return matrix_->value() / scalar_;
255 }
256 //*******************************************************************************************
257
258 //**Index function***************************************************************************
263 inline size_t index() const {
264 return matrix_->index();
265 }
266 //*******************************************************************************************
267
268 //**Equality operator************************************************************************
274 inline bool operator==( const ConstIterator& rhs ) const {
275 return matrix_ == rhs.matrix_;
276 }
277 //*******************************************************************************************
278
279 //**Inequality operator**********************************************************************
285 inline bool operator!=( const ConstIterator& rhs ) const {
286 return matrix_ != rhs.matrix_;
287 }
288 //*******************************************************************************************
289
290 //**Subtraction operator*********************************************************************
296 inline DifferenceType operator-( const ConstIterator& rhs ) const {
297 return matrix_ - rhs.matrix_;
298 }
299 //*******************************************************************************************
300
301 private:
302 //**Member variables*************************************************************************
305 //*******************************************************************************************
306 };
307 //**********************************************************************************************
308
309 //**Compilation flags***************************************************************************
311 static constexpr bool smpAssignable = false;
312 //**********************************************************************************************
313
314 //**Constructor*********************************************************************************
320 inline SMatScalarDivExpr( const MT& matrix, ST scalar ) noexcept
321 : matrix_( matrix ) // Left-hand side sparse matrix of the division expression
322 , scalar_( scalar ) // Right-hand side scalar of the division expression
323 {}
324 //**********************************************************************************************
325
326 //**Access operator*****************************************************************************
333 inline ReturnType operator()( size_t i, size_t j ) const {
334 BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
335 BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
336 return matrix_(i,j) / scalar_;
337 }
338 //**********************************************************************************************
339
340 //**At function*********************************************************************************
348 inline ReturnType at( size_t i, size_t j ) const {
349 if( i >= matrix_.rows() ) {
350 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
351 }
352 if( j >= matrix_.columns() ) {
353 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
354 }
355 return (*this)(i,j);
356 }
357 //**********************************************************************************************
358
359 //**Begin function******************************************************************************
365 inline ConstIterator begin( size_t i ) const {
366 return ConstIterator( matrix_.begin(i), scalar_ );
367 }
368 //**********************************************************************************************
369
370 //**End function********************************************************************************
376 inline ConstIterator end( size_t i ) const {
377 return ConstIterator( matrix_.end(i), scalar_ );
378 }
379 //**********************************************************************************************
380
381 //**Rows function*******************************************************************************
386 inline size_t rows() const noexcept {
387 return matrix_.rows();
388 }
389 //**********************************************************************************************
390
391 //**Columns function****************************************************************************
396 inline size_t columns() const noexcept {
397 return matrix_.columns();
398 }
399 //**********************************************************************************************
400
401 //**NonZeros function***************************************************************************
406 inline size_t nonZeros() const {
407 return matrix_.nonZeros();
408 }
409 //**********************************************************************************************
410
411 //**NonZeros function***************************************************************************
417 inline size_t nonZeros( size_t i ) const {
418 return matrix_.nonZeros(i);
419 }
420 //**********************************************************************************************
421
422 //**Find function*******************************************************************************
429 inline ConstIterator find( size_t i, size_t j ) const {
431 return ConstIterator( matrix_.find( i, j ), scalar_ );
432 }
433 //**********************************************************************************************
434
435 //**LowerBound function*************************************************************************
442 inline ConstIterator lowerBound( size_t i, size_t j ) const {
444 return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
445 }
446 //**********************************************************************************************
447
448 //**UpperBound function*************************************************************************
455 inline ConstIterator upperBound( size_t i, size_t j ) const {
457 return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
458 }
459 //**********************************************************************************************
460
461 //**Left operand access*************************************************************************
466 inline LeftOperand leftOperand() const noexcept {
467 return matrix_;
468 }
469 //**********************************************************************************************
470
471 //**Right operand access************************************************************************
476 inline RightOperand rightOperand() const noexcept {
477 return scalar_;
478 }
479 //**********************************************************************************************
480
481 //**********************************************************************************************
487 template< typename T >
488 inline bool canAlias( const T* alias ) const noexcept {
489 return matrix_.canAlias( alias );
490 }
491 //**********************************************************************************************
492
493 //**********************************************************************************************
499 template< typename T >
500 inline bool isAliased( const T* alias ) const noexcept {
501 return matrix_.isAliased( alias );
502 }
503 //**********************************************************************************************
504
505 private:
506 //**Member variables****************************************************************************
509 //**********************************************************************************************
510
511 //**Assignment to dense matrices****************************************************************
525 template< typename MT2 // Type of the target dense matrix
526 , bool SO2 > // Storage order of the target dense matrix
527 friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
529 {
531
532 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
533 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
534
535 assign( *lhs, rhs.matrix_ );
536 (*lhs) /= rhs.scalar_;
537 }
539 //**********************************************************************************************
540
541 //**Assignment to sparse matrices***************************************************************
555 template< typename MT2 // Type of the target sparse matrix
556 , bool SO2 > // Storage order of the target sparse matrix
557 friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
559 {
561
562 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
563 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
564
565 assign( *lhs, rhs.matrix_ );
566 (*lhs) /= rhs.scalar_;
567 }
569 //**********************************************************************************************
570
571 //**Addition assignment to dense matrices*******************************************************
585 template< typename MT2 // Type of the target dense matrix
586 , bool SO2 > // Storage order of the target dense matrix
587 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
588 -> EnableIf_t< UseAssign_v<MT2> >
589 {
591
594
595 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
596 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
597
598 const ResultType tmp( serial( rhs ) );
599 addAssign( *lhs, tmp );
600 }
602 //**********************************************************************************************
603
604 //**Addition assignment to sparse matrices******************************************************
605 // No special implementation for the addition assignment to sparse matrices.
606 //**********************************************************************************************
607
608 //**Subtraction assignment to dense matrices****************************************************
622 template< typename MT2 // Type of the target dense matrix
623 , bool SO2 > // Storage order of the target dense matrix
624 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
625 -> EnableIf_t< UseAssign_v<MT2> >
626 {
628
631
632 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
633 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
634
635 const ResultType tmp( serial( rhs ) );
636 subAssign( *lhs, tmp );
637 }
639 //**********************************************************************************************
640
641 //**Subtraction assignment to sparse matrices***************************************************
642 // No special implementation for the subtraction assignment to sparse matrices.
643 //**********************************************************************************************
644
645 //**Schur product assignment to dense matrices**************************************************
659 template< typename MT2 // Type of the target dense matrix
660 , bool SO2 > // Storage order of the target dense matrix
661 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
662 -> EnableIf_t< UseAssign_v<MT2> >
663 {
665
668
669 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
670 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
671
672 const ResultType tmp( serial( rhs ) );
673 schurAssign( *lhs, tmp );
674 }
676 //**********************************************************************************************
677
678 //**Schur product assignment to sparse matrices*************************************************
679 // No special implementation for the Schur product assignment to sparse matrices.
680 //**********************************************************************************************
681
682 //**Multiplication assignment to dense matrices*************************************************
683 // No special implementation for the multiplication assignment to dense matrices.
684 //**********************************************************************************************
685
686 //**Multiplication assignment to sparse matrices************************************************
687 // No special implementation for the multiplication assignment to sparse matrices.
688 //**********************************************************************************************
689
690 //**SMP assignment to dense matrices************************************************************
691 // No special implementation for the SMP assignment to dense matrices.
692 //**********************************************************************************************
693
694 //**SMP assignment to sparse matrices***********************************************************
695 // No special implementation for the SMP assignment to sparse matrices.
696 //**********************************************************************************************
697
698 //**SMP addition assignment to dense matrices***************************************************
712 template< typename MT2 // Type of the target dense matrix
713 , bool SO2 > // Storage order of the target dense matrix
714 friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
715 -> EnableIf_t< UseSMPAssign_v<MT2> >
716 {
718
721
722 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
723 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
724
725 const ResultType tmp( rhs );
726 smpAddAssign( *lhs, tmp );
727 }
729 //**********************************************************************************************
730
731 //**SMP addition assignment to sparse matrices**************************************************
732 // No special implementation for the SMP addition assignment to sparse matrices.
733 //**********************************************************************************************
734
735 //**SMP subtraction assignment to dense matrices************************************************
749 template< typename MT2 // Type of the target dense matrix
750 , bool SO2 > // Storage order of the target dense matrix
751 friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
752 -> EnableIf_t< UseSMPAssign_v<MT2> >
753 {
755
758
759 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
760 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
761
762 const ResultType tmp( rhs );
763 smpSubAssign( *lhs, tmp );
764 }
766 //**********************************************************************************************
767
768 //**SMP subtraction assignment to sparse matrices***********************************************
769 // No special implementation for the SMP subtraction assignment to sparse matrices.
770 //**********************************************************************************************
771
772 //**SMP Schur product assignment to dense matrices**********************************************
786 template< typename MT2 // Type of the target dense matrix
787 , bool SO2 > // Storage order of the target dense matrix
788 friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
789 -> EnableIf_t< UseSMPAssign_v<MT2> >
790 {
792
795
796 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
797 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
798
799 const ResultType tmp( rhs );
800 smpSchurAssign( *lhs, tmp );
801 }
803 //**********************************************************************************************
804
805 //**SMP Schur product assignment to sparse matrices*********************************************
806 // No special implementation for the SMP Schur product assignment to sparse matrices.
807 //**********************************************************************************************
808
809 //**Multiplication assignment to dense matrices*************************************************
810 // No special implementation for the SMP multiplication assignment to dense matrices.
811 //**********************************************************************************************
812
813 //**SMP multiplication assignment to sparse matrices********************************************
814 // No special implementation for the SMP multiplication assignment to sparse matrices.
815 //**********************************************************************************************
816
817 //**Compile time checks*************************************************************************
827 //**********************************************************************************************
828};
829//*************************************************************************************************
830
831
832
833
834//=================================================================================================
835//
836// GLOBAL BINARY ARITHMETIC OPERATORS
837//
838//=================================================================================================
839
840//*************************************************************************************************
845template< typename MT // Type of the left-hand side sparse matrix
846 , typename ST > // Type of the right-hand side scalar
847using SMatScalarDivExprHelper_t =
848 If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<MT> > ||
849 IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
850 , If_t< IsBuiltin_v<ST>
851 , DivTrait_t< UnderlyingBuiltin_t<MT>, ST >
852 , decltype( inv( std::declval<ST>() ) ) >
853 , ST >;
855//*************************************************************************************************
856
857
858//*************************************************************************************************
870template< typename MT // Type of the left-hand side sparse matrix
871 , bool SO // Storage order of the left-hand side sparse matrix
872 , typename ST // Type of the right-hand side scalar
873 , EnableIf_t< !IsZero_v<MT> &&
874 !IsInvertible_v< SMatScalarDivExprHelper_t<MT,ST> > >* = nullptr >
875inline decltype(auto) smatscalardiv( const SparseMatrix<MT,SO>& mat, ST scalar )
876{
878
879 using ScalarType = SMatScalarDivExprHelper_t<MT,ST>;
880 using ReturnType = const SMatScalarDivExpr<MT,ScalarType,SO>;
881
882 return ReturnType( *mat, scalar );
883}
885//*************************************************************************************************
886
887
888//*************************************************************************************************
900template< typename MT // Type of the left-hand side sparse matrix
901 , bool SO // Storage order of the left-hand side sparse matrix
902 , typename ST // Type of the right-hand side scalar
903 , EnableIf_t< !IsZero_v<MT> &&
904 IsInvertible_v< SMatScalarDivExprHelper_t<MT,ST> > >* = nullptr >
905inline decltype(auto) smatscalardiv( const SparseMatrix<MT,SO>& mat, ST scalar )
906{
908
909 using ScalarType = SMatScalarDivExprHelper_t<MT,ST>;
910 using ReturnType = const SMatScalarMultExpr<MT,ScalarType,SO>;
911
912 return ReturnType( *mat, inv(scalar) );
913}
915//*************************************************************************************************
916
917
918//*************************************************************************************************
931template< typename MT // Type of the left-hand side sparse matrix
932 , bool SO // Storage order of the left-hand side zero matrix
933 , typename ST // Type of the right-hand side scalar
934 , EnableIf_t< IsZero_v<MT> >* = nullptr >
935inline decltype(auto)
936 smatscalardiv( const SparseMatrix<MT,SO>& mat, ST scalar )
937{
939
940 MAYBE_UNUSED( scalar );
941
942 using ReturnType = const DivTrait_t< ResultType_t<MT>, ST >;
943
946
947 return ReturnType( (*mat).rows(), (*mat).columns() );
948}
950//*************************************************************************************************
951
952
953//*************************************************************************************************
975template< typename MT // Type of the left-hand side sparse matrix
976 , bool SO // Storage order of the left-hand side sparse matrix
977 , typename ST // Type of the right-hand side scalar
978 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
979inline decltype(auto) operator/( const SparseMatrix<MT,SO>& mat, ST scalar )
980{
982
983 BLAZE_USER_ASSERT( scalar != ST{}, "Division by zero detected" );
984
985 return smatscalardiv( *mat, scalar );
986}
987//*************************************************************************************************
988
989} // namespace blaze
990
991#endif
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition: Aliases.h:130
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the division trait.
Header file for the EnableIf class template.
Constraint on the data type.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsBuiltin type trait.
Header file for the IsExpression type trait class.
Header file for the IsFloatingPoint type trait.
Header file for the IsInvertible type trait.
Header file for the IsMultExpr type trait class.
Header file for the IsScalar type trait.
Header file for the IsTemporary type trait class.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Header file for the RemoveReference type trait.
Data type constraint.
Constraint on the data type.
Header file for the UnderlyingBuiltin type trait.
Header file for the UnderlyingElement type trait.
Header file for the ValueIndexPair class.
Constraint on the data type.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:185
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:189
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarDivExpr.h:194
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:274
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:222
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarDivExpr.h:197
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:195
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarDivExpr.h:201
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:285
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:303
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarDivExpr.h:253
DifferenceType difference_type
Difference between two iterators.
Definition: SMatScalarDivExpr.h:205
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarDivExpr.h:296
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarDivExpr.h:211
ConstIterator_t< RemoveReference_t< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:192
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarDivExpr.h:198
ValueType * PointerType
Pointer return type.
Definition: SMatScalarDivExpr.h:196
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarDivExpr.h:263
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:243
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:233
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:304
Expression object for sparse matrix-scalar divisions.
Definition: SMatScalarDivExpr.h:103
SMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:320
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:164
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatScalarDivExpr.h:386
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:333
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarDivExpr.h:466
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatScalarDivExpr.h:311
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:165
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatScalarDivExpr.h:376
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarDivExpr.h:348
MultTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SMatScalarDivExpr.h:163
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarDivExpr.h:500
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SMatScalarDivExpr.h:118
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:106
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarDivExpr.h:488
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the division expression.
Definition: SMatScalarDivExpr.h:132
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:166
ReturnType_t< MT > RN
Return type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:107
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:396
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:442
decltype(std::declval< RN >()/std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:121
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatScalarDivExpr.h:365
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:406
LeftOperand matrix_
Left-hand side sparse matrix of the division expression.
Definition: SMatScalarDivExpr.h:507
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarDivExpr.h:429
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:508
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:178
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:175
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:169
CompositeType_t< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:108
If_t< useAssign, const ResultType, const SMatScalarDivExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:172
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:476
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarDivExpr.h:417
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarDivExpr.h:455
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Index-value-pair for sparse vectors and matrices.
Definition: ValueIndexPair.h:75
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the MatScalarDivExpr base class.
Header file for the SparseMatrix base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.
Definition: FloatingPoint.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.
Definition: SameType.h:71
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) inv(const DenseMatrix< MT, SO > &dm)
Calculation of the inverse of the given dense matrix.
Definition: DMatInvExpr.h:405
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:61
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraints on the storage order of matrix types.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all matrix/scalar division expression templates.
Definition: MatScalarDivExpr.h:75
Header file for the IsZero type trait.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.