IdentityMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SPARSE_IDENTITYMATRIX_H_
36 #define _BLAZE_MATH_SPARSE_IDENTITYMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <iterator>
45 #include <blaze/math/Aliases.h>
46 #include <blaze/math/Exception.h>
51 #include <blaze/math/Forward.h>
80 #include <blaze/util/Assert.h>
86 #include <blaze/util/EnableIf.h>
88 #include <blaze/util/InvalidType.h>
89 #include <blaze/util/mpl/If.h>
90 #include <blaze/util/TrueType.h>
91 #include <blaze/util/Types.h>
93 #include <blaze/util/Unused.h>
94 
95 
96 namespace blaze {
97 
98 //=================================================================================================
99 //
100 // CLASS DEFINITION
101 //
102 //=================================================================================================
103 
104 //*************************************************************************************************
178 template< typename Type // Data type of the matrix
179  , bool SO = defaultStorageOrder > // Storage order
180 class IdentityMatrix
181  : public SparseMatrix< IdentityMatrix<Type,SO>, SO >
182 {
183  public:
184  //**Type definitions****************************************************************************
187  using ResultType = This;
190  using ElementType = Type;
191  using ReturnType = const Type;
192  using CompositeType = const This&;
193  using Reference = const Type;
194  using ConstReference = const Type;
195  //**********************************************************************************************
196 
197  //**Rebind struct definition********************************************************************
200  template< typename NewType > // Data type of the other matrix
201  struct Rebind {
203  };
204  //**********************************************************************************************
205 
206  //**Resize struct definition********************************************************************
209  template< size_t NewM // Number of rows of the other matrix
210  , size_t NewN > // Number of columns of the other matrix
211  struct Resize {
213  };
214  //**********************************************************************************************
215 
216  //**ConstIterator class definition**************************************************************
220  {
221  public:
222  //**Type definitions*************************************************************************
225 
226  using IteratorCategory = std::forward_iterator_tag;
227  using ValueType = Element;
231 
232  // STL iterator requirements
238  //*******************************************************************************************
239 
240  //**Default constructor**********************************************************************
243  inline ConstIterator()
244  : index_() // Index to the current identity matrix element
245  {}
246  //*******************************************************************************************
247 
248  //**Constructor******************************************************************************
253  inline ConstIterator( size_t index )
254  : index_( index ) // Index to the current identity matrix element
255  {}
256  //*******************************************************************************************
257 
258  //**Prefix increment operator****************************************************************
264  ++index_;
265  return *this;
266  }
267  //*******************************************************************************************
268 
269  //**Postfix increment operator***************************************************************
274  inline ConstIterator operator++( int ) {
275  ConstIterator tmp( *this );
276  ++index_;
277  return tmp;
278  }
279  //*******************************************************************************************
280 
281  //**Element access operator******************************************************************
286  inline const Element operator*() const {
287  return Element( Type(1), index_ );
288  }
289  //*******************************************************************************************
290 
291  //**Element access operator******************************************************************
296  inline const ConstIterator* operator->() const {
297  return this;
298  }
299  //*******************************************************************************************
300 
301  //**Value function***************************************************************************
306  inline Type value() const {
307  return Type(1);
308  }
309  //*******************************************************************************************
310 
311  //**Index function***************************************************************************
316  inline size_t index() const {
317  return index_;
318  }
319  //*******************************************************************************************
320 
321  //**Equality operator************************************************************************
327  inline bool operator==( const ConstIterator& rhs ) const {
328  return index_ == rhs.index_;
329  }
330  //*******************************************************************************************
331 
332  //**Inequality operator**********************************************************************
338  inline bool operator!=( const ConstIterator& rhs ) const {
339  return index_ != rhs.index_;
340  }
341  //*******************************************************************************************
342 
343  //**Subtraction operator*********************************************************************
349  inline DifferenceType operator-( const ConstIterator& rhs ) const {
350  return index_ - rhs.index_;
351  }
352  //*******************************************************************************************
353 
354  private:
355  //**Member variables*************************************************************************
356  size_t index_;
357  //*******************************************************************************************
358  };
359  //**********************************************************************************************
360 
361  //**Type definitions****************************************************************************
363  //**********************************************************************************************
364 
365  //**Compilation flags***************************************************************************
367 
370  enum : bool { smpAssignable = !IsSMPAssignable<Type>::value };
371  //**********************************************************************************************
372 
373  //**Constructors********************************************************************************
376  explicit inline IdentityMatrix() noexcept;
377  explicit inline IdentityMatrix( size_t n ) noexcept;
378 
379  template< typename MT, bool SO2 >
380  explicit inline IdentityMatrix( const Matrix<MT,SO2>& m );
381 
382  // No explicitly declared copy constructor.
383  // No explicitly declared move constructor.
385  //**********************************************************************************************
386 
387  //**Destructor**********************************************************************************
388  // No explicitly declared destructor.
389  //**********************************************************************************************
390 
391  //**Data access functions***********************************************************************
394  inline ConstReference operator()( size_t i, size_t j ) const noexcept;
395  inline ConstReference at( size_t i, size_t j ) const;
396  inline ConstIterator begin ( size_t i ) const noexcept;
397  inline ConstIterator cbegin( size_t i ) const noexcept;
398  inline ConstIterator end ( size_t i ) const noexcept;
399  inline ConstIterator cend ( size_t i ) const noexcept;
401  //**********************************************************************************************
402 
403  //**Assignment operators************************************************************************
406  template< typename MT, bool SO2 >
407  inline IdentityMatrix& operator=( const Matrix<MT,SO2>& rhs );
408 
409  // No explicitly declared copy assignment operator.
410  // No explicitly declared move assignment operator.
412  //**********************************************************************************************
413 
414  //**Utility functions***************************************************************************
417  inline size_t rows() const noexcept;
418  inline size_t columns() const noexcept;
419  inline size_t capacity() const noexcept;
420  inline size_t capacity( size_t i ) const noexcept;
421  inline size_t nonZeros() const;
422  inline size_t nonZeros( size_t i ) const;
423  inline void clear();
424  void resize( size_t n );
425  inline void swap( IdentityMatrix& m ) noexcept;
427  //**********************************************************************************************
428 
429  //**Lookup functions****************************************************************************
432  inline ConstIterator find ( size_t i, size_t j ) const;
433  inline ConstIterator lowerBound( size_t i, size_t j ) const;
434  inline ConstIterator upperBound( size_t i, size_t j ) const;
436  //**********************************************************************************************
437 
438  //**Numeric functions***************************************************************************
441  inline IdentityMatrix& transpose();
442  inline IdentityMatrix& ctranspose();
444  //**********************************************************************************************
445 
446  //**Expression template evaluation functions****************************************************
449  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
450  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
451 
452  inline bool canSMPAssign() const noexcept;
454  //**********************************************************************************************
455 
456  private:
457  //**Member variables****************************************************************************
460  size_t n_;
461 
462  //**********************************************************************************************
463 
464  //**Compile time checks*************************************************************************
472  //**********************************************************************************************
473 };
474 //*************************************************************************************************
475 
476 
477 
478 
479 //=================================================================================================
480 //
481 // CONSTRUCTORS
482 //
483 //=================================================================================================
484 
485 //*************************************************************************************************
488 template< typename Type // Data type of the matrix
489  , bool SO > // Storage order
491  : n_( 0UL ) // The current number of rows and columns of the identity matrix
492 {}
493 //*************************************************************************************************
494 
495 
496 //*************************************************************************************************
501 template< typename Type // Data type of the matrix
502  , bool SO > // Storage order
503 inline IdentityMatrix<Type,SO>::IdentityMatrix( size_t n ) noexcept
504  : n_( n ) // The current number of rows and columns of the identity matrix
505 {}
506 //*************************************************************************************************
507 
508 
509 //*************************************************************************************************
518 template< typename Type // Data type of the matrix
519  , bool SO > // Storage order
520 template< typename MT // Type of the foreign identity matrix
521  , bool SO2 > // Storage order of the foreign identity matrix
523  : n_( (~m).rows() ) // The current number of rows and columns of the identity matrix
524 {
525  if( !IsIdentity<MT>::value && !isIdentity( ~m ) ) {
526  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of identity matrix" );
527  }
528 }
529 //*************************************************************************************************
530 
531 
532 
533 
534 //=================================================================================================
535 //
536 // DATA ACCESS FUNCTIONS
537 //
538 //=================================================================================================
539 
540 //*************************************************************************************************
550 template< typename Type // Data type of the matrix
551  , bool SO > // Storage order
553  IdentityMatrix<Type,SO>::operator()( size_t i, size_t j ) const noexcept
554 {
555  BLAZE_USER_ASSERT( i < rows() , "Invalid identity matrix row access index" );
556  BLAZE_USER_ASSERT( j < columns(), "Invalid identity matrix column access index" );
557 
558  if( i == j )
559  return Type( 1 );
560  else
561  return Type( 0 );
562 }
563 //*************************************************************************************************
564 
565 
566 //*************************************************************************************************
577 template< typename Type // Data type of the matrix
578  , bool SO > // Storage order
580  IdentityMatrix<Type,SO>::at( size_t i, size_t j ) const
581 {
582  if( i >= n_ ) {
583  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
584  }
585  if( j >= n_ ) {
586  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
587  }
588  return (*this)(i,j);
589 }
590 //*************************************************************************************************
591 
592 
593 //*************************************************************************************************
604 template< typename Type // Data type of the matrix
605  , bool SO > // Storage order
607  IdentityMatrix<Type,SO>::begin( size_t i ) const noexcept
608 {
609  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
610 
611  return ConstIterator( i );
612 }
613 //*************************************************************************************************
614 
615 
616 //*************************************************************************************************
627 template< typename Type // Data type of the matrix
628  , bool SO > // Storage order
630  IdentityMatrix<Type,SO>::cbegin( size_t i ) const noexcept
631 {
632  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
633 
634  return ConstIterator( i );
635 }
636 //*************************************************************************************************
637 
638 
639 //*************************************************************************************************
650 template< typename Type // Data type of the matrix
651  , bool SO > // Storage order
653  IdentityMatrix<Type,SO>::end( size_t i ) const noexcept
654 {
655  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
656 
657  return ConstIterator( i+1UL );
658 }
659 //*************************************************************************************************
660 
661 
662 //*************************************************************************************************
673 template< typename Type // Data type of the matrix
674  , bool SO > // Storage order
676  IdentityMatrix<Type,SO>::cend( size_t i ) const noexcept
677 {
678  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
679 
680  return ConstIterator( i+1UL );
681 }
682 //*************************************************************************************************
683 
684 
685 
686 
687 //=================================================================================================
688 //
689 // ASSIGNMENT OPERATORS
690 //
691 //=================================================================================================
692 
693 //*************************************************************************************************
703 template< typename Type // Data type of the matrix
704  , bool SO > // Storage order
705 template< typename MT // Type of the right-hand side identity matrix
706  , bool SO2 > // Storage order of the right-hand side identity matrix
709 {
710  if( !IsIdentity<MT>::value && !isIdentity( ~rhs ) ) {
711  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment of identity matrix" );
712  }
713 
714  n_ = (~rhs).rows();
715 
716  return *this;
717 }
718 //*************************************************************************************************
719 
720 
721 
722 
723 //=================================================================================================
724 //
725 // UTILITY FUNCTIONS
726 //
727 //=================================================================================================
728 
729 //*************************************************************************************************
734 template< typename Type // Data type of the matrix
735  , bool SO > // Storage order
736 inline size_t IdentityMatrix<Type,SO>::rows() const noexcept
737 {
738  return n_;
739 }
740 //*************************************************************************************************
741 
742 
743 //*************************************************************************************************
748 template< typename Type // Data type of the matrix
749  , bool SO > // Storage order
750 inline size_t IdentityMatrix<Type,SO>::columns() const noexcept
751 {
752  return n_;
753 }
754 //*************************************************************************************************
755 
756 
757 //*************************************************************************************************
762 template< typename Type // Data type of the matrix
763  , bool SO > // Storage order
764 inline size_t IdentityMatrix<Type,SO>::capacity() const noexcept
765 {
766  return n_;
767 }
768 //*************************************************************************************************
769 
770 
771 //*************************************************************************************************
782 template< typename Type // Data type of the matrix
783  , bool SO > // Storage order
784 inline size_t IdentityMatrix<Type,SO>::capacity( size_t i ) const noexcept
785 {
786  UNUSED_PARAMETER( i );
787 
788  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
789 
790  return 1UL;
791 }
792 //*************************************************************************************************
793 
794 
795 //*************************************************************************************************
800 template< typename Type // Data type of the matrix
801  , bool SO > // Storage order
803 {
804  return n_;
805 }
806 //*************************************************************************************************
807 
808 
809 //*************************************************************************************************
820 template< typename Type // Data type of the matrix
821  , bool SO > // Storage order
822 inline size_t IdentityMatrix<Type,SO>::nonZeros( size_t i ) const
823 {
824  UNUSED_PARAMETER( i );
825 
826  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
827 
828  return 1UL;
829 }
830 //*************************************************************************************************
831 
832 
833 //*************************************************************************************************
840 template< typename Type // Data type of the matrix
841  , bool SO > // Storage order
843 {
844  n_ = 0UL;
845 }
846 //*************************************************************************************************
847 
848 
849 //*************************************************************************************************
859 template< typename Type // Data type of the matrix
860  , bool SO > // Storage order
862 {
863  n_ = n;
864 }
865 //*************************************************************************************************
866 
867 
868 //*************************************************************************************************
874 template< typename Type // Data type of the matrix
875  , bool SO > // Storage order
877 {
878  std::swap( n_, m.n_ );
879 }
880 //*************************************************************************************************
881 
882 
883 
884 
885 //=================================================================================================
886 //
887 // LOOKUP FUNCTIONS
888 //
889 //=================================================================================================
890 
891 //*************************************************************************************************
904 template< typename Type // Data type of the matrix
905  , bool SO > // Storage order
907  IdentityMatrix<Type,SO>::find( size_t i, size_t j ) const
908 {
909  BLAZE_USER_ASSERT( SO || i < rows() , "Invalid identity matrix row access index" );
910  BLAZE_USER_ASSERT( !SO || j < columns(), "Invalid identity matrix column access index" );
911 
912  if( i == j )
913  return begin( i );
914  else
915  return end( SO ? j : i );
916 }
917 //*************************************************************************************************
918 
919 
920 //*************************************************************************************************
933 template< typename Type // Data type of the matrix
934  , bool SO > // Storage order
936  IdentityMatrix<Type,SO>::lowerBound( size_t i, size_t j ) const
937 {
938  BLAZE_USER_ASSERT( SO || i < rows() , "Invalid identity matrix row access index" );
939  BLAZE_USER_ASSERT( !SO || j < columns(), "Invalid identity matrix column access index" );
940 
941  if( ( !SO && j <= i ) || ( SO && i <= j ) )
942  return begin( SO ? j : i );
943  else
944  return end( SO ? j : i );
945 }
946 //*************************************************************************************************
947 
948 
949 //*************************************************************************************************
962 template< typename Type // Data type of the matrix
963  , bool SO > // Storage order
965  IdentityMatrix<Type,SO>::upperBound( size_t i, size_t j ) const
966 {
967  BLAZE_USER_ASSERT( SO || i < rows() , "Invalid identity matrix row access index" );
968  BLAZE_USER_ASSERT( !SO || j < columns(), "Invalid identity matrix column access index" );
969 
970  if( ( !SO && j < i ) || ( SO && i < j ) )
971  return begin( SO ? j : i );
972  else
973  return end( SO ? j : i );
974 }
975 //*************************************************************************************************
976 
977 
978 
979 
980 //=================================================================================================
981 //
982 // NUMERIC FUNCTIONS
983 //
984 //=================================================================================================
985 
986 //*************************************************************************************************
991 template< typename Type // Data type of the matrix
992  , bool SO > // Storage order
994 {
995  return *this;
996 }
997 //*************************************************************************************************
998 
999 
1000 //*************************************************************************************************
1005 template< typename Type // Data type of the matrix
1006  , bool SO > // Storage order
1008 {
1009  return *this;
1010 }
1011 //*************************************************************************************************
1012 
1013 
1014 
1015 
1016 //=================================================================================================
1017 //
1018 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1019 //
1020 //=================================================================================================
1021 
1022 //*************************************************************************************************
1032 template< typename Type // Data type of the matrix
1033  , bool SO > // Storage order
1034 template< typename Other > // Data type of the foreign expression
1035 inline bool IdentityMatrix<Type,SO>::canAlias( const Other* alias ) const noexcept
1036 {
1037  UNUSED_PARAMETER( alias );
1038 
1039  return false;
1040 }
1041 //*************************************************************************************************
1042 
1043 
1044 //*************************************************************************************************
1054 template< typename Type // Data type of the matrix
1055  , bool SO > // Storage order
1056 template< typename Other > // Data type of the foreign expression
1057 inline bool IdentityMatrix<Type,SO>::isAliased( const Other* alias ) const noexcept
1058 {
1059  UNUSED_PARAMETER( alias );
1060 
1061  return false;
1062 }
1063 //*************************************************************************************************
1064 
1065 
1066 //*************************************************************************************************
1076 template< typename Type // Data type of the matrix
1077  , bool SO > // Storage order
1078 inline bool IdentityMatrix<Type,SO>::canSMPAssign() const noexcept
1079 {
1080  return false;
1081 }
1082 //*************************************************************************************************
1083 
1084 
1085 
1086 
1087 
1088 
1089 
1090 
1091 //=================================================================================================
1092 //
1093 // IDENTITYMATRIX OPERATORS
1094 //
1095 //=================================================================================================
1096 
1097 //*************************************************************************************************
1100 template< typename Type, bool SO >
1101 inline void reset( IdentityMatrix<Type,SO>& m );
1102 
1103 template< typename Type, bool SO >
1104 inline void reset( IdentityMatrix<Type,SO>& m, size_t i );
1105 
1106 template< typename Type, bool SO >
1107 inline void clear( IdentityMatrix<Type,SO>& m );
1108 
1109 template< bool RF, typename Type, bool SO >
1110 inline bool isDefault( const IdentityMatrix<Type,SO>& m );
1111 
1112 template< typename Type, bool SO >
1113 inline bool isIntact( const IdentityMatrix<Type,SO>& m );
1114 
1115 template< typename Type, bool SO >
1116 inline void swap( IdentityMatrix<Type,SO>& a, IdentityMatrix<Type,SO>& b ) noexcept;
1118 //*************************************************************************************************
1119 
1120 
1121 //*************************************************************************************************
1128 template< typename Type // Data type of the matrix
1129  , bool SO > // Storage order
1131 {
1132  UNUSED_PARAMETER( m );
1133 }
1134 //*************************************************************************************************
1135 
1136 
1137 //*************************************************************************************************
1150 template< typename Type // Data type of the matrix
1151  , bool SO > // Storage order
1152 inline void reset( IdentityMatrix<Type,SO>& m, size_t i )
1153 {
1154  UNUSED_PARAMETER( m, i );
1155 }
1156 //*************************************************************************************************
1157 
1158 
1159 //*************************************************************************************************
1166 template< typename Type // Data type of the matrix
1167  , bool SO > // Storage order
1169 {
1170  m.clear();
1171 }
1172 //*************************************************************************************************
1173 
1174 
1175 //*************************************************************************************************
1200 template< bool RF // Relaxation flag
1201  , typename Type // Data type of the matrix
1202  , bool SO > // Storage order
1203 inline bool isDefault( const IdentityMatrix<Type,SO>& m )
1204 {
1205  return ( m.rows() == 0UL );
1206 }
1207 //*************************************************************************************************
1208 
1209 
1210 //*************************************************************************************************
1228 template< typename Type // Data type of the matrix
1229  , bool SO > // Storage order
1230 inline bool isIntact( const IdentityMatrix<Type,SO>& m )
1231 {
1232  UNUSED_PARAMETER( m );
1233 
1234  return true;
1235 }
1236 //*************************************************************************************************
1237 
1238 
1239 //*************************************************************************************************
1247 template< typename Type // Data type of the matrix
1248  , bool SO > // Storage order
1250 {
1251  a.swap( b );
1252 }
1253 //*************************************************************************************************
1254 
1255 
1256 
1257 
1258 //=================================================================================================
1259 //
1260 // GLOBAL BINARY ARITHMETIC OPERATORS
1261 //
1262 //=================================================================================================
1263 
1264 //*************************************************************************************************
1292 template< typename T // Data type of the left-hand side identity matrix
1293  , bool SO // Storage order of the left-hand side identity matrix
1294  , typename VT // Type of the right-hand side dense vector
1295  , typename = EnableIf_< IsSame< T, ElementType_<VT> > > >
1296 inline decltype(auto)
1297  operator*( const IdentityMatrix<T,SO>& mat, const DenseVector<VT,false>& vec )
1298 {
1300 
1301  if( (~mat).columns() != (~vec).size() ) {
1302  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
1303  }
1304 
1305  return (~vec);
1306 }
1308 //*************************************************************************************************
1309 
1310 
1311 //*************************************************************************************************
1339 template< typename VT // Type of the left-hand side dense vector
1340  , typename T // Data type of the right-hand side identity matrix
1341  , bool SO // Storage order of the right-hand side identity matrix
1342  , typename = EnableIf_< IsSame< ElementType_<VT>, T > > >
1343 inline decltype(auto)
1344  operator*( const DenseVector<VT,true>& vec, const IdentityMatrix<T,SO>& mat )
1345 {
1347 
1348  if( (~vec).size() != (~mat).rows() ) {
1349  BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
1350  }
1351 
1352  return (~vec);
1353 }
1355 //*************************************************************************************************
1356 
1357 
1358 //*************************************************************************************************
1386 template< typename T // Data type of the left-hand side identity matrix
1387  , bool SO // Storage order of the left-hand side identity matrix
1388  , typename VT // Type of the right-hand side sparse vector
1389  , typename = EnableIf_< IsSame< T, ElementType_<VT> > > >
1390 inline decltype(auto)
1391  operator*( const IdentityMatrix<T,SO>& mat, const SparseVector<VT,false>& vec )
1392 {
1394 
1395  if( (~mat).columns() != (~vec).size() ) {
1396  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
1397  }
1398 
1399  return (~vec);
1400 }
1402 //*************************************************************************************************
1403 
1404 
1405 //*************************************************************************************************
1433 template< typename VT // Type of the left-hand side sparse vector
1434  , typename T // Data type of the right-hand side identity matrix
1435  , bool SO // Storage order of the right-hand side identity matrix
1436  , typename = EnableIf_< IsSame< ElementType_<VT>, T > > >
1437 inline decltype(auto)
1438  operator*( const SparseVector<VT,true>& vec, const IdentityMatrix<T,SO>& mat )
1439 {
1441 
1442  if( (~vec).size() != (~mat).rows() ) {
1443  BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
1444  }
1445 
1446  return (~vec);
1447 }
1449 //*************************************************************************************************
1450 
1451 
1452 //*************************************************************************************************
1477 template< typename T // Data type of the left-hand side identity matrix
1478  , bool SO1 // Storage order of the left-hand side identity matrix
1479  , typename MT // Type of the right-hand side dense matrix
1480  , bool SO2 // Storage order of the right-hand side dense matrix
1481  , typename = EnableIf_< IsSame< T, ElementType_<MT> > > >
1482 inline decltype(auto)
1483  operator*( const IdentityMatrix<T,SO1>& lhs, const DenseMatrix<MT,SO2>& rhs )
1484 {
1486 
1487  if( (~lhs).columns() != (~rhs).rows() ) {
1488  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1489  }
1490 
1491  return (~rhs);
1492 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1522 template< typename MT // Type of the left-hand side dense matrix
1523  , bool SO1 // Storage order of the left-hand side dense matrix
1524  , typename T // Data type of the right-hand side identity matrix
1525  , bool SO2 // Storage order of the right-hand side identity matrix
1526  , typename = EnableIf_< IsSame< ElementType_<MT>, T > > >
1527 inline decltype(auto)
1528  operator*( const DenseMatrix<MT,SO1>& lhs, const IdentityMatrix<T,SO2>& rhs )
1529 {
1531 
1532  if( (~lhs).columns() != (~rhs).rows() ) {
1533  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1534  }
1535 
1536  return (~lhs);
1537 }
1539 //*************************************************************************************************
1540 
1541 
1542 //*************************************************************************************************
1567 template< typename T // Data type of the left-hand side identity matrix
1568  , bool SO1 // Storage order of the left-hand side identity matrix
1569  , typename MT // Type of the right-hand side sparse matrix
1570  , bool SO2 // Storage order of the right-hand side sparse matrix
1571  , typename = EnableIf_< IsSame< T, ElementType_<MT> > > >
1572 inline decltype(auto)
1573  operator*( const IdentityMatrix<T,SO1>& lhs, const SparseMatrix<MT,SO2>& rhs )
1574 {
1576 
1577  if( (~lhs).columns() != (~rhs).rows() ) {
1578  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1579  }
1580 
1581  return (~rhs);
1582 }
1584 //*************************************************************************************************
1585 
1586 
1587 //*************************************************************************************************
1612 template< typename MT // Type of the left-hand side sparse matrix
1613  , bool SO1 // Storage order of the left-hand side sparse matrix
1614  , typename T // Data type of the right-hand side identity matrix
1615  , bool SO2 // Storage order of the right-hand side identity matrix
1616  , typename = EnableIf_< IsSame< ElementType_<MT>, T > > >
1617 inline decltype(auto)
1618  operator*( const SparseMatrix<MT,SO1>& lhs, const IdentityMatrix<T,SO2>& rhs )
1619 {
1621 
1622  if( (~lhs).columns() != (~rhs).rows() ) {
1623  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1624  }
1625 
1626  return (~lhs);
1627 }
1629 //*************************************************************************************************
1630 
1631 
1632 //*************************************************************************************************
1655 template< typename T1 // Data type of the left-hand side identity matrix
1656  , bool SO1 // Storage order of the left-hand side identity matrix
1657  , typename T2 // Data type of the right-hand side dense matrix
1658  , bool SO2 > // Storage order of the right-hand side dense matrix
1659 inline decltype(auto)
1660  operator*( const IdentityMatrix<T1,SO1>& lhs, const IdentityMatrix<T2,SO2>& rhs )
1661 {
1663 
1664  if( (~lhs).columns() != (~rhs).rows() ) {
1665  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1666  }
1667 
1668  return IdentityMatrix< MultTrait_<T1,T2>, SO1 >( (~lhs).rows() );
1669 }
1671 //*************************************************************************************************
1672 
1673 
1674 
1675 
1676 //=================================================================================================
1677 //
1678 // GLOBAL FUNCTIONS
1679 //
1680 //=================================================================================================
1681 
1682 //*************************************************************************************************
1701 template< typename MT // Type of the sparse matrix
1702  , bool SO > // Storage order
1704  declid( const Matrix<MT,SO>& m )
1705 {
1707 
1708  if( !isSquare( ~m ) ) {
1709  BLAZE_THROW_INVALID_ARGUMENT( "Invalid identity matrix specification" );
1710  }
1711 
1712  return IdentityMatrix<ElementType_<MT>,SO>( (~m).rows() );
1713 }
1714 //*************************************************************************************************
1715 
1716 
1717 
1718 
1719 //=================================================================================================
1720 //
1721 // ISSQUARE SPECIALIZATIONS
1722 //
1723 //=================================================================================================
1724 
1725 //*************************************************************************************************
1727 template< typename MT, bool SO >
1728 struct IsSquare< IdentityMatrix<MT,SO> >
1729  : public TrueType
1730 {};
1732 //*************************************************************************************************
1733 
1734 
1735 
1736 
1737 //=================================================================================================
1738 //
1739 // ISSYMMETRIC SPECIALIZATIONS
1740 //
1741 //=================================================================================================
1742 
1743 //*************************************************************************************************
1745 template< typename MT, bool SO >
1746 struct IsSymmetric< IdentityMatrix<MT,SO> >
1747  : public TrueType
1748 {};
1750 //*************************************************************************************************
1751 
1752 
1753 
1754 
1755 //=================================================================================================
1756 //
1757 // ISHERMITIAN SPECIALIZATIONS
1758 //
1759 //=================================================================================================
1760 
1761 //*************************************************************************************************
1763 template< typename MT, bool SO >
1764 struct IsHermitian< IdentityMatrix<MT,SO> >
1765  : public TrueType
1766 {};
1768 //*************************************************************************************************
1769 
1770 
1771 
1772 
1773 //=================================================================================================
1774 //
1775 // ISUNILOWER SPECIALIZATIONS
1776 //
1777 //=================================================================================================
1778 
1779 //*************************************************************************************************
1781 template< typename MT, bool SO >
1782 struct IsUniLower< IdentityMatrix<MT,SO> >
1783  : public TrueType
1784 {};
1786 //*************************************************************************************************
1787 
1788 
1789 
1790 
1791 //=================================================================================================
1792 //
1793 // ISUNIUPPER SPECIALIZATIONS
1794 //
1795 //=================================================================================================
1796 
1797 //*************************************************************************************************
1799 template< typename MT, bool SO >
1800 struct IsUniUpper< IdentityMatrix<MT,SO> >
1801  : public TrueType
1802 {};
1804 //*************************************************************************************************
1805 
1806 
1807 
1808 
1809 //=================================================================================================
1810 //
1811 // ISRESIZABLE SPECIALIZATIONS
1812 //
1813 //=================================================================================================
1814 
1815 //*************************************************************************************************
1817 template< typename T, bool SO >
1818 struct IsResizable< IdentityMatrix<T,SO> >
1819  : public TrueType
1820 {};
1822 //*************************************************************************************************
1823 
1824 
1825 
1826 
1827 //=================================================================================================
1828 //
1829 // ADDTRAIT SPECIALIZATIONS
1830 //
1831 //=================================================================================================
1832 
1833 //*************************************************************************************************
1835 template< typename T1, bool SO, typename T2, size_t M, size_t N >
1836 struct AddTrait< IdentityMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
1837 {
1838  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
1839 };
1840 
1841 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
1842 struct AddTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
1843 {
1844  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
1845 };
1846 
1847 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
1848 struct AddTrait< StaticMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
1849 {
1850  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
1851 };
1852 
1853 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
1854 struct AddTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
1855 {
1856  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
1857 };
1858 
1859 template< typename T1, bool SO, typename T2, size_t M, size_t N >
1860 struct AddTrait< IdentityMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
1861 {
1862  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
1863 };
1864 
1865 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
1866 struct AddTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
1867 {
1868  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
1869 };
1870 
1871 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
1872 struct AddTrait< HybridMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
1873 {
1874  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
1875 };
1876 
1877 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
1878 struct AddTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
1879 {
1880  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
1881 };
1882 
1883 template< typename T1, bool SO, typename T2 >
1884 struct AddTrait< IdentityMatrix<T1,SO>, DynamicMatrix<T2,SO> >
1885 {
1886  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1887 };
1888 
1889 template< typename T1, bool SO1, typename T2, bool SO2 >
1890 struct AddTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
1891 {
1892  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
1893 };
1894 
1895 template< typename T1, bool SO, typename T2 >
1896 struct AddTrait< DynamicMatrix<T1,SO>, IdentityMatrix<T2,SO> >
1897 {
1898  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1899 };
1900 
1901 template< typename T1, bool SO1, typename T2, bool SO2 >
1902 struct AddTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
1903 {
1904  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
1905 };
1906 
1907 template< typename T1, bool SO, typename T2, bool AF, bool PF >
1908 struct AddTrait< IdentityMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
1909 {
1910  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1911 };
1912 
1913 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
1914 struct AddTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
1915 {
1916  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
1917 };
1918 
1919 template< typename T1, bool AF, bool PF, bool SO, typename T2 >
1920 struct AddTrait< CustomMatrix<T1,AF,PF,SO>, IdentityMatrix<T2,SO> >
1921 {
1922  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1923 };
1924 
1925 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
1926 struct AddTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
1927 {
1928  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
1929 };
1930 
1931 template< typename T1, bool SO, typename T2 >
1932 struct AddTrait< IdentityMatrix<T1,SO>, CompressedMatrix<T2,SO> >
1933 {
1934  using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
1935 };
1936 
1937 template< typename T1, bool SO1, typename T2, bool SO2 >
1938 struct AddTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
1939 {
1940  using Type = CompressedMatrix< AddTrait_<T1,T2>, false >;
1941 };
1942 
1943 template< typename T1, bool SO, typename T2 >
1944 struct AddTrait< CompressedMatrix<T1,SO>, IdentityMatrix<T2,SO> >
1945 {
1946  using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
1947 };
1948 
1949 template< typename T1, bool SO1, typename T2, bool SO2 >
1950 struct AddTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
1951 {
1952  using Type = CompressedMatrix< AddTrait_<T1,T2>, false >;
1953 };
1954 
1955 template< typename T1, bool SO, typename T2 >
1956 struct AddTrait< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
1957 {
1958  using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
1959 };
1960 
1961 template< typename T1, bool SO1, typename T2, bool SO2 >
1962 struct AddTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
1963 {
1964  using Type = CompressedMatrix< AddTrait_<T1,T2>, false >;
1965 };
1967 //*************************************************************************************************
1968 
1969 
1970 
1971 
1972 //=================================================================================================
1973 //
1974 // SUBTRAIT SPECIALIZATIONS
1975 //
1976 //=================================================================================================
1977 
1978 //*************************************************************************************************
1980 template< typename T1, bool SO, typename T2, size_t M, size_t N >
1981 struct SubTrait< IdentityMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
1982 {
1983  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
1984 };
1985 
1986 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
1987 struct SubTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
1988 {
1989  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
1990 };
1991 
1992 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
1993 struct SubTrait< StaticMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
1994 {
1995  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
1996 };
1997 
1998 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
1999 struct SubTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2000 {
2001  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
2002 };
2003 
2004 template< typename T1, bool SO, typename T2, size_t M, size_t N >
2005 struct SubTrait< IdentityMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
2006 {
2007  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
2008 };
2009 
2010 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2011 struct SubTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
2012 {
2013  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
2014 };
2015 
2016 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
2017 struct SubTrait< HybridMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
2018 {
2019  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
2020 };
2021 
2022 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2023 struct SubTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2024 {
2025  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
2026 };
2027 
2028 template< typename T1, bool SO, typename T2 >
2029 struct SubTrait< IdentityMatrix<T1,SO>, DynamicMatrix<T2,SO> >
2030 {
2031  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2032 };
2033 
2034 template< typename T1, bool SO1, typename T2, bool SO2 >
2035 struct SubTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
2036 {
2037  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
2038 };
2039 
2040 template< typename T1, bool SO, typename T2 >
2041 struct SubTrait< DynamicMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2042 {
2043  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2044 };
2045 
2046 template< typename T1, bool SO1, typename T2, bool SO2 >
2047 struct SubTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2048 {
2049  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
2050 };
2051 
2052 template< typename T1, bool SO, typename T2, bool AF, bool PF >
2053 struct SubTrait< IdentityMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
2054 {
2055  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2056 };
2057 
2058 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
2059 struct SubTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
2060 {
2061  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
2062 };
2063 
2064 template< typename T1, bool AF, bool PF, bool SO, typename T2 >
2065 struct SubTrait< CustomMatrix<T1,AF,PF,SO>, IdentityMatrix<T2,SO> >
2066 {
2067  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2068 };
2069 
2070 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
2071 struct SubTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
2072 {
2073  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
2074 };
2075 
2076 template< typename T1, bool SO, typename T2 >
2077 struct SubTrait< IdentityMatrix<T1,SO>, CompressedMatrix<T2,SO> >
2078 {
2079  using Type = CompressedMatrix< SubTrait_<T1,T2>, SO >;
2080 };
2081 
2082 template< typename T1, bool SO1, typename T2, bool SO2 >
2083 struct SubTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
2084 {
2085  using Type = CompressedMatrix< SubTrait_<T1,T2>, false >;
2086 };
2087 
2088 template< typename T1, bool SO, typename T2 >
2089 struct SubTrait< CompressedMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2090 {
2091  using Type = CompressedMatrix< SubTrait_<T1,T2>, SO >;
2092 };
2093 
2094 template< typename T1, bool SO1, typename T2, bool SO2 >
2095 struct SubTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2096 {
2097  using Type = CompressedMatrix< SubTrait_<T1,T2>, false >;
2098 };
2099 
2100 template< typename T1, bool SO, typename T2 >
2101 struct SubTrait< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2102 {
2103  using Type = CompressedMatrix< SubTrait_<T1,T2> , SO >;
2104 };
2105 
2106 template< typename T1, bool SO1, typename T2, bool SO2 >
2107 struct SubTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2108 {
2109  using Type = CompressedMatrix< SubTrait_<T1,T2> , false >;
2110 };
2112 //*************************************************************************************************
2113 
2114 
2115 
2116 
2117 //=================================================================================================
2118 //
2119 // SCHURTRAIT SPECIALIZATIONS
2120 //
2121 //=================================================================================================
2122 
2123 //*************************************************************************************************
2125 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2126 struct SchurTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
2127 {
2128  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2129 };
2130 
2131 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2132 struct SchurTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2133 {
2134  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2135 };
2136 
2137 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2138 struct SchurTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
2139 {
2140  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2141 };
2142 
2143 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2144 struct SchurTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2145 {
2146  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2147 };
2148 
2149 template< typename T1, bool SO1, typename T2, bool SO2 >
2150 struct SchurTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
2151 {
2152  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2153 };
2154 
2155 template< typename T1, bool SO1, typename T2, bool SO2 >
2156 struct SchurTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2157 {
2158  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2159 };
2160 
2161 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
2162 struct SchurTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
2163 {
2164  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2165 };
2166 
2167 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
2168 struct SchurTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
2169 {
2170  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2171 };
2172 
2173 template< typename T1, bool SO, typename T2 >
2174 struct SchurTrait< IdentityMatrix<T1,SO>, CompressedMatrix<T2,SO> >
2175 {
2176  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2177 };
2178 
2179 template< typename T1, bool SO1, typename T2, bool SO2 >
2180 struct SchurTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
2181 {
2182  using Type = CompressedMatrix< MultTrait_<T1,T2>, false >;
2183 };
2184 
2185 template< typename T1, bool SO, typename T2 >
2186 struct SchurTrait< CompressedMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2187 {
2188  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2189 };
2190 
2191 template< typename T1, bool SO1, typename T2, bool SO2 >
2192 struct SchurTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2193 {
2194  using Type = CompressedMatrix< MultTrait_<T1,T2>, false >;
2195 };
2196 
2197 template< typename T1, bool SO1, typename T2, bool SO2 >
2198 struct SchurTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2199 {
2200  using Type = IdentityMatrix< MultTrait_<T1,T2>, SO1 >;
2201 };
2203 //*************************************************************************************************
2204 
2205 
2206 
2207 
2208 //=================================================================================================
2209 //
2210 // MULTTRAIT SPECIALIZATIONS
2211 //
2212 //=================================================================================================
2213 
2214 //*************************************************************************************************
2216 template< typename T1, bool SO, typename T2 >
2217 struct MultTrait< IdentityMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
2218 {
2219  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2220 };
2221 
2222 template< typename T1, typename T2, bool SO >
2223 struct MultTrait< T1, IdentityMatrix<T2,SO>, EnableIf_< IsNumeric<T1> > >
2224 {
2225  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2226 };
2227 
2228 template< typename T1, bool SO, typename T2, size_t N >
2229 struct MultTrait< IdentityMatrix<T1,SO>, StaticVector<T2,N,false> >
2230 {
2231  using Type = StaticVector< MultTrait_<T1,T2>, N, false >;
2232 };
2233 
2234 template< typename T1, size_t N, typename T2, bool SO >
2235 struct MultTrait< StaticVector<T1,N,true>, IdentityMatrix<T2,SO> >
2236 {
2237  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
2238 };
2239 
2240 template< typename T1, bool SO, typename T2, size_t N >
2241 struct MultTrait< IdentityMatrix<T1,SO>, HybridVector<T2,N,false> >
2242 {
2243  using Type = HybridVector< MultTrait_<T1,T2>, N, false >;
2244 };
2245 
2246 template< typename T1, size_t N, typename T2, bool SO >
2247 struct MultTrait< HybridVector<T1,N,true>, IdentityMatrix<T2,SO> >
2248 {
2249  using Type = HybridVector< MultTrait_<T1,T2>, N, true >;
2250 };
2251 
2252 template< typename T1, bool SO, typename T2 >
2253 struct MultTrait< IdentityMatrix<T1,SO>, DynamicVector<T2,false> >
2254 {
2255  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
2256 };
2257 
2258 template< typename T1, typename T2, bool SO >
2259 struct MultTrait< DynamicVector<T1,true>, IdentityMatrix<T2,SO> >
2260 {
2261  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
2262 };
2263 
2264 template< typename T1, bool SO, typename T2, bool AF, bool PF >
2265 struct MultTrait< IdentityMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
2266 {
2267  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
2268 };
2269 
2270 template< typename T1, bool AF, bool PF, typename T2, bool SO >
2271 struct MultTrait< CustomVector<T1,AF,PF,true>, IdentityMatrix<T2,SO> >
2272 {
2273  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
2274 };
2275 
2276 template< typename T1, bool SO, typename T2 >
2277 struct MultTrait< IdentityMatrix<T1,SO>, CompressedVector<T2,false> >
2278 {
2279  using Type = CompressedVector< MultTrait_<T1,T2>, false >;
2280 };
2281 
2282 template< typename T1, typename T2, bool SO >
2283 struct MultTrait< CompressedVector<T1,true>, IdentityMatrix<T2,SO> >
2284 {
2285  using Type = CompressedVector< MultTrait_<T1,T2>, true >;
2286 };
2287 
2288 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2289 struct MultTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
2290 {
2291  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2292 };
2293 
2294 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2295 struct MultTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2296 {
2297  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2298 };
2299 
2300 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2301 struct MultTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
2302 {
2303  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2304 };
2305 
2306 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2307 struct MultTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2308 {
2309  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2310 };
2311 
2312 template< typename T1, bool SO1, typename T2, bool SO2 >
2313 struct MultTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
2314 {
2315  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2316 };
2317 
2318 template< typename T1, bool SO1, typename T2, bool SO2 >
2319 struct MultTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2320 {
2321  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2322 };
2323 
2324 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
2325 struct MultTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
2326 {
2327  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2328 };
2329 
2330 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
2331 struct MultTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
2332 {
2333  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2334 };
2335 
2336 template< typename T1, bool SO1, typename T2, bool SO2 >
2337 struct MultTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
2338 {
2339  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2340 };
2341 
2342 template< typename T1, bool SO1, typename T2, bool SO2 >
2343 struct MultTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2344 {
2345  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2346 };
2347 
2348 template< typename T1, bool SO1, typename T2, bool SO2 >
2349 struct MultTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2350 {
2351  using Type = IdentityMatrix< MultTrait_<T1,T2>, SO1 >;
2352 };
2354 //*************************************************************************************************
2355 
2356 
2357 
2358 
2359 //=================================================================================================
2360 //
2361 // DIVTRAIT SPECIALIZATIONS
2362 //
2363 //=================================================================================================
2364 
2365 //*************************************************************************************************
2367 template< typename T1, bool SO, typename T2 >
2368 struct DivTrait< IdentityMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
2369 {
2370  using Type = CompressedMatrix< DivTrait_<T1,T2>, SO >;
2371 };
2373 //*************************************************************************************************
2374 
2375 
2376 
2377 
2378 //=================================================================================================
2379 //
2380 // UNARYMAPTRAIT SPECIALIZATIONS
2381 //
2382 //=================================================================================================
2383 
2384 //*************************************************************************************************
2386 template< typename T, bool SO, typename OP >
2387 struct UnaryMapTrait< IdentityMatrix<T,SO>, OP >
2388 {
2389  using Type = CompressedMatrix< UnaryMapTrait_<T,OP>, SO >;
2390 };
2391 
2392 template< typename T, bool SO >
2393 struct UnaryMapTrait< IdentityMatrix<T,SO>, Abs >
2394 {
2395  using Type = IdentityMatrix< UnaryMapTrait_<T,Abs>, SO >;
2396 };
2397 
2398 template< typename T, bool SO >
2399 struct UnaryMapTrait< IdentityMatrix<T,SO>, Floor >
2400 {
2401  using Type = IdentityMatrix< UnaryMapTrait_<T,Floor>, SO >;
2402 };
2403 
2404 template< typename T, bool SO >
2405 struct UnaryMapTrait< IdentityMatrix<T,SO>, Ceil >
2406 {
2407  using Type = IdentityMatrix< UnaryMapTrait_<T,Ceil>, SO >;
2408 };
2409 
2410 template< typename T, bool SO >
2411 struct UnaryMapTrait< IdentityMatrix<T,SO>, Trunc >
2412 {
2413  using Type = IdentityMatrix< UnaryMapTrait_<T,Trunc>, SO >;
2414 };
2415 
2416 template< typename T, bool SO >
2417 struct UnaryMapTrait< IdentityMatrix<T,SO>, Round >
2418 {
2419  using Type = IdentityMatrix< UnaryMapTrait_<T,Round>, SO >;
2420 };
2421 
2422 template< typename T, bool SO >
2423 struct UnaryMapTrait< IdentityMatrix<T,SO>, Conj >
2424 {
2425  using Type = IdentityMatrix< UnaryMapTrait_<T,Conj>, SO >;
2426 };
2427 
2428 template< typename T, bool SO >
2429 struct UnaryMapTrait< IdentityMatrix<T,SO>, Real >
2430 {
2431  using Type = IdentityMatrix< UnaryMapTrait_<T,Real>, SO >;
2432 };
2433 
2434 template< typename T, bool SO >
2435 struct UnaryMapTrait< IdentityMatrix<T,SO>, Sqrt >
2436 {
2437  using Type = IdentityMatrix< UnaryMapTrait<T,Sqrt>, SO >;
2438 };
2439 
2440 template< typename T, bool SO >
2441 struct UnaryMapTrait< IdentityMatrix<T,SO>, Cbrt >
2442 {
2443  using Type = IdentityMatrix< UnaryMapTrait<T,Cbrt>, SO >;
2444 };
2445 
2446 template< typename T, bool SO, typename ET >
2447 struct UnaryMapTrait< IdentityMatrix<T,SO>, Pow<ET> >
2448 {
2449  using Type = IdentityMatrix< UnaryMapTrait< T, Pow<ET> >, SO >;
2450 };
2452 //*************************************************************************************************
2453 
2454 
2455 
2456 
2457 //=================================================================================================
2458 //
2459 // DECLSYMTRAIT SPECIALIZATIONS
2460 //
2461 //=================================================================================================
2462 
2463 //*************************************************************************************************
2465 template< typename T, bool SO >
2466 struct DeclSymTrait< IdentityMatrix<T,SO> >
2467 {
2468  using Type = IdentityMatrix<T,SO>;
2469 };
2471 //*************************************************************************************************
2472 
2473 
2474 
2475 
2476 //=================================================================================================
2477 //
2478 // DECLHERMTRAIT SPECIALIZATIONS
2479 //
2480 //=================================================================================================
2481 
2482 //*************************************************************************************************
2484 template< typename T, bool SO >
2485 struct DeclHermTrait< IdentityMatrix<T,SO> >
2486 {
2487  using Type = IdentityMatrix<T,SO>;
2488 };
2490 //*************************************************************************************************
2491 
2492 
2493 
2494 
2495 //=================================================================================================
2496 //
2497 // DECLLOWTRAIT SPECIALIZATIONS
2498 //
2499 //=================================================================================================
2500 
2501 //*************************************************************************************************
2503 template< typename T, bool SO >
2504 struct DeclLowTrait< IdentityMatrix<T,SO> >
2505 {
2506  using Type = IdentityMatrix<T,SO>;
2507 };
2509 //*************************************************************************************************
2510 
2511 
2512 
2513 
2514 //=================================================================================================
2515 //
2516 // DECLUPPTRAIT SPECIALIZATIONS
2517 //
2518 //=================================================================================================
2519 
2520 //*************************************************************************************************
2522 template< typename T, bool SO >
2523 struct DeclUppTrait< IdentityMatrix<T,SO> >
2524 {
2525  using Type = IdentityMatrix<T,SO>;
2526 };
2528 //*************************************************************************************************
2529 
2530 
2531 
2532 
2533 //=================================================================================================
2534 //
2535 // DECLDIAGTRAIT SPECIALIZATIONS
2536 //
2537 //=================================================================================================
2538 
2539 //*************************************************************************************************
2541 template< typename T, bool SO >
2542 struct DeclDiagTrait< IdentityMatrix<T,SO> >
2543 {
2544  using Type = IdentityMatrix<T,SO>;
2545 };
2547 //*************************************************************************************************
2548 
2549 
2550 
2551 
2552 //=================================================================================================
2553 //
2554 // HIGHTYPE SPECIALIZATIONS
2555 //
2556 //=================================================================================================
2557 
2558 //*************************************************************************************************
2560 template< typename T1, bool SO, typename T2 >
2561 struct HighType< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2562 {
2564 };
2566 //*************************************************************************************************
2567 
2568 
2569 
2570 
2571 //=================================================================================================
2572 //
2573 // LOWTYPE SPECIALIZATIONS
2574 //
2575 //=================================================================================================
2576 
2577 //*************************************************************************************************
2579 template< typename T1, bool SO, typename T2 >
2580 struct LowType< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2581 {
2583 };
2585 //*************************************************************************************************
2586 
2587 
2588 
2589 
2590 //=================================================================================================
2591 //
2592 // SUBMATRIXTRAIT SPECIALIZATIONS
2593 //
2594 //=================================================================================================
2595 
2596 //*************************************************************************************************
2598 template< typename T1, bool SO >
2599 struct SubmatrixTrait< IdentityMatrix<T1,SO> >
2600 {
2601  using Type = CompressedMatrix<T1,SO>;
2602 };
2604 //*************************************************************************************************
2605 
2606 
2607 
2608 
2609 //=================================================================================================
2610 //
2611 // ROWTRAIT SPECIALIZATIONS
2612 //
2613 //=================================================================================================
2614 
2615 //*************************************************************************************************
2617 template< typename T1, bool SO >
2618 struct RowTrait< IdentityMatrix<T1,SO> >
2619 {
2620  using Type = CompressedVector<T1,true>;
2621 };
2623 //*************************************************************************************************
2624 
2625 
2626 
2627 
2628 //=================================================================================================
2629 //
2630 // COLUMNTRAIT SPECIALIZATIONS
2631 //
2632 //=================================================================================================
2633 
2634 //*************************************************************************************************
2636 template< typename T1, bool SO >
2637 struct ColumnTrait< IdentityMatrix<T1,SO> >
2638 {
2639  using Type = CompressedVector<T1,false>;
2640 };
2642 //*************************************************************************************************
2643 
2644 } // namespace blaze
2645 
2646 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Header file for the decldiag trait.
Iterator over the elements of the identity matrix.
Definition: IdentityMatrix.h:219
Constraint on the data type.
Header file for the Schur product trait.
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: IdentityMatrix.h:1057
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
ConstIterator & operator++()
Pre-increment operator.
Definition: IdentityMatrix.h:263
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
const Type ReturnType
Return type for expression template evaluations.
Definition: IdentityMatrix.h:191
Header file for basic type definitions.
Header file for the SparseVector base class.
IdentityMatrix() noexcept
The default constructor for IdentityMatrix.
Definition: IdentityMatrix.h:490
Header file for the row trait.
Header file for the declherm trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:128
Resize mechanism to obtain a IdentityMatrix with different fixed dimensions.
Definition: IdentityMatrix.h:211
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:127
IdentityMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: IdentityMatrix.h:1007
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:216
const Type ConstReference
Reference to a constant identity matrix element.
Definition: IdentityMatrix.h:194
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Base template for the DeclUppTrait class.
Definition: DeclUppTrait.h:133
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Base template for the SchurTrait class.
Definition: SchurTrait.h:124
size_t index() const
Access to the current index of the sparse element.
Definition: IdentityMatrix.h:316
size_t columns() const noexcept
Returns the current number of columns of the identity matrix.
Definition: IdentityMatrix.h:750
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
Header file for the DenseVector base class.
Header file for the IsIdentity type trait.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: IdentityMatrix.h:338
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
void resize(size_t n)
Changing the size of the identity matrix.
Definition: IdentityMatrix.h:861
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: IdentityMatrix.h:226
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: IdentityMatrix.h:936
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:183
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation ...
Definition: DynamicMatrix.h:212
Header file for the IsUniLower type trait.
size_t capacity() const noexcept
Returns the maximum capacity of the identity matrix.
Definition: IdentityMatrix.h:764
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:78
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
void swap(IdentityMatrix &m) noexcept
Swapping the contents of two sparse matrices.
Definition: IdentityMatrix.h:876
size_t nonZeros() const
Returns the number of non-zero elements in the identity matrix.
Definition: IdentityMatrix.h:802
Constraint on the data type.
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1686
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first non-zero element of row/column i.
Definition: IdentityMatrix.h:630
Header file for the SparseMatrix base class.
Efficient implementation of a dynamically sized vector with static memory.The HybridVector class temp...
Definition: Forward.h:59
Header file for the IsSquare type trait.
Base template for the RowTrait class.
Definition: RowTrait.h:127
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Header file for the ValueIndexPair class.
Efficient implementation of an identity matrix.The IdentityMatrix class template is the representati...
Definition: Forward.h:49
Header file for the LowType type trait.
Base template for the HighType type trait.
Definition: HighType.h:133
Header file for the multiplication trait.
Header file for the unary map trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5924
Header file for the If class template.
Header file for all forward declarations of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Header file for the IsSMPAssignable type trait.
Header file for the decllow trait.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:60
Header file for the DenseMatrix base class.
Type ElementType
Type of the identity matrix elements.
Definition: IdentityMatrix.h:190
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
ConstIterator end(size_t i) const noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: IdentityMatrix.h:653
Constraint on the data type.
IdentityMatrix & transpose()
In-place transpose of the matrix.
Definition: IdentityMatrix.h:993
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: IdentityMatrix.h:907
Compile time check for square matrices.This type trait tests whether or not the given template parame...
Definition: IsSquare.h:88
Header file for the default storage order for all vectors of the Blaze library.
Header file for the IsUniTriangular type trait.
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: IdentityMatrix.h:296
Base template for the DeclSymTrait class.
Definition: DeclSymTrait.h:134
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Header file for the exception macros of the math module.
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:119
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two ConstIterator objects.
Definition: IdentityMatrix.h:349
Rebind mechanism to obtain an IdentityMatrix with different data/element type.
Definition: IdentityMatrix.h:201
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
size_t index_
Index to the current identity matrix element.
Definition: IdentityMatrix.h:356
ConstIterator operator++(int)
Post-increment operator.
Definition: IdentityMatrix.h:274
Header file for the EnableIf class template.
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: IdentityMatrix.h:1078
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
const Type Reference
Reference to a identity matrix element.
Definition: IdentityMatrix.h:193
Header file for the IsNumeric type trait.
Base template for the LowType type trait.
Definition: LowType.h:133
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
size_t n_
The current number of rows and columns of the identity matrix.
Definition: IdentityMatrix.h:460
IdentityMatrix< Type, SO > This
Type of this IdentityMatrix instance.
Definition: IdentityMatrix.h:185
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: IdentityMatrix.h:327
Header file for the declupp trait.
IdentityMatrix< ElementType_< MT >, SO > declid(const Matrix< MT, SO > &m)
Declares the given matrix expression m as identity matrix.
Definition: IdentityMatrix.h:1704
Compile time check for identity matrices.This type trait tests whether or not the given template para...
Definition: IsIdentity.h:90
ConstIterator(size_t index)
Constructor for the ConstIterator class.
Definition: IdentityMatrix.h:253
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:139
Base template for the DeclHermTrait class.
Definition: DeclHermTrait.h:134
Utility type for generic codes.
Base template for the MultTrait class.
Definition: MultTrait.h:139
Header file for the addition trait.
ConstReference operator()(size_t i, size_t j) const noexcept
2D-access to the identity matrix elements.
Definition: IdentityMatrix.h:553
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
Header file for the declsym trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Efficient implementation of a dynamically sized matrix with static memory.The HybridMatrix class temp...
Definition: Forward.h:58
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Constraint on the data type.
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: IdentityMatrix.h:1035
size_t rows() const noexcept
Returns the current number of rows of the identity matrix.
Definition: IdentityMatrix.h:736
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Base template for the DivTrait class.
Definition: DivTrait.h:139
IdentityMatrix< NewType, SO > Other
The type of the other IdentityMatrix.
Definition: IdentityMatrix.h:202
ConstIterator begin(size_t i) const noexcept
Returns an iterator to the first non-zero element of row/column i.
Definition: IdentityMatrix.h:607
ConstReference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: IdentityMatrix.h:580
Base template for the DeclLowTrait class.
Definition: DeclLowTrait.h:133
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: IdentityMatrix.h:286
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
IteratorCategory iterator_category
The iterator category.
Definition: IdentityMatrix.h:233
void clear()
Clearing the identity matrix.
Definition: IdentityMatrix.h:842
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
Type value() const
Access to the current value of the sparse element.
Definition: IdentityMatrix.h:306
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
Base template for the SubTrait class.
Definition: SubTrait.h:139
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
ConstIterator()
Default constructor for the ConstIterator class.
Definition: IdentityMatrix.h:243
Header file for the IsHermitian type trait.
Base template for the DeclDiagTrait class.
Definition: DeclDiagTrait.h:133
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
Header file for the IsResizable type trait.
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:117
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: IdentityMatrix.h:676
Efficient implementation of an arbitrary sized sparse vector.The CompressedVector class is the repres...
Definition: CompressedVector.h:197
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
Header file for the function trace functionality.
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: IdentityMatrix.h:965