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>
84 #include <blaze/util/Assert.h>
90 #include <blaze/util/EnableIf.h>
92 #include <blaze/util/mpl/If.h>
93 #include <blaze/util/TrueType.h>
94 #include <blaze/util/Types.h>
96 #include <blaze/util/Unused.h>
97 
98 
99 namespace blaze {
100 
101 //=================================================================================================
102 //
103 // CLASS DEFINITION
104 //
105 //=================================================================================================
106 
107 //*************************************************************************************************
181 template< typename Type // Data type of the matrix
182  , bool SO = defaultStorageOrder > // Storage order
183 class IdentityMatrix
184  : public SparseMatrix< IdentityMatrix<Type,SO>, SO >
185 {
186  public:
187  //**Type definitions****************************************************************************
190  using ResultType = This;
193  using ElementType = Type;
194  using ReturnType = const Type;
195  using CompositeType = const This&;
196  using Reference = const Type;
197  using ConstReference = const Type;
198  //**********************************************************************************************
199 
200  //**Rebind struct definition********************************************************************
203  template< typename NewType > // Data type of the other matrix
204  struct Rebind {
206  };
207  //**********************************************************************************************
208 
209  //**Resize struct definition********************************************************************
212  template< size_t NewM // Number of rows of the other matrix
213  , size_t NewN > // Number of columns of the other matrix
214  struct Resize {
216  };
217  //**********************************************************************************************
218 
219  //**ConstIterator class definition**************************************************************
223  {
224  public:
225  //**Type definitions*************************************************************************
228 
229  using IteratorCategory = std::forward_iterator_tag;
230  using ValueType = Element;
234 
235  // STL iterator requirements
241  //*******************************************************************************************
242 
243  //**Default constructor**********************************************************************
246  inline ConstIterator()
247  : index_() // Index to the current identity matrix element
248  {}
249  //*******************************************************************************************
250 
251  //**Constructor******************************************************************************
256  inline ConstIterator( size_t index )
257  : index_( index ) // Index to the current identity matrix element
258  {}
259  //*******************************************************************************************
260 
261  //**Prefix increment operator****************************************************************
267  ++index_;
268  return *this;
269  }
270  //*******************************************************************************************
271 
272  //**Postfix increment operator***************************************************************
277  inline ConstIterator operator++( int ) {
278  ConstIterator tmp( *this );
279  ++index_;
280  return tmp;
281  }
282  //*******************************************************************************************
283 
284  //**Element access operator******************************************************************
289  inline const Element operator*() const {
290  return Element( Type(1), index_ );
291  }
292  //*******************************************************************************************
293 
294  //**Element access operator******************************************************************
299  inline const ConstIterator* operator->() const {
300  return this;
301  }
302  //*******************************************************************************************
303 
304  //**Value function***************************************************************************
309  inline Type value() const {
310  return Type(1);
311  }
312  //*******************************************************************************************
313 
314  //**Index function***************************************************************************
319  inline size_t index() const {
320  return index_;
321  }
322  //*******************************************************************************************
323 
324  //**Equality operator************************************************************************
330  inline bool operator==( const ConstIterator& rhs ) const {
331  return index_ == rhs.index_;
332  }
333  //*******************************************************************************************
334 
335  //**Inequality operator**********************************************************************
341  inline bool operator!=( const ConstIterator& rhs ) const {
342  return index_ != rhs.index_;
343  }
344  //*******************************************************************************************
345 
346  //**Subtraction operator*********************************************************************
352  inline DifferenceType operator-( const ConstIterator& rhs ) const {
353  return index_ - rhs.index_;
354  }
355  //*******************************************************************************************
356 
357  private:
358  //**Member variables*************************************************************************
359  size_t index_;
360  //*******************************************************************************************
361  };
362  //**********************************************************************************************
363 
364  //**Type definitions****************************************************************************
366  //**********************************************************************************************
367 
368  //**Compilation flags***************************************************************************
370 
373  enum : bool { smpAssignable = !IsSMPAssignable<Type>::value };
374  //**********************************************************************************************
375 
376  //**Constructors********************************************************************************
379  explicit inline IdentityMatrix() noexcept;
380  explicit inline IdentityMatrix( size_t n ) noexcept;
381 
382  template< typename MT, bool SO2 >
383  explicit inline IdentityMatrix( const Matrix<MT,SO2>& m );
384 
385  // No explicitly declared copy constructor.
386  // No explicitly declared move constructor.
388  //**********************************************************************************************
389 
390  //**Destructor**********************************************************************************
391  // No explicitly declared destructor.
392  //**********************************************************************************************
393 
394  //**Data access functions***********************************************************************
397  inline ConstReference operator()( size_t i, size_t j ) const noexcept;
398  inline ConstReference at( size_t i, size_t j ) const;
399  inline ConstIterator begin ( size_t i ) const noexcept;
400  inline ConstIterator cbegin( size_t i ) const noexcept;
401  inline ConstIterator end ( size_t i ) const noexcept;
402  inline ConstIterator cend ( size_t i ) const noexcept;
404  //**********************************************************************************************
405 
406  //**Assignment operators************************************************************************
409  template< typename MT, bool SO2 >
410  inline IdentityMatrix& operator=( const Matrix<MT,SO2>& rhs );
411 
412  // No explicitly declared copy assignment operator.
413  // No explicitly declared move assignment operator.
415  //**********************************************************************************************
416 
417  //**Utility functions***************************************************************************
420  inline size_t rows() const noexcept;
421  inline size_t columns() const noexcept;
422  inline size_t capacity() const noexcept;
423  inline size_t capacity( size_t i ) const noexcept;
424  inline size_t nonZeros() const;
425  inline size_t nonZeros( size_t i ) const;
426  inline void clear();
427  void resize( size_t n );
428  inline void swap( IdentityMatrix& m ) noexcept;
430  //**********************************************************************************************
431 
432  //**Lookup functions****************************************************************************
435  inline ConstIterator find ( size_t i, size_t j ) const;
436  inline ConstIterator lowerBound( size_t i, size_t j ) const;
437  inline ConstIterator upperBound( size_t i, size_t j ) const;
439  //**********************************************************************************************
440 
441  //**Numeric functions***************************************************************************
444  inline IdentityMatrix& transpose();
445  inline IdentityMatrix& ctranspose();
447  //**********************************************************************************************
448 
449  //**Expression template evaluation functions****************************************************
452  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
453  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
454 
455  inline bool canSMPAssign() const noexcept;
457  //**********************************************************************************************
458 
459  private:
460  //**Member variables****************************************************************************
463  size_t n_;
464 
465  //**********************************************************************************************
466 
467  //**Compile time checks*************************************************************************
475  //**********************************************************************************************
476 };
477 //*************************************************************************************************
478 
479 
480 
481 
482 //=================================================================================================
483 //
484 // CONSTRUCTORS
485 //
486 //=================================================================================================
487 
488 //*************************************************************************************************
491 template< typename Type // Data type of the matrix
492  , bool SO > // Storage order
494  : n_( 0UL ) // The current number of rows and columns of the identity matrix
495 {}
496 //*************************************************************************************************
497 
498 
499 //*************************************************************************************************
504 template< typename Type // Data type of the matrix
505  , bool SO > // Storage order
506 inline IdentityMatrix<Type,SO>::IdentityMatrix( size_t n ) noexcept
507  : n_( n ) // The current number of rows and columns of the identity matrix
508 {}
509 //*************************************************************************************************
510 
511 
512 //*************************************************************************************************
521 template< typename Type // Data type of the matrix
522  , bool SO > // Storage order
523 template< typename MT // Type of the foreign identity matrix
524  , bool SO2 > // Storage order of the foreign identity matrix
526  : n_( (~m).rows() ) // The current number of rows and columns of the identity matrix
527 {
528  if( !IsIdentity<MT>::value && !isIdentity( ~m ) ) {
529  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of identity matrix" );
530  }
531 }
532 //*************************************************************************************************
533 
534 
535 
536 
537 //=================================================================================================
538 //
539 // DATA ACCESS FUNCTIONS
540 //
541 //=================================================================================================
542 
543 //*************************************************************************************************
553 template< typename Type // Data type of the matrix
554  , bool SO > // Storage order
556  IdentityMatrix<Type,SO>::operator()( size_t i, size_t j ) const noexcept
557 {
558  BLAZE_USER_ASSERT( i < rows() , "Invalid identity matrix row access index" );
559  BLAZE_USER_ASSERT( j < columns(), "Invalid identity matrix column access index" );
560 
561  if( i == j )
562  return Type( 1 );
563  else
564  return Type( 0 );
565 }
566 //*************************************************************************************************
567 
568 
569 //*************************************************************************************************
580 template< typename Type // Data type of the matrix
581  , bool SO > // Storage order
583  IdentityMatrix<Type,SO>::at( size_t i, size_t j ) const
584 {
585  if( i >= n_ ) {
586  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
587  }
588  if( j >= n_ ) {
589  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
590  }
591  return (*this)(i,j);
592 }
593 //*************************************************************************************************
594 
595 
596 //*************************************************************************************************
607 template< typename Type // Data type of the matrix
608  , bool SO > // Storage order
610  IdentityMatrix<Type,SO>::begin( size_t i ) const noexcept
611 {
612  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
613 
614  return ConstIterator( i );
615 }
616 //*************************************************************************************************
617 
618 
619 //*************************************************************************************************
630 template< typename Type // Data type of the matrix
631  , bool SO > // Storage order
633  IdentityMatrix<Type,SO>::cbegin( size_t i ) const noexcept
634 {
635  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
636 
637  return ConstIterator( i );
638 }
639 //*************************************************************************************************
640 
641 
642 //*************************************************************************************************
653 template< typename Type // Data type of the matrix
654  , bool SO > // Storage order
656  IdentityMatrix<Type,SO>::end( size_t i ) const noexcept
657 {
658  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
659 
660  return ConstIterator( i+1UL );
661 }
662 //*************************************************************************************************
663 
664 
665 //*************************************************************************************************
676 template< typename Type // Data type of the matrix
677  , bool SO > // Storage order
679  IdentityMatrix<Type,SO>::cend( size_t i ) const noexcept
680 {
681  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
682 
683  return ConstIterator( i+1UL );
684 }
685 //*************************************************************************************************
686 
687 
688 
689 
690 //=================================================================================================
691 //
692 // ASSIGNMENT OPERATORS
693 //
694 //=================================================================================================
695 
696 //*************************************************************************************************
706 template< typename Type // Data type of the matrix
707  , bool SO > // Storage order
708 template< typename MT // Type of the right-hand side identity matrix
709  , bool SO2 > // Storage order of the right-hand side identity matrix
712 {
713  if( !IsIdentity<MT>::value && !isIdentity( ~rhs ) ) {
714  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment of identity matrix" );
715  }
716 
717  n_ = (~rhs).rows();
718 
719  return *this;
720 }
721 //*************************************************************************************************
722 
723 
724 
725 
726 //=================================================================================================
727 //
728 // UTILITY FUNCTIONS
729 //
730 //=================================================================================================
731 
732 //*************************************************************************************************
737 template< typename Type // Data type of the matrix
738  , bool SO > // Storage order
739 inline size_t IdentityMatrix<Type,SO>::rows() const noexcept
740 {
741  return n_;
742 }
743 //*************************************************************************************************
744 
745 
746 //*************************************************************************************************
751 template< typename Type // Data type of the matrix
752  , bool SO > // Storage order
753 inline size_t IdentityMatrix<Type,SO>::columns() const noexcept
754 {
755  return n_;
756 }
757 //*************************************************************************************************
758 
759 
760 //*************************************************************************************************
765 template< typename Type // Data type of the matrix
766  , bool SO > // Storage order
767 inline size_t IdentityMatrix<Type,SO>::capacity() const noexcept
768 {
769  return n_;
770 }
771 //*************************************************************************************************
772 
773 
774 //*************************************************************************************************
785 template< typename Type // Data type of the matrix
786  , bool SO > // Storage order
787 inline size_t IdentityMatrix<Type,SO>::capacity( size_t i ) const noexcept
788 {
789  UNUSED_PARAMETER( i );
790 
791  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
792 
793  return 1UL;
794 }
795 //*************************************************************************************************
796 
797 
798 //*************************************************************************************************
803 template< typename Type // Data type of the matrix
804  , bool SO > // Storage order
806 {
807  return n_;
808 }
809 //*************************************************************************************************
810 
811 
812 //*************************************************************************************************
823 template< typename Type // Data type of the matrix
824  , bool SO > // Storage order
825 inline size_t IdentityMatrix<Type,SO>::nonZeros( size_t i ) const
826 {
827  UNUSED_PARAMETER( i );
828 
829  BLAZE_USER_ASSERT( i < n_, "Invalid identity matrix row/column access index" );
830 
831  return 1UL;
832 }
833 //*************************************************************************************************
834 
835 
836 //*************************************************************************************************
843 template< typename Type // Data type of the matrix
844  , bool SO > // Storage order
846 {
847  n_ = 0UL;
848 }
849 //*************************************************************************************************
850 
851 
852 //*************************************************************************************************
862 template< typename Type // Data type of the matrix
863  , bool SO > // Storage order
865 {
866  n_ = n;
867 }
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
877 template< typename Type // Data type of the matrix
878  , bool SO > // Storage order
880 {
881  using std::swap;
882 
883  swap( n_, m.n_ );
884 }
885 //*************************************************************************************************
886 
887 
888 
889 
890 //=================================================================================================
891 //
892 // LOOKUP FUNCTIONS
893 //
894 //=================================================================================================
895 
896 //*************************************************************************************************
909 template< typename Type // Data type of the matrix
910  , bool SO > // Storage order
912  IdentityMatrix<Type,SO>::find( size_t i, size_t j ) const
913 {
914  BLAZE_USER_ASSERT( SO || i < rows() , "Invalid identity matrix row access index" );
915  BLAZE_USER_ASSERT( !SO || j < columns(), "Invalid identity matrix column access index" );
916 
917  if( i == j )
918  return begin( i );
919  else
920  return end( SO ? j : i );
921 }
922 //*************************************************************************************************
923 
924 
925 //*************************************************************************************************
938 template< typename Type // Data type of the matrix
939  , bool SO > // Storage order
941  IdentityMatrix<Type,SO>::lowerBound( size_t i, size_t j ) const
942 {
943  BLAZE_USER_ASSERT( SO || i < rows() , "Invalid identity matrix row access index" );
944  BLAZE_USER_ASSERT( !SO || j < columns(), "Invalid identity matrix column access index" );
945 
946  if( ( !SO && j <= i ) || ( SO && i <= j ) )
947  return begin( SO ? j : i );
948  else
949  return end( SO ? j : i );
950 }
951 //*************************************************************************************************
952 
953 
954 //*************************************************************************************************
967 template< typename Type // Data type of the matrix
968  , bool SO > // Storage order
970  IdentityMatrix<Type,SO>::upperBound( size_t i, size_t j ) const
971 {
972  BLAZE_USER_ASSERT( SO || i < rows() , "Invalid identity matrix row access index" );
973  BLAZE_USER_ASSERT( !SO || j < columns(), "Invalid identity matrix column access index" );
974 
975  if( ( !SO && j < i ) || ( SO && i < j ) )
976  return begin( SO ? j : i );
977  else
978  return end( SO ? j : i );
979 }
980 //*************************************************************************************************
981 
982 
983 
984 
985 //=================================================================================================
986 //
987 // NUMERIC FUNCTIONS
988 //
989 //=================================================================================================
990 
991 //*************************************************************************************************
996 template< typename Type // Data type of the matrix
997  , bool SO > // Storage order
999 {
1000  return *this;
1001 }
1002 //*************************************************************************************************
1003 
1004 
1005 //*************************************************************************************************
1010 template< typename Type // Data type of the matrix
1011  , bool SO > // Storage order
1013 {
1014  return *this;
1015 }
1016 //*************************************************************************************************
1017 
1018 
1019 
1020 
1021 //=================================================================================================
1022 //
1023 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1024 //
1025 //=================================================================================================
1026 
1027 //*************************************************************************************************
1037 template< typename Type // Data type of the matrix
1038  , bool SO > // Storage order
1039 template< typename Other > // Data type of the foreign expression
1040 inline bool IdentityMatrix<Type,SO>::canAlias( const Other* alias ) const noexcept
1041 {
1042  UNUSED_PARAMETER( alias );
1043 
1044  return false;
1045 }
1046 //*************************************************************************************************
1047 
1048 
1049 //*************************************************************************************************
1059 template< typename Type // Data type of the matrix
1060  , bool SO > // Storage order
1061 template< typename Other > // Data type of the foreign expression
1062 inline bool IdentityMatrix<Type,SO>::isAliased( const Other* alias ) const noexcept
1063 {
1064  UNUSED_PARAMETER( alias );
1065 
1066  return false;
1067 }
1068 //*************************************************************************************************
1069 
1070 
1071 //*************************************************************************************************
1081 template< typename Type // Data type of the matrix
1082  , bool SO > // Storage order
1083 inline bool IdentityMatrix<Type,SO>::canSMPAssign() const noexcept
1084 {
1085  return false;
1086 }
1087 //*************************************************************************************************
1088 
1089 
1090 
1091 
1092 
1093 
1094 
1095 
1096 //=================================================================================================
1097 //
1098 // IDENTITYMATRIX OPERATORS
1099 //
1100 //=================================================================================================
1101 
1102 //*************************************************************************************************
1105 template< typename Type, bool SO >
1106 inline void reset( IdentityMatrix<Type,SO>& m );
1107 
1108 template< typename Type, bool SO >
1109 inline void reset( IdentityMatrix<Type,SO>& m, size_t i );
1110 
1111 template< typename Type, bool SO >
1112 inline void clear( IdentityMatrix<Type,SO>& m );
1113 
1114 template< bool RF, typename Type, bool SO >
1115 inline bool isDefault( const IdentityMatrix<Type,SO>& m );
1116 
1117 template< typename Type, bool SO >
1118 inline bool isIntact( const IdentityMatrix<Type,SO>& m );
1119 
1120 template< typename Type, bool SO >
1121 inline void swap( IdentityMatrix<Type,SO>& a, IdentityMatrix<Type,SO>& b ) noexcept;
1123 //*************************************************************************************************
1124 
1125 
1126 //*************************************************************************************************
1133 template< typename Type // Data type of the matrix
1134  , bool SO > // Storage order
1136 {
1137  UNUSED_PARAMETER( m );
1138 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1155 template< typename Type // Data type of the matrix
1156  , bool SO > // Storage order
1157 inline void reset( IdentityMatrix<Type,SO>& m, size_t i )
1158 {
1159  UNUSED_PARAMETER( m, i );
1160 }
1161 //*************************************************************************************************
1162 
1163 
1164 //*************************************************************************************************
1171 template< typename Type // Data type of the matrix
1172  , bool SO > // Storage order
1174 {
1175  m.clear();
1176 }
1177 //*************************************************************************************************
1178 
1179 
1180 //*************************************************************************************************
1205 template< bool RF // Relaxation flag
1206  , typename Type // Data type of the matrix
1207  , bool SO > // Storage order
1208 inline bool isDefault( const IdentityMatrix<Type,SO>& m )
1209 {
1210  return ( m.rows() == 0UL );
1211 }
1212 //*************************************************************************************************
1213 
1214 
1215 //*************************************************************************************************
1233 template< typename Type // Data type of the matrix
1234  , bool SO > // Storage order
1235 inline bool isIntact( const IdentityMatrix<Type,SO>& m )
1236 {
1237  UNUSED_PARAMETER( m );
1238 
1239  return true;
1240 }
1241 //*************************************************************************************************
1242 
1243 
1244 //*************************************************************************************************
1252 template< typename Type // Data type of the matrix
1253  , bool SO > // Storage order
1255 {
1256  a.swap( b );
1257 }
1258 //*************************************************************************************************
1259 
1260 
1261 
1262 
1263 //=================================================================================================
1264 //
1265 // GLOBAL BINARY ARITHMETIC OPERATORS
1266 //
1267 //=================================================================================================
1268 
1269 //*************************************************************************************************
1297 template< typename T // Data type of the left-hand side identity matrix
1298  , bool SO // Storage order of the left-hand side identity matrix
1299  , typename VT // Type of the right-hand side dense vector
1300  , typename = EnableIf_< IsSame< T, ElementType_<VT> > > >
1301 inline decltype(auto)
1302  operator*( const IdentityMatrix<T,SO>& mat, const DenseVector<VT,false>& vec )
1303 {
1305 
1306  if( (~mat).columns() != (~vec).size() ) {
1307  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
1308  }
1309 
1310  return (~vec);
1311 }
1313 //*************************************************************************************************
1314 
1315 
1316 //*************************************************************************************************
1344 template< typename VT // Type of the left-hand side dense vector
1345  , typename T // Data type of the right-hand side identity matrix
1346  , bool SO // Storage order of the right-hand side identity matrix
1347  , typename = EnableIf_< IsSame< ElementType_<VT>, T > > >
1348 inline decltype(auto)
1349  operator*( const DenseVector<VT,true>& vec, const IdentityMatrix<T,SO>& mat )
1350 {
1352 
1353  if( (~vec).size() != (~mat).rows() ) {
1354  BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
1355  }
1356 
1357  return (~vec);
1358 }
1360 //*************************************************************************************************
1361 
1362 
1363 //*************************************************************************************************
1391 template< typename T // Data type of the left-hand side identity matrix
1392  , bool SO // Storage order of the left-hand side identity matrix
1393  , typename VT // Type of the right-hand side sparse vector
1394  , typename = EnableIf_< IsSame< T, ElementType_<VT> > > >
1395 inline decltype(auto)
1396  operator*( const IdentityMatrix<T,SO>& mat, const SparseVector<VT,false>& vec )
1397 {
1399 
1400  if( (~mat).columns() != (~vec).size() ) {
1401  BLAZE_THROW_INVALID_ARGUMENT( "Matrix and vector sizes do not match" );
1402  }
1403 
1404  return (~vec);
1405 }
1407 //*************************************************************************************************
1408 
1409 
1410 //*************************************************************************************************
1438 template< typename VT // Type of the left-hand side sparse vector
1439  , typename T // Data type of the right-hand side identity matrix
1440  , bool SO // Storage order of the right-hand side identity matrix
1441  , typename = EnableIf_< IsSame< ElementType_<VT>, T > > >
1442 inline decltype(auto)
1443  operator*( const SparseVector<VT,true>& vec, const IdentityMatrix<T,SO>& mat )
1444 {
1446 
1447  if( (~vec).size() != (~mat).rows() ) {
1448  BLAZE_THROW_INVALID_ARGUMENT( "Vector and matrix sizes do not match" );
1449  }
1450 
1451  return (~vec);
1452 }
1454 //*************************************************************************************************
1455 
1456 
1457 //*************************************************************************************************
1482 template< typename T // Data type of the left-hand side identity matrix
1483  , bool SO1 // Storage order of the left-hand side identity matrix
1484  , typename MT // Type of the right-hand side dense matrix
1485  , bool SO2 // Storage order of the right-hand side dense matrix
1486  , typename = EnableIf_< IsSame< T, ElementType_<MT> > > >
1487 inline decltype(auto)
1488  operator*( const IdentityMatrix<T,SO1>& lhs, const DenseMatrix<MT,SO2>& rhs )
1489 {
1491 
1492  if( (~lhs).columns() != (~rhs).rows() ) {
1493  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1494  }
1495 
1496  return (~rhs);
1497 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1527 template< typename MT // Type of the left-hand side dense matrix
1528  , bool SO1 // Storage order of the left-hand side dense matrix
1529  , typename T // Data type of the right-hand side identity matrix
1530  , bool SO2 // Storage order of the right-hand side identity matrix
1531  , typename = EnableIf_< IsSame< ElementType_<MT>, T > > >
1532 inline decltype(auto)
1533  operator*( const DenseMatrix<MT,SO1>& lhs, const IdentityMatrix<T,SO2>& rhs )
1534 {
1536 
1537  if( (~lhs).columns() != (~rhs).rows() ) {
1538  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1539  }
1540 
1541  return (~lhs);
1542 }
1544 //*************************************************************************************************
1545 
1546 
1547 //*************************************************************************************************
1572 template< typename T // Data type of the left-hand side identity matrix
1573  , bool SO1 // Storage order of the left-hand side identity matrix
1574  , typename MT // Type of the right-hand side sparse matrix
1575  , bool SO2 // Storage order of the right-hand side sparse matrix
1576  , typename = EnableIf_< IsSame< T, ElementType_<MT> > > >
1577 inline decltype(auto)
1578  operator*( const IdentityMatrix<T,SO1>& lhs, const SparseMatrix<MT,SO2>& rhs )
1579 {
1581 
1582  if( (~lhs).columns() != (~rhs).rows() ) {
1583  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1584  }
1585 
1586  return (~rhs);
1587 }
1589 //*************************************************************************************************
1590 
1591 
1592 //*************************************************************************************************
1617 template< typename MT // Type of the left-hand side sparse matrix
1618  , bool SO1 // Storage order of the left-hand side sparse matrix
1619  , typename T // Data type of the right-hand side identity matrix
1620  , bool SO2 // Storage order of the right-hand side identity matrix
1621  , typename = EnableIf_< IsSame< ElementType_<MT>, T > > >
1622 inline decltype(auto)
1623  operator*( const SparseMatrix<MT,SO1>& lhs, const IdentityMatrix<T,SO2>& rhs )
1624 {
1626 
1627  if( (~lhs).columns() != (~rhs).rows() ) {
1628  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1629  }
1630 
1631  return (~lhs);
1632 }
1634 //*************************************************************************************************
1635 
1636 
1637 //*************************************************************************************************
1660 template< typename T1 // Data type of the left-hand side identity matrix
1661  , bool SO1 // Storage order of the left-hand side identity matrix
1662  , typename T2 // Data type of the right-hand side dense matrix
1663  , bool SO2 > // Storage order of the right-hand side dense matrix
1664 inline decltype(auto)
1665  operator*( const IdentityMatrix<T1,SO1>& lhs, const IdentityMatrix<T2,SO2>& rhs )
1666 {
1668 
1669  if( (~lhs).columns() != (~rhs).rows() ) {
1670  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1671  }
1672 
1673  return IdentityMatrix< MultTrait_<T1,T2>, SO1 >( (~lhs).rows() );
1674 }
1676 //*************************************************************************************************
1677 
1678 
1679 
1680 
1681 //=================================================================================================
1682 //
1683 // GLOBAL FUNCTIONS
1684 //
1685 //=================================================================================================
1686 
1687 //*************************************************************************************************
1706 template< typename MT // Type of the sparse matrix
1707  , bool SO > // Storage order
1709  declid( const Matrix<MT,SO>& m )
1710 {
1712 
1713  if( !isSquare( ~m ) ) {
1714  BLAZE_THROW_INVALID_ARGUMENT( "Invalid identity matrix specification" );
1715  }
1716 
1717  return IdentityMatrix<ElementType_<MT>,SO>( (~m).rows() );
1718 }
1719 //*************************************************************************************************
1720 
1721 
1722 
1723 
1724 //=================================================================================================
1725 //
1726 // ISSQUARE SPECIALIZATIONS
1727 //
1728 //=================================================================================================
1729 
1730 //*************************************************************************************************
1732 template< typename MT, bool SO >
1733 struct IsSquare< IdentityMatrix<MT,SO> >
1734  : public TrueType
1735 {};
1737 //*************************************************************************************************
1738 
1739 
1740 
1741 
1742 //=================================================================================================
1743 //
1744 // ISSYMMETRIC SPECIALIZATIONS
1745 //
1746 //=================================================================================================
1747 
1748 //*************************************************************************************************
1750 template< typename MT, bool SO >
1751 struct IsSymmetric< IdentityMatrix<MT,SO> >
1752  : public TrueType
1753 {};
1755 //*************************************************************************************************
1756 
1757 
1758 
1759 
1760 //=================================================================================================
1761 //
1762 // ISHERMITIAN SPECIALIZATIONS
1763 //
1764 //=================================================================================================
1765 
1766 //*************************************************************************************************
1768 template< typename MT, bool SO >
1769 struct IsHermitian< IdentityMatrix<MT,SO> >
1770  : public TrueType
1771 {};
1773 //*************************************************************************************************
1774 
1775 
1776 
1777 
1778 //=================================================================================================
1779 //
1780 // ISUNILOWER SPECIALIZATIONS
1781 //
1782 //=================================================================================================
1783 
1784 //*************************************************************************************************
1786 template< typename MT, bool SO >
1787 struct IsUniLower< IdentityMatrix<MT,SO> >
1788  : public TrueType
1789 {};
1791 //*************************************************************************************************
1792 
1793 
1794 
1795 
1796 //=================================================================================================
1797 //
1798 // ISUNIUPPER SPECIALIZATIONS
1799 //
1800 //=================================================================================================
1801 
1802 //*************************************************************************************************
1804 template< typename MT, bool SO >
1805 struct IsUniUpper< IdentityMatrix<MT,SO> >
1806  : public TrueType
1807 {};
1809 //*************************************************************************************************
1810 
1811 
1812 
1813 
1814 //=================================================================================================
1815 //
1816 // ISRESIZABLE SPECIALIZATIONS
1817 //
1818 //=================================================================================================
1819 
1820 //*************************************************************************************************
1822 template< typename T, bool SO >
1823 struct IsResizable< IdentityMatrix<T,SO> >
1824  : public TrueType
1825 {};
1827 //*************************************************************************************************
1828 
1829 
1830 
1831 
1832 //=================================================================================================
1833 //
1834 // ADDTRAIT SPECIALIZATIONS
1835 //
1836 //=================================================================================================
1837 
1838 //*************************************************************************************************
1840 template< typename T1, bool SO, typename T2, size_t M, size_t N >
1841 struct AddTrait< IdentityMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
1842 {
1843  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
1844 };
1845 
1846 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
1847 struct AddTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
1848 {
1849  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
1850 };
1851 
1852 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
1853 struct AddTrait< StaticMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
1854 {
1855  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
1856 };
1857 
1858 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
1859 struct AddTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
1860 {
1861  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
1862 };
1863 
1864 template< typename T1, bool SO, typename T2, size_t M, size_t N >
1865 struct AddTrait< IdentityMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
1866 {
1867  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
1868 };
1869 
1870 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
1871 struct AddTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
1872 {
1873  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
1874 };
1875 
1876 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
1877 struct AddTrait< HybridMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
1878 {
1879  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
1880 };
1881 
1882 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
1883 struct AddTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
1884 {
1885  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
1886 };
1887 
1888 template< typename T1, bool SO, typename T2 >
1889 struct AddTrait< IdentityMatrix<T1,SO>, DynamicMatrix<T2,SO> >
1890 {
1891  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1892 };
1893 
1894 template< typename T1, bool SO1, typename T2, bool SO2 >
1895 struct AddTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
1896 {
1897  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
1898 };
1899 
1900 template< typename T1, bool SO, typename T2 >
1901 struct AddTrait< DynamicMatrix<T1,SO>, IdentityMatrix<T2,SO> >
1902 {
1903  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1904 };
1905 
1906 template< typename T1, bool SO1, typename T2, bool SO2 >
1907 struct AddTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
1908 {
1909  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
1910 };
1911 
1912 template< typename T1, bool SO, typename T2, bool AF, bool PF >
1913 struct AddTrait< IdentityMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
1914 {
1915  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1916 };
1917 
1918 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
1919 struct AddTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
1920 {
1921  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
1922 };
1923 
1924 template< typename T1, bool AF, bool PF, bool SO, typename T2 >
1925 struct AddTrait< CustomMatrix<T1,AF,PF,SO>, IdentityMatrix<T2,SO> >
1926 {
1927  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
1928 };
1929 
1930 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
1931 struct AddTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
1932 {
1933  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
1934 };
1935 
1936 template< typename T1, bool SO, typename T2 >
1937 struct AddTrait< IdentityMatrix<T1,SO>, CompressedMatrix<T2,SO> >
1938 {
1939  using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
1940 };
1941 
1942 template< typename T1, bool SO1, typename T2, bool SO2 >
1943 struct AddTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
1944 {
1945  using Type = CompressedMatrix< AddTrait_<T1,T2>, false >;
1946 };
1947 
1948 template< typename T1, bool SO, typename T2 >
1949 struct AddTrait< CompressedMatrix<T1,SO>, IdentityMatrix<T2,SO> >
1950 {
1951  using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
1952 };
1953 
1954 template< typename T1, bool SO1, typename T2, bool SO2 >
1955 struct AddTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
1956 {
1957  using Type = CompressedMatrix< AddTrait_<T1,T2>, false >;
1958 };
1959 
1960 template< typename T1, bool SO, typename T2 >
1961 struct AddTrait< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
1962 {
1963  using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
1964 };
1965 
1966 template< typename T1, bool SO1, typename T2, bool SO2 >
1967 struct AddTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
1968 {
1969  using Type = CompressedMatrix< AddTrait_<T1,T2>, false >;
1970 };
1972 //*************************************************************************************************
1973 
1974 
1975 
1976 
1977 //=================================================================================================
1978 //
1979 // SUBTRAIT SPECIALIZATIONS
1980 //
1981 //=================================================================================================
1982 
1983 //*************************************************************************************************
1985 template< typename T1, bool SO, typename T2, size_t M, size_t N >
1986 struct SubTrait< IdentityMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
1987 {
1988  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
1989 };
1990 
1991 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
1992 struct SubTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
1993 {
1994  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
1995 };
1996 
1997 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
1998 struct SubTrait< StaticMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
1999 {
2000  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
2001 };
2002 
2003 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2004 struct SubTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2005 {
2006  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
2007 };
2008 
2009 template< typename T1, bool SO, typename T2, size_t M, size_t N >
2010 struct SubTrait< IdentityMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
2011 {
2012  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
2013 };
2014 
2015 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2016 struct SubTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
2017 {
2018  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
2019 };
2020 
2021 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
2022 struct SubTrait< HybridMatrix<T1,M,N,SO>, IdentityMatrix<T2,SO> >
2023 {
2024  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
2025 };
2026 
2027 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2028 struct SubTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2029 {
2030  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
2031 };
2032 
2033 template< typename T1, bool SO, typename T2 >
2034 struct SubTrait< IdentityMatrix<T1,SO>, DynamicMatrix<T2,SO> >
2035 {
2036  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2037 };
2038 
2039 template< typename T1, bool SO1, typename T2, bool SO2 >
2040 struct SubTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
2041 {
2042  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
2043 };
2044 
2045 template< typename T1, bool SO, typename T2 >
2046 struct SubTrait< DynamicMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2047 {
2048  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2049 };
2050 
2051 template< typename T1, bool SO1, typename T2, bool SO2 >
2052 struct SubTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2053 {
2054  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
2055 };
2056 
2057 template< typename T1, bool SO, typename T2, bool AF, bool PF >
2058 struct SubTrait< IdentityMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
2059 {
2060  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2061 };
2062 
2063 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
2064 struct SubTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
2065 {
2066  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
2067 };
2068 
2069 template< typename T1, bool AF, bool PF, bool SO, typename T2 >
2070 struct SubTrait< CustomMatrix<T1,AF,PF,SO>, IdentityMatrix<T2,SO> >
2071 {
2072  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
2073 };
2074 
2075 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
2076 struct SubTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
2077 {
2078  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
2079 };
2080 
2081 template< typename T1, bool SO, typename T2 >
2082 struct SubTrait< IdentityMatrix<T1,SO>, CompressedMatrix<T2,SO> >
2083 {
2084  using Type = CompressedMatrix< SubTrait_<T1,T2>, SO >;
2085 };
2086 
2087 template< typename T1, bool SO1, typename T2, bool SO2 >
2088 struct SubTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
2089 {
2090  using Type = CompressedMatrix< SubTrait_<T1,T2>, false >;
2091 };
2092 
2093 template< typename T1, bool SO, typename T2 >
2094 struct SubTrait< CompressedMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2095 {
2096  using Type = CompressedMatrix< SubTrait_<T1,T2>, SO >;
2097 };
2098 
2099 template< typename T1, bool SO1, typename T2, bool SO2 >
2100 struct SubTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2101 {
2102  using Type = CompressedMatrix< SubTrait_<T1,T2>, false >;
2103 };
2104 
2105 template< typename T1, bool SO, typename T2 >
2106 struct SubTrait< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2107 {
2108  using Type = CompressedMatrix< SubTrait_<T1,T2> , SO >;
2109 };
2110 
2111 template< typename T1, bool SO1, typename T2, bool SO2 >
2112 struct SubTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2113 {
2114  using Type = CompressedMatrix< SubTrait_<T1,T2> , false >;
2115 };
2117 //*************************************************************************************************
2118 
2119 
2120 
2121 
2122 //=================================================================================================
2123 //
2124 // SCHURTRAIT SPECIALIZATIONS
2125 //
2126 //=================================================================================================
2127 
2128 //*************************************************************************************************
2130 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2131 struct SchurTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
2132 {
2133  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2134 };
2135 
2136 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2137 struct SchurTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2138 {
2139  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2140 };
2141 
2142 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2143 struct SchurTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
2144 {
2145  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2146 };
2147 
2148 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2149 struct SchurTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2150 {
2151  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2152 };
2153 
2154 template< typename T1, bool SO1, typename T2, bool SO2 >
2155 struct SchurTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
2156 {
2157  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2158 };
2159 
2160 template< typename T1, bool SO1, typename T2, bool SO2 >
2161 struct SchurTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2162 {
2163  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2164 };
2165 
2166 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
2167 struct SchurTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
2168 {
2169  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2170 };
2171 
2172 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
2173 struct SchurTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
2174 {
2175  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
2176 };
2177 
2178 template< typename T1, bool SO, typename T2 >
2179 struct SchurTrait< IdentityMatrix<T1,SO>, CompressedMatrix<T2,SO> >
2180 {
2181  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2182 };
2183 
2184 template< typename T1, bool SO1, typename T2, bool SO2 >
2185 struct SchurTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
2186 {
2187  using Type = CompressedMatrix< MultTrait_<T1,T2>, false >;
2188 };
2189 
2190 template< typename T1, bool SO, typename T2 >
2191 struct SchurTrait< CompressedMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2192 {
2193  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2194 };
2195 
2196 template< typename T1, bool SO1, typename T2, bool SO2 >
2197 struct SchurTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2198 {
2199  using Type = CompressedMatrix< MultTrait_<T1,T2>, false >;
2200 };
2201 
2202 template< typename T1, bool SO1, typename T2, bool SO2 >
2203 struct SchurTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2204 {
2205  using Type = IdentityMatrix< MultTrait_<T1,T2>, SO1 >;
2206 };
2208 //*************************************************************************************************
2209 
2210 
2211 
2212 
2213 //=================================================================================================
2214 //
2215 // MULTTRAIT SPECIALIZATIONS
2216 //
2217 //=================================================================================================
2218 
2219 //*************************************************************************************************
2221 template< typename T1, bool SO, typename T2 >
2222 struct MultTrait< IdentityMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
2223 {
2224  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2225 };
2226 
2227 template< typename T1, typename T2, bool SO >
2228 struct MultTrait< T1, IdentityMatrix<T2,SO>, EnableIf_< IsNumeric<T1> > >
2229 {
2230  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
2231 };
2232 
2233 template< typename T1, bool SO, typename T2, size_t N >
2234 struct MultTrait< IdentityMatrix<T1,SO>, StaticVector<T2,N,false> >
2235 {
2236  using Type = StaticVector< MultTrait_<T1,T2>, N, false >;
2237 };
2238 
2239 template< typename T1, size_t N, typename T2, bool SO >
2240 struct MultTrait< StaticVector<T1,N,true>, IdentityMatrix<T2,SO> >
2241 {
2242  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
2243 };
2244 
2245 template< typename T1, bool SO, typename T2, size_t N >
2246 struct MultTrait< IdentityMatrix<T1,SO>, HybridVector<T2,N,false> >
2247 {
2248  using Type = HybridVector< MultTrait_<T1,T2>, N, false >;
2249 };
2250 
2251 template< typename T1, size_t N, typename T2, bool SO >
2252 struct MultTrait< HybridVector<T1,N,true>, IdentityMatrix<T2,SO> >
2253 {
2254  using Type = HybridVector< MultTrait_<T1,T2>, N, true >;
2255 };
2256 
2257 template< typename T1, bool SO, typename T2 >
2258 struct MultTrait< IdentityMatrix<T1,SO>, DynamicVector<T2,false> >
2259 {
2260  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
2261 };
2262 
2263 template< typename T1, typename T2, bool SO >
2264 struct MultTrait< DynamicVector<T1,true>, IdentityMatrix<T2,SO> >
2265 {
2266  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
2267 };
2268 
2269 template< typename T1, bool SO, typename T2, bool AF, bool PF >
2270 struct MultTrait< IdentityMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
2271 {
2272  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
2273 };
2274 
2275 template< typename T1, bool AF, bool PF, typename T2, bool SO >
2276 struct MultTrait< CustomVector<T1,AF,PF,true>, IdentityMatrix<T2,SO> >
2277 {
2278  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
2279 };
2280 
2281 template< typename T1, bool SO, typename T2 >
2282 struct MultTrait< IdentityMatrix<T1,SO>, CompressedVector<T2,false> >
2283 {
2284  using Type = CompressedVector< MultTrait_<T1,T2>, false >;
2285 };
2286 
2287 template< typename T1, typename T2, bool SO >
2288 struct MultTrait< CompressedVector<T1,true>, IdentityMatrix<T2,SO> >
2289 {
2290  using Type = CompressedVector< MultTrait_<T1,T2>, true >;
2291 };
2292 
2293 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2294 struct MultTrait< IdentityMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
2295 {
2296  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2297 };
2298 
2299 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2300 struct MultTrait< StaticMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2301 {
2302  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2303 };
2304 
2305 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
2306 struct MultTrait< IdentityMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
2307 {
2308  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2309 };
2310 
2311 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
2312 struct MultTrait< HybridMatrix<T1,M,N,SO1>, IdentityMatrix<T2,SO2> >
2313 {
2314  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
2315 };
2316 
2317 template< typename T1, bool SO1, typename T2, bool SO2 >
2318 struct MultTrait< IdentityMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
2319 {
2320  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2321 };
2322 
2323 template< typename T1, bool SO1, typename T2, bool SO2 >
2324 struct MultTrait< DynamicMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2325 {
2326  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2327 };
2328 
2329 template< typename T1, bool SO1, typename T2, bool AF, bool PF, bool SO2 >
2330 struct MultTrait< IdentityMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
2331 {
2332  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2333 };
2334 
2335 template< typename T1, bool AF, bool PF, bool SO1, typename T2, bool SO2 >
2336 struct MultTrait< CustomMatrix<T1,AF,PF,SO1>, IdentityMatrix<T2,SO2> >
2337 {
2338  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
2339 };
2340 
2341 template< typename T1, bool SO1, typename T2, bool SO2 >
2342 struct MultTrait< IdentityMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
2343 {
2344  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2345 };
2346 
2347 template< typename T1, bool SO1, typename T2, bool SO2 >
2348 struct MultTrait< CompressedMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2349 {
2350  using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
2351 };
2352 
2353 template< typename T1, bool SO1, typename T2, bool SO2 >
2354 struct MultTrait< IdentityMatrix<T1,SO1>, IdentityMatrix<T2,SO2> >
2355 {
2356  using Type = IdentityMatrix< MultTrait_<T1,T2>, SO1 >;
2357 };
2359 //*************************************************************************************************
2360 
2361 
2362 
2363 
2364 //=================================================================================================
2365 //
2366 // DIVTRAIT SPECIALIZATIONS
2367 //
2368 //=================================================================================================
2369 
2370 //*************************************************************************************************
2372 template< typename T1, bool SO, typename T2 >
2373 struct DivTrait< IdentityMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
2374 {
2375  using Type = CompressedMatrix< DivTrait_<T1,T2>, SO >;
2376 };
2378 //*************************************************************************************************
2379 
2380 
2381 
2382 
2383 //=================================================================================================
2384 //
2385 // UNARYMAPTRAIT SPECIALIZATIONS
2386 //
2387 //=================================================================================================
2388 
2389 //*************************************************************************************************
2391 template< typename T, bool SO, typename OP >
2392 struct UnaryMapTrait< IdentityMatrix<T,SO>, OP >
2393 {
2394  using Type = CompressedMatrix< UnaryMapTrait_<T,OP>, SO >;
2395 };
2396 
2397 template< typename T, bool SO >
2398 struct UnaryMapTrait< IdentityMatrix<T,SO>, Abs >
2399 {
2400  using Type = IdentityMatrix< UnaryMapTrait_<T,Abs>, SO >;
2401 };
2402 
2403 template< typename T, bool SO >
2404 struct UnaryMapTrait< IdentityMatrix<T,SO>, Floor >
2405 {
2406  using Type = IdentityMatrix< UnaryMapTrait_<T,Floor>, SO >;
2407 };
2408 
2409 template< typename T, bool SO >
2410 struct UnaryMapTrait< IdentityMatrix<T,SO>, Ceil >
2411 {
2412  using Type = IdentityMatrix< UnaryMapTrait_<T,Ceil>, SO >;
2413 };
2414 
2415 template< typename T, bool SO >
2416 struct UnaryMapTrait< IdentityMatrix<T,SO>, Trunc >
2417 {
2418  using Type = IdentityMatrix< UnaryMapTrait_<T,Trunc>, SO >;
2419 };
2420 
2421 template< typename T, bool SO >
2422 struct UnaryMapTrait< IdentityMatrix<T,SO>, Round >
2423 {
2424  using Type = IdentityMatrix< UnaryMapTrait_<T,Round>, SO >;
2425 };
2426 
2427 template< typename T, bool SO >
2428 struct UnaryMapTrait< IdentityMatrix<T,SO>, Conj >
2429 {
2430  using Type = IdentityMatrix< UnaryMapTrait_<T,Conj>, SO >;
2431 };
2432 
2433 template< typename T, bool SO >
2434 struct UnaryMapTrait< IdentityMatrix<T,SO>, Real >
2435 {
2436  using Type = IdentityMatrix< UnaryMapTrait_<T,Real>, SO >;
2437 };
2438 
2439 template< typename T, bool SO >
2440 struct UnaryMapTrait< IdentityMatrix<T,SO>, Sqrt >
2441 {
2442  using Type = IdentityMatrix< UnaryMapTrait<T,Sqrt>, SO >;
2443 };
2444 
2445 template< typename T, bool SO >
2446 struct UnaryMapTrait< IdentityMatrix<T,SO>, Cbrt >
2447 {
2448  using Type = IdentityMatrix< UnaryMapTrait<T,Cbrt>, SO >;
2449 };
2450 
2451 template< typename T, bool SO, typename ET >
2452 struct UnaryMapTrait< IdentityMatrix<T,SO>, UnaryPow<ET> >
2453 {
2455 };
2457 //*************************************************************************************************
2458 
2459 
2460 
2461 
2462 //=================================================================================================
2463 //
2464 // DECLSYMTRAIT SPECIALIZATIONS
2465 //
2466 //=================================================================================================
2467 
2468 //*************************************************************************************************
2470 template< typename T, bool SO >
2471 struct DeclSymTrait< IdentityMatrix<T,SO> >
2472 {
2473  using Type = IdentityMatrix<T,SO>;
2474 };
2476 //*************************************************************************************************
2477 
2478 
2479 
2480 
2481 //=================================================================================================
2482 //
2483 // DECLHERMTRAIT SPECIALIZATIONS
2484 //
2485 //=================================================================================================
2486 
2487 //*************************************************************************************************
2489 template< typename T, bool SO >
2490 struct DeclHermTrait< IdentityMatrix<T,SO> >
2491 {
2492  using Type = IdentityMatrix<T,SO>;
2493 };
2495 //*************************************************************************************************
2496 
2497 
2498 
2499 
2500 //=================================================================================================
2501 //
2502 // DECLLOWTRAIT SPECIALIZATIONS
2503 //
2504 //=================================================================================================
2505 
2506 //*************************************************************************************************
2508 template< typename T, bool SO >
2509 struct DeclLowTrait< IdentityMatrix<T,SO> >
2510 {
2511  using Type = IdentityMatrix<T,SO>;
2512 };
2514 //*************************************************************************************************
2515 
2516 
2517 
2518 
2519 //=================================================================================================
2520 //
2521 // DECLUPPTRAIT SPECIALIZATIONS
2522 //
2523 //=================================================================================================
2524 
2525 //*************************************************************************************************
2527 template< typename T, bool SO >
2528 struct DeclUppTrait< IdentityMatrix<T,SO> >
2529 {
2530  using Type = IdentityMatrix<T,SO>;
2531 };
2533 //*************************************************************************************************
2534 
2535 
2536 
2537 
2538 //=================================================================================================
2539 //
2540 // DECLDIAGTRAIT SPECIALIZATIONS
2541 //
2542 //=================================================================================================
2543 
2544 //*************************************************************************************************
2546 template< typename T, bool SO >
2547 struct DeclDiagTrait< IdentityMatrix<T,SO> >
2548 {
2549  using Type = IdentityMatrix<T,SO>;
2550 };
2552 //*************************************************************************************************
2553 
2554 
2555 
2556 
2557 //=================================================================================================
2558 //
2559 // HIGHTYPE SPECIALIZATIONS
2560 //
2561 //=================================================================================================
2562 
2563 //*************************************************************************************************
2565 template< typename T1, bool SO, typename T2 >
2566 struct HighType< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2567 {
2569 };
2571 //*************************************************************************************************
2572 
2573 
2574 
2575 
2576 //=================================================================================================
2577 //
2578 // LOWTYPE SPECIALIZATIONS
2579 //
2580 //=================================================================================================
2581 
2582 //*************************************************************************************************
2584 template< typename T1, bool SO, typename T2 >
2585 struct LowType< IdentityMatrix<T1,SO>, IdentityMatrix<T2,SO> >
2586 {
2588 };
2590 //*************************************************************************************************
2591 
2592 
2593 
2594 
2595 //=================================================================================================
2596 //
2597 // SUBMATRIXTRAIT SPECIALIZATIONS
2598 //
2599 //=================================================================================================
2600 
2601 //*************************************************************************************************
2603 template< typename T, bool SO, size_t I, size_t J, size_t M, size_t N >
2604 struct SubmatrixTrait< IdentityMatrix<T,SO>, I, J, M, N >
2605 {
2606  using Type = StaticMatrix<T,M,N,SO>;
2607 };
2608 
2609 template< typename T, bool SO >
2610 struct SubmatrixTrait< IdentityMatrix<T,SO> >
2611 {
2612  using Type = CompressedMatrix<T,SO>;
2613 };
2615 //*************************************************************************************************
2616 
2617 
2618 
2619 
2620 //=================================================================================================
2621 //
2622 // ROWTRAIT SPECIALIZATIONS
2623 //
2624 //=================================================================================================
2625 
2626 //*************************************************************************************************
2628 template< typename T, bool SO, size_t... CRAs >
2629 struct RowTrait< IdentityMatrix<T,SO>, CRAs... >
2630 {
2631  using Type = CompressedVector<T,true>;
2632 };
2634 //*************************************************************************************************
2635 
2636 
2637 
2638 
2639 //=================================================================================================
2640 //
2641 // ROWSTRAIT SPECIALIZATIONS
2642 //
2643 //=================================================================================================
2644 
2645 //*************************************************************************************************
2647 template< typename T, bool SO, size_t... CRAs >
2648 struct RowsTrait< IdentityMatrix<T,SO>, CRAs... >
2649 {
2650  using Type = CompressedMatrix<T,false>;
2651 };
2653 //*************************************************************************************************
2654 
2655 
2656 
2657 
2658 //=================================================================================================
2659 //
2660 // COLUMNTRAIT SPECIALIZATIONS
2661 //
2662 //=================================================================================================
2663 
2664 //*************************************************************************************************
2666 template< typename T, bool SO, size_t... CCAs >
2667 struct ColumnTrait< IdentityMatrix<T,SO>, CCAs... >
2668 {
2669  using Type = CompressedVector<T,false>;
2670 };
2672 //*************************************************************************************************
2673 
2674 
2675 
2676 
2677 //=================================================================================================
2678 //
2679 // COLUMNSTRAIT SPECIALIZATIONS
2680 //
2681 //=================================================================================================
2682 
2683 //*************************************************************************************************
2685 template< typename T, bool SO, size_t... CCAs >
2686 struct ColumnsTrait< IdentityMatrix<T,SO>, CCAs... >
2687 {
2688  using Type = CompressedMatrix<T,true>;
2689 };
2691 //*************************************************************************************************
2692 
2693 
2694 
2695 
2696 //=================================================================================================
2697 //
2698 // BANDTRAIT SPECIALIZATIONS
2699 //
2700 //=================================================================================================
2701 
2702 //*************************************************************************************************
2704 template< typename T, bool SO, ptrdiff_t... CBAs >
2705 struct BandTrait< IdentityMatrix<T,SO>, CBAs... >
2706 {
2708 };
2709 
2710 template< typename T, bool SO >
2711 struct BandTrait< IdentityMatrix<T,SO>, 0L >
2712 {
2714 };
2716 //*************************************************************************************************
2717 
2718 } // namespace blaze
2719 
2720 #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:222
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:1062
#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:266
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:194
Header file for basic type definitions.
Header file for the SparseVector base class.
IdentityMatrix() noexcept
The default constructor for IdentityMatrix.
Definition: IdentityMatrix.h:493
Header file for the row trait.
Header file for the declherm trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:109
Resize mechanism to obtain a IdentityMatrix with different fixed dimensions.
Definition: IdentityMatrix.h:214
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:108
IdentityMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: IdentityMatrix.h:1012
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:221
const Type ConstReference
Reference to a constant identity matrix element.
Definition: IdentityMatrix.h:197
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:113
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:112
size_t index() const
Access to the current index of the sparse element.
Definition: IdentityMatrix.h:319
size_t columns() const noexcept
Returns the current number of columns of the identity matrix.
Definition: IdentityMatrix.h:753
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
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:341
#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:864
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: IdentityMatrix.h:229
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:941
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:185
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation ...
Definition: DynamicMatrix.h:217
Header file for the IsUniLower type trait.
size_t capacity() const noexcept
Returns the maximum capacity of the identity matrix.
Definition: IdentityMatrix.h:767
Base template for the RowsTrait class.
Definition: RowsTrait.h:109
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
Header file for the band trait.
void swap(IdentityMatrix &m) noexcept
Swapping the contents of two sparse matrices.
Definition: IdentityMatrix.h:879
size_t nonZeros() const
Returns the number of non-zero elements in the identity matrix.
Definition: IdentityMatrix.h:805
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:1827
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:633
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:109
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:58
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
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:193
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
ConstIterator end(size_t i) const noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: IdentityMatrix.h:656
Constraint on the data type.
IdentityMatrix & transpose()
In-place transpose of the matrix.
Definition: IdentityMatrix.h:998
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: IdentityMatrix.h:912
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:299
Base template for the DeclSymTrait class.
Definition: DeclSymTrait.h:113
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:123
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two ConstIterator objects.
Definition: IdentityMatrix.h:352
Rebind mechanism to obtain an IdentityMatrix with different data/element type.
Definition: IdentityMatrix.h:204
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:359
ConstIterator operator++(int)
Post-increment operator.
Definition: IdentityMatrix.h:277
Header file for the EnableIf class template.
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: IdentityMatrix.h:1083
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:196
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:463
IdentityMatrix< Type, SO > This
Type of this IdentityMatrix instance.
Definition: IdentityMatrix.h:188
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: IdentityMatrix.h:330
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:1709
Compile time check for identity matrices.This type trait tests whether or not the given template para...
Definition: IsIdentity.h:89
ConstIterator(size_t index)
Constructor for the ConstIterator class.
Definition: IdentityMatrix.h:256
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:119
Base template for the DeclHermTrait class.
Definition: DeclHermTrait.h:113
Base template for the MultTrait class.
Definition: MultTrait.h:119
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:556
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Header file for the columns trait.
#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:1040
size_t rows() const noexcept
Returns the current number of rows of the identity matrix.
Definition: IdentityMatrix.h:739
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:120
Header file for the rows trait.
IdentityMatrix< NewType, SO > Other
The type of the other IdentityMatrix.
Definition: IdentityMatrix.h:205
ConstIterator begin(size_t i) const noexcept
Returns an iterator to the first non-zero element of row/column i.
Definition: IdentityMatrix.h:610
ConstReference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: IdentityMatrix.h:583
Base template for the DeclLowTrait class.
Definition: DeclLowTrait.h:113
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
Base template for the ColumnsTrait class.
Definition: ColumnsTrait.h:109
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: IdentityMatrix.h:289
Header file for the default transpose flag for all vectors of the Blaze library.
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:236
void clear()
Clearing the identity matrix.
Definition: IdentityMatrix.h:845
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
Type value() const
Access to the current value of the sparse element.
Definition: IdentityMatrix.h:309
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
Base template for the SubTrait class.
Definition: SubTrait.h:119
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
ConstIterator()
Default constructor for the ConstIterator class.
Definition: IdentityMatrix.h:246
Header file for the IsHermitian type trait.
Base template for the DeclDiagTrait class.
Definition: DeclDiagTrait.h:113
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
Header file for the IsResizable type trait.
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:95
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: IdentityMatrix.h:679
Efficient implementation of an arbitrary sized sparse vector.The CompressedVector class is the repres...
Definition: CompressedVector.h:199
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
Base template for the BandTrait class.
Definition: BandTrait.h:109
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:970