Blaze 3.9
SMatMapExpr.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_SMATMAPEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SMATMAPEXPR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
45#include <blaze/math/Aliases.h>
54#include <blaze/math/Functors.h>
64#include <blaze/util/Assert.h>
65#include <blaze/util/EnableIf.h>
67#include <blaze/util/mpl/If.h>
68#include <blaze/util/Types.h>
72
73
74namespace blaze {
75
76//=================================================================================================
77//
78// CLASS SMATMAPEXPR
79//
80//=================================================================================================
81
82//*************************************************************************************************
89template< typename MT // Type of the sparse matrix
90 , typename OP // Type of the custom operation
91 , bool SO > // Storage order
93 : public MatMapExpr< SparseMatrix< SMatMapExpr<MT,OP,SO>, SO > >
94 , private Computation
95{
96 private:
97 //**Type definitions****************************************************************************
101 //**********************************************************************************************
102
103 //**Serial evaluation strategy******************************************************************
105
111 static constexpr bool useAssign = RequiresEvaluation_v<MT>;
112
115 template< typename MT2 >
116 static constexpr bool UseAssign_v = useAssign;
118 //**********************************************************************************************
119
120 //**Parallel evaluation strategy****************************************************************
122
128 template< typename MT2 >
129 static constexpr bool UseSMPAssign_v =
130 ( ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign );
132 //**********************************************************************************************
133
134 public:
135 //**Type definitions****************************************************************************
138
141
146
148 using ReturnType = decltype( std::declval<OP>()( std::declval<RN>() ) );
149
152
154 using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
155
157 using Operation = OP;
158 //**********************************************************************************************
159
160 //**ConstIterator class definition**************************************************************
164 {
165 public:
166 //**Type definitions*************************************************************************
169
172
173 using IteratorCategory = std::forward_iterator_tag;
177 using DifferenceType = ptrdiff_t;
178
179 // STL iterator requirements
185 //*******************************************************************************************
186
187 //**Constructor******************************************************************************
193 inline ConstIterator( IteratorType it, OP op )
194 : it_( it ) // Iterator over the elements of the sparse matrix expression
195 , op_( std::move(op) ) // The custom unary operation
196 {}
197 //*******************************************************************************************
198
199 //**Prefix increment operator****************************************************************
205 ++it_;
206 return *this;
207 }
208 //*******************************************************************************************
209
210 //**Element access operator******************************************************************
215 inline const Element operator*() const {
216 return Element( op_( it_->value() ), it_->index() );
217 }
218 //*******************************************************************************************
219
220 //**Element access operator******************************************************************
225 inline const ConstIterator* operator->() const {
226 return this;
227 }
228 //*******************************************************************************************
229
230 //**Value function***************************************************************************
235 inline ReturnType value() const {
236 return op_( it_->value() );
237 }
238 //*******************************************************************************************
239
240 //**Index function***************************************************************************
245 inline size_t index() const {
246 return it_->index();
247 }
248 //*******************************************************************************************
249
250 //**Equality operator************************************************************************
256 inline bool operator==( const ConstIterator& rhs ) const {
257 return it_ == rhs.it_;
258 }
259 //*******************************************************************************************
260
261 //**Inequality operator**********************************************************************
267 inline bool operator!=( const ConstIterator& rhs ) const {
268 return it_ != rhs.it_;
269 }
270 //*******************************************************************************************
271
272 //**Subtraction operator*********************************************************************
278 inline DifferenceType operator-( const ConstIterator& rhs ) const {
279 return it_ - rhs.it_;
280 }
281 //*******************************************************************************************
282
283 private:
284 //**Member variables*************************************************************************
286 OP op_;
287 //*******************************************************************************************
288 };
289 //**********************************************************************************************
290
291 //**Compilation flags***************************************************************************
293 static constexpr bool smpAssignable = MT::smpAssignable;
294 //**********************************************************************************************
295
296 //**Constructor*********************************************************************************
302 inline SMatMapExpr( const MT& sm, OP op ) noexcept
303 : sm_( sm ) // Sparse matrix of the map expression
304 , op_( std::move(op) ) // The custom unary operation
305 {}
306 //**********************************************************************************************
307
308 //**Access operator*****************************************************************************
315 inline ReturnType operator()( size_t i, size_t j ) const {
316 BLAZE_INTERNAL_ASSERT( i < sm_.rows() , "Invalid row access index" );
317 BLAZE_INTERNAL_ASSERT( j < sm_.columns(), "Invalid column access index" );
318 return op_( sm_(i,j) );
319 }
320 //**********************************************************************************************
321
322 //**At function*********************************************************************************
330 inline ReturnType at( size_t i, size_t j ) const {
331 if( i >= sm_.rows() ) {
332 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
333 }
334 if( j >= sm_.columns() ) {
335 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
336 }
337 return (*this)(i,j);
338 }
339 //**********************************************************************************************
340
341 //**Begin function******************************************************************************
347 inline ConstIterator begin( size_t i ) const {
348 return ConstIterator( sm_.begin(i), op_ );
349 }
350 //**********************************************************************************************
351
352 //**End function********************************************************************************
358 inline ConstIterator end( size_t i ) const {
359 return ConstIterator( sm_.end(i), op_ );
360 }
361 //**********************************************************************************************
362
363 //**Rows function*******************************************************************************
368 inline size_t rows() const noexcept {
369 return sm_.rows();
370 }
371 //**********************************************************************************************
372
373 //**Columns function****************************************************************************
378 inline size_t columns() const noexcept {
379 return sm_.columns();
380 }
381 //**********************************************************************************************
382
383 //**NonZeros function***************************************************************************
388 inline size_t nonZeros() const {
389 return sm_.nonZeros();
390 }
391 //**********************************************************************************************
392
393 //**NonZeros function***************************************************************************
399 inline size_t nonZeros( size_t i ) const {
400 return sm_.nonZeros(i);
401 }
402 //**********************************************************************************************
403
404 //**Find function*******************************************************************************
411 inline ConstIterator find( size_t i, size_t j ) const {
413 return ConstIterator( sm_.find( i, j ), op_ );
414 }
415 //**********************************************************************************************
416
417 //**LowerBound function*************************************************************************
424 inline ConstIterator lowerBound( size_t i, size_t j ) const {
426 return ConstIterator( sm_.lowerBound( i, j ), op_ );
427 }
428 //**********************************************************************************************
429
430 //**UpperBound function*************************************************************************
437 inline ConstIterator upperBound( size_t i, size_t j ) const {
439 return ConstIterator( sm_.upperBound( i, j ), op_ );
440 }
441 //**********************************************************************************************
442
443 //**Operand access******************************************************************************
448 inline Operand operand() const noexcept {
449 return sm_;
450 }
451 //**********************************************************************************************
452
453 //**Operation access****************************************************************************
458 inline Operation operation() const {
459 return op_;
460 }
461 //**********************************************************************************************
462
463 //**********************************************************************************************
469 template< typename T >
470 inline bool canAlias( const T* alias ) const noexcept {
471 return sm_.canAlias( alias );
472 }
473 //**********************************************************************************************
474
475 //**********************************************************************************************
481 template< typename T >
482 inline bool isAliased( const T* alias ) const noexcept {
483 return sm_.isAliased( alias );
484 }
485 //**********************************************************************************************
486
487 //**********************************************************************************************
492 inline bool canSMPAssign() const noexcept {
493 return sm_.canSMPAssign();
494 }
495 //**********************************************************************************************
496
497 private:
498 //**Member variables****************************************************************************
501 //**********************************************************************************************
502
503 //**Assignment to dense matrices****************************************************************
517 template< typename MT2 // Type of the target dense matrix
518 , bool SO2 > // Storage order of the target dense matrix
519 friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
521 {
523
527
528 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
529 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
530
531 const RT tmp( serial( rhs.sm_ ) );
532 assign( *lhs, map( tmp, rhs.op_ ) );
533 }
535 //**********************************************************************************************
536
537 //**Assignment to row-major sparse matrices*****************************************************
552 template< typename MT2 > // Type of the target sparse matrix
553 friend inline auto assign( SparseMatrix<MT2,false>& lhs, const SMatMapExpr& rhs )
555 IsSame_v< UnderlyingScalar_t<MT>, UnderlyingScalar_t<MT2> > >
556 {
558
559 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
560 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
561
562 assign( *lhs, rhs.sm_ );
563
564 const size_t m( rhs.rows() );
565
566 for( size_t i=0UL; i<m; ++i ) {
567 const auto end( (*lhs).end(i) );
568 for( auto element=(*lhs).begin(i); element!=end; ++element ) {
569 element->value() = rhs.op_( element->value() );
570 }
571 }
572 }
574 //**********************************************************************************************
575
576 //**Assignment to column-major sparse matrices**************************************************
591 template< typename MT2 > // Type of the target sparse matrix
592 friend inline auto assign( SparseMatrix<MT2,true>& lhs, const SMatMapExpr& rhs )
593 -> EnableIf_t< UseAssign_v<MT2> &&
594 IsSame_v< UnderlyingScalar_t<MT>, UnderlyingScalar_t<MT2> > >
595 {
597
598 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
599 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
600
601 assign( *lhs, rhs.sm_ );
602
603 const size_t n( rhs.columns() );
604
605 for( size_t j=0UL; j<n; ++j ) {
606 const auto end( (*lhs).end(j) );
607 for( auto element=(*lhs).begin(j); element!=end; ++element ) {
608 element->value() = rhs.op_( element->value() );
609 }
610 }
611 }
613 //**********************************************************************************************
614
615 //**Assignment to sparse matrices***************************************************************
630 template< typename MT2 // Type of the target sparse matrix
631 , bool SO2 > // Storage order of the target sparse matrix
632 friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
633 -> EnableIf_t< UseAssign_v<MT2> &&
634 !IsSame_v< UnderlyingScalar_t<MT>, UnderlyingScalar_t<MT2> > >
635 {
637
641
642 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
643 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
644
645 const RT tmp( serial( rhs.sm_ ) );
646 (*lhs).reserve( tmp.nonZeros() );
647 assign( *lhs, map( tmp, rhs.op_ ) );
648 }
650 //**********************************************************************************************
651
652 //**Addition assignment to dense matrices*******************************************************
666 template< typename MT2 // Type of the target dense matrix
667 , bool SO2 > // Storage order of the target dense matrix
668 friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
669 -> EnableIf_t< UseAssign_v<MT2> >
670 {
672
676
677 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
678 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
679
680 const RT tmp( serial( rhs.sm_ ) );
681 addAssign( *lhs, map( tmp, rhs.op_ ) );
682 }
684 //**********************************************************************************************
685
686 //**Addition assignment to sparse matrices******************************************************
687 // No special implementation for the addition assignment to sparse matrices.
688 //**********************************************************************************************
689
690 //**Subtraction assignment to dense matrices****************************************************
704 template< typename MT2 // Type of the target dense matrix
705 , bool SO2 > // Storage order of the target sparse matrix
706 friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
707 -> EnableIf_t< UseAssign_v<MT2> >
708 {
710
714
715 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
716 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
717
718 const RT tmp( serial( rhs.sm_ ) );
719 subAssign( *lhs, map( tmp, rhs.op_ ) );
720 }
722 //**********************************************************************************************
723
724 //**Subtraction assignment to sparse matrices***************************************************
725 // No special implementation for the subtraction assignment to sparse matrices.
726 //**********************************************************************************************
727
728 //**Schur product assignment to dense matrices**************************************************
742 template< typename MT2 // Type of the target dense matrix
743 , bool SO2 > // Storage order of the target dense matrix
744 friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
745 -> EnableIf_t< UseAssign_v<MT2> >
746 {
748
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 RT tmp( serial( rhs.sm_ ) );
757 schurAssign( *lhs, map( tmp, rhs.op_ ) );
758 }
760 //**********************************************************************************************
761
762 //**Schur product assignment to sparse matrices*************************************************
763 // No special implementation for the Schur product assignment to sparse matrices.
764 //**********************************************************************************************
765
766 //**Multiplication assignment to dense matrices*************************************************
767 // No special implementation for the multiplication assignment to dense matrices.
768 //**********************************************************************************************
769
770 //**Multiplication assignment to sparse matrices************************************************
771 // No special implementation for the multiplication assignment to sparse matrices.
772 //**********************************************************************************************
773
774 //**SMP assignment to dense matrices************************************************************
788 template< typename MT2 // Type of the target dense matrix
789 , bool SO2 > // Storage order of the target dense matrix
790 friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
791 -> EnableIf_t< UseSMPAssign_v<MT2> >
792 {
794
798
799 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
800 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
801
802 const RT tmp( rhs.sm_ );
803 smpAssign( *lhs, map( tmp, rhs.op_ ) );
804 }
806 //**********************************************************************************************
807
808 //**SMP assignment to sparse matrices***********************************************************
809 // No special implementation for the SMP assignment to sparse matrices.
810 //**********************************************************************************************
811
812 //**SMP addition assignment to dense matrices***************************************************
826 template< typename MT2 // Type of the target dense matrix
827 , bool SO2 > // Storage order of the target dense matrix
828 friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
829 -> EnableIf_t< UseSMPAssign_v<MT2> >
830 {
832
836
837 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
838 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
839
840 const RT tmp( rhs.sm_ );
841 smpAddAssign( *lhs, map( tmp, rhs.op_ ) );
842 }
844 //**********************************************************************************************
845
846 //**SMP addition assignment to sparse matrices**************************************************
847 // No special implementation for the SMP addition assignment to sparse matrices.
848 //**********************************************************************************************
849
850 //**SMP subtraction assignment to dense matrices************************************************
864 template< typename MT2 // Type of the target dense matrix
865 , bool SO2 > // Storage order of the target sparse matrix
866 friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
867 -> EnableIf_t< UseSMPAssign_v<MT2> >
868 {
870
874
875 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
876 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
877
878 const RT tmp( rhs.sm_ );
879 smpSubAssign( *lhs, map( tmp, rhs.op_ ) );
880 }
882 //**********************************************************************************************
883
884 //**SMP subtraction assignment to sparse matrices***********************************************
885 // No special implementation for the SMP subtraction assignment to sparse matrices.
886 //**********************************************************************************************
887
888 //**SMP Schur product assignment to dense matrices**********************************************
902 template< typename MT2 // Type of the target dense matrix
903 , bool SO2 > // Storage order of the target dense matrix
904 friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const SMatMapExpr& rhs )
905 -> EnableIf_t< UseSMPAssign_v<MT2> >
906 {
908
912
913 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
914 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
915
916 const RT tmp( rhs.sm_ );
917 smpSchurAssign( *lhs, map( tmp, rhs.op_ ) );
918 }
920 //**********************************************************************************************
921
922 //**SMP Schur product assignment to sparse matrices*********************************************
923 // No special implementation for the SMP Schur product assignment to sparse matrices.
924 //**********************************************************************************************
925
926 //**SMP multiplication assignment to dense matrices*********************************************
927 // No special implementation for the SMP multiplication assignment to dense matrices.
928 //**********************************************************************************************
929
930 //**SMP multiplication assignment to sparse matrices********************************************
931 // No special implementation for the SMP multiplication assignment to sparse matrices.
932 //**********************************************************************************************
933
934 //**Compile time checks*************************************************************************
939 //**********************************************************************************************
940};
941//*************************************************************************************************
942
943
944
945
946//=================================================================================================
947//
948// GLOBAL FUNCTIONS
949//
950//=================================================================================================
951
952//*************************************************************************************************
970template< typename MT // Type of the sparse matrix
971 , bool SO // Storage order
972 , typename OP > // Type of the custom operation
973inline decltype(auto) map( const SparseMatrix<MT,SO>& sm, OP op )
974{
976
977 using ReturnType = const SMatMapExpr<MT,OP,SO>;
978 return ReturnType( *sm, std::move(op) );
979}
980//*************************************************************************************************
981
982
983//*************************************************************************************************
1001template< typename MT // Type of the sparse matrix
1002 , bool SO // Storage order
1003 , typename OP > // Type of the custom operation
1004inline decltype(auto) forEach( const SparseMatrix<MT,SO>& sm, OP op )
1005{
1007
1008 return map( *sm, std::move(op) );
1009}
1010//*************************************************************************************************
1011
1012
1013//*************************************************************************************************
1030template< typename MT // Type of the sparse matrix
1031 , bool SO > // Storage order
1032inline decltype(auto) abs( const SparseMatrix<MT,SO>& sm )
1033{
1035
1036 return map( *sm, Abs() );
1037}
1038//*************************************************************************************************
1039
1040
1041//*************************************************************************************************
1058template< typename MT // Type of the sparse matrix
1059 , bool SO > // Storage order
1060inline decltype(auto) sign( const SparseMatrix<MT,SO>& sm )
1061{
1063
1064 return map( *sm, Sign() );
1065}
1066//*************************************************************************************************
1067
1068
1069//*************************************************************************************************
1086template< typename MT // Type of the sparse matrix
1087 , bool SO > // Storage order
1088inline decltype(auto) floor( const SparseMatrix<MT,SO>& sm )
1089{
1091
1092 return map( *sm, Floor() );
1093}
1094//*************************************************************************************************
1095
1096
1097//*************************************************************************************************
1114template< typename MT // Type of the sparse matrix
1115 , bool SO > // Storage order
1116inline decltype(auto) ceil( const SparseMatrix<MT,SO>& sm )
1117{
1119
1120 return map( *sm, Ceil() );
1121}
1122//*************************************************************************************************
1123
1124
1125//*************************************************************************************************
1142template< typename MT // Type of the sparse matrix
1143 , bool SO > // Storage order
1144inline decltype(auto) trunc( const SparseMatrix<MT,SO>& sm )
1145{
1147
1148 return map( *sm, Trunc() );
1149}
1150//*************************************************************************************************
1151
1152
1153//*************************************************************************************************
1170template< typename MT // Type of the sparse matrix
1171 , bool SO > // Storage order
1172inline decltype(auto) round( const SparseMatrix<MT,SO>& sm )
1173{
1175
1176 return map( *sm, Round() );
1177}
1178//*************************************************************************************************
1179
1180
1181//*************************************************************************************************
1198template< typename MT // Type of the sparse matrix
1199 , bool SO > // Storage order
1200inline decltype(auto) conj( const SparseMatrix<MT,SO>& sm )
1201{
1203
1204 return map( *sm, Conj() );
1205}
1206//*************************************************************************************************
1207
1208
1209//*************************************************************************************************
1235template< typename MT // Type of the sparse matrix
1236 , bool SO > // Storage order
1237inline decltype(auto) ctrans( const SparseMatrix<MT,SO>& sm )
1238{
1240
1241 return trans( conj( *sm ) );
1242}
1243//*************************************************************************************************
1244
1245
1246//*************************************************************************************************
1263template< typename MT // Type of the sparse matrix
1264 , bool SO > // Storage order
1265inline decltype(auto) real( const SparseMatrix<MT,SO>& sm )
1266{
1268
1269 return map( *sm, Real() );
1270}
1271//*************************************************************************************************
1272
1273
1274//*************************************************************************************************
1291template< typename MT // Type of the sparse matrix
1292 , bool SO > // Storage order
1293inline decltype(auto) imag( const SparseMatrix<MT,SO>& sm )
1294{
1296
1297 return map( *sm, Imag() );
1298}
1299//*************************************************************************************************
1300
1301
1302//*************************************************************************************************
1319template< typename MT // Type of the sparse matrix
1320 , bool SO > // Storage order
1321inline decltype(auto) arg( const SparseMatrix<MT,SO>& sm )
1322{
1324
1325 return map( *sm, Arg() );
1326}
1327//*************************************************************************************************
1328
1329
1330//*************************************************************************************************
1350template< typename MT // Type of the sparse matrix
1351 , bool SO > // Storage order
1352inline decltype(auto) sqrt( const SparseMatrix<MT,SO>& sm )
1353{
1355
1356 return map( *sm, Sqrt() );
1357}
1358//*************************************************************************************************
1359
1360
1361//*************************************************************************************************
1381template< typename MT // Type of the sparse matrix
1382 , bool SO > // Storage order
1383inline decltype(auto) invsqrt( const SparseMatrix<MT,SO>& sm )
1384{
1386
1387 return map( *sm, InvSqrt() );
1388}
1389//*************************************************************************************************
1390
1391
1392//*************************************************************************************************
1412template< typename MT // Type of the sparse matrix
1413 , bool SO > // Storage order
1414inline decltype(auto) cbrt( const SparseMatrix<MT,SO>& sm )
1415{
1417
1418 return map( *sm, Cbrt() );
1419}
1420//*************************************************************************************************
1421
1422
1423//*************************************************************************************************
1443template< typename MT // Type of the sparse matrix
1444 , bool SO > // Storage order
1445inline decltype(auto) invcbrt( const SparseMatrix<MT,SO>& sm )
1446{
1448
1449 return map( *sm, InvCbrt() );
1450}
1451//*************************************************************************************************
1452
1453
1454//*************************************************************************************************
1473template< typename MT // Type of the sparse matrix
1474 , bool SO // Storage order
1475 , typename DT > // Type of the delimiters
1476inline decltype(auto) clamp( const SparseMatrix<MT,SO>& sm, const DT& min, const DT& max )
1477{
1479
1480 return map( *sm, bind2nd( bind3rd( Clamp(), max ), min ) );
1481}
1482//*************************************************************************************************
1483
1484
1485//*************************************************************************************************
1503template< typename MT // Type of the sparse matrix
1504 , bool SO // Storage order
1505 , typename ST // Type of the scalar exponent
1506 , EnableIf_t< IsScalar_v<ST> >* = nullptr >
1507inline decltype(auto) pow( const SparseMatrix<MT,SO>& sm, ST exp )
1508{
1510
1511 using ScalarType = MultTrait_t< UnderlyingBuiltin_t<MT>, ST >;
1512 return map( *sm, blaze::bind2nd( Pow(), ScalarType( exp ) ) );
1513}
1514//*************************************************************************************************
1515
1516
1517//*************************************************************************************************
1534template< typename MT // Type of the sparse matrix
1535 , bool SO > // Storage order
1536inline decltype(auto) exp( const SparseMatrix<MT,SO>& sm )
1537{
1539
1540 return map( *sm, Exp() );
1541}
1542//*************************************************************************************************
1543
1544
1545//*************************************************************************************************
1562template< typename MT // Type of the sparse matrix
1563 , bool SO > // Storage order
1564inline decltype(auto) exp2( const SparseMatrix<MT,SO>& sm )
1565{
1567
1568 return map( *sm, Exp2() );
1569}
1570//*************************************************************************************************
1571
1572
1573//*************************************************************************************************
1590template< typename MT // Type of the sparse matrix
1591 , bool SO > // Storage order
1592inline decltype(auto) exp10( const SparseMatrix<MT,SO>& sm )
1593{
1595
1596 return map( *sm, Exp10() );
1597}
1598//*************************************************************************************************
1599
1600
1601//*************************************************************************************************
1621template< typename MT // Type of the sparse matrix
1622 , bool SO > // Storage order
1623inline decltype(auto) log( const SparseMatrix<MT,SO>& sm )
1624{
1626
1627 return map( *sm, Log() );
1628}
1629//*************************************************************************************************
1630
1631
1632//*************************************************************************************************
1652template< typename MT // Type of the sparse matrix
1653 , bool SO > // Storage order
1654inline decltype(auto) log2( const SparseMatrix<MT,SO>& sm )
1655{
1657
1658 return map( *sm, Log2() );
1659}
1660//*************************************************************************************************
1661
1662
1663//*************************************************************************************************
1683template< typename MT // Type of the sparse matrix
1684 , bool SO > // Storage order
1685inline decltype(auto) log10( const SparseMatrix<MT,SO>& sm )
1686{
1688
1689 return map( *sm, Log10() );
1690}
1691//*************************************************************************************************
1692
1693
1694//*************************************************************************************************
1716template< typename MT // Type of the sparse matrix
1717 , bool SO > // Storage order
1718inline decltype(auto) log1p( const SparseMatrix<MT,SO>& sm )
1719{
1721
1722 return map( *sm, Log1p() );
1723}
1724//*************************************************************************************************
1725
1726
1727//*************************************************************************************************
1749template< typename MT // Type of the sparse matrix
1750 , bool SO > // Storage order
1751inline decltype(auto) lgamma( const SparseMatrix<MT,SO>& sm )
1752{
1754
1755 return map( *sm, LGamma() );
1756}
1757//*************************************************************************************************
1758
1759
1760//*************************************************************************************************
1777template< typename MT // Type of the sparse matrix
1778 , bool SO > // Storage order
1779inline decltype(auto) sin( const SparseMatrix<MT,SO>& sm )
1780{
1782
1783 return map( *sm, Sin() );
1784}
1785//*************************************************************************************************
1786
1787
1788//*************************************************************************************************
1808template< typename MT // Type of the sparse matrix
1809 , bool SO > // Storage order
1810inline decltype(auto) asin( const SparseMatrix<MT,SO>& sm )
1811{
1813
1814 return map( *sm, Asin() );
1815}
1816//*************************************************************************************************
1817
1818
1819//*************************************************************************************************
1836template< typename MT // Type of the sparse matrix
1837 , bool SO > // Storage order
1838inline decltype(auto) sinh( const SparseMatrix<MT,SO>& sm )
1839{
1841
1842 return map( *sm, Sinh() );
1843}
1844//*************************************************************************************************
1845
1846
1847//*************************************************************************************************
1864template< typename MT // Type of the sparse matrix
1865 , bool SO > // Storage order
1866inline decltype(auto) asinh( const SparseMatrix<MT,SO>& sm )
1867{
1869
1870 return map( *sm, Asinh() );
1871}
1872//*************************************************************************************************
1873
1874
1875//*************************************************************************************************
1892template< typename MT // Type of the sparse matrix
1893 , bool SO > // Storage order
1894inline decltype(auto) cos( const SparseMatrix<MT,SO>& sm )
1895{
1897
1898 return map( *sm, Cos() );
1899}
1900//*************************************************************************************************
1901
1902
1903//*************************************************************************************************
1923template< typename MT // Type of the sparse matrix
1924 , bool SO > // Storage order
1925inline decltype(auto) acos( const SparseMatrix<MT,SO>& sm )
1926{
1928
1929 return map( *sm, Acos() );
1930}
1931//*************************************************************************************************
1932
1933
1934//*************************************************************************************************
1951template< typename MT // Type of the sparse matrix
1952 , bool SO > // Storage order
1953inline decltype(auto) cosh( const SparseMatrix<MT,SO>& sm )
1954{
1956
1957 return map( *sm, Cosh() );
1958}
1959//*************************************************************************************************
1960
1961
1962//*************************************************************************************************
1982template< typename MT // Type of the sparse matrix
1983 , bool SO > // Storage order
1984inline decltype(auto) acosh( const SparseMatrix<MT,SO>& sm )
1985{
1987
1988 return map( *sm, Acosh() );
1989}
1990//*************************************************************************************************
1991
1992
1993//*************************************************************************************************
2010template< typename MT // Type of the sparse matrix
2011 , bool SO > // Storage order
2012inline decltype(auto) tan( const SparseMatrix<MT,SO>& sm )
2013{
2015
2016 return map( *sm, Tan() );
2017}
2018//*************************************************************************************************
2019
2020
2021//*************************************************************************************************
2038template< typename MT // Type of the sparse matrix
2039 , bool SO > // Storage order
2040inline decltype(auto) atan( const SparseMatrix<MT,SO>& sm )
2041{
2043
2044 return map( *sm, Atan() );
2045}
2046//*************************************************************************************************
2047
2048
2049//*************************************************************************************************
2069template< typename MT // Type of the sparse matrix
2070 , bool SO > // Storage order
2071inline decltype(auto) tanh( const SparseMatrix<MT,SO>& sm )
2072{
2074
2075 return map( *sm, Tanh() );
2076}
2077//*************************************************************************************************
2078
2079
2080//*************************************************************************************************
2100template< typename MT // Type of the sparse matrix
2101 , bool SO > // Storage order
2102inline decltype(auto) atanh( const SparseMatrix<MT,SO>& sm )
2103{
2105
2106 return map( *sm, Atanh() );
2107}
2108//*************************************************************************************************
2109
2110
2111//*************************************************************************************************
2128template< typename MT // Type of the sparse matrix
2129 , bool SO > // Storage order
2130inline decltype(auto) erf( const SparseMatrix<MT,SO>& sm )
2131{
2133
2134 return map( *sm, Erf() );
2135}
2136//*************************************************************************************************
2137
2138
2139//*************************************************************************************************
2157template< typename MT // Type of the sparse matrix
2158 , bool SO > // Storage order
2159inline decltype(auto) erfc( const SparseMatrix<MT,SO>& sm )
2160{
2162
2163 return map( *sm, Erfc() );
2164}
2165//*************************************************************************************************
2166
2167
2168
2169
2170//=================================================================================================
2171//
2172// GLOBAL RESTRUCTURING FUNCTIONS
2173//
2174//=================================================================================================
2175
2176//*************************************************************************************************
2187template< typename MT // Type of the sparse matrix
2188 , bool SO > // Storage order
2189inline decltype(auto) abs( const SMatMapExpr<MT,Abs,SO>& sm )
2190{
2192
2193 return sm;
2194}
2196//*************************************************************************************************
2197
2198
2199//*************************************************************************************************
2210template< typename MT // Type of the sparse matrix
2211 , bool SO > // Storage order
2212inline decltype(auto) sign( const SMatMapExpr<MT,Sign,SO>& sm )
2213{
2215
2216 return sm;
2217}
2219//*************************************************************************************************
2220
2221
2222//*************************************************************************************************
2233template< typename MT // Type of the sparse matrix
2234 , bool SO > // Storage order
2235inline decltype(auto) floor( const SMatMapExpr<MT,Floor,SO>& sm )
2236{
2238
2239 return sm;
2240}
2242//*************************************************************************************************
2243
2244
2245//*************************************************************************************************
2256template< typename MT // Type of the sparse matrix
2257 , bool SO > // Storage order
2258inline decltype(auto) ceil( const SMatMapExpr<MT,Ceil,SO>& sm )
2259{
2261
2262 return sm;
2263}
2265//*************************************************************************************************
2266
2267
2268//*************************************************************************************************
2279template< typename MT // Type of the sparse matrix
2280 , bool SO > // Storage order
2281inline decltype(auto) trunc( const SMatMapExpr<MT,Trunc,SO>& sm )
2282{
2284
2285 return sm;
2286}
2288//*************************************************************************************************
2289
2290
2291//*************************************************************************************************
2302template< typename MT // Type of the sparse matrix
2303 , bool SO > // Storage order
2304inline decltype(auto) round( const SMatMapExpr<MT,Round,SO>& sm )
2305{
2307
2308 return sm;
2309}
2311//*************************************************************************************************
2312
2313
2314//*************************************************************************************************
2332template< typename MT // Type of the sparse matrix
2333 , bool TF > // Transpose flag
2334inline decltype(auto) conj( const SMatMapExpr<MT,Conj,TF>& sm )
2335{
2337
2338 return sm.operand();
2339}
2341//*************************************************************************************************
2342
2343
2344//*************************************************************************************************
2362template< typename MT // Type of the sparse matrix
2363 , bool SO > // Storage order
2364inline decltype(auto) conj( const SMatTransExpr<SMatMapExpr<MT,Conj,SO>,!SO>& sm )
2365{
2367
2368 return trans( sm.operand().operand() );
2369}
2371//*************************************************************************************************
2372
2373
2374//*************************************************************************************************
2385template< typename MT // Type of the sparse matrix
2386 , bool SO > // Storage order
2387inline decltype(auto) real( const SMatMapExpr<MT,Real,SO>& sm )
2388{
2390
2391 return sm;
2392}
2394//*************************************************************************************************
2395
2396
2397//*************************************************************************************************
2408template< typename MT // Type of the sparse matrix
2409 , bool SO > // Storage order
2410inline decltype(auto) imag( const SMatMapExpr<MT,Imag,SO>& sm )
2411{
2413
2414 return sm;
2415}
2417//*************************************************************************************************
2418
2419} // namespace blaze
2420
2421#endif
Header file for auxiliary alias declarations.
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 all functors.
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 IsSame and IsStrictlySame type traits.
Header file for the IsScalar type trait.
Header file for the map trait.
Header file for the multiplication trait.
Header file for the RemoveReference type trait.
Header file for the UnderlyingBuiltin type trait.
Header file for the UnderlyingScalar type trait.
Header file for the ValueIndexPair class.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Iterator over the elements of the sparse matrix map expression.
Definition: SMatMapExpr.h:164
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatMapExpr.h:173
ConstIterator(IteratorType it, OP op)
Constructor for the ConstIterator class.
Definition: SMatMapExpr.h:193
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatMapExpr.h:204
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatMapExpr.h:256
DifferenceType difference_type
Difference between two iterators.
Definition: SMatMapExpr.h:184
OP op_
The custom unary operation.
Definition: SMatMapExpr.h:286
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatMapExpr.h:267
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatMapExpr.h:168
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatMapExpr.h:285
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatMapExpr.h:215
ValueType * PointerType
Pointer return type.
Definition: SMatMapExpr.h:175
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatMapExpr.h:278
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatMapExpr.h:235
size_t index() const
Access to the current index of the sparse element.
Definition: SMatMapExpr.h:245
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatMapExpr.h:225
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatMapExpr.h:177
ValueType & ReferenceType
Reference return type.
Definition: SMatMapExpr.h:176
ConstIterator_t< RemoveReference_t< Operand > > IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatMapExpr.h:171
Element ValueType
Type of the underlying pointers.
Definition: SMatMapExpr.h:174
IteratorCategory iterator_category
The iterator category.
Definition: SMatMapExpr.h:180
Expression object for the sparse matrix map() function.
Definition: SMatMapExpr.h:95
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the map expression.
Definition: SMatMapExpr.h:111
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SMatMapExpr.h:144
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatMapExpr.h:411
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SMatMapExpr.h:293
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SMatMapExpr.h:470
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatMapExpr.h:388
OppositeType_t< MT > OT
Opposite type of the sparse matrix expression.
Definition: SMatMapExpr.h:99
Operation op_
The custom unary operation.
Definition: SMatMapExpr.h:500
Operand operand() const noexcept
Returns the sparse matrix operand.
Definition: SMatMapExpr.h:448
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SMatMapExpr.h:347
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: SMatMapExpr.h:492
decltype(std::declval< OP >()(std::declval< RN >())) ReturnType
Return type for expression template evaluations.
Definition: SMatMapExpr.h:148
ResultType_t< MT > RT
Result type of the sparse matrix expression.
Definition: SMatMapExpr.h:98
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatMapExpr.h:424
Operation operation() const
Returns a copy of the custom operation.
Definition: SMatMapExpr.h:458
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatMapExpr.h:437
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: SMatMapExpr.h:368
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SMatMapExpr.h:358
If_t< useAssign, const ResultType, const SMatMapExpr & > CompositeType
Data type for composite expression templates.
Definition: SMatMapExpr.h:151
If_t< IsExpression_v< MT >, const MT, const MT & > Operand
Composite data type of the sparse matrix expression.
Definition: SMatMapExpr.h:154
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatMapExpr.h:143
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatMapExpr.h:399
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SMatMapExpr.h:482
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatMapExpr.h:330
SMatMapExpr(const MT &sm, OP op) noexcept
Constructor for the SMatMapExpr class.
Definition: SMatMapExpr.h:302
ReturnType_t< MT > RN
Return type of the sparse matrix expression.
Definition: SMatMapExpr.h:100
OP Operation
Data type of the custom unary operation.
Definition: SMatMapExpr.h:157
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatMapExpr.h:315
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SMatMapExpr.h:145
MapTrait_t< RT, OP > ResultType
Result type for expression template evaluations.
Definition: SMatMapExpr.h:142
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: SMatMapExpr.h:378
Operand sm_
Sparse matrix of the map expression.
Definition: SMatMapExpr.h:499
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 MatMapExpr base class.
Header file for the SparseMatrix base class.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Elementwise evaluation of the given binary operation on each single element of the dense matrices lhs...
Definition: DMatDMatMapExpr.h:1144
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
constexpr Bind3rd< OP, A3 > bind3rd(const OP &op, const A3 &a3)
Binds the given object/value to the 3rd parameter of the given operation.
Definition: Bind3rd.h:157
constexpr Bind2nd< OP, A2 > bind2nd(const OP &op, const A2 &a2)
Binds the given object/value to the 2nd parameter of the given operation.
Definition: Bind2nd.h:155
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.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_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition: MapTrait.h:131
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
typename UnderlyingScalar< T >::Type UnderlyingScalar_t
Auxiliary alias declaration for the UnderlyingScalar type trait.
Definition: UnderlyingScalar.h:116
#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 smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
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
decltype(auto) log1p(const SparseMatrix< MT, SO > &sm)
Computes the natural logarithm of x+1 for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1718
decltype(auto) round(const SparseMatrix< MT, SO > &sm)
Applies the round() function to each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1172
decltype(auto) imag(const SparseMatrix< MT, SO > &sm)
Returns a matrix containing the imaginary parts of each single element of sm.
Definition: SMatMapExpr.h:1293
decltype(auto) abs(const SparseMatrix< MT, SO > &sm)
Applies the abs() function to each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1032
decltype(auto) exp(const SparseMatrix< MT, SO > &sm)
Computes for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1536
decltype(auto) cosh(const SparseMatrix< MT, SO > &sm)
Computes the hyperbolic cosine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1953
decltype(auto) tan(const SparseMatrix< MT, SO > &sm)
Computes the tangent for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:2012
decltype(auto) clamp(const SparseMatrix< MT, SO > &sm, const DT &min, const DT &max)
Restricts each single element of the sparse matrix sm to the range .
Definition: SMatMapExpr.h:1476
decltype(auto) invsqrt(const SparseMatrix< MT, SO > &sm)
Computes the inverse square root of each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1383
decltype(auto) ceil(const SparseMatrix< MT, SO > &sm)
Applies the ceil() function to each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1116
decltype(auto) asin(const SparseMatrix< MT, SO > &sm)
Computes the inverse sine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1810
decltype(auto) forEach(const SparseMatrix< MT, SO > &sm, OP op)
Evaluates the given custom operation on each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1004
decltype(auto) log(const SparseMatrix< MT, SO > &sm)
Computes the natural logarithm for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1623
decltype(auto) cos(const SparseMatrix< MT, SO > &sm)
Computes the cosine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1894
decltype(auto) conj(const SparseMatrix< MT, SO > &sm)
Returns a matrix containing the complex conjugate of each single element of sm.
Definition: SMatMapExpr.h:1200
decltype(auto) acos(const SparseMatrix< MT, SO > &sm)
Computes the inverse cosine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1925
decltype(auto) sinh(const SparseMatrix< MT, SO > &sm)
Computes the hyperbolic sine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1838
decltype(auto) atanh(const SparseMatrix< MT, SO > &sm)
Computes the inverse hyperbolic tangent for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:2102
decltype(auto) pow(const SparseMatrix< MT, SO > &sm, ST exp)
Computes the exponential value for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1507
decltype(auto) tanh(const SparseMatrix< MT, SO > &sm)
Computes the hyperbolic tangent for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:2071
decltype(auto) erfc(const SparseMatrix< MT, SO > &sm)
Computes the complementary error function for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:2159
decltype(auto) erf(const SparseMatrix< MT, SO > &sm)
Computes the error function for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:2130
decltype(auto) invcbrt(const SparseMatrix< MT, SO > &sm)
Computes the inverse cubic root of each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1445
decltype(auto) sign(const SparseMatrix< MT, SO > &sm)
Applies the sign() function to each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1060
decltype(auto) log10(const SparseMatrix< MT, SO > &sm)
Computes the common logarithm for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1685
decltype(auto) trunc(const SparseMatrix< MT, SO > &sm)
Applies the trunc() function to each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1144
decltype(auto) exp10(const SparseMatrix< MT, SO > &sm)
Computes for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1592
decltype(auto) ctrans(const SparseMatrix< MT, SO > &sm)
Returns the conjugate transpose matrix of sm.
Definition: SMatMapExpr.h:1237
decltype(auto) asinh(const SparseMatrix< MT, SO > &sm)
Computes the inverse hyperbolic sine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1866
decltype(auto) exp2(const SparseMatrix< MT, SO > &sm)
Computes for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1564
decltype(auto) log2(const SparseMatrix< MT, SO > &sm)
Computes the binary logarithm for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1654
decltype(auto) floor(const SparseMatrix< MT, SO > &sm)
Applies the floor() function to each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1088
decltype(auto) atan(const SparseMatrix< MT, SO > &sm)
Computes the inverse tangent for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:2040
decltype(auto) acosh(const SparseMatrix< MT, SO > &sm)
Computes the inverse hyperbolic cosine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1984
decltype(auto) sin(const SparseMatrix< MT, SO > &sm)
Computes the sine for each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1779
decltype(auto) cbrt(const SparseMatrix< MT, SO > &sm)
Computes the cubic root of each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1414
decltype(auto) arg(const SparseMatrix< MT, SO > &sm)
Returns a matrix containing the phase angle of each single element of sm.
Definition: SMatMapExpr.h:1321
decltype(auto) real(const SparseMatrix< MT, SO > &sm)
Returns a matrix containing the real parts of each single element of sm.
Definition: SMatMapExpr.h:1265
decltype(auto) lgamma(const SparseMatrix< MT, SO > &sm)
Computes the natural logarithm of the absolute value of the gamma function for each non-zero element ...
Definition: SMatMapExpr.h:1751
decltype(auto) sqrt(const SparseMatrix< MT, SO > &sm)
Computes the square root of each non-zero element of the sparse matrix sm.
Definition: SMatMapExpr.h:1352
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
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.
Generic wrapper for the abs() function.
Definition: Abs.h:85
Generic wrapper for the acos() function.
Definition: Acos.h:71
Generic wrapper for the acosh() function.
Definition: Acosh.h:71
Generic wrapper for the arg() function.
Definition: Arg.h:77
Generic wrapper for the asin() function.
Definition: Asin.h:81
Generic wrapper for the asinh() function.
Definition: Asinh.h:81
Generic wrapper for the atan() function.
Definition: Atan.h:81
Generic wrapper for the atanh() function.
Definition: Atanh.h:81
Generic wrapper for the cbrt() function.
Definition: Cbrt.h:83
Generic wrapper for the ceil() function.
Definition: Ceil.h:83
Generic wrapper for the clamp() function.
Definition: Clamp.h:68
Base class for all compute expression templates.
Definition: Computation.h:68
Generic wrapper for the conj() function.
Definition: Conj.h:85
Generic wrapper for the cos() function.
Definition: Cos.h:71
Generic wrapper for the cosh() function.
Definition: Cosh.h:71
Generic wrapper for the erf() function.
Definition: Erf.h:79
Generic wrapper for the erfc() function.
Definition: Erfc.h:69
Generic wrapper for the exp10() function.
Definition: Exp10.h:69
Generic wrapper for the exp2() function.
Definition: Exp2.h:69
Generic wrapper for the exp() function.
Definition: Exp.h:71
Generic wrapper for the floor() function.
Definition: Floor.h:83
Generic wrapper for the imag() function.
Definition: Imag.h:76
Generic wrapper for the invcbrt() function.
Definition: InvCbrt.h:69
Generic wrapper for the invsqrt() function.
Definition: InvSqrt.h:71
Generic wrapper for the lgamma() function.
Definition: LGamma.h:71
Generic wrapper for the log10() function.
Definition: Log10.h:71
Generic wrapper for the log1p() function.
Definition: Log1p.h:71
Generic wrapper for the log2() function.
Definition: Log2.h:69
Generic wrapper for the log() function.
Definition: Log.h:71
Base class for all unary matrix map expression templates.
Definition: MatMapExpr.h:68
Generic wrapper for the pow() function.
Definition: Pow.h:65
Generic wrapper for the real() function.
Definition: Real.h:82
Generic wrapper for the round() function.
Definition: Round.h:83
Generic wrapper for the sign() function.
Definition: Sign.h:83
Generic wrapper for the sin() function.
Definition: Sin.h:81
Generic wrapper for the sinh() function.
Definition: Sinh.h:81
Generic wrapper for the sqrt() function.
Definition: Sqrt.h:85
Generic wrapper for the tan() function.
Definition: Tan.h:81
Generic wrapper for the tanh() function.
Definition: Tanh.h:81
Generic wrapper for the trunc() function.
Definition: Trunc.h:83
Header file for the RequiresEvaluation type trait.
Header file for basic type definitions.