Blaze 3.9
SMatScalarMultExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARMULTEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SMATSCALARMULTEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
66#include <blaze/util/Assert.h>
68#include <blaze/util/EnableIf.h>
71#include <blaze/util/mpl/If.h>
72#include <blaze/util/Types.h>
74
75
76namespace blaze {
77
78//=================================================================================================
79//
80// CLASS SMATSCALARMULTEXPR
81//
82//=================================================================================================
83
84//*************************************************************************************************
91template< typename MT // Type of the left-hand side sparse matrix
92 , typename ST // Type of the right-hand side scalar value
93 , bool SO > // Storage order
95 : public MatScalarMultExpr< SparseMatrix< SMatScalarMultExpr<MT,ST,SO>, SO > >
96 , private Computation
97{
98 private:
99 //**Type definitions****************************************************************************
103 //**********************************************************************************************
104
105 //**Return type evaluation**********************************************************************
107
112 static constexpr bool returnExpr = !IsTemporary_v<RN>;
113
115 using ExprReturnType = decltype( std::declval<RN>() * std::declval<ST>() );
116 //**********************************************************************************************
117
118 //**Serial evaluation strategy******************************************************************
120
126 static constexpr bool useAssign = RequiresEvaluation_v<MT>;
127
130 template< typename MT2 >
131 static constexpr bool UseAssign_v = useAssign;
133 //**********************************************************************************************
134
135 //**Parallel evaluation strategy****************************************************************
137
143 template< typename MT2 >
144 static constexpr bool UseSMPAssign_v =
145 ( ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign );
147 //**********************************************************************************************
148
149 public:
150 //**Type definitions****************************************************************************
153
156
161
164
167
169 using LeftOperand = If_t< IsExpression_v<MT>, const MT, const MT& >;
170
172 using RightOperand = ST;
173 //**********************************************************************************************
174
175 //**ConstIterator class definition**************************************************************
179 {
180 public:
181 //**Type definitions*************************************************************************
184
187
188 using IteratorCategory = std::forward_iterator_tag;
192 using DifferenceType = ptrdiff_t;
193
194 // STL iterator requirements
200 //*******************************************************************************************
201
202 //**Constructor******************************************************************************
205 inline ConstIterator( IteratorType matrix, RightOperand scalar )
206 : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
207 , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
208 {}
209 //*******************************************************************************************
210
211 //**Prefix increment operator****************************************************************
217 ++matrix_;
218 return *this;
219 }
220 //*******************************************************************************************
221
222 //**Element access operator******************************************************************
227 inline const Element operator*() const {
228 return Element( matrix_->value() * scalar_, matrix_->index() );
229 }
230 //*******************************************************************************************
231
232 //**Element access operator******************************************************************
237 inline const ConstIterator* operator->() const {
238 return this;
239 }
240 //*******************************************************************************************
241
242 //**Value function***************************************************************************
247 inline ReturnType value() const {
248 return matrix_->value() * scalar_;
249 }
250 //*******************************************************************************************
251
252 //**Index function***************************************************************************
257 inline size_t index() const {
258 return matrix_->index();
259 }
260 //*******************************************************************************************
261
262 //**Equality operator************************************************************************
268 inline bool operator==( const ConstIterator& rhs ) const {
269 return matrix_ == rhs.matrix_;
270 }
271 //*******************************************************************************************
272
273 //**Inequality operator**********************************************************************
279 inline bool operator!=( const ConstIterator& rhs ) const {
280 return matrix_ != rhs.matrix_;
281 }
282 //*******************************************************************************************
283
284 //**Subtraction operator*********************************************************************
290 inline DifferenceType operator-( const ConstIterator& rhs ) const {
291 return matrix_ - rhs.matrix_;
292 }
293 //*******************************************************************************************
294
295 private:
296 //**Member variables*************************************************************************
299 //*******************************************************************************************
300 };
301 //**********************************************************************************************
302
303 //**Compilation flags***************************************************************************
305 static constexpr bool smpAssignable = false;
306 //**********************************************************************************************
307
308 //**Constructor*********************************************************************************
314 inline SMatScalarMultExpr( const MT& matrix, ST scalar ) noexcept
315 : matrix_( matrix ) // Left-hand side sparse matrix of the multiplication expression
316 , scalar_( scalar ) // Right-hand side scalar of the multiplication expression
317 {}
318 //**********************************************************************************************
319
320 //**Access operator*****************************************************************************
327 inline ReturnType operator()( size_t i, size_t j ) const {
328 BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
329 BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
330 return matrix_(i,j) * scalar_;
331 }
332 //**********************************************************************************************
333
334 //**At function*********************************************************************************
342 inline ReturnType at( size_t i, size_t j ) const {
343 if( i >= matrix_.rows() ) {
344 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
345 }
346 if( j >= matrix_.columns() ) {
347 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
348 }
349 return (*this)(i,j);
350 }
351 //**********************************************************************************************
352
353 //**Begin function******************************************************************************
359 inline ConstIterator begin( size_t i ) const {
360 return ConstIterator( matrix_.begin(i), scalar_ );
361 }
362 //**********************************************************************************************
363
364 //**End function********************************************************************************
370 inline ConstIterator end( size_t i ) const {
371 return ConstIterator( matrix_.end(i), scalar_ );
372 }
373 //**********************************************************************************************
374
375 //**Rows function*******************************************************************************
380 inline size_t rows() const noexcept {
381 return matrix_.rows();
382 }
383 //**********************************************************************************************
384
385 //**Columns function****************************************************************************
390 inline size_t columns() const noexcept {
391 return matrix_.columns();
392 }
393 //**********************************************************************************************
394
395 //**NonZeros function***************************************************************************
400 inline size_t nonZeros() const {
401 return matrix_.nonZeros();
402 }
403 //**********************************************************************************************
404
405 //**NonZeros function***************************************************************************
411 inline size_t nonZeros( size_t i ) const {
412 return matrix_.nonZeros(i);
413 }
414 //**********************************************************************************************
415
416 //**Find function*******************************************************************************
423 inline ConstIterator find( size_t i, size_t j ) const {
425 return ConstIterator( matrix_.find( i, j ), scalar_ );
426 }
427 //**********************************************************************************************
428
429 //**LowerBound function*************************************************************************
436 inline ConstIterator lowerBound( size_t i, size_t j ) const {
438 return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
439 }
440 //**********************************************************************************************
441
442 //**UpperBound function*************************************************************************
449 inline ConstIterator upperBound( size_t i, size_t j ) const {
451 return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
452 }
453 //**********************************************************************************************
454
455 //**Left operand access*************************************************************************
460 inline LeftOperand leftOperand() const noexcept {
461 return matrix_;
462 }
463 //**********************************************************************************************
464
465 //**Right operand access************************************************************************
470 inline RightOperand rightOperand() const noexcept {
471 return scalar_;
472 }
473 //**********************************************************************************************
474
475 //**********************************************************************************************
481 template< typename T >
482 inline bool canAlias( const T* alias ) const noexcept {
483 return matrix_.canAlias( alias );
484 }
485 //**********************************************************************************************
486
487 //**********************************************************************************************
493 template< typename T >
494 inline bool isAliased( const T* alias ) const noexcept {
495 return matrix_.isAliased( alias );
496 }
497 //**********************************************************************************************
498
499 private:
500 //**Member variables****************************************************************************
503 //**********************************************************************************************
504
505 //**Assignment to dense matrices****************************************************************
519 template< typename MT2 // Type of the target dense matrix
520 , bool SO2 > // Storage order of the target dense matrix
521 friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
523 {
525
526 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
527 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
528
529 assign( *lhs, rhs.matrix_ );
530 (*lhs) *= rhs.scalar_;
531 }
533 //**********************************************************************************************
534
535 //**Assignment to sparse matrices***************************************************************
549 template< typename MT2 // Type of the target sparse matrix
550 , bool SO2 > // Storage order of the target sparse matrix
551 friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
553 {
555
556 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
557 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
558
559 assign( *lhs, rhs.matrix_ );
560 (*lhs) *= rhs.scalar_;
561 }
563 //**********************************************************************************************
564
565 //**Addition assignment to dense matrices*******************************************************
579 template< typename MT2 // Type of the target dense matrix
580 , bool SO2 > // Storage order of the target dense matrix
581 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
582 -> EnableIf_t< UseAssign_v<MT2> >
583 {
585
588
589 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
590 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
591
592 const ResultType tmp( serial( rhs ) );
593 addAssign( *lhs, tmp );
594 }
596 //**********************************************************************************************
597
598 //**Addition assignment to sparse matrices******************************************************
599 // No special implementation for the addition assignment to sparse matrices.
600 //**********************************************************************************************
601
602 //**Subtraction assignment to dense matrices****************************************************
616 template< typename MT2 // Type of the target dense matrix
617 , bool SO2 > // Storage order of the target dense matrix
618 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
619 -> EnableIf_t< UseAssign_v<MT2> >
620 {
622
625
626 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
627 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
628
629 const ResultType tmp( serial( rhs ) );
630 subAssign( *lhs, tmp );
631 }
633 //**********************************************************************************************
634
635 //**Subtraction assignment to sparse matrices***************************************************
636 // No special implementation for the subtraction assignment to sparse matrices.
637 //**********************************************************************************************
638
639 //**Schur product assignment to dense matrices**************************************************
653 template< typename MT2 // Type of the target dense matrix
654 , bool SO2 > // Storage order of the target dense matrix
655 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
656 -> EnableIf_t< UseAssign_v<MT2> >
657 {
659
662
663 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
664 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
665
666 const ResultType tmp( serial( rhs ) );
667 schurAssign( *lhs, tmp );
668 }
670 //**********************************************************************************************
671
672 //**Schur product assignment to sparse matrices*************************************************
673 // No special implementation for the Schur product assignment to sparse matrices.
674 //**********************************************************************************************
675
676 //**Multiplication assignment to dense matrices*************************************************
677 // No special implementation for the multiplication assignment to dense matrices.
678 //**********************************************************************************************
679
680 //**Multiplication assignment to sparse matrices************************************************
681 // No special implementation for the multiplication assignment to sparse matrices.
682 //**********************************************************************************************
683
684 //**SMP assignment to dense matrices************************************************************
685 // No special implementation for the SMP assignment to dense matrices.
686 //**********************************************************************************************
687
688 //**SMP assignment to sparse matrices***********************************************************
689 // No special implementation for the SMP assignment to sparse matrices.
690 //**********************************************************************************************
691
692 //**SMP addition assignment to dense matrices***************************************************
706 template< typename MT2 // Type of the target dense matrix
707 , bool SO2 > // Storage order of the target dense matrix
708 friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
709 -> EnableIf_t< UseSMPAssign_v<MT2> >
710 {
712
715
716 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
717 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
718
719 const ResultType tmp( rhs );
720 smpAddAssign( *lhs, tmp );
721 }
723 //**********************************************************************************************
724
725 //**SMP addition assignment to sparse matrices**************************************************
726 // No special implementation for the SMP addition assignment to sparse matrices.
727 //**********************************************************************************************
728
729 //**SMP Schur product assignment to dense matrices**********************************************
743 template< typename MT2 // Type of the target dense matrix
744 , bool SO2 > // Storage order of the target dense matrix
745 friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
746 -> EnableIf_t< UseSMPAssign_v<MT2> >
747 {
749
752
753 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
754 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
755
756 const ResultType tmp( rhs );
757 smpSchurAssign( *lhs, tmp );
758 }
760 //**********************************************************************************************
761
762 //**SMP Schur product assignment to sparse matrices*********************************************
763 // No special implementation for the SMP Schur product assignment to sparse matrices.
764 //**********************************************************************************************
765
766 //**SMP subtraction assignment to dense matrices************************************************
780 template< typename MT2 // Type of the target dense matrix
781 , bool SO2 > // Storage order of the target dense matrix
782 friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarMultExpr& rhs )
783 -> EnableIf_t< UseSMPAssign_v<MT2> >
784 {
786
789
790 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
791 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
792
793 const ResultType tmp( rhs );
794 smpSubAssign( *lhs, tmp );
795 }
797 //**********************************************************************************************
798
799 //**SMP subtraction assignment to sparse matrices***********************************************
800 // No special implementation for the SMP subtraction assignment to sparse matrices.
801 //**********************************************************************************************
802
803 //**SMP multiplication assignment to dense matrices*********************************************
804 // No special implementation for the SMP multiplication assignment to dense matrices.
805 //**********************************************************************************************
806
807 //**SMP multiplication assignment to sparse matrices********************************************
808 // No special implementation for the SMP multiplication assignment to sparse matrices.
809 //**********************************************************************************************
810
811 //**Compile time checks*************************************************************************
819 //**********************************************************************************************
820};
821//*************************************************************************************************
822
823
824
825
826//=================================================================================================
827//
828// GLOBAL UNARY ARITHMETIC OPERATORS
829//
830//=================================================================================================
831
832//*************************************************************************************************
849template< typename MT // Data type of the sparse matrix
850 , bool SO > // Storage order
851inline decltype(auto) operator-( const SparseMatrix<MT,SO>& sm )
852{
854
855 using ScalarType = UnderlyingBuiltin_t<MT>;
856 using ReturnType = const SMatScalarMultExpr<MT,ScalarType,SO>;
857 return ReturnType( *sm, ScalarType(-1) );
858}
859//*************************************************************************************************
860
861
862
863
864//=================================================================================================
865//
866// GLOBAL BINARY ARITHMETIC OPERATORS
867//
868//=================================================================================================
869
870//*************************************************************************************************
883template< typename MT // Type of the left-hand side sparse matrix
884 , bool SO // Storage order of the left-hand side sparse matrix
885 , typename ST // Type of the right-hand side scalar
886 , DisableIf_t< IsZero_v<MT> >* = nullptr >
887inline const SMatScalarMultExpr< MT, MultTrait_t< UnderlyingBuiltin_t<MT>, ST >, SO >
888 smatscalarmult( const SparseMatrix<MT,SO>& mat, ST scalar )
889{
891
892 using ScalarType = MultTrait_t< UnderlyingBuiltin_t<MT>, ST >;
893 using ReturnType = const SMatScalarMultExpr<MT,ScalarType,SO>;
894 return ReturnType( *mat, scalar );
895}
897//*************************************************************************************************
898
899
900//*************************************************************************************************
913template< typename MT // Type of the left-hand side sparse matrix
914 , bool SO // Storage order of the left-hand side zero matrix
915 , typename ST // Type of the right-hand side scalar
916 , EnableIf_t< IsZero_v<MT> >* = nullptr >
917inline decltype(auto)
918 smatscalarmult( const SparseMatrix<MT,SO>& mat, ST scalar )
919{
921
922 MAYBE_UNUSED( scalar );
923
924 using ReturnType = const MultTrait_t< ResultType_t<MT>, ST >;
925
928
929 return ReturnType( (*mat).rows(), (*mat).columns() );
930}
932//*************************************************************************************************
933
934
935//*************************************************************************************************
956template< typename MT // Type of the left-hand side sparse matrix
957 , bool SO // Storage order of the left-hand side sparse matrix
958 , typename ST // Type of the right-hand side scalar
959 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
960inline decltype(auto) operator*( const SparseMatrix<MT,SO>& mat, ST scalar )
961{
963
964 return smatscalarmult( *mat, scalar );
965}
966//*************************************************************************************************
967
968
969//*************************************************************************************************
990template< typename ST // Type of the left-hand side scalar
991 , typename MT // Type of the right-hand side sparse matrix
992 , bool SO // Storage order of the right-hand side sparse matrix
993 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
994inline decltype(auto) operator*( ST scalar, const SparseMatrix<MT,SO>& mat )
995{
997
998 return smatscalarmult( *mat, scalar );
999}
1000//*************************************************************************************************
1001
1002} // namespace blaze
1003
1004#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 EnableIf class template.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsExpression type trait class.
Header file for the IsInvertible type trait.
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 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 multiplication expression.
Definition: SMatScalarMultExpr.h:179
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:183
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarMultExpr.h:279
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarMultExpr.h:192
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarMultExpr.h:189
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: SMatScalarMultExpr.h:298
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarMultExpr.h:290
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarMultExpr.h:237
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarMultExpr.h:268
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarMultExpr.h:216
ConstIterator_t< RemoveReference_t< LeftOperand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:186
DifferenceType difference_type
Difference between two iterators.
Definition: SMatScalarMultExpr.h:199
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarMultExpr.h:195
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarMultExpr.h:257
ValueType * PointerType
Pointer return type.
Definition: SMatScalarMultExpr.h:190
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarMultExpr.h:205
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarMultExpr.h:227
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarMultExpr.h:297
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarMultExpr.h:191
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarMultExpr.h:247
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarMultExpr.h:188
Expression object for sparse matrix-scalar multiplications.
Definition: SMatScalarMultExpr.h:97
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatScalarMultExpr.h:380
CompositeType_t< MT > CT
Composite type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:102
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarMultExpr.h:482
If_t< IsExpression_v< MT >, const MT, const MT & > LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:169
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarMultExpr.h:159
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatScalarMultExpr.h:390
RightOperand scalar_
Right-hand side scalar of the multiplication expression.
Definition: SMatScalarMultExpr.h:502
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the multiplication expression.
Definition: SMatScalarMultExpr.h:126
MultTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SMatScalarMultExpr.h:157
decltype(std::declval< RN >() *std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarMultExpr.h:115
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SMatScalarMultExpr.h:163
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatScalarMultExpr.h:436
ReturnType_t< MT > RN
Return type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:101
SMatScalarMultExpr(const MT &matrix, ST scalar) noexcept
Constructor for the SMatScalarMultExpr class.
Definition: SMatScalarMultExpr.h:314
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatScalarMultExpr.h:370
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatScalarMultExpr.h:342
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarMultExpr.h:423
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatScalarMultExpr.h:305
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarMultExpr.h:494
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarMultExpr.h:460
If_t< useAssign, const ResultType, const SMatScalarMultExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatScalarMultExpr.h:166
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatScalarMultExpr.h:359
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatScalarMultExpr.h:160
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SMatScalarMultExpr.h:470
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarMultExpr.h:411
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarMultExpr.h:400
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarMultExpr.h:449
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarMultExpr.h:172
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarMultExpr.h:327
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SMatScalarMultExpr.h:112
LeftOperand matrix_
Left-hand side sparse matrix of the multiplication expression.
Definition: SMatScalarMultExpr.h:501
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatScalarMultExpr.h:100
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarMultExpr.h:158
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 MatScalarMultExpr base class.
Header file for the SparseMatrix base class.
#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
#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
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_t
Auxiliary alias declaration for the UnderlyingBuiltin type trait.
Definition: UnderlyingBuiltin.h:117
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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 multiplication expression templates.
Definition: MatScalarMultExpr.h:77
Header file for the IsZero type trait.
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.