SparseMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SPARSE_SPARSEMATRIX_H_
36 #define _BLAZE_MATH_SPARSE_SPARSEMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
49 #include <blaze/math/shims/Equal.h>
51 #include <blaze/math/shims/IsNaN.h>
52 #include <blaze/math/shims/IsOne.h>
79 #include <blaze/util/Assert.h>
81 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/FalseType.h>
83 #include <blaze/util/mpl/And.h>
84 #include <blaze/util/mpl/If.h>
85 #include <blaze/util/mpl/Or.h>
86 #include <blaze/util/TrueType.h>
87 #include <blaze/util/Types.h>
93 
94 
95 namespace blaze {
96 
97 //=================================================================================================
98 //
99 // GLOBAL OPERATORS
100 //
101 //=================================================================================================
102 
103 //*************************************************************************************************
106 template< typename T1, typename T2, bool SO >
107 inline bool operator==( const SparseMatrix<T1,false>& lhs, const SparseMatrix<T2,false>& rhs );
108 
109 template< typename T1, typename T2, bool SO >
110 inline bool operator==( const SparseMatrix<T1,true>& lhs, const SparseMatrix<T2,true>& rhs );
111 
112 template< typename T1, typename T2, bool SO >
113 inline bool operator==( const SparseMatrix<T1,SO>& lhs, const SparseMatrix<T2,!SO>& rhs );
114 
115 template< typename T1, bool SO1, typename T2, bool SO2 >
116 inline bool operator!=( const SparseMatrix<T1,SO1>& lhs, const SparseMatrix<T2,SO2>& rhs );
117 
118 template< typename MT, bool SO, typename ST >
119 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( SparseMatrix<MT,SO>& mat, ST scalar );
120 
121 template< typename MT, bool SO, typename ST >
122 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( SparseMatrix<MT,SO>&& mat, ST scalar );
123 
124 template< typename MT, bool SO, typename ST >
125 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( SparseMatrix<MT,SO>& mat, ST scalar );
126 
127 template< typename MT, bool SO, typename ST >
128 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( SparseMatrix<MT,SO>&& mat, ST scalar );
130 //*************************************************************************************************
131 
132 
133 //*************************************************************************************************
141 template< typename T1 // Type of the left-hand side sparse matrix
142  , typename T2 > // Type of the right-hand side sparse matrix
143 inline bool operator==( const SparseMatrix<T1,false>& lhs, const SparseMatrix<T2,false>& rhs )
144 {
145  using CT1 = CompositeType_<T1>;
146  using CT2 = CompositeType_<T2>;
147  using LhsConstIterator = ConstIterator_< RemoveReference_<CT1> >;
148  using RhsConstIterator = ConstIterator_< RemoveReference_<CT2> >;
149 
150  // Early exit in case the matrix sizes don't match
151  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
152  return false;
153 
154  // Evaluation of the two sparse matrix operands
155  CT1 A( ~lhs );
156  CT2 B( ~rhs );
157 
158  // In order to compare the two matrices, the data values of the lower-order data
159  // type are converted to the higher-order data type within the equal function.
160  for( size_t i=0UL; i<A.rows(); ++i )
161  {
162  const LhsConstIterator lend( A.end(i) );
163  const RhsConstIterator rend( B.end(i) );
164 
165  LhsConstIterator lelem( A.begin(i) );
166  RhsConstIterator relem( B.begin(i) );
167 
168  while( lelem != lend && relem != rend )
169  {
170  if( lelem->index() < relem->index() ) {
171  if( !isDefault( lelem->value() ) )
172  return false;
173  ++lelem;
174  }
175  else if( lelem->index() > relem->index() ) {
176  if( !isDefault( relem->value() ) )
177  return false;
178  ++relem;
179  }
180  else if( !equal( lelem->value(), relem->value() ) ) {
181  return false;
182  }
183  else {
184  ++lelem;
185  ++relem;
186  }
187  }
188 
189  while( lelem != lend ) {
190  if( !isDefault( lelem->value() ) )
191  return false;
192  ++lelem;
193  }
194 
195  while( relem != rend ) {
196  if( !isDefault( relem->value() ) )
197  return false;
198  ++relem;
199  }
200  }
201 
202  return true;
203 }
204 //*************************************************************************************************
205 
206 
207 //*************************************************************************************************
215 template< typename T1 // Type of the left-hand side sparse matrix
216  , typename T2 > // Type of the right-hand side sparse matrix
217 inline bool operator==( const SparseMatrix<T1,true>& lhs, const SparseMatrix<T2,true>& rhs )
218 {
219  using CT1 = CompositeType_<T1>;
220  using CT2 = CompositeType_<T2>;
221  using LhsConstIterator = ConstIterator_< RemoveReference_<CT1> >;
222  using RhsConstIterator = ConstIterator_< RemoveReference_<CT2> >;
223 
224  // Early exit in case the matrix sizes don't match
225  if( (~lhs).rows() != (~rhs).rows() || (~lhs).columns() != (~rhs).columns() )
226  return false;
227 
228  // Evaluation of the two sparse matrix operands
229  CT1 A( ~lhs );
230  CT2 B( ~rhs );
231 
232  // In order to compare the two matrices, the data values of the lower-order data
233  // type are converted to the higher-order data type within the equal function.
234  for( size_t j=0UL; j<A.columns(); ++j )
235  {
236  const LhsConstIterator lend( A.end(j) );
237  const RhsConstIterator rend( B.end(j) );
238 
239  LhsConstIterator lelem( A.begin(j) );
240  RhsConstIterator relem( B.begin(j) );
241 
242  while( lelem != lend && relem != rend )
243  {
244  if( lelem->index() < relem->index() ) {
245  if( !isDefault( lelem->value() ) )
246  return false;
247  ++lelem;
248  }
249  else if( lelem->index() > relem->index() ) {
250  if( !isDefault( relem->value() ) )
251  return false;
252  ++relem;
253  }
254  else if( !equal( lelem->value(), relem->value() ) ) {
255  return false;
256  }
257  else {
258  ++lelem;
259  ++relem;
260  }
261  }
262 
263  while( lelem != lend ) {
264  if( !isDefault( lelem->value() ) )
265  return false;
266  ++lelem;
267  }
268 
269  while( relem != rend ) {
270  if( !isDefault( relem->value() ) )
271  return false;
272  ++relem;
273  }
274  }
275 
276  return true;
277 }
278 //*************************************************************************************************
279 
280 
281 //*************************************************************************************************
289 template< typename T1 // Type of the left-hand side sparse matrix
290  , typename T2 // Type of the right-hand side sparse matrix
291  , bool SO > // Storage order
292 inline bool operator==( const SparseMatrix<T1,SO>& lhs, const SparseMatrix<T2,!SO>& rhs )
293 {
294  const OppositeType_<T2> tmp( ~rhs );
295  return ( ~lhs == tmp );
296 }
297 //*************************************************************************************************
298 
299 
300 //*************************************************************************************************
308 template< typename T1 // Type of the left-hand side sparse matrix
309  , bool SO1 // Storage order of the left-hand side sparse matrix
310  , typename T2 // Type of the right-hand side sparse matrix
311  , bool SO2 > // Storage order of the right-hand side sparse matrix
312 inline bool operator!=( const SparseMatrix<T1,SO1>& lhs, const SparseMatrix<T2,SO2>& rhs )
313 {
314  return !( lhs == rhs );
315 }
316 //*************************************************************************************************
317 
318 
319 //*************************************************************************************************
332 template< typename MT // Type of the left-hand side sparse matrix
333  , bool SO // Storage order
334  , typename ST > // Data type of the right-hand side scalar
335 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( SparseMatrix<MT,SO>& mat, ST scalar )
336 {
338 
340  if( !tryMult( ~mat, 0UL, 0UL, (~mat).rows(), (~mat).columns(), scalar ) ) {
341  BLAZE_THROW_INVALID_ARGUMENT( "Invalid scaling of restricted matrix" );
342  }
343  }
344 
345  if( !IsResizable< ElementType_<MT> >::value && isZero( scalar ) )
346  {
347  reset( ~mat );
348  }
349  else
350  {
351  BLAZE_DECLTYPE_AUTO( left, derestrict( ~mat ) );
352 
353  const size_t iend( SO == rowMajor ? (~mat).rows() : (~mat).columns() );
354  for( size_t i=0UL; i<iend; ++i ) {
355  const auto last( left.end(i) );
356  for( auto element=left.begin(i); element!=last; ++element ) {
357  element->value() *= scalar;
358  }
359  }
360  }
361 
362  BLAZE_INTERNAL_ASSERT( isIntact( ~mat ), "Invariant violation detected" );
363 
364  return ~mat;
365 }
366 //*************************************************************************************************
367 
368 
369 //*************************************************************************************************
382 template< typename MT // Type of the left-hand side sparse matrix
383  , bool SO // Storage order
384  , typename ST > // Data type of the right-hand side scalar
385 inline EnableIf_< IsNumeric<ST>, MT& > operator*=( SparseMatrix<MT,SO>&& mat, ST scalar )
386 {
387  return operator*=( ~mat, scalar );
388 }
389 //*************************************************************************************************
390 
391 
392 //*************************************************************************************************
407 template< typename MT // Type of the left-hand side sparse matrix
408  , bool SO // Storage order
409  , typename ST > // Data type of the right-hand side scalar
410 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( SparseMatrix<MT,SO>& mat, ST scalar )
411 {
413 
414  BLAZE_USER_ASSERT( !isZero( scalar ), "Division by zero detected" );
415 
417  if( !tryDiv( ~mat, 0UL, 0UL, (~mat).rows(), (~mat).columns(), scalar ) ) {
418  BLAZE_THROW_INVALID_ARGUMENT( "Invalid scaling of restricted matrix" );
419  }
420  }
421 
425  , IsBuiltin<ST> >
428  , ST >;
429 
430  BLAZE_DECLTYPE_AUTO( left, derestrict( ~mat ) );
431 
433  const ScalarType tmp( ScalarType(1)/static_cast<ScalarType>( scalar ) );
434  const size_t iend( SO == rowMajor ? (~mat).rows() : (~mat).columns() );
435  for( size_t i=0UL; i<iend; ++i ) {
436  const auto last( left.end(i) );
437  for( auto element=left.begin(i); element!=last; ++element ) {
438  element->value() *= tmp;
439  }
440  }
441  }
442  else {
443  const size_t iend( SO == rowMajor ? (~mat).rows() : (~mat).columns() );
444  for( size_t i=0UL; i<iend; ++i ) {
445  const auto last( left.end(i) );
446  for( auto element=left.begin(i); element!=last; ++element ) {
447  element->value() /= scalar;
448  }
449  }
450  }
451 
452  BLAZE_INTERNAL_ASSERT( isIntact( ~mat ), "Invariant violation detected" );
453 
454  return ~mat;
455 }
456 //*************************************************************************************************
457 
458 
459 //*************************************************************************************************
474 template< typename MT // Type of the left-hand side sparse matrix
475  , bool SO // Storage order
476  , typename ST > // Data type of the right-hand side scalar
477 inline EnableIf_< IsNumeric<ST>, MT& > operator/=( SparseMatrix<MT,SO>&& mat, ST scalar )
478 {
479  return operator/=( ~mat, scalar );
480 }
481 //*************************************************************************************************
482 
483 
484 
485 
486 //=================================================================================================
487 //
488 // GLOBAL FUNCTIONS
489 //
490 //=================================================================================================
491 
492 //*************************************************************************************************
495 template< typename MT, bool SO >
496 bool isnan( const SparseMatrix<MT,SO>& sm );
497 
498 template< bool RF, typename MT, bool SO >
499 bool isSymmetric( const SparseMatrix<MT,SO>& sm );
500 
501 template< bool RF, typename MT, bool SO >
502 bool isHermitian( const SparseMatrix<MT,SO>& sm );
503 
504 template< bool RF, typename MT, bool SO >
505 bool isUniform( const SparseMatrix<MT,SO>& sm );
506 
507 template< bool RF, typename MT, bool SO >
508 bool isLower( const SparseMatrix<MT,SO>& sm );
509 
510 template< bool RF, typename MT, bool SO >
511 bool isUniLower( const SparseMatrix<MT,SO>& sm );
512 
513 template< bool RF, typename MT, bool SO >
514 bool isStrictlyLower( const SparseMatrix<MT,SO>& sm );
515 
516 template< bool RF, typename MT, bool SO >
517 bool isUpper( const SparseMatrix<MT,SO>& sm );
518 
519 template< bool RF, typename MT, bool SO >
520 bool isUniUpper( const SparseMatrix<MT,SO>& sm );
521 
522 template< bool RF, typename MT, bool SO >
523 bool isStrictlyUpper( const SparseMatrix<MT,SO>& sm );
524 
525 template< bool RF, typename MT, bool SO >
526 bool isDiagonal( const SparseMatrix<MT,SO>& sm );
527 
528 template< bool RF, typename MT, bool SO >
529 bool isIdentity( const SparseMatrix<MT,SO>& sm );
530 
531 template< typename MT, bool SO >
532 const ElementType_<MT> min( const SparseMatrix<MT,SO>& sm );
533 
534 template< typename MT, bool SO >
535 const ElementType_<MT> max( const SparseMatrix<MT,SO>& sm );
537 //*************************************************************************************************
538 
539 
540 //*************************************************************************************************
560 template< typename MT // Type of the sparse matrix
561  , bool SO > // Storage order
562 bool isnan( const SparseMatrix<MT,SO>& sm )
563 {
564  using CT = CompositeType_<MT>;
566 
567  CT A( ~sm ); // Evaluation of the sparse matrix operand
568 
569  if( SO == rowMajor ) {
570  for( size_t i=0UL; i<A.rows(); ++i ) {
571  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
572  if( isnan( element->value() ) ) return true;
573  }
574  }
575  else {
576  for( size_t j=0UL; j<A.columns(); ++j ) {
577  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
578  if( isnan( element->value() ) ) return true;
579  }
580  }
581 
582  return false;
583 }
584 //*************************************************************************************************
585 
586 
587 //*************************************************************************************************
620 template< bool RF // Relaxation flag
621  , typename MT // Type of the sparse matrix
622  , bool SO > // Storage order
624 {
625  using RT = ResultType_<MT>;
626  using RN = ReturnType_<MT>;
627  using CT = CompositeType_<MT>;
628  using Tmp = If_< IsExpression<RN>, const RT, CT >;
630 
632  return true;
633 
634  if( !isSquare( ~sm ) )
635  return false;
636 
637  if( IsUniform<MT>::value || (~sm).rows() < 2UL )
638  return true;
639 
640  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
641 
642  if( SO == rowMajor ) {
643  for( size_t i=0UL; i<A.rows(); ++i ) {
644  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
645  {
646  const size_t j( element->index() );
647 
648  if( i == j || isDefault<RF>( element->value() ) )
649  continue;
650 
651  const ConstIterator pos( A.find( j, i ) );
652  if( pos == A.end(j) || !equal<RF>( pos->value(), element->value() ) )
653  return false;
654  }
655  }
656  }
657  else {
658  for( size_t j=0UL; j<A.columns(); ++j ) {
659  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
660  {
661  const size_t i( element->index() );
662 
663  if( j == i || isDefault<RF>( element->value() ) )
664  continue;
665 
666  const ConstIterator pos( A.find( j, i ) );
667  if( pos == A.end(i) || !equal<RF>( pos->value(), element->value() ) )
668  return false;
669  }
670  }
671  }
672 
673  return true;
674 }
675 //*************************************************************************************************
676 
677 
678 //*************************************************************************************************
713 template< bool RF // Relaxation flag
714  , typename MT // Type of the sparse matrix
715  , bool SO > // Storage order
717 {
718  using RT = ResultType_<MT>;
719  using ET = ElementType_<MT>;
720  using RN = ReturnType_<MT>;
721  using CT = CompositeType_<MT>;
722  using Tmp = If_< IsExpression<RN>, const RT, CT >;
724 
726  return true;
727 
728  if( !IsNumeric<ET>::value || !isSquare( ~sm ) )
729  return false;
730 
732  return true;
733 
734  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
735 
736  if( SO == rowMajor ) {
737  for( size_t i=0UL; i<A.rows(); ++i ) {
738  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
739  {
740  const size_t j( element->index() );
741 
742  if( isDefault<RF>( element->value() ) )
743  continue;
744 
745  if( i == j && !isReal<RF>( element->value() ) )
746  return false;
747 
748  const ConstIterator pos( A.find( j, i ) );
749  if( pos == A.end(j) || !equal<RF>( pos->value(), conj( element->value() ) ) )
750  return false;
751  }
752  }
753  }
754  else {
755  for( size_t j=0UL; j<A.columns(); ++j ) {
756  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
757  {
758  const size_t i( element->index() );
759 
760  if( isDefault<RF>( element->value() ) )
761  continue;
762 
763  if( j == i && !isReal<RF>( element->value() ) )
764  return false;
765 
766  const ConstIterator pos( A.find( j, i ) );
767  if( pos == A.end(i) || !equal<RF>( pos->value(), conj( element->value() ) ) )
768  return false;
769  }
770  }
771  }
772 
773  return true;
774 }
775 //*************************************************************************************************
776 
777 
778 //*************************************************************************************************
786 template< bool RF // Relaxation flag
787  , typename MT > // Type of the sparse matrix
788 bool isUniform_backend( const SparseMatrix<MT,false>& sm, TrueType )
789 {
792 
793  BLAZE_INTERNAL_ASSERT( (~sm).rows() != 0UL, "Invalid number of rows detected" );
794  BLAZE_INTERNAL_ASSERT( (~sm).columns() != 0UL, "Invalid number of columns detected" );
795 
797 
798  const size_t ibegin( ( IsStrictlyLower<MT>::value )?( 1UL ):( 0UL ) );
799  const size_t iend ( ( IsStrictlyUpper<MT>::value )?( (~sm).rows()-1UL ):( (~sm).rows() ) );
800 
801  for( size_t i=ibegin; i<iend; ++i ) {
802  for( ConstIterator element=(~sm).begin(i); element!=(~sm).end(i); ++element ) {
803  if( !isDefault<RF>( element->value() ) )
804  return false;
805  }
806  }
807 
808  return true;
809 }
811 //*************************************************************************************************
812 
813 
814 //*************************************************************************************************
822 template< bool RF // Relaxation flag
823  , typename MT > // Type of the sparse matrix
824 bool isUniform_backend( const SparseMatrix<MT,true>& sm, TrueType )
825 {
828 
829  BLAZE_INTERNAL_ASSERT( (~sm).rows() != 0UL, "Invalid number of rows detected" );
830  BLAZE_INTERNAL_ASSERT( (~sm).columns() != 0UL, "Invalid number of columns detected" );
831 
833 
834  const size_t jbegin( ( IsStrictlyUpper<MT>::value )?( 1UL ):( 0UL ) );
835  const size_t jend ( ( IsStrictlyLower<MT>::value )?( (~sm).columns()-1UL ):( (~sm).columns() ) );
836 
837  for( size_t j=jbegin; j<jend; ++j ) {
838  for( ConstIterator element=(~sm).begin(j); element!=(~sm).end(j); ++element ) {
839  if( !isDefault<RF>( element->value() ) )
840  return false;
841  }
842  }
843 
844  return true;
845 }
847 //*************************************************************************************************
848 
849 
850 //*************************************************************************************************
858 template< bool RF // Relaxation flag
859  , typename MT > // Type of the sparse matrix
860 bool isUniform_backend( const SparseMatrix<MT,false>& sm, FalseType )
861 {
864 
865  BLAZE_INTERNAL_ASSERT( (~sm).rows() != 0UL, "Invalid number of rows detected" );
866  BLAZE_INTERNAL_ASSERT( (~sm).columns() != 0UL, "Invalid number of columns detected" );
867 
870 
871  const size_t maxElements( (~sm).rows() * (~sm).columns() );
872 
873  if( (~sm).nonZeros() != maxElements )
874  {
875  for( size_t i=0UL; i<(~sm).rows(); ++i ) {
876  for( ConstIterator element=(~sm).begin(i); element!=(~sm).end(i); ++element ) {
877  if( !isDefault<RF>( element->value() ) )
878  return false;
879  }
880  }
881  }
882  else
883  {
884  BLAZE_INTERNAL_ASSERT( (~sm).find(0UL,0UL) != (~sm).end(0UL), "Missing element detected" );
885 
886  ConstReference cmp( (~sm)(0UL,0UL) );
887 
888  for( size_t i=0UL; i<(~sm).rows(); ++i ) {
889  for( ConstIterator element=(~sm).begin(i); element!=(~sm).end(i); ++element ) {
890  if( element->value() != cmp )
891  return false;
892  }
893  }
894  }
895 
896  return true;
897 }
899 //*************************************************************************************************
900 
901 
902 //*************************************************************************************************
910 template< bool RF // Relaxation flag
911  , typename MT > // Type of the sparse matrix
912 bool isUniform_backend( const SparseMatrix<MT,true>& sm, FalseType )
913 {
916 
917  BLAZE_INTERNAL_ASSERT( (~sm).rows() != 0UL, "Invalid number of rows detected" );
918  BLAZE_INTERNAL_ASSERT( (~sm).columns() != 0UL, "Invalid number of columns detected" );
919 
922 
923  const size_t maxElements( (~sm).rows() * (~sm).columns() );
924 
925  if( (~sm).nonZeros() != maxElements )
926  {
927  for( size_t j=0UL; j<(~sm).columns(); ++j ) {
928  for( ConstIterator element=(~sm).begin(j); element!=(~sm).end(j); ++element ) {
929  if( !isDefault<RF>( element->value() ) )
930  return false;
931  }
932  }
933  }
934  else
935  {
936  BLAZE_INTERNAL_ASSERT( (~sm).find(0UL,0UL) != (~sm).end(0UL), "Missing element detected" );
937 
938  ConstReference cmp( (~sm)(0UL,0UL) );
939 
940  for( size_t j=0UL; j<(~sm).columns(); ++j ) {
941  for( ConstIterator element=(~sm).begin(j); element!=(~sm).end(j); ++element ) {
942  if( element->value() != cmp )
943  return false;
944  }
945  }
946  }
947 
948  return true;
949 }
951 //*************************************************************************************************
952 
953 
954 //*************************************************************************************************
987 template< bool RF // Relaxation flag
988  , typename MT // Type of the sparse matrix
989  , bool SO > // Storage order
991 {
993  return false;
994 
995  if( IsUniform<MT>::value ||
996  (~sm).rows() == 0UL || (~sm).columns() == 0UL ||
997  ( (~sm).rows() == 1UL && (~sm).columns() == 1UL ) )
998  return true;
999 
1000  CompositeType_<MT> A( ~sm ); // Evaluation of the sparse matrix operand
1001 
1002  return isUniform_backend<RF>( A, typename IsTriangular<MT>::Type() );
1003 }
1004 //*************************************************************************************************
1005 
1006 
1007 //*************************************************************************************************
1050 template< bool RF // Relaxation flag
1051  , typename MT // Type of the sparse matrix
1052  , bool SO > // Storage order
1053 bool isLower( const SparseMatrix<MT,SO>& sm )
1054 {
1055  using RT = ResultType_<MT>;
1056  using RN = ReturnType_<MT>;
1057  using CT = CompositeType_<MT>;
1058  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1060 
1061  if( IsLower<MT>::value )
1062  return true;
1063 
1064  if( !isSquare( ~sm ) )
1065  return false;
1066 
1067  if( (~sm).rows() < 2UL )
1068  return true;
1069 
1070  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1071 
1072  if( SO == rowMajor ) {
1073  for( size_t i=0UL; i<A.rows()-1UL; ++i ) {
1074  for( ConstIterator element=A.lowerBound(i,i+1UL); element!=A.end(i); ++element )
1075  {
1076  if( !isDefault<RF>( element->value() ) )
1077  return false;
1078  }
1079  }
1080  }
1081  else {
1082  for( size_t j=1UL; j<A.columns(); ++j ) {
1083  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
1084  {
1085  if( element->index() >= j )
1086  break;
1087 
1088  if( !isDefault<RF>( element->value() ) )
1089  return false;
1090  }
1091  }
1092  }
1093 
1094  return true;
1095 }
1096 //*************************************************************************************************
1097 
1098 
1099 //*************************************************************************************************
1141 template< bool RF // Relaxation flag
1142  , typename MT // Type of the sparse matrix
1143  , bool SO > // Storage order
1145 {
1146  using RT = ResultType_<MT>;
1147  using RN = ReturnType_<MT>;
1148  using CT = CompositeType_<MT>;
1149  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1151 
1152  if( IsUniLower<MT>::value )
1153  return true;
1154 
1155  if( !isSquare( ~sm ) )
1156  return false;
1157 
1158  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1159 
1160  if( SO == rowMajor ) {
1161  for( size_t i=0UL; i<A.rows(); ++i )
1162  {
1163  ConstIterator element( A.lowerBound(i,i) );
1164 
1165  if( element == A.end(i) || element->index() != i || !isOne<RF>( element->value() ) )
1166  return false;
1167 
1168  ++element;
1169 
1170  for( ; element!=A.end(i); ++element ) {
1171  if( !isZero<RF>( element->value() ) )
1172  return false;
1173  }
1174  }
1175  }
1176  else {
1177  for( size_t j=0UL; j<A.columns(); ++j )
1178  {
1179  bool hasDiagonalElement( false );
1180 
1181  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
1182  {
1183  if( element->index() >= j ) {
1184  if( element->index() != j || !isOne<RF>( element->value() ) )
1185  return false;
1186  hasDiagonalElement = true;
1187  break;
1188  }
1189 
1190  if( !isZero<RF>( element->value() ) )
1191  return false;
1192  }
1193 
1194  if( !hasDiagonalElement ) {
1195  return false;
1196  }
1197  }
1198  }
1199 
1200  return true;
1201 }
1202 //*************************************************************************************************
1203 
1204 
1205 //*************************************************************************************************
1248 template< bool RF // Relaxation flag
1249  , typename MT // Type of the sparse matrix
1250  , bool SO > // Storage order
1252 {
1253  using RT = ResultType_<MT>;
1254  using RN = ReturnType_<MT>;
1255  using CT = CompositeType_<MT>;
1256  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1258 
1260  return true;
1261 
1263  return false;
1264 
1265  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1266 
1267  if( SO == rowMajor ) {
1268  for( size_t i=0UL; i<A.rows(); ++i ) {
1269  for( ConstIterator element=A.lowerBound(i,i); element!=A.end(i); ++element )
1270  {
1271  if( !isDefault<RF>( element->value() ) )
1272  return false;
1273  }
1274  }
1275  }
1276  else {
1277  for( size_t j=0UL; j<A.columns(); ++j ) {
1278  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
1279  {
1280  if( element->index() > j )
1281  break;
1282 
1283  if( !isDefault<RF>( element->value() ) )
1284  return false;
1285  }
1286  }
1287  }
1288 
1289  return true;
1290 }
1291 //*************************************************************************************************
1292 
1293 
1294 //*************************************************************************************************
1337 template< bool RF // Relaxation flag
1338  , typename MT // Type of the sparse matrix
1339  , bool SO > // Storage order
1340 bool isUpper( const SparseMatrix<MT,SO>& sm )
1341 {
1342  using RT = ResultType_<MT>;
1343  using RN = ReturnType_<MT>;
1344  using CT = CompositeType_<MT>;
1345  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1347 
1348  if( IsUpper<MT>::value )
1349  return true;
1350 
1351  if( !isSquare( ~sm ) )
1352  return false;
1353 
1354  if( (~sm).rows() < 2UL )
1355  return true;
1356 
1357  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1358 
1359  if( SO == rowMajor ) {
1360  for( size_t i=1UL; i<A.rows(); ++i ) {
1361  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
1362  {
1363  if( element->index() >= i )
1364  break;
1365 
1366  if( !isDefault<RF>( element->value() ) )
1367  return false;
1368  }
1369  }
1370  }
1371  else {
1372  for( size_t j=0UL; j<A.columns()-1UL; ++j ) {
1373  for( ConstIterator element=A.lowerBound(j+1UL,j); element!=A.end(j); ++element )
1374  {
1375  if( !isDefault<RF>( element->value() ) )
1376  return false;
1377  }
1378  }
1379  }
1380 
1381  return true;
1382 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1428 template< bool RF // Relaxation flag
1429  , typename MT // Type of the sparse matrix
1430  , bool SO > // Storage order
1432 {
1433  using RT = ResultType_<MT>;
1434  using RN = ReturnType_<MT>;
1435  using CT = CompositeType_<MT>;
1436  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1438 
1439  if( IsUniUpper<MT>::value )
1440  return true;
1441 
1442  if( !isSquare( ~sm ) )
1443  return false;
1444 
1445  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1446 
1447  if( SO == rowMajor ) {
1448  for( size_t i=0UL; i<A.rows(); ++i )
1449  {
1450  bool hasDiagonalElement( false );
1451 
1452  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
1453  {
1454  if( element->index() >= i ) {
1455  if( element->index() != i || !isOne<RF>( element->value() ) )
1456  return false;
1457  hasDiagonalElement = true;
1458  break;
1459  }
1460  else if( !isZero<RF>( element->value() ) ) {
1461  return false;
1462  }
1463  }
1464 
1465  if( !hasDiagonalElement ) {
1466  return false;
1467  }
1468  }
1469  }
1470  else {
1471  for( size_t j=0UL; j<A.columns(); ++j )
1472  {
1473  ConstIterator element( A.lowerBound(j,j) );
1474 
1475  if( element == A.end(j) || element->index() != j || !isOne<RF>( element->value() ) )
1476  return false;
1477 
1478  ++element;
1479 
1480  for( ; element!=A.end(j); ++element ) {
1481  if( !isZero<RF>( element->value() ) )
1482  return false;
1483  }
1484  }
1485  }
1486 
1487  return true;
1488 }
1489 //*************************************************************************************************
1490 
1491 
1492 //*************************************************************************************************
1535 template< bool RF // Relaxation flag
1536  , typename MT // Type of the sparse matrix
1537  , bool SO > // Storage order
1539 {
1540  using RT = ResultType_<MT>;
1541  using RN = ReturnType_<MT>;
1542  using CT = CompositeType_<MT>;
1543  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1545 
1547  return true;
1548 
1550  return false;
1551 
1552  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1553 
1554  if( SO == rowMajor ) {
1555  for( size_t i=0UL; i<A.rows(); ++i ) {
1556  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
1557  {
1558  if( element->index() > i )
1559  break;
1560 
1561  if( !isDefault<RF>( element->value() ) )
1562  return false;
1563  }
1564  }
1565  }
1566  else {
1567  for( size_t j=0UL; j<A.columns(); ++j ) {
1568  for( ConstIterator element=A.lowerBound(j,j); element!=A.end(j); ++element )
1569  {
1570  if( !isDefault<RF>( element->value() ) )
1571  return false;
1572  }
1573  }
1574  }
1575 
1576  return true;
1577 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1624 template< bool RF // Relaxation flag
1625  , typename MT // Type of the sparse matrix
1626  , bool SO > // Storage order
1628 {
1629  using RT = ResultType_<MT>;
1630  using RN = ReturnType_<MT>;
1631  using CT = CompositeType_<MT>;
1632  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1634 
1635  if( IsDiagonal<MT>::value )
1636  return true;
1637 
1638  if( !isSquare( ~sm ) )
1639  return false;
1640 
1641  if( (~sm).rows() < 2UL )
1642  return true;
1643 
1644  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1645 
1646  if( SO == rowMajor ) {
1647  for( size_t i=0UL; i<A.rows(); ++i ) {
1648  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
1649  if( element->index() != i && !isDefault<RF>( element->value() ) )
1650  return false;
1651  }
1652  }
1653  else {
1654  for( size_t j=0UL; j<A.columns(); ++j ) {
1655  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
1656  if( element->index() != j && !isDefault<RF>( element->value() ) )
1657  return false;
1658  }
1659  }
1660 
1661  return true;
1662 }
1663 //*************************************************************************************************
1664 
1665 
1666 //*************************************************************************************************
1709 template< bool RF // Relaxation flag
1710  , typename MT // Type of the sparse matrix
1711  , bool SO > // Storage order
1713 {
1714  using RT = ResultType_<MT>;
1715  using RN = ReturnType_<MT>;
1716  using CT = CompositeType_<MT>;
1717  using Tmp = If_< IsExpression<RN>, const RT, CT >;
1719 
1720  if( IsIdentity<MT>::value )
1721  return true;
1722 
1723  if( !isSquare( ~sm ) )
1724  return false;
1725 
1726  Tmp A( ~sm ); // Evaluation of the sparse matrix operand
1727 
1728  if( SO == rowMajor ) {
1729  for( size_t i=0UL; i<A.rows(); ++i )
1730  {
1731  bool hasDiagonalElement( false );
1732 
1733  for( ConstIterator element=A.begin(i); element!=A.end(i); ++element )
1734  {
1735  if( element->index() == i ) {
1736  if( !isOne<RF>( element->value() ) )
1737  return false;
1738  hasDiagonalElement = true;
1739  }
1740  else if( !isZero<RF>( element->value() ) ) {
1741  return false;
1742  }
1743  }
1744 
1745  if( !hasDiagonalElement ) {
1746  return false;
1747  }
1748  }
1749  }
1750  else {
1751  for( size_t j=0UL; j<A.columns(); ++j )
1752  {
1753  bool hasDiagonalElement( false );
1754 
1755  for( ConstIterator element=A.begin(j); element!=A.end(j); ++element )
1756  {
1757  if( element->index() == j ) {
1758  if( !isOne<RF>( element->value() ) )
1759  return false;
1760  hasDiagonalElement = true;
1761  }
1762  else if( !isZero<RF>( element->value() ) ) {
1763  return false;
1764  }
1765  }
1766 
1767  if( !hasDiagonalElement ) {
1768  return false;
1769  }
1770  }
1771  }
1772 
1773  return true;
1774 }
1775 //*************************************************************************************************
1776 
1777 
1778 //*************************************************************************************************
1790 template< typename MT // Type of the sparse matrix
1791  , bool SO > // Storage order
1793 {
1794  using blaze::min;
1795 
1796  using ET = ElementType_<MT>;
1797  using CT = CompositeType_<MT>;
1799 
1800  CT A( ~sm ); // Evaluation of the sparse matrix operand
1801 
1802  const size_t nonzeros( A.nonZeros() );
1803 
1804  if( nonzeros == 0UL ) {
1805  return ET();
1806  }
1807 
1808  ET minimum{};
1809  if( nonzeros == A.rows() * A.columns() ) {
1810  minimum = A.begin( 0UL )->value();
1811  }
1812 
1813  const size_t index( ( SO == rowMajor )?( A.rows() ):( A.columns() ) );
1814 
1815  for( size_t i=0UL; i<index; ++i ) {
1816  const ConstIterator end( A.end( i ) );
1817  ConstIterator element( A.begin( i ) );
1818  for( ; element!=end; ++element )
1819  minimum = min( minimum, element->value() );
1820  }
1821 
1822  return minimum;
1823 }
1824 //*************************************************************************************************
1825 
1826 
1827 //*************************************************************************************************
1839 template< typename MT // Type of the sparse matrix
1840  , bool SO > // Storage order
1842 {
1843  using blaze::max;
1844 
1845  using ET = ElementType_<MT>;
1846  using CT = CompositeType_<MT>;
1848 
1849  CT A( ~sm ); // Evaluation of the sparse matrix operand
1850 
1851  const size_t nonzeros( A.nonZeros() );
1852 
1853  if( nonzeros == 0UL ) {
1854  return ET();
1855  }
1856 
1857  ET maximum{};
1858  if( nonzeros == A.rows() * A.columns() ) {
1859  maximum = A.begin( 0UL )->value();
1860  }
1861 
1862  const size_t index( ( SO == rowMajor )?( A.rows() ):( A.columns() ) );
1863 
1864  for( size_t i=0UL; i<index; ++i ) {
1865  const ConstIterator end( A.end( i ) );
1866  ConstIterator element( A.begin( i ) );
1867  for( ; element!=end; ++element )
1868  maximum = max( maximum, element->value() );
1869  }
1870 
1871  return maximum;
1872 }
1873 //*************************************************************************************************
1874 
1875 } // namespace blaze
1876 
1877 #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.
Header file for the UnderlyingNumeric type trait.
#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
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
Compile time check for uniform vectors and matrices.This type trait tests whether or not the given te...
Definition: IsUniform.h:67
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1299
Header file for the And class template.
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.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:1725
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
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 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.
Header file for the IsSquare type trait.
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.
Header file for the IsFloatingPoint type trait.
Header file for the UnderlyingBuiltin type trait.
Header file for the Or class template.
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
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:75
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1151
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
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
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:292
Header file for the conjugate shim.
Constraint on the data type.
Header file for the IsNumeric type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
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.
Header file for the division trait.
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
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:82
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.
Header file for the IsInvertible type trait.
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:263
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
Header file for the IsComplex type trait.
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 IsResizable type trait.
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.