DenseMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_DENSE_DENSEMATRIX_H_
36 #define _BLAZE_MATH_DENSE_DENSEMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
50 #include <blaze/math/shims/Equal.h>
52 #include <blaze/math/shims/IsNaN.h>
53 #include <blaze/math/shims/IsOne.h>
74 #include <blaze/util/Assert.h>
76 #include <blaze/util/EnableIf.h>
77 #include <blaze/util/FalseType.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/TrueType.h>
80 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // GLOBAL OPERATORS
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
97 template< typename T1, typename T2 >
98 inline bool operator==( const DenseMatrix<T1,false>& lhs, const DenseMatrix<T2,false>& rhs );
99 
100 template< typename T1, typename T2 >
101 inline bool operator==( const DenseMatrix<T1,true>& lhs, const DenseMatrix<T2,true>& rhs );
102 
103 template< typename T1, typename T2, bool SO >
104 inline bool operator==( const DenseMatrix<T1,SO>& lhs, const DenseMatrix<T2,!SO>& rhs );
105 
106 template< typename T1, typename T2, bool SO >
107 inline bool operator==( const DenseMatrix<T1,SO>& lhs, const SparseMatrix<T2,false>& rhs );
108 
109 template< typename T1, typename T2, bool SO >
110 inline bool operator==( const DenseMatrix<T1,SO>& lhs, const SparseMatrix<T2,true>& rhs );
111 
112 template< typename T1, bool SO1, typename T2, bool SO2 >
113 inline bool operator==( const SparseMatrix<T1,SO1>& lhs, const DenseMatrix<T2,SO2>& rhs );
114 
115 template< typename T1, typename T2 >
116 inline EnableIf_< IsNumeric<T2>, bool > operator==( const DenseMatrix<T1,false>& mat, T2 scalar );
117 
118 template< typename T1, typename T2 >
119 inline EnableIf_< IsNumeric<T2>, bool > operator==( const DenseMatrix<T1,true>& mat, T2 scalar );
120 
121 template< typename T1, typename T2, bool SO >
122 inline EnableIf_< IsNumeric<T2>, bool > operator==( T1 scalar, const DenseMatrix<T2,SO>& mat );
123 
124 template< typename T1, bool SO1, typename T2, bool SO2 >
125 inline bool operator!=( const DenseMatrix<T1,SO1>& lhs, const DenseMatrix<T2,SO2>& rhs );
126 
127 template< typename T1, bool SO1, typename T2, bool SO2 >
128 inline bool operator!=( const DenseMatrix<T1,SO1>& lhs, const SparseMatrix<T2,SO2>& rhs );
129 
130 template< typename T1, bool SO1, typename T2, bool SO2 >
131 inline bool operator!=( const SparseMatrix<T1,SO1>& lhs, const DenseMatrix<T2,SO2>& rhs );
132 
133 template< typename T1, typename T2, bool SO >
134 inline EnableIf_< IsNumeric<T2>, bool > operator!=( const DenseMatrix<T1,SO>& mat, T2 scalar );
135 
136 template< typename T1, typename T2, bool SO >
137 inline EnableIf_< IsNumeric<T2>, bool > operator!=( T1 scalar, const DenseMatrix<T2,SO>& mat );
138 
139 template< typename MT, bool SO, typename ST >
140 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( DenseMatrix<MT,SO>& mat, ST scalar );
141 
142 template< typename MT, bool SO, typename ST >
143 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( DenseMatrix<MT,SO>&& mat, ST scalar );
144 
145 template< typename MT, bool SO, typename ST >
146 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( DenseMatrix<MT,SO>& mat, ST scalar );
147 
148 template< typename MT, bool SO, typename ST >
149 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( DenseMatrix<MT,SO>&& mat, ST scalar );
151 //*************************************************************************************************
152 
153 
154 //*************************************************************************************************
162 template< typename T1 // Type of the left-hand side dense matrix
163  , typename T2 > // Type of the right-hand side dense matrix
164 inline bool operator==( const DenseMatrix<T1,false>& lhs, const DenseMatrix<T2,false>& rhs )
165 {
166  using CT1 = CompositeType_<T1>;
167  using CT2 = CompositeType_<T2>;
168 
169  // Early exit in case the matrix sizes don't match
170  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
171  return false;
172 
173  // Evaluation of the two dense matrix operands
174  CT1 A( ~lhs );
175  CT2 B( ~rhs );
176 
177  // In order to compare the two matrices, the data values of the lower-order data
178  // type are converted to the higher-order data type within the equal function.
179  for( size_t i=0; i<A.rows(); ++i ) {
180  for( size_t j=0; j<A.columns(); ++j ) {
181  if( !equal( A(i,j), B(i,j) ) ) return false;
182  }
183  }
184 
185  return true;
186 }
187 //*************************************************************************************************
188 
189 
190 //*************************************************************************************************
198 template< typename T1 // Type of the left-hand side dense matrix
199  , typename T2 > // Type of the right-hand side dense matrix
200 inline bool operator==( const DenseMatrix<T1,true>& lhs, const DenseMatrix<T2,true>& rhs )
201 {
202  using CT1 = CompositeType_<T1>;
203  using CT2 = CompositeType_<T2>;
204 
205  // Early exit in case the matrix sizes don't match
206  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
207  return false;
208 
209  // Evaluation of the two dense matrix operands
210  CT1 A( ~lhs );
211  CT2 B( ~rhs );
212 
213  // In order to compare the two matrices, the data values of the lower-order data
214  // type are converted to the higher-order data type within the equal function.
215  for( size_t j=0; j<A.columns(); ++j ) {
216  for( size_t i=0; i<A.rows(); ++i ) {
217  if( !equal( A(i,j), B(i,j) ) ) return false;
218  }
219  }
220 
221  return true;
222 }
223 //*************************************************************************************************
224 
225 
226 //*************************************************************************************************
234 template< typename T1 // Type of the left-hand side dense matrix
235  , typename T2 // Type of the right-hand side dense matrix
236  , bool SO > // Storage order
237 inline bool operator==( const DenseMatrix<T1,SO>& lhs, const DenseMatrix<T2,!SO>& rhs )
238 {
239  using CT1 = CompositeType_<T1>;
240  using CT2 = CompositeType_<T2>;
241 
242  // Early exit in case the matrix sizes don't match
243  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
244  return false;
245 
246  // Evaluation of the two dense matrix operands
247  CT1 A( ~lhs );
248  CT2 B( ~rhs );
249 
250  // In order to compare the two matrices, the data values of the lower-order data
251  // type are converted to the higher-order data type within the equal function.
252  const size_t rows ( A.rows() );
253  const size_t columns( A.columns() );
254  const size_t block ( 16 );
255 
256  for( size_t ii=0; ii<rows; ii+=block ) {
257  const size_t iend( ( rows < ii+block )?( rows ):( ii+block ) );
258  for( size_t jj=0; jj<columns; jj+=block ) {
259  const size_t jend( ( columns < jj+block )?( columns ):( jj+block ) );
260  for( size_t i=ii; i<iend; ++i ) {
261  for( size_t j=jj; j<jend; ++j ) {
262  if( !equal( A(i,j), B(i,j) ) ) return false;
263  }
264  }
265  }
266  }
267 
268  return true;
269 }
270 //*************************************************************************************************
271 
272 
273 //*************************************************************************************************
281 template< typename T1 // Type of the left-hand side dense matrix
282  , typename T2 // Type of the right-hand side sparse matrix
283  , bool SO > // Storage order of the left-hand side dense matrix
284 inline bool operator==( const DenseMatrix<T1,SO>& lhs, const SparseMatrix<T2,false>& rhs )
285 {
286  using CT1 = CompositeType_<T1>;
287  using CT2 = CompositeType_<T2>;
289 
290  // Early exit in case the matrix sizes don't match
291  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
292  return false;
293 
294  // Evaluation of the dense matrix and sparse matrix operand
295  CT1 A( ~lhs );
296  CT2 B( ~rhs );
297 
298  // In order to compare the two matrices, the data values of the lower-order data
299  // type are converted to the higher-order data type within the equal function.
300  size_t j( 0 );
301 
302  for( size_t i=0; i<B.rows(); ++i ) {
303  j = 0;
304  for( ConstIterator element=B.begin(i); element!=B.end(i); ++element, ++j ) {
305  for( ; j<element->index(); ++j ) {
306  if( !isDefault( A(i,j) ) ) return false;
307  }
308  if( !equal( element->value(), A(i,j) ) ) return false;
309  }
310  for( ; j<A.columns(); ++j ) {
311  if( !isDefault( A(i,j) ) ) return false;
312  }
313  }
314 
315  return true;
316 }
317 //*************************************************************************************************
318 
319 
320 //*************************************************************************************************
328 template< typename T1 // Type of the left-hand side dense matrix
329  , typename T2 // Type of the right-hand side sparse matrix
330  , bool SO > // Storage order of the left-hand side dense matrix
331 inline bool operator==( const DenseMatrix<T1,SO>& lhs, const SparseMatrix<T2,true>& rhs )
332 {
333  using CT1 = CompositeType_<T1>;
334  using CT2 = CompositeType_<T2>;
336 
337  // Early exit in case the matrix sizes don't match
338  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
339  return false;
340 
341  // Evaluation of the dense matrix and sparse matrix operand
342  CT1 A( ~lhs );
343  CT2 B( ~rhs );
344 
345  // In order to compare the two matrices, the data values of the lower-order data
346  // type are converted to the higher-order data type within the equal function.
347  size_t i( 0 );
348 
349  for( size_t j=0; j<B.columns(); ++j ) {
350  i = 0;
351  for( ConstIterator element=B.begin(j); element!=B.end(j); ++element, ++i ) {
352  for( ; i<element->index(); ++i ) {
353  if( !isDefault( A(i,j) ) ) return false;
354  }
355  if( !equal( element->value(), A(i,j) ) ) return false;
356  }
357  for( ; i<A.rows(); ++i ) {
358  if( !isDefault( A(i,j) ) ) return false;
359  }
360  }
361 
362  return true;
363 }
364 //*************************************************************************************************
365 
366 
367 //*************************************************************************************************
375 template< typename T1 // Type of the left-hand side sparse matrix
376  , bool SO1 // Storage order of the left-hand side sparse matrix
377  , typename T2 // Type of the right-hand side dense matrix
378  , bool SO2 > // Storage order of the right-hand side sparse matrix
379 inline bool operator==( const SparseMatrix<T1,SO1>& lhs, const DenseMatrix<T2,SO2>& rhs )
380 {
381  return ( rhs == lhs );
382 }
383 //*************************************************************************************************
384 
385 
386 //*************************************************************************************************
398 template< typename T1 // Type of the left-hand side dense matrix
399  , typename T2 > // Type of the right-hand side scalar
400 inline EnableIf_< IsNumeric<T2>, bool > operator==( const DenseMatrix<T1,false>& mat, T2 scalar )
401 {
402  using CT1 = CompositeType_<T1>;
403 
404  // Evaluation of the dense matrix operand
405  CT1 A( ~mat );
406 
407  // In order to compare the matrix and the scalar value, the data values of the lower-order
408  // data type are converted to the higher-order data type within the equal function.
409  for( size_t i=0; i<A.rows(); ++i ) {
410  for( size_t j=0; j<A.columns(); ++j ) {
411  if( !equal( A(i,j), scalar ) ) return false;
412  }
413  }
414 
415  return true;
416 }
417 //*************************************************************************************************
418 
419 
420 //*************************************************************************************************
432 template< typename T1 // Type of the left-hand side dense matrix
433  , typename T2 > // Type of the right-hand side scalar
434 inline EnableIf_< IsNumeric<T2>, bool > operator==( const DenseMatrix<T1,true>& mat, T2 scalar )
435 {
436  using CT1 = CompositeType_<T1>;
437 
438  // Evaluation of the dense matrix operand
439  CT1 A( ~mat );
440 
441  // In order to compare the matrix and the scalar value, the data values of the lower-order
442  // data type are converted to the higher-order data type within the equal function.
443  for( size_t j=0; j<A.columns(); ++j ) {
444  for( size_t i=0; i<A.rows(); ++i ) {
445  if( !equal( A(i,j), scalar ) ) return false;
446  }
447  }
448 
449  return true;
450 }
451 //*************************************************************************************************
452 
453 
454 //*************************************************************************************************
466 template< typename T1 // Type of the left-hand side scalar
467  , typename T2 // Type of the right-hand side dense matrix
468  , bool SO > // Storage order
469 inline EnableIf_< IsNumeric<T1>, bool > operator==( T1 scalar, const DenseMatrix<T2,SO>& mat )
470 {
471  return ( mat == scalar );
472 }
473 //*************************************************************************************************
474 
475 
476 //*************************************************************************************************
484 template< typename T1 // Type of the left-hand side dense matrix
485  , bool SO1 // Storage order of the left-hand side dense matrix
486  , typename T2 // Type of the right-hand side dense matrix
487  , bool SO2 > // Storage order of the right-hand side dense matrix
488 inline bool operator!=( const DenseMatrix<T1,SO1>& lhs, const DenseMatrix<T2,SO2>& rhs )
489 {
490  return !( lhs == rhs );
491 }
492 //*************************************************************************************************
493 
494 
495 //*************************************************************************************************
503 template< typename T1 // Type of the left-hand side dense matrix
504  , bool SO1 // Storage order of the left-hand side dense matrix
505  , typename T2 // Type of the right-hand side sparse matrix
506  , bool SO2 > // Storage order of the right-hand side sparse matrix
507 inline bool operator!=( const DenseMatrix<T1,SO1>& lhs, const SparseMatrix<T2,SO2>& rhs )
508 {
509  return !( lhs == rhs );
510 }
511 //*************************************************************************************************
512 
513 
514 //*************************************************************************************************
522 template< typename T1 // Type of the left-hand side sparse matrix
523  , bool SO1 // Storage order of the left-hand side sparse matrix
524  , typename T2 // Type of the right-hand side dense matrix
525  , bool SO2 > // Storage order right-hand side dense matrix
526 inline bool operator!=( const SparseMatrix<T1,SO1>& lhs, const DenseMatrix<T2,SO2>& rhs )
527 {
528  return !( rhs == lhs );
529 }
530 //*************************************************************************************************
531 
532 
533 //*************************************************************************************************
545 template< typename T1 // Type of the left-hand side dense matrix
546  , typename T2 // Type of the right-hand side scalar
547  , bool SO > // Storage order
548 inline EnableIf_< IsNumeric<T2>, bool > operator!=( const DenseMatrix<T1,SO>& mat, T2 scalar )
549 {
550  return !( mat == scalar );
551 }
552 //*************************************************************************************************
553 
554 
555 //*************************************************************************************************
567 template< typename T1 // Type of the left-hand side scalar
568  , typename T2 // Type of the right-hand side dense matrix
569  , bool SO > // Storage order
570 inline EnableIf_< IsNumeric<T1>, bool > operator!=( T1 scalar, const DenseMatrix<T2,SO>& mat )
571 {
572  return !( mat == scalar );
573 }
574 //*************************************************************************************************
575 
576 
577 //*************************************************************************************************
590 template< typename MT // Type of the left-hand side dense matrix
591  , bool SO // Storage order
592  , typename ST > // Data type of the right-hand side scalar
593 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( DenseMatrix<MT,SO>& mat, ST scalar )
594 {
596 
598  if( !tryMult( ~mat, 0UL, 0UL, (~mat).rows(), (~mat).columns(), scalar ) ) {
599  BLAZE_THROW_INVALID_ARGUMENT( "Invalid scaling of restricted matrix" );
600  }
601  }
602 
603  BLAZE_DECLTYPE_AUTO( left, derestrict( ~mat ) );
604 
605  smpAssign( left, left * scalar );
606 
607  BLAZE_INTERNAL_ASSERT( isIntact( ~mat ), "Invariant violation detected" );
608 
609  return ~mat;
610 }
611 //*************************************************************************************************
612 
613 
614 //*************************************************************************************************
627 template< typename MT // Type of the left-hand side dense matrix
628  , bool SO // Storage order
629  , typename ST > // Data type of the right-hand side scalar
630 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( DenseMatrix<MT,SO>&& mat, ST scalar )
631 {
632  return operator*=( ~mat, scalar );
633 }
634 //*************************************************************************************************
635 
636 
637 //*************************************************************************************************
652 template< typename MT // Type of the left-hand side dense matrix
653  , bool SO // Storage order
654  , typename ST > // Data type of the right-hand side scalar
655 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( DenseMatrix<MT,SO>& mat, ST scalar )
656 {
658 
659  BLAZE_USER_ASSERT( !isZero( scalar ), "Division by zero detected" );
660 
662  if( !tryDiv( ~mat, 0UL, 0UL, (~mat).rows(), (~mat).columns(), scalar ) ) {
663  BLAZE_THROW_INVALID_ARGUMENT( "Invalid scaling of restricted matrix" );
664  }
665  }
666 
667  BLAZE_DECLTYPE_AUTO( left, derestrict( ~mat ) );
668 
669  smpAssign( left, left / scalar );
670 
671  BLAZE_INTERNAL_ASSERT( isIntact( ~mat ), "Invariant violation detected" );
672 
673  return ~mat;
674 }
675 //*************************************************************************************************
676 
677 
678 //*************************************************************************************************
693 template< typename MT // Type of the left-hand side dense matrix
694  , bool SO // Storage order
695  , typename ST > // Data type of the right-hand side scalar
696 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( DenseMatrix<MT,SO>&& mat, ST scalar )
697 {
698  return operator/=( ~mat, scalar );
699 }
700 //*************************************************************************************************
701 
702 
703 
704 
705 //=================================================================================================
706 //
707 // GLOBAL FUNCTIONS
708 //
709 //=================================================================================================
710 
711 //*************************************************************************************************
714 template< typename MT, bool SO >
715 bool isnan( const DenseMatrix<MT,SO>& dm );
716 
717 template< bool RF, typename MT, bool SO >
718 bool isSymmetric( const DenseMatrix<MT,SO>& dm );
719 
720 template< bool RF, typename MT, bool SO >
721 bool isHermitian( const DenseMatrix<MT,SO>& dm );
722 
723 template< bool RF, typename MT, bool SO >
724 bool isUniform( const DenseMatrix<MT,SO>& dm );
725 
726 template< bool RF, typename MT, bool SO >
727 bool isLower( const DenseMatrix<MT,SO>& dm );
728 
729 template< bool RF, typename MT, bool SO >
730 bool isUniLower( const DenseMatrix<MT,SO>& dm );
731 
732 template< bool RF, typename MT, bool SO >
733 bool isStrictlyLower( const DenseMatrix<MT,SO>& dm );
734 
735 template< bool RF, typename MT, bool SO >
736 bool isUpper( const DenseMatrix<MT,SO>& dm );
737 
738 template< bool RF, typename MT, bool SO >
739 bool isUniUpper( const DenseMatrix<MT,SO>& dm );
740 
741 template< bool RF, typename MT, bool SO >
742 bool isStrictlyUpper( const DenseMatrix<MT,SO>& dm );
743 
744 template< bool RF, typename MT, bool SO >
745 bool isDiagonal( const DenseMatrix<MT,SO>& dm );
746 
747 template< bool RF, typename MT, bool SO >
748 bool isIdentity( const DenseMatrix<MT,SO>& dm );
749 
750 template< typename MT, bool SO >
751 const ElementType_<MT> min( const DenseMatrix<MT,SO>& dm );
752 
753 template< typename MT, bool SO >
754 const ElementType_<MT> max( const DenseMatrix<MT,SO>& dm );
756 //*************************************************************************************************
757 
758 
759 //*************************************************************************************************
779 template< typename MT // Type of the dense matrix
780  , bool SO > // Storage order
781 bool isnan( const DenseMatrix<MT,SO>& dm )
782 {
783  using CT = CompositeType_<MT>;
784 
785  CT A( ~dm ); // Evaluation of the dense matrix operand
786 
787  if( SO == rowMajor ) {
788  for( size_t i=0UL; i<A.rows(); ++i ) {
789  for( size_t j=0UL; j<A.columns(); ++j )
790  if( isnan( A(i,j) ) ) return true;
791  }
792  }
793  else {
794  for( size_t j=0UL; j<A.columns(); ++j ) {
795  for( size_t i=0UL; i<A.rows(); ++i )
796  if( isnan( A(i,j) ) ) return true;
797  }
798  }
799 
800  return false;
801 }
802 //*************************************************************************************************
803 
804 
805 //*************************************************************************************************
838 template< bool RF // Relaxation flag
839  , typename MT // Type of the dense matrix
840  , bool SO > // Storage order
842 {
843  using CT = CompositeType_<MT>;
844 
846  return true;
847 
848  if( !isSquare( ~dm ) )
849  return false;
850 
851  if( IsUniform<MT>::value || (~dm).rows() < 2UL )
852  return true;
853 
855  return isDiagonal( ~dm );
856 
857  CT A( ~dm ); // Evaluation of the dense matrix operand
858 
859  if( SO == rowMajor ) {
860  for( size_t i=1UL; i<A.rows(); ++i ) {
861  for( size_t j=0UL; j<i; ++j ) {
862  if( !equal<RF>( A(i,j), A(j,i) ) )
863  return false;
864  }
865  }
866  }
867  else {
868  for( size_t j=1UL; j<A.columns(); ++j ) {
869  for( size_t i=0UL; i<j; ++i ) {
870  if( !equal<RF>( A(i,j), A(j,i) ) )
871  return false;
872  }
873  }
874  }
875 
876  return true;
877 }
878 //*************************************************************************************************
879 
880 
881 //*************************************************************************************************
916 template< bool RF // Relaxation flag
917  , typename MT // Type of the dense matrix
918  , bool SO > // Storage order
920 {
921  using ET = ElementType_<MT>;
922  using CT = CompositeType_<MT>;
923 
925  return true;
926 
927  if( !IsNumeric<ET>::value || !isSquare( ~dm ) )
928  return false;
929 
931  return true;
932 
933  CT A( ~dm ); // Evaluation of the dense matrix operand
934 
935  if( SO == rowMajor ) {
936  for( size_t i=0UL; i<A.rows(); ++i ) {
937  for( size_t j=0UL; j<i; ++j ) {
938  if( !equal<RF>( A(i,j), conj( A(j,i) ) ) )
939  return false;
940  }
941  if( !isReal<RF>( A(i,i) ) )
942  return false;
943  }
944  }
945  else {
946  for( size_t j=0UL; j<A.columns(); ++j ) {
947  for( size_t i=0UL; i<j; ++i ) {
948  if( !equal<RF>( A(i,j), conj( A(j,i) ) ) )
949  return false;
950  }
951  if( !isReal<RF>( A(j,j) ) )
952  return false;
953  }
954  }
955 
956  return true;
957 }
958 //*************************************************************************************************
959 
960 
961 //*************************************************************************************************
969 template< bool RF // Relaxation flag
970  , typename MT > // Type of the dense matrix
971 bool isUniform_backend( const DenseMatrix<MT,false>& dm, TrueType )
972 {
975 
976  BLAZE_INTERNAL_ASSERT( (~dm).rows() != 0UL, "Invalid number of rows detected" );
977  BLAZE_INTERNAL_ASSERT( (~dm).columns() != 0UL, "Invalid number of columns detected" );
978 
979  const size_t ibegin( ( IsStrictlyLower<MT>::value )?( 1UL ):( 0UL ) );
980  const size_t iend ( ( IsStrictlyUpper<MT>::value )?( (~dm).rows()-1UL ):( (~dm).rows() ) );
981 
982  for( size_t i=ibegin; i<iend; ++i ) {
983  if( !IsUpper<MT>::value ) {
984  for( size_t j=0UL; j<i; ++j ) {
985  if( !isDefault<RF>( (~dm)(i,j) ) )
986  return false;
987  }
988  }
989  if( !isDefault<RF>( (~dm)(i,i) ) )
990  return false;
991  if( !IsLower<MT>::value ) {
992  for( size_t j=i+1UL; j<(~dm).columns(); ++j ) {
993  if( !isDefault<RF>( (~dm)(i,j) ) )
994  return false;
995  }
996  }
997  }
998 
999  return true;
1000 }
1002 //*************************************************************************************************
1003 
1004 
1005 //*************************************************************************************************
1013 template< bool RF // Relaxation flag
1014  , typename MT > // Type of the dense matrix
1015 bool isUniform_backend( const DenseMatrix<MT,true>& dm, TrueType )
1016 {
1019 
1020  BLAZE_INTERNAL_ASSERT( (~dm).rows() != 0UL, "Invalid number of rows detected" );
1021  BLAZE_INTERNAL_ASSERT( (~dm).columns() != 0UL, "Invalid number of columns detected" );
1022 
1023  const size_t jbegin( ( IsStrictlyUpper<MT>::value )?( 1UL ):( 0UL ) );
1024  const size_t jend ( ( IsStrictlyLower<MT>::value )?( (~dm).columns()-1UL ):( (~dm).columns() ) );
1025 
1026  for( size_t j=jbegin; j<jend; ++j ) {
1027  if( !IsLower<MT>::value ) {
1028  for( size_t i=0UL; i<j; ++i ) {
1029  if( !isDefault<RF>( (~dm)(i,j) ) )
1030  return false;
1031  }
1032  }
1033  if( !isDefault<RF>( (~dm)(j,j) ) )
1034  return false;
1035  if( !IsUpper<MT>::value ) {
1036  for( size_t i=j+1UL; i<(~dm).rows(); ++i ) {
1037  if( !isDefault<RF>( (~dm)(i,j) ) )
1038  return false;
1039  }
1040  }
1041  }
1042 
1043  return true;
1044 }
1046 //*************************************************************************************************
1047 
1048 
1049 //*************************************************************************************************
1057 template< bool RF // Relaxation flag
1058  , typename MT > // Type of the dense matrix
1059 bool isUniform_backend( const DenseMatrix<MT,false>& dm, FalseType )
1060 {
1063 
1064  BLAZE_INTERNAL_ASSERT( (~dm).rows() != 0UL, "Invalid number of rows detected" );
1065  BLAZE_INTERNAL_ASSERT( (~dm).columns() != 0UL, "Invalid number of columns detected" );
1066 
1067  ConstReference_<MT> cmp( (~dm)(0UL,0UL) );
1068 
1069  for( size_t i=0UL; i<(~dm).rows(); ++i ) {
1070  for( size_t j=0UL; j<(~dm).columns(); ++j ) {
1071  if( (~dm)(i,j) != cmp )
1072  return false;
1073  }
1074  }
1075 
1076  return true;
1077 }
1079 //*************************************************************************************************
1080 
1081 
1082 //*************************************************************************************************
1090 template< bool RF // Relaxation flag
1091  , typename MT > // Type of the dense matrix
1092 bool isUniform_backend( const DenseMatrix<MT,true>& dm, FalseType )
1093 {
1096 
1097  BLAZE_INTERNAL_ASSERT( (~dm).rows() != 0UL, "Invalid number of rows detected" );
1098  BLAZE_INTERNAL_ASSERT( (~dm).columns() != 0UL, "Invalid number of columns detected" );
1099 
1100  ConstReference_<MT> cmp( (~dm)(0UL,0UL) );
1101 
1102  for( size_t j=0UL; j<(~dm).columns(); ++j ) {
1103  for( size_t i=0UL; i<(~dm).rows(); ++i ) {
1104  if( (~dm)(i,j) != cmp )
1105  return false;
1106  }
1107  }
1108 
1109  return true;
1110 }
1112 //*************************************************************************************************
1113 
1114 
1115 //*************************************************************************************************
1148 template< bool RF // Relaxation flag
1149  , typename MT // Type of the dense matrix
1150  , bool SO > // Storage order
1152 {
1154  return false;
1155 
1156  if( IsUniform<MT>::value ||
1157  (~dm).rows() == 0UL || (~dm).columns() == 0UL ||
1158  ( (~dm).rows() == 1UL && (~dm).columns() == 1UL ) )
1159  return true;
1160 
1161  CompositeType_<MT> A( ~dm ); // Evaluation of the dense matrix operand
1162 
1163  return isUniform_backend<RF>( A, typename IsTriangular<MT>::Type() );
1164 }
1165 //*************************************************************************************************
1166 
1167 
1168 //*************************************************************************************************
1211 template< bool RF // Relaxation flag
1212  , typename MT // Type of the dense matrix
1213  , bool SO > // Storage order
1214 bool isLower( const DenseMatrix<MT,SO>& dm )
1215 {
1216  using RT = ResultType_<MT>;
1217  using RN = ReturnType_<MT>;
1218  using CT = CompositeType_<MT>;
1219  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1220 
1221  if( IsLower<MT>::value )
1222  return true;
1223 
1224  if( !isSquare( ~dm ) )
1225  return false;
1226 
1227  if( (~dm).rows() < 2UL )
1228  return true;
1229 
1230  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1231 
1232  if( SO == rowMajor ) {
1233  for( size_t i=0UL; i<A.rows()-1UL; ++i ) {
1234  for( size_t j=i+1UL; j<A.columns(); ++j ) {
1235  if( !isDefault<RF>( A(i,j) ) )
1236  return false;
1237  }
1238  }
1239  }
1240  else {
1241  for( size_t j=1UL; j<A.columns(); ++j ) {
1242  for( size_t i=0UL; i<j; ++i ) {
1243  if( !isDefault<RF>( A(i,j) ) )
1244  return false;
1245  }
1246  }
1247  }
1248 
1249  return true;
1250 }
1251 //*************************************************************************************************
1252 
1253 
1254 //*************************************************************************************************
1296 template< bool RF // Relaxation flag
1297  , typename MT // Type of the dense matrix
1298  , bool SO > // Storage order
1300 {
1301  using RT = ResultType_<MT>;
1302  using RN = ReturnType_<MT>;
1303  using CT = CompositeType_<MT>;
1304  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1305 
1306  if( IsUniLower<MT>::value )
1307  return true;
1308 
1309  if( !isSquare( ~dm ) )
1310  return false;
1311 
1312  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1313 
1314  if( SO == rowMajor ) {
1315  for( size_t i=0UL; i<A.rows(); ++i ) {
1316  if( !isOne<RF>( A(i,i) ) )
1317  return false;
1318  for( size_t j=i+1UL; j<A.columns(); ++j ) {
1319  if( !isZero<RF>( A(i,j) ) )
1320  return false;
1321  }
1322  }
1323  }
1324  else {
1325  for( size_t j=0UL; j<A.columns(); ++j ) {
1326  for( size_t i=0UL; i<j; ++i ) {
1327  if( !isZero<RF>( A(i,j) ) )
1328  return false;
1329  }
1330  if( !isOne<RF>( A(j,j) ) )
1331  return false;
1332  }
1333  }
1334 
1335  return true;
1336 }
1337 //*************************************************************************************************
1338 
1339 
1340 //*************************************************************************************************
1383 template< bool RF // Relaxation flag
1384  , typename MT // Type of the dense matrix
1385  , bool SO > // Storage order
1387 {
1388  using RT = ResultType_<MT>;
1389  using RN = ReturnType_<MT>;
1390  using CT = CompositeType_<MT>;
1391  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1392 
1394  return true;
1395 
1397  return false;
1398 
1399  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1400 
1401  if( SO == rowMajor ) {
1402  for( size_t i=0UL; i<A.rows(); ++i ) {
1403  for( size_t j=i; j<A.columns(); ++j ) {
1404  if( !isDefault<RF>( A(i,j) ) )
1405  return false;
1406  }
1407  }
1408  }
1409  else {
1410  for( size_t j=0UL; j<A.columns(); ++j ) {
1411  for( size_t i=0UL; i<=j; ++i ) {
1412  if( !isDefault<RF>( A(i,j) ) )
1413  return false;
1414  }
1415  }
1416  }
1417 
1418  return true;
1419 }
1420 //*************************************************************************************************
1421 
1422 
1423 //*************************************************************************************************
1466 template< bool RF // Relaxation flag
1467  , typename MT // Type of the dense matrix
1468  , bool SO > // Storage order
1469 bool isUpper( const DenseMatrix<MT,SO>& dm )
1470 {
1471  using RT = ResultType_<MT>;
1472  using RN = ReturnType_<MT>;
1473  using CT = CompositeType_<MT>;
1474  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1475 
1476  if( IsUpper<MT>::value )
1477  return true;
1478 
1479  if( !isSquare( ~dm ) )
1480  return false;
1481 
1482  if( (~dm).rows() < 2UL )
1483  return true;
1484 
1485  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1486 
1487  if( SO == rowMajor ) {
1488  for( size_t i=1UL; i<A.rows(); ++i ) {
1489  for( size_t j=0UL; j<i; ++j ) {
1490  if( !isDefault<RF>( A(i,j) ) )
1491  return false;
1492  }
1493  }
1494  }
1495  else {
1496  for( size_t j=0UL; j<A.columns()-1UL; ++j ) {
1497  for( size_t i=j+1UL; i<A.rows(); ++i ) {
1498  if( !isDefault<RF>( A(i,j) ) )
1499  return false;
1500  }
1501  }
1502  }
1503 
1504  return true;
1505 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1551 template< bool RF // Relaxation flag
1552  , typename MT // Type of the dense matrix
1553  , bool SO > // Storage order
1555 {
1556  using RT = ResultType_<MT>;
1557  using RN = ReturnType_<MT>;
1558  using CT = CompositeType_<MT>;
1559  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1560 
1561  if( IsUniUpper<MT>::value )
1562  return true;
1563 
1564  if( !isSquare( ~dm ) )
1565  return false;
1566 
1567  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1568 
1569  if( SO == rowMajor ) {
1570  for( size_t i=0UL; i<A.rows(); ++i ) {
1571  for( size_t j=0UL; j<i; ++j ) {
1572  if( !isZero<RF>( A(i,j) ) )
1573  return false;
1574  }
1575  if( !isOne<RF>( A(i,i) ) )
1576  return false;
1577  }
1578  }
1579  else {
1580  for( size_t j=0UL; j<A.columns(); ++j ) {
1581  if( !isOne<RF>( A(j,j) ) )
1582  return false;
1583  for( size_t i=j+1UL; i<A.rows(); ++i ) {
1584  if( !isZero<RF>( A(i,j) ) )
1585  return false;
1586  }
1587  }
1588  }
1589 
1590  return true;
1591 }
1592 //*************************************************************************************************
1593 
1594 
1595 //*************************************************************************************************
1638 template< bool RF // Relaxation flag
1639  , typename MT // Type of the dense matrix
1640  , bool SO > // Storage order
1642 {
1643  using RT = ResultType_<MT>;
1644  using RN = ReturnType_<MT>;
1645  using CT = CompositeType_<MT>;
1646  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1647 
1649  return true;
1650 
1652  return false;
1653 
1654  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1655 
1656  if( SO == rowMajor ) {
1657  for( size_t i=0UL; i<A.rows(); ++i ) {
1658  for( size_t j=0UL; j<=i; ++j ) {
1659  if( !isDefault<RF>( A(i,j) ) )
1660  return false;
1661  }
1662  }
1663  }
1664  else {
1665  for( size_t j=0UL; j<A.columns(); ++j ) {
1666  for( size_t i=j; i<A.rows(); ++i ) {
1667  if( !isDefault<RF>( A(i,j) ) )
1668  return false;
1669  }
1670  }
1671  }
1672 
1673  return true;
1674 }
1675 //*************************************************************************************************
1676 
1677 
1678 //*************************************************************************************************
1722 template< bool RF // Relaxation flag
1723  , typename MT // Type of the dense matrix
1724  , bool SO > // Storage order
1726 {
1727  using RT = ResultType_<MT>;
1728  using RN = ReturnType_<MT>;
1729  using CT = CompositeType_<MT>;
1730  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1731 
1732  if( IsDiagonal<MT>::value )
1733  return true;
1734 
1735  if( !isSquare( ~dm ) )
1736  return false;
1737 
1738  if( (~dm).rows() < 2UL )
1739  return true;
1740 
1741  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1742 
1743  if( SO == rowMajor ) {
1744  for( size_t i=0UL; i<A.rows(); ++i ) {
1745  if( !IsUpper<MT>::value ) {
1746  for( size_t j=0UL; j<i; ++j ) {
1747  if( !isDefault<RF>( A(i,j) ) )
1748  return false;
1749  }
1750  }
1751  if( !IsLower<MT>::value ) {
1752  for( size_t j=i+1UL; j<A.columns(); ++j ) {
1753  if( !isDefault<RF>( A(i,j) ) )
1754  return false;
1755  }
1756  }
1757  }
1758  }
1759  else {
1760  for( size_t j=0UL; j<A.columns(); ++j ) {
1761  if( !IsLower<MT>::value ) {
1762  for( size_t i=0UL; i<j; ++i ) {
1763  if( !isDefault<RF>( A(i,j) ) )
1764  return false;
1765  }
1766  }
1767  if( !IsUpper<MT>::value ) {
1768  for( size_t i=j+1UL; i<A.rows(); ++i ) {
1769  if( !isDefault<RF>( A(i,j) ) )
1770  return false;
1771  }
1772  }
1773  }
1774  }
1775 
1776  return true;
1777 }
1778 //*************************************************************************************************
1779 
1780 
1781 //*************************************************************************************************
1824 template< bool RF // Relaxation flag
1825  , typename MT // Type of the dense matrix
1826  , bool SO > // Storage order
1828 {
1829  using RT = ResultType_<MT>;
1830  using RN = ReturnType_<MT>;
1831  using CT = CompositeType_<MT>;
1832  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1833 
1834  if( IsIdentity<MT>::value )
1835  return true;
1836 
1837  if( !isSquare( ~dm ) )
1838  return false;
1839 
1840  if( (~dm).rows() == 0UL )
1841  return true;
1842 
1843  Tmp A( ~dm ); // Evaluation of the dense matrix operand
1844 
1845  if( SO == rowMajor ) {
1846  for( size_t i=0UL; i<A.rows(); ++i ) {
1847  if( !IsUpper<MT>::value ) {
1848  for( size_t j=0UL; j<i; ++j ) {
1849  if( !isZero<RF>( A(i,j) ) )
1850  return false;
1851  }
1852  }
1853  if( !IsUniLower<MT>::value && !IsUniUpper<MT>::value && !isOne<RF>( A(i,i) ) ) {
1854  return false;
1855  }
1856  if( !IsLower<MT>::value ) {
1857  for( size_t j=i+1UL; j<A.columns(); ++j ) {
1858  if( !isZero<RF>( A(i,j) ) )
1859  return false;
1860  }
1861  }
1862  }
1863  }
1864  else {
1865  for( size_t j=0UL; j<A.columns(); ++j ) {
1866  if( !IsLower<MT>::value ) {
1867  for( size_t i=0UL; i<j; ++i ) {
1868  if( !isZero<RF>( A(i,j) ) )
1869  return false;
1870  }
1871  }
1872  if( !IsUniLower<MT>::value && !IsUniUpper<MT>::value && !isOne<RF>( A(j,j) ) ) {
1873  return false;
1874  }
1875  if( !IsUpper<MT>::value ) {
1876  for( size_t i=j+1UL; i<A.rows(); ++i ) {
1877  if( !isZero<RF>( A(i,j) ) )
1878  return false;
1879  }
1880  }
1881  }
1882  }
1883 
1884  return true;
1885 }
1886 //*************************************************************************************************
1887 
1888 
1889 //*************************************************************************************************
1901 template< typename MT // Type of the dense matrix
1902  , bool SO > // Storage order
1904 {
1905  using blaze::min;
1906 
1907  using ET = ElementType_<MT>;
1908  using CT = CompositeType_<MT>;
1909 
1910  CT A( ~dm ); // Evaluation of the dense matrix operand
1911 
1912  if( A.rows() == 0UL || A.columns() == 0UL ) return ET();
1913 
1914  ET minimum( A(0,0) );
1915 
1916  if( SO == rowMajor ) {
1917  for( size_t j=1UL; j<A.columns(); ++j )
1918  minimum = min( minimum, A(0UL,j) );
1919  for( size_t i=1UL; i<A.rows(); ++i )
1920  for( size_t j=0UL; j<A.columns(); ++j )
1921  minimum = min( minimum, A(i,j) );
1922  }
1923  else {
1924  for( size_t i=1UL; i<A.rows(); ++i )
1925  minimum = min( minimum, A(i,0UL) );
1926  for( size_t j=1UL; j<A.columns(); ++j )
1927  for( size_t i=0UL; i<A.rows(); ++i )
1928  minimum = min( minimum, A(i,j) );
1929  }
1930 
1931  return minimum;
1932 }
1933 //*************************************************************************************************
1934 
1935 
1936 //*************************************************************************************************
1948 template< typename MT // Type of the dense matrix
1949  , bool SO > // Transpose flag
1951 {
1952  using blaze::max;
1953 
1954  using ET = ElementType_<MT>;
1955  using CT = CompositeType_<MT>;
1956 
1957  CT A( ~dm ); // Evaluation of the dense matrix operand
1958 
1959  if( A.rows() == 0UL || A.columns() == 0UL ) return ET();
1960 
1961  ET maximum( A(0,0) );
1962 
1963  if( SO == rowMajor ) {
1964  for( size_t j=1UL; j<A.columns(); ++j )
1965  maximum = max( maximum, A(0UL,j) );
1966  for( size_t i=1UL; i<A.rows(); ++i )
1967  for( size_t j=0UL; j<A.columns(); ++j )
1968  maximum = max( maximum, A(i,j) );
1969  }
1970  else {
1971  for( size_t i=1UL; i<A.rows(); ++i )
1972  maximum = max( maximum, A(i,0UL) );
1973  for( size_t j=1UL; j<A.columns(); ++j )
1974  for( size_t i=0UL; i<A.rows(); ++i )
1975  maximum = max( maximum, A(i,j) );
1976  }
1977 
1978  return maximum;
1979 }
1980 //*************************************************************************************************
1981 
1982 } // namespace blaze
1983 
1984 #endif
#define BLAZE_CONSTRAINT_MUST_BE_TRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a lower or upper triangular matrix t...
Definition: Triangular.h:61
Header file for the isnan shim.
#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
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1214
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1469
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1386
#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 IsUniUpper type trait.
Compile time check for triangular matrix types.This type trait tests whether or not the given templat...
Definition: IsTriangular.h:86
Header file for basic type definitions.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper triangular matrix type...
Definition: Triangular.h:81
constexpr bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:76
Header file for the FalseType type/value trait base class.
Header file for the IsDiagonal type trait.
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Compile time check for uniform vectors and matrices.This type trait tests whether or not the given te...
Definition: IsUniform.h:67
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1299
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
Header file for the IsIdentity type trait.
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:1725
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
Header file for the decltype(auto) workaround.
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
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
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1827
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Header file for the SparseMatrix base class.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:670
Header file for the matrix storage order types.
Constraint on the data type.
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Headerfile for the generic max algorithm.
Header file for the IsUniform type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Header file for the DenseMatrix base class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
Header file for the isZero shim.
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for the IsLower type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:89
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
Header file for the equal shim.
Header file for the IsUniTriangular type trait.
Header file for the IsTriangular type trait.
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
bool isnan(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is not a number.
Definition: DiagonalProxy.h:710
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1151
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the isOne shim.
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
Header file for the conjugate shim.
Constraint on the data type.
Header file for the IsNumeric type trait.
Compile time check for identity matrices.This type trait tests whether or not the given template para...
Definition: IsIdentity.h:89
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1641
Header file for run time assertion macros.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:919
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
Compile time check for built-in data types.This type trait tests whether or not the given template pa...
Definition: IsBuiltin.h:75
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:841
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
typename T::ConstReference ConstReference_
Alias declaration for nested ConstReference type definitions.The ConstReference_ alias declaration pr...
Definition: Aliases.h:143
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the IsBuiltin type trait.
bool isUniUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper unitriangular matrix.
Definition: DenseMatrix.h:1554
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
Header file for the IsUpper type trait.
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsHermitian type trait.
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 IsRestricted type trait.
Header file for the isReal shim.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TrueType type/value trait base class.
Compile time check for unitriangular matrix types.This type trait tests whether or not the given temp...
Definition: IsUniTriangular.h:86
Header file for the IsExpression type trait class.