Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <vector>
49 #include <blaze/math/Aliases.h>
59 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Clear.h>
73 #include <blaze/util/Assert.h>
79 #include <blaze/util/DisableIf.h>
80 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/TrueType.h>
83 #include <blaze/util/Types.h>
87 #include <blaze/util/Unused.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
106 template< typename MT // Type of the adapted sparse matrix
107  , bool SO > // Storage order of the adapted sparse matrix
108 class HermitianMatrix<MT,SO,false>
109  : public SparseMatrix< HermitianMatrix<MT,SO,false>, SO >
110 {
111  private:
112  //**Type definitions****************************************************************************
113  using OT = OppositeType_t<MT>;
114  using TT = TransposeType_t<MT>;
115  using ET = ElementType_t<MT>;
116  //**********************************************************************************************
117 
118  public:
119  //**Type definitions****************************************************************************
120  using This = HermitianMatrix<MT,SO,false>;
121  using BaseType = SparseMatrix<This,SO>;
122  using ResultType = This;
123  using OppositeType = HermitianMatrix<OT,!SO,false>;
124  using TransposeType = HermitianMatrix<TT,!SO,false>;
125  using ElementType = ET;
126  using ReturnType = ReturnType_t<MT>;
127  using CompositeType = const This&;
128  using Reference = HermitianProxy<MT>;
129  using ConstReference = ConstReference_t<MT>;
130  using ConstIterator = ConstIterator_t<MT>;
131  //**********************************************************************************************
132 
133  //**Rebind struct definition********************************************************************
136  template< typename NewType > // Data type of the other matrix
137  struct Rebind {
139  using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
140  };
141  //**********************************************************************************************
142 
143  //**Resize struct definition********************************************************************
146  template< size_t NewM // Number of rows of the other matrix
147  , size_t NewN > // Number of columns of the other matrix
148  struct Resize {
150  using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
151  };
152  //**********************************************************************************************
153 
154  //**Iterator class definition*******************************************************************
157  class Iterator
158  {
159  public:
160  //**Type definitions*************************************************************************
161  using IteratorType = Iterator_t<MT>;
162 
163  using IteratorCategory = std::forward_iterator_tag;
164  using ValueType = HermitianElement<MT>;
165  using PointerType = ValueType;
166  using ReferenceType = ValueType;
167  using DifferenceType = ptrdiff_t;
168 
169  // STL iterator requirements
170  using iterator_category = IteratorCategory;
171  using value_type = ValueType;
172  using pointer = PointerType;
173  using reference = ReferenceType;
174  using difference_type = DifferenceType;
175  //*******************************************************************************************
176 
177  //**Default constructor**********************************************************************
180  inline Iterator()
181  : pos_ () // Iterator to the current sparse Hermitian matrix element
182  , matrix_( nullptr ) // The sparse matrix containing the iterator
183  , index_ ( 0UL ) // The row/column index of the iterator
184  {}
185  //*******************************************************************************************
186 
187  //**Constructor******************************************************************************
194  inline Iterator( IteratorType pos, MT& matrix, size_t index )
195  : pos_ ( pos ) // Iterator to the current sparse Hermitian matrix element
196  , matrix_( &matrix ) // The sparse matrix containing the iterator
197  , index_ ( index ) // The row/column index of the iterator
198  {}
199  //*******************************************************************************************
200 
201  //**Prefix increment operator****************************************************************
206  inline Iterator& operator++() {
207  ++pos_;
208  return *this;
209  }
210  //*******************************************************************************************
211 
212  //**Postfix increment operator***************************************************************
217  inline const Iterator operator++( int ) {
218  const Iterator tmp( *this );
219  ++(*this);
220  return tmp;
221  }
222  //*******************************************************************************************
223 
224  //**Element access operator******************************************************************
229  inline ReferenceType operator*() const {
230  return ReferenceType( pos_, matrix_, index_ );
231  }
232  //*******************************************************************************************
233 
234  //**Element access operator******************************************************************
239  inline PointerType operator->() const {
240  return PointerType( pos_, matrix_, index_ );
241  }
242  //*******************************************************************************************
243 
244  //**Conversion operator**********************************************************************
249  inline operator ConstIterator() const {
250  return pos_;
251  }
252  //*******************************************************************************************
253 
254  //**Equality operator************************************************************************
260  inline bool operator==( const Iterator& rhs ) const {
261  return pos_ == rhs.pos_;
262  }
263  //*******************************************************************************************
264 
265  //**Inequality operator**********************************************************************
271  inline bool operator!=( const Iterator& rhs ) const {
272  return !( *this == rhs );
273  }
274  //*******************************************************************************************
275 
276  //**Subtraction operator*********************************************************************
282  inline DifferenceType operator-( const Iterator& rhs ) const {
283  return pos_ - rhs.pos_;
284  }
285  //*******************************************************************************************
286 
287  //**Base function****************************************************************************
292  inline IteratorType base() const {
293  return pos_;
294  }
295  //*******************************************************************************************
296 
297  private:
298  //**Member variables*************************************************************************
299  IteratorType pos_;
300  MT* matrix_;
301  size_t index_;
302  //*******************************************************************************************
303  };
304  //**********************************************************************************************
305 
306  //**Compilation flags***************************************************************************
308  static constexpr bool smpAssignable = false;
309  //**********************************************************************************************
310 
311  //**Constructors********************************************************************************
314  explicit inline HermitianMatrix();
315  explicit inline HermitianMatrix( size_t n );
316  explicit inline HermitianMatrix( size_t n, size_t nonzeros );
317  explicit inline HermitianMatrix( size_t n, const std::vector<size_t>& nonzeros );
318  explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
319 
320  inline HermitianMatrix( const HermitianMatrix& m );
321  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
322 
323  template< typename MT2, bool SO2 >
324  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
326  //**********************************************************************************************
327 
328  //**Destructor**********************************************************************************
331  ~HermitianMatrix() = default;
333  //**********************************************************************************************
334 
335  //**Data access functions***********************************************************************
338  inline Reference operator()( size_t i, size_t j );
339  inline ConstReference operator()( size_t i, size_t j ) const;
340  inline Reference at( size_t i, size_t j );
341  inline ConstReference at( size_t i, size_t j ) const;
342  inline Iterator begin ( size_t i );
343  inline ConstIterator begin ( size_t i ) const;
344  inline ConstIterator cbegin( size_t i ) const;
345  inline Iterator end ( size_t i );
346  inline ConstIterator end ( size_t i ) const;
347  inline ConstIterator cend ( size_t i ) const;
349  //**********************************************************************************************
350 
351  //**Assignment operators************************************************************************
354  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
355 
356  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
357  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
358 
359  template< typename MT2, bool SO2 >
360  inline auto operator=( const Matrix<MT2,SO2>& rhs )
361  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
362 
363  template< typename MT2, bool SO2 >
364  inline auto operator=( const Matrix<MT2,SO2>& rhs )
365  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
366 
367  template< typename MT2 >
368  inline auto operator=( const Matrix<MT2,!SO>& rhs )
369  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
370 
371  template< typename MT2, bool SO2 >
372  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
373  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
374 
375  template< typename MT2, bool SO2 >
376  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
377  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
378 
379  template< typename MT2 >
380  inline auto operator+=( const Matrix<MT2,!SO>& rhs )
381  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
382 
383  template< typename MT2, bool SO2 >
384  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
385  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
386 
387  template< typename MT2, bool SO2 >
388  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
389  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
390 
391  template< typename MT2 >
392  inline auto operator-=( const Matrix<MT2,!SO>& rhs )
393  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
394 
395  template< typename MT2, bool SO2 >
396  inline auto operator%=( const Matrix<MT2,SO2>& rhs )
397  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
398 
399  template< typename MT2, bool SO2 >
400  inline auto operator%=( const Matrix<MT2,SO2>& rhs )
401  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
402 
403  template< typename MT2 >
404  inline auto operator%=( const Matrix<MT2,!SO>& rhs )
405  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
406 
407  template< typename ST >
408  inline auto operator*=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >;
409 
410  template< typename ST >
411  inline auto operator/=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >;
413  //**********************************************************************************************
414 
415  //**Utility functions***************************************************************************
418  inline size_t rows() const noexcept;
419  inline size_t columns() const noexcept;
420  inline size_t capacity() const noexcept;
421  inline size_t capacity( size_t i ) const noexcept;
422  inline size_t nonZeros() const;
423  inline size_t nonZeros( size_t i ) const;
424  inline void reset();
425  inline void reset( size_t i );
426  inline void clear();
427  inline void resize ( size_t n, bool preserve=true );
428  inline void reserve( size_t nonzeros );
429  inline void reserve( size_t i, size_t nonzeros );
430  inline void trim();
431  inline void trim( size_t i );
432  inline void shrinkToFit();
433  inline void swap( HermitianMatrix& m ) noexcept;
435  //**********************************************************************************************
436 
437  //**Insertion functions*************************************************************************
440  inline Iterator set ( size_t i, size_t j, const ElementType& value );
441  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
442  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
443  inline void finalize( size_t i );
445  //**********************************************************************************************
446 
447  //**Erase functions*****************************************************************************
450  inline void erase( size_t i, size_t j );
451  inline Iterator erase( size_t i, Iterator pos );
452  inline Iterator erase( size_t i, Iterator first, Iterator last );
453 
454  template< typename Pred >
455  inline void erase( Pred predicate );
456 
457  template< typename Pred >
458  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
460  //**********************************************************************************************
461 
462  //**Lookup functions****************************************************************************
465  inline Iterator find ( size_t i, size_t j );
466  inline ConstIterator find ( size_t i, size_t j ) const;
467  inline Iterator lowerBound( size_t i, size_t j );
468  inline ConstIterator lowerBound( size_t i, size_t j ) const;
469  inline Iterator upperBound( size_t i, size_t j );
470  inline ConstIterator upperBound( size_t i, size_t j ) const;
472  //**********************************************************************************************
473 
474  //**Numeric functions***************************************************************************
477  inline HermitianMatrix& transpose();
478  inline HermitianMatrix& ctranspose();
479 
480  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
482  //**********************************************************************************************
483 
484  //**Debugging functions*************************************************************************
487  inline bool isIntact() const noexcept;
489  //**********************************************************************************************
490 
491  //**Expression template evaluation functions****************************************************
494  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
495  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
496 
497  inline bool canSMPAssign() const noexcept;
499  //**********************************************************************************************
500 
501  private:
502  //**Construction functions**********************************************************************
505  template< typename MT2, bool SO2, typename T >
506  inline decltype(auto) construct( const Matrix<MT2,SO2>& m, T );
507 
508  template< typename MT2 >
509  inline decltype(auto) construct( const Matrix<MT2,!SO>& m, TrueType );
511  //**********************************************************************************************
512 
513  //**Member variables****************************************************************************
516  MT matrix_;
517 
518  //**********************************************************************************************
519 
520  //**Friend declarations*************************************************************************
521  template< bool RF, typename MT2, bool SO2, bool DF2 >
522  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
523  //**********************************************************************************************
524 
525  //**Compile time checks*************************************************************************
539  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
540  //**********************************************************************************************
541 };
543 //*************************************************************************************************
544 
545 
546 
547 
548 //=================================================================================================
549 //
550 // CONSTRUCTORS
551 //
552 //=================================================================================================
553 
554 //*************************************************************************************************
558 template< typename MT // Type of the adapted sparse matrix
559  , bool SO > // Storage order of the adapted sparse matrix
560 inline HermitianMatrix<MT,SO,false>::HermitianMatrix()
561  : matrix_() // The adapted sparse matrix
562 {
563  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
564 }
566 //*************************************************************************************************
567 
568 
569 //*************************************************************************************************
577 template< typename MT // Type of the adapted sparse matrix
578  , bool SO > // Storage order of the adapted sparse matrix
579 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( size_t n )
580  : matrix_( n, n ) // The adapted sparse matrix
581 {
583 
584  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
585 }
587 //*************************************************************************************************
588 
589 
590 //*************************************************************************************************
599 template< typename MT // Type of the adapted sparse matrix
600  , bool SO > // Storage order of the adapted sparse matrix
601 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( size_t n, size_t nonzeros )
602  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
603 {
605 
606  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
607 }
609 //*************************************************************************************************
610 
611 
612 //*************************************************************************************************
623 template< typename MT // Type of the adapted sparse matrix
624  , bool SO > // Storage order of the adapted sparse matrix
625 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( size_t n, const std::vector<size_t>& nonzeros )
626  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
627 {
629 
630  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
631 }
633 //*************************************************************************************************
634 
635 
636 //*************************************************************************************************
663 template< typename MT // Type of the adapted sparse matrix
664  , bool SO > // Storage order of the adapted sparse matrix
665 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
666  : matrix_( list ) // The adapted sparse matrix
667 {
668  if( !isHermitian( matrix_ ) ) {
669  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
670  }
671 
672  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
673 }
675 //*************************************************************************************************
676 
677 
678 //*************************************************************************************************
684 template< typename MT // Type of the adapted sparse matrix
685  , bool SO > // Storage order of the adapted sparse matrix
686 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( const HermitianMatrix& m )
687  : matrix_( m.matrix_ ) // The adapted sparse matrix
688 {
689  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
690  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
691 }
693 //*************************************************************************************************
694 
695 
696 //*************************************************************************************************
702 template< typename MT // Type of the adapted sparse matrix
703  , bool SO > // Storage order of the adapted sparse matrix
704 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( HermitianMatrix&& m ) noexcept
705  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
706 {
707  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
708  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
709 }
711 //*************************************************************************************************
712 
713 
714 //*************************************************************************************************
724 template< typename MT // Type of the adapted sparse matrix
725  , bool SO > // Storage order of the adapted sparse matrix
726 template< typename MT2 // Type of the foreign matrix
727  , bool SO2 > // Storage order of the foreign matrix
728 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( const Matrix<MT2,SO2>& m )
729  : matrix_( construct( m, typename IsBuiltin< ElementType_t<MT2> >::Type() ) ) // The adapted sparse matrix
730 {
731  if( !IsHermitian_v<MT2> && !isHermitian( matrix_ ) ) {
732  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
733  }
734 }
736 //*************************************************************************************************
737 
738 
739 
740 
741 //=================================================================================================
742 //
743 // DATA ACCESS FUNCTIONS
744 //
745 //=================================================================================================
746 
747 //*************************************************************************************************
763 template< typename MT // Type of the adapted sparse matrix
764  , bool SO > // Storage order of the adapted sparse matrix
766  HermitianMatrix<MT,SO,false>::operator()( size_t i, size_t j )
767 {
768  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
769  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
770 
771  return Reference( matrix_, i, j );
772 }
774 //*************************************************************************************************
775 
776 
777 //*************************************************************************************************
793 template< typename MT // Type of the adapted sparse matrix
794  , bool SO > // Storage order of the adapted sparse matrix
796  HermitianMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
797 {
798  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
799  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
800 
801  return matrix_(i,j);
802 }
804 //*************************************************************************************************
805 
806 
807 //*************************************************************************************************
824 template< typename MT // Type of the adapted sparse matrix
825  , bool SO > // Storage order of the adapted sparse matrix
827  HermitianMatrix<MT,SO,false>::at( size_t i, size_t j )
828 {
829  if( i >= rows() ) {
830  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
831  }
832  if( j >= columns() ) {
833  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
834  }
835  return (*this)(i,j);
836 }
838 //*************************************************************************************************
839 
840 
841 //*************************************************************************************************
858 template< typename MT // Type of the adapted sparse matrix
859  , bool SO > // Storage order of the adapted sparse matrix
861  HermitianMatrix<MT,SO,false>::at( size_t i, size_t j ) const
862 {
863  if( i >= rows() ) {
864  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
865  }
866  if( j >= columns() ) {
867  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
868  }
869  return (*this)(i,j);
870 }
872 //*************************************************************************************************
873 
874 
875 //*************************************************************************************************
887 template< typename MT // Type of the adapted sparse matrix
888  , bool SO > // Storage order of the adapted sparse matrix
891 {
892  return Iterator( matrix_.begin(i), matrix_, i );
893 }
895 //*************************************************************************************************
896 
897 
898 //*************************************************************************************************
910 template< typename MT // Type of the adapted sparse matrix
911  , bool SO > // Storage order of the adapted sparse matrix
913  HermitianMatrix<MT,SO,false>::begin( size_t i ) const
914 {
915  return matrix_.begin(i);
916 }
918 //*************************************************************************************************
919 
920 
921 //*************************************************************************************************
933 template< typename MT // Type of the adapted sparse matrix
934  , bool SO > // Storage order of the adapted sparse matrix
936  HermitianMatrix<MT,SO,false>::cbegin( size_t i ) const
937 {
938  return matrix_.cbegin(i);
939 }
941 //*************************************************************************************************
942 
943 
944 //*************************************************************************************************
956 template< typename MT // Type of the adapted sparse matrix
957  , bool SO > // Storage order of the adapted sparse matrix
960 {
961  return Iterator( matrix_.end(i), matrix_, i );
962 }
964 //*************************************************************************************************
965 
966 
967 //*************************************************************************************************
979 template< typename MT // Type of the adapted sparse matrix
980  , bool SO > // Storage order of the adapted sparse matrix
982  HermitianMatrix<MT,SO,false>::end( size_t i ) const
983 {
984  return matrix_.end(i);
985 }
987 //*************************************************************************************************
988 
989 
990 //*************************************************************************************************
1002 template< typename MT // Type of the adapted sparse matrix
1003  , bool SO > // Storage order of the adapted sparse matrix
1005  HermitianMatrix<MT,SO,false>::cend( size_t i ) const
1006 {
1007  return matrix_.cend(i);
1008 }
1010 //*************************************************************************************************
1011 
1012 
1013 
1014 
1015 //=================================================================================================
1016 //
1017 // ASSIGNMENT OPERATORS
1018 //
1019 //=================================================================================================
1020 
1021 //*************************************************************************************************
1048 template< typename MT // Type of the adapted sparse matrix
1049  , bool SO > // Storage order of the adapted sparse matrix
1050 inline HermitianMatrix<MT,SO,false>&
1051  HermitianMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
1052 {
1053  const InitializerMatrix<ElementType> tmp( list, list.size() );
1054 
1055  if( !isHermitian( tmp ) ) {
1056  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1057  }
1058 
1059  matrix_ = list;
1060 
1061  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1062  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1063 
1064  return *this;
1065 }
1067 //*************************************************************************************************
1068 
1069 
1070 //*************************************************************************************************
1080 template< typename MT // Type of the adapted sparse matrix
1081  , bool SO > // Storage order of the adapted sparse matrix
1082 inline HermitianMatrix<MT,SO,false>&
1083  HermitianMatrix<MT,SO,false>::operator=( const HermitianMatrix& rhs )
1084 {
1085  matrix_ = rhs.matrix_;
1086 
1087  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1088  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1089 
1090  return *this;
1091 }
1093 //*************************************************************************************************
1094 
1095 
1096 //*************************************************************************************************
1103 template< typename MT // Type of the adapted sparse matrix
1104  , bool SO > // Storage order of the adapted sparse matrix
1105 inline HermitianMatrix<MT,SO,false>&
1106  HermitianMatrix<MT,SO,false>::operator=( HermitianMatrix&& rhs ) noexcept
1107 {
1108  matrix_ = std::move( rhs.matrix_ );
1109 
1110  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1111  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1112 
1113  return *this;
1114 }
1116 //*************************************************************************************************
1117 
1118 
1119 //*************************************************************************************************
1132 template< typename MT // Type of the adapted sparse matrix
1133  , bool SO > // Storage order of the adapted sparse matrix
1134 template< typename MT2 // Type of the right-hand side matrix
1135  , bool SO2 > // Storage order of the right-hand side matrix
1136 inline auto HermitianMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
1137  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1138 {
1139  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1140  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1141  }
1142 
1143  matrix_ = ~rhs;
1144 
1145  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1146  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1147 
1148  return *this;
1149 }
1151 //*************************************************************************************************
1152 
1153 
1154 //*************************************************************************************************
1167 template< typename MT // Type of the adapted sparse matrix
1168  , bool SO > // Storage order of the adapted sparse matrix
1169 template< typename MT2 // Type of the right-hand side matrix
1170  , bool SO2 > // Storage order of the right-hand side matrix
1171 inline auto HermitianMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
1172  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1173 {
1174  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1175  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1176  }
1177 
1178  if( IsHermitian_v<MT2> ) {
1179  matrix_ = ~rhs;
1180  }
1181  else {
1182  MT tmp( ~rhs );
1183 
1184  if( !isHermitian( tmp ) ) {
1185  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1186  }
1187 
1188  matrix_ = std::move( tmp );
1189  }
1190 
1191  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1192  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1193 
1194  return *this;
1195 }
1197 //*************************************************************************************************
1198 
1199 
1200 //*************************************************************************************************
1213 template< typename MT // Type of the adapted sparse matrix
1214  , bool SO > // Storage order of the adapted sparse matrix
1215 template< typename MT2 > // Type of the right-hand side matrix
1216 inline auto HermitianMatrix<MT,SO,false>::operator=( const Matrix<MT2,!SO>& rhs )
1217  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1218 {
1219  return this->operator=( trans( ~rhs ) );
1220 }
1222 //*************************************************************************************************
1223 
1224 
1225 //*************************************************************************************************
1238 template< typename MT // Type of the adapted sparse matrix
1239  , bool SO > // Storage order of the adapted sparse matrix
1240 template< typename MT2 // Type of the right-hand side matrix
1241  , bool SO2 > // Storage order of the right-hand side matrix
1242 inline auto HermitianMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1243  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1244 {
1245  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1246  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1247  }
1248 
1249  matrix_ += ~rhs;
1250 
1251  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1252  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1253 
1254  return *this;
1255 }
1257 //*************************************************************************************************
1258 
1259 
1260 //*************************************************************************************************
1273 template< typename MT // Type of the adapted sparse matrix
1274  , bool SO > // Storage order of the adapted sparse matrix
1275 template< typename MT2 // Type of the right-hand side matrix
1276  , bool SO2 > // Storage order of the right-hand side matrix
1277 inline auto HermitianMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1278  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1279 {
1280  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1281  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1282  }
1283 
1284  if( IsHermitian_v<MT2> ) {
1285  matrix_ += ~rhs;
1286  }
1287  else {
1288  const ResultType_t<MT2> tmp( ~rhs );
1289 
1290  if( !isHermitian( tmp ) ) {
1291  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1292  }
1293 
1294  matrix_ += tmp;
1295  }
1296 
1297  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1298  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1299 
1300  return *this;
1301 }
1303 //*************************************************************************************************
1304 
1305 
1306 //*************************************************************************************************
1320 template< typename MT // Type of the adapted sparse matrix
1321  , bool SO > // Storage order of the adapted sparse matrix
1322 template< typename MT2 > // Type of the right-hand side matrix
1323 inline auto HermitianMatrix<MT,SO,false>::operator+=( const Matrix<MT2,!SO>& rhs )
1324  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1325 {
1326  return this->operator+=( trans( ~rhs ) );
1327 }
1329 //*************************************************************************************************
1330 
1331 
1332 //*************************************************************************************************
1345 template< typename MT // Type of the adapted sparse matrix
1346  , bool SO > // Storage order of the adapted sparse matrix
1347 template< typename MT2 // Type of the right-hand side matrix
1348  , bool SO2 > // Storage order of the right-hand side matrix
1349 inline auto HermitianMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1350  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1351 {
1352  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1353  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1354  }
1355 
1356  matrix_ -= ~rhs;
1357 
1358  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1359  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1360 
1361  return *this;
1362 }
1364 //*************************************************************************************************
1365 
1366 
1367 //*************************************************************************************************
1380 template< typename MT // Type of the adapted sparse matrix
1381  , bool SO > // Storage order of the adapted sparse matrix
1382 template< typename MT2 // Type of the right-hand side matrix
1383  , bool SO2 > // Storage order of the right-hand side matrix
1384 inline auto HermitianMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1385  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1386 {
1387  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1388  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1389  }
1390 
1391  if( IsHermitian_v<MT2> ) {
1392  matrix_ -= ~rhs;
1393  }
1394  else {
1395  const ResultType_t<MT2> tmp( ~rhs );
1396 
1397  if( !isHermitian( tmp ) ) {
1398  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1399  }
1400 
1401  matrix_ -= tmp;
1402  }
1403 
1404  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1405  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1406 
1407  return *this;
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1427 template< typename MT // Type of the adapted sparse matrix
1428  , bool SO > // Storage order of the adapted sparse matrix
1429 template< typename MT2 > // Type of the right-hand side matrix
1430 inline auto HermitianMatrix<MT,SO,false>::operator-=( const Matrix<MT2,!SO>& rhs )
1431  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1432 {
1433  return this->operator-=( trans( ~rhs ) );
1434 }
1436 //*************************************************************************************************
1437 
1438 
1439 //*************************************************************************************************
1453 template< typename MT // Type of the adapted sparse matrix
1454  , bool SO > // Storage order of the adapted sparse matrix
1455 template< typename MT2 // Type of the right-hand side matrix
1456  , bool SO2 > // Storage order of the right-hand side matrix
1457 inline auto HermitianMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1458  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1459 {
1460  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1461  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1462  }
1463 
1464  matrix_ %= ~rhs;
1465 
1466  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1467  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1468 
1469  return *this;
1470 }
1472 //*************************************************************************************************
1473 
1474 
1475 //*************************************************************************************************
1489 template< typename MT // Type of the adapted sparse matrix
1490  , bool SO > // Storage order of the adapted sparse matrix
1491 template< typename MT2 // Type of the right-hand side matrix
1492  , bool SO2 > // Storage order of the right-hand side matrix
1493 inline auto HermitianMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1494  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1495 {
1496  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1497  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1498  }
1499 
1500  if( IsHermitian_v<MT2> ) {
1501  matrix_ %= ~rhs;
1502  }
1503  else {
1504  const ResultType_t<MT2> tmp( ~rhs );
1505 
1506  if( !isHermitian( tmp ) ) {
1507  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1508  }
1509 
1510  matrix_ %= tmp;
1511  }
1512 
1513  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1514  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1515 
1516  return *this;
1517 }
1519 //*************************************************************************************************
1520 
1521 
1522 //*************************************************************************************************
1536 template< typename MT // Type of the adapted sparse matrix
1537  , bool SO > // Storage order of the adapted sparse matrix
1538 template< typename MT2 > // Type of the right-hand side matrix
1539 inline auto HermitianMatrix<MT,SO,false>::operator%=( const Matrix<MT2,!SO>& rhs )
1540  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1541 {
1542  return this->operator%=( trans( ~rhs ) );
1543 }
1545 //*************************************************************************************************
1546 
1547 
1548 //*************************************************************************************************
1556 template< typename MT // Type of the adapted sparse matrix
1557  , bool SO > // Storage order of the adapted sparse matrix
1558 template< typename ST > // Data type of the right-hand side scalar
1559 inline auto HermitianMatrix<MT,SO,false>::operator*=( ST rhs )
1560  -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
1561 {
1562  matrix_ *= rhs;
1563  return *this;
1564 }
1565 //*************************************************************************************************
1566 
1567 
1568 //*************************************************************************************************
1576 template< typename MT // Type of the adapted sparse matrix
1577  , bool SO > // Storage order of the adapted sparse matrix
1578 template< typename ST > // Data type of the right-hand side scalar
1579 inline auto HermitianMatrix<MT,SO,false>::operator/=( ST rhs )
1580  -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
1581 {
1582  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
1583 
1584  matrix_ /= rhs;
1585  return *this;
1586 }
1588 //*************************************************************************************************
1589 
1590 
1591 
1592 
1593 //=================================================================================================
1594 //
1595 // UTILITY FUNCTIONS
1596 //
1597 //=================================================================================================
1598 
1599 //*************************************************************************************************
1605 template< typename MT // Type of the adapted sparse matrix
1606  , bool SO > // Storage order of the adapted sparse matrix
1607 inline size_t HermitianMatrix<MT,SO,false>::rows() const noexcept
1608 {
1609  return matrix_.rows();
1610 }
1612 //*************************************************************************************************
1613 
1614 
1615 //*************************************************************************************************
1621 template< typename MT // Type of the adapted sparse matrix
1622  , bool SO > // Storage order of the adapted sparse matrix
1623 inline size_t HermitianMatrix<MT,SO,false>::columns() const noexcept
1624 {
1625  return matrix_.columns();
1626 }
1628 //*************************************************************************************************
1629 
1630 
1631 //*************************************************************************************************
1637 template< typename MT // Type of the adapted sparse matrix
1638  , bool SO > // Storage order of the adapted sparse matrix
1639 inline size_t HermitianMatrix<MT,SO,false>::capacity() const noexcept
1640 {
1641  return matrix_.capacity();
1642 }
1644 //*************************************************************************************************
1645 
1646 
1647 //*************************************************************************************************
1658 template< typename MT // Type of the adapted sparse matrix
1659  , bool SO > // Storage order of the adapted sparse matrix
1660 inline size_t HermitianMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1661 {
1662  return matrix_.capacity(i);
1663 }
1665 //*************************************************************************************************
1666 
1667 
1668 //*************************************************************************************************
1674 template< typename MT // Type of the adapted sparse matrix
1675  , bool SO > // Storage order of the adapted sparse matrix
1676 inline size_t HermitianMatrix<MT,SO,false>::nonZeros() const
1677 {
1678  return matrix_.nonZeros();
1679 }
1681 //*************************************************************************************************
1682 
1683 
1684 //*************************************************************************************************
1696 template< typename MT // Type of the adapted sparse matrix
1697  , bool SO > // Storage order of the adapted sparse matrix
1698 inline size_t HermitianMatrix<MT,SO,false>::nonZeros( size_t i ) const
1699 {
1700  return matrix_.nonZeros(i);
1701 }
1703 //*************************************************************************************************
1704 
1705 
1706 //*************************************************************************************************
1712 template< typename MT // Type of the adapted sparse matrix
1713  , bool SO > // Storage order of the adapted sparse matrix
1715 {
1716  matrix_.reset();
1717 }
1719 //*************************************************************************************************
1720 
1721 
1722 //*************************************************************************************************
1758 template< typename MT // Type of the adapted sparse matrix
1759  , bool SO > // Storage order of the adapted sparse matrix
1760 inline void HermitianMatrix<MT,SO,false>::reset( size_t i )
1761 {
1762  using blaze::erase;
1763 
1764  for( auto it=matrix_.begin(i); it!=matrix_.end(i); ++it )
1765  {
1766  const size_t j( it->index() );
1767 
1768  if( i == j )
1769  continue;
1770 
1771  if( SO ) {
1772  const Iterator_t<MT> pos( matrix_.find( i, j ) );
1773  BLAZE_INTERNAL_ASSERT( pos != matrix_.end( j ), "Missing element detected" );
1774  erase( matrix_, j, pos );
1775  }
1776  else {
1777  const Iterator_t<MT> pos( matrix_.find( j, i ) );
1778  BLAZE_INTERNAL_ASSERT( pos != matrix_.end( j ), "Missing element detected" );
1779  erase( matrix_, j, pos );
1780  }
1781  }
1782 
1783  matrix_.reset( i );
1784 }
1786 //*************************************************************************************************
1787 
1788 
1789 //*************************************************************************************************
1797 template< typename MT // Type of the adapted sparse matrix
1798  , bool SO > // Storage order of the adapted sparse matrix
1800 {
1801  using blaze::clear;
1802 
1803  clear( matrix_ );
1804 }
1806 //*************************************************************************************************
1807 
1808 
1809 //*************************************************************************************************
1824 template< typename MT // Type of the adapted sparse matrix
1825  , bool SO > // Storage order of the adapted sparse matrix
1826 void HermitianMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1827 {
1829 
1830  UNUSED_PARAMETER( preserve );
1831 
1832  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1833 
1834  matrix_.resize( n, n, true );
1835 }
1837 //*************************************************************************************************
1838 
1839 
1840 //*************************************************************************************************
1851 template< typename MT // Type of the adapted sparse matrix
1852  , bool SO > // Storage order of the adapted sparse matrix
1853 inline void HermitianMatrix<MT,SO,false>::reserve( size_t nonzeros )
1854 {
1855  matrix_.reserve( nonzeros );
1856 }
1858 //*************************************************************************************************
1859 
1860 
1861 //*************************************************************************************************
1875 template< typename MT // Type of the adapted sparse matrix
1876  , bool SO > // Storage order of the adapted sparse matrix
1877 inline void HermitianMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1878 {
1879  matrix_.reserve( i, nonzeros );
1880 }
1882 //*************************************************************************************************
1883 
1884 
1885 //*************************************************************************************************
1896 template< typename MT // Type of the adapted sparse matrix
1897  , bool SO > // Storage order of the adapted sparse matrix
1898 inline void HermitianMatrix<MT,SO,false>::trim()
1899 {
1900  matrix_.trim();
1901 }
1903 //*************************************************************************************************
1904 
1905 
1906 //*************************************************************************************************
1918 template< typename MT // Type of the adapted sparse matrix
1919  , bool SO > // Storage order of the adapted sparse matrix
1920 inline void HermitianMatrix<MT,SO,false>::trim( size_t i )
1921 {
1922  matrix_.trim( i );
1923 }
1925 //*************************************************************************************************
1926 
1927 
1928 //*************************************************************************************************
1938 template< typename MT // Type of the adapted sparse matrix
1939  , bool SO > // Storage order of the adapted sparse matrix
1941 {
1942  matrix_.shrinkToFit();
1943 }
1945 //*************************************************************************************************
1946 
1947 
1948 //*************************************************************************************************
1955 template< typename MT // Type of the adapted sparse matrix
1956  , bool SO > // Storage order of the adapted sparse matrix
1957 inline void HermitianMatrix<MT,SO,false>::swap( HermitianMatrix& m ) noexcept
1958 {
1959  using std::swap;
1960 
1961  swap( matrix_, m.matrix_ );
1962 }
1964 //*************************************************************************************************
1965 
1966 
1967 
1968 
1969 //=================================================================================================
1970 //
1971 // INSERTION FUNCTIONS
1972 //
1973 //=================================================================================================
1974 
1975 //*************************************************************************************************
1990 template< typename MT // Type of the adapted sparse matrix
1991  , bool SO > // Storage order of the adapted sparse matrix
1993  HermitianMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1994 {
1995  const bool isDiagonal( i == j );
1996 
1997  if( IsComplex_v<ElementType> && isDiagonal && !isReal( value ) ) {
1998  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal matrix element" );
1999  }
2000 
2001  if( !isDiagonal )
2002  matrix_.set( j, i, conj( value ) );
2003  return Iterator( matrix_.set( i, j, value ), matrix_, ( SO ? j : i ) );
2004 }
2006 //*************************************************************************************************
2007 
2008 
2009 //*************************************************************************************************
2025 template< typename MT // Type of the adapted sparse matrix
2026  , bool SO > // Storage order of the adapted sparse matrix
2028  HermitianMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
2029 {
2030  const bool isDiagonal( i == j );
2031 
2032  if( IsComplex_v<ElementType> && isDiagonal && !isReal( value ) ) {
2033  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal matrix element" );
2034  }
2035 
2036  if( !isDiagonal )
2037  matrix_.insert( j, i, conj( value ) );
2038  return Iterator( matrix_.insert( i, j, value ), matrix_, ( SO ? j : i ) );
2039 }
2041 //*************************************************************************************************
2042 
2043 
2044 //*************************************************************************************************
2103 template< typename MT // Type of the adapted sparse matrix
2104  , bool SO > // Storage order of the adapted sparse matrix
2105 inline void HermitianMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
2106 {
2107  const bool isDiagonal( i == j );
2108 
2109  if( IsComplex_v<ElementType> && isDiagonal && !isReal( value ) ) {
2110  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal matrix element" );
2111  }
2112 
2113  matrix_.append( i, j, value, check );
2114  if( !isDiagonal && ( !check || !isDefault<strict>( value ) ) )
2115  matrix_.insert( j, i, conj( value ) );
2116 }
2118 //*************************************************************************************************
2119 
2120 
2121 //*************************************************************************************************
2135 template< typename MT // Type of the adapted sparse matrix
2136  , bool SO > // Storage order of the adapted sparse matrix
2137 inline void HermitianMatrix<MT,SO,false>::finalize( size_t i )
2138 {
2139  matrix_.trim( i );
2140 }
2142 //*************************************************************************************************
2143 
2144 
2145 
2146 
2147 //=================================================================================================
2148 //
2149 // ERASE FUNCTIONS
2150 //
2151 //=================================================================================================
2152 
2153 //*************************************************************************************************
2163 template< typename MT // Type of the adapted sparse matrix
2164  , bool SO > // Storage order of the adapted sparse matrix
2165 inline void HermitianMatrix<MT,SO,false>::erase( size_t i, size_t j )
2166 {
2167  using blaze::erase;
2168 
2169  erase( matrix_, i, j );
2170  if( i != j )
2171  erase( matrix_, j, i );
2172 }
2174 //*************************************************************************************************
2175 
2176 
2177 //*************************************************************************************************
2189 template< typename MT // Type of the adapted sparse matrix
2190  , bool SO > // Storage order of the adapted sparse matrix
2192  HermitianMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
2193 {
2194  using blaze::erase;
2195 
2196  const Iterator_t<MT> base( pos.base() );
2197 
2198  if( base == matrix_.end( i ) )
2199  return pos;
2200 
2201  const size_t j( base->index() );
2202 
2203  if( i == j ) {
2204  BLAZE_INTERNAL_ASSERT( matrix_.find( i, i ) != matrix_.end( i ), "Missing element detected" );
2205  return Iterator( erase( matrix_, i, base ), matrix_, i );
2206  }
2207 
2208  if( SO ) {
2209  BLAZE_INTERNAL_ASSERT( matrix_.find( i, j ) != matrix_.end( j ), "Missing element detected" );
2210  erase( matrix_, j, matrix_.find( i, j ) );
2211  return Iterator( erase( matrix_, i, base ), matrix_, i );
2212  }
2213  else {
2214  BLAZE_INTERNAL_ASSERT( matrix_.find( j, i ) != matrix_.end( j ), "Missing element detected" );
2215  erase( matrix_, j, matrix_.find( j, i ) );
2216  return Iterator( erase( matrix_, i, base ), matrix_, i );
2217  }
2218 }
2220 //*************************************************************************************************
2221 
2222 
2223 //*************************************************************************************************
2237 template< typename MT // Type of the adapted sparse matrix
2238  , bool SO > // Storage order of the adapted sparse matrix
2240  HermitianMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
2241 {
2242  using blaze::erase;
2243 
2244  for( auto it=first.base(); it!=last.base(); ++it )
2245  {
2246  const size_t j( it->index() );
2247 
2248  if( i == j )
2249  continue;
2250 
2251  if( SO ) {
2252  BLAZE_INTERNAL_ASSERT( matrix_.find( i, j ) != matrix_.end( j ), "Missing element detected" );
2253  erase( matrix_, i, j );
2254  }
2255  else {
2256  BLAZE_INTERNAL_ASSERT( matrix_.find( j, i ) != matrix_.end( j ), "Missing element detected" );
2257  erase( matrix_, j, i );
2258  }
2259  }
2260 
2261  return Iterator( erase( matrix_, i, first.base(), last.base() ), matrix_, i );
2262 }
2264 //*************************************************************************************************
2265 
2266 
2267 //*************************************************************************************************
2289 template< typename MT // Type of the adapted sparse matrix
2290  , bool SO > // Storage order of the adapted sparse matrix
2291 template< typename Pred > // Type of the unary predicate
2292 inline void HermitianMatrix<MT,SO,false>::erase( Pred predicate )
2293 {
2294  using blaze::erase;
2295 
2296  erase( matrix_, [predicate=predicate]( const ElementType& value ) {
2297  return predicate( value ) || predicate( conj( value ) );
2298  } );
2299 
2300  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2301 }
2303 //*************************************************************************************************
2304 
2305 
2306 //*************************************************************************************************
2334 template< typename MT // Type of the adapted sparse matrix
2335  , bool SO > // Storage order of the adapted sparse matrix
2336 template< typename Pred > // Type of the unary predicate
2337 inline void
2338  HermitianMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
2339 {
2340  using blaze::erase;
2341 
2342  for( auto it=first; it!=last; ++it ) {
2343  const size_t j( it->index() );
2344  if( i != j && predicate( it->value() ) ) {
2345  if( SO )
2346  erase( matrix_, i, j );
2347  else
2348  erase( matrix_, j, i );
2349  }
2350  }
2351 
2352  erase( matrix_, i, first.base(), last.base(), predicate );
2353 
2354  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2355 }
2357 //*************************************************************************************************
2358 
2359 
2360 
2361 
2362 //=================================================================================================
2363 //
2364 // LOOKUP FUNCTIONS
2365 //
2366 //=================================================================================================
2367 
2368 //*************************************************************************************************
2384 template< typename MT // Type of the adapted sparse matrix
2385  , bool SO > // Storage order of the adapted sparse matrix
2387  HermitianMatrix<MT,SO,false>::find( size_t i, size_t j )
2388 {
2389  return Iterator( matrix_.find( i, j ), matrix_, ( SO ? j : i ) );
2390 }
2392 //*************************************************************************************************
2393 
2394 
2395 //*************************************************************************************************
2411 template< typename MT // Type of the adapted sparse matrix
2412  , bool SO > // Storage order of the adapted sparse matrix
2414  HermitianMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2415 {
2416  return matrix_.find( i, j );
2417 }
2419 //*************************************************************************************************
2420 
2421 
2422 //*************************************************************************************************
2438 template< typename MT // Type of the adapted sparse matrix
2439  , bool SO > // Storage order of the adapted sparse matrix
2441  HermitianMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2442 {
2443  return Iterator( matrix_.lowerBound( i, j ), matrix_, ( SO ? j : i ) );
2444 }
2446 //*************************************************************************************************
2447 
2448 
2449 //*************************************************************************************************
2465 template< typename MT // Type of the adapted sparse matrix
2466  , bool SO > // Storage order of the adapted sparse matrix
2468  HermitianMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2469 {
2470  return matrix_.lowerBound( i, j );
2471 }
2473 //*************************************************************************************************
2474 
2475 
2476 //*************************************************************************************************
2492 template< typename MT // Type of the adapted sparse matrix
2493  , bool SO > // Storage order of the adapted sparse matrix
2495  HermitianMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2496 {
2497  return Iterator( matrix_.upperBound( i, j ), matrix_, ( SO ? j : i ) );
2498 }
2500 //*************************************************************************************************
2501 
2502 
2503 //*************************************************************************************************
2519 template< typename MT // Type of the adapted sparse matrix
2520  , bool SO > // Storage order of the adapted sparse matrix
2522  HermitianMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2523 {
2524  return matrix_.upperBound( i, j );
2525 }
2527 //*************************************************************************************************
2528 
2529 
2530 
2531 
2532 //=================================================================================================
2533 //
2534 // NUMERIC FUNCTIONS
2535 //
2536 //=================================================================================================
2537 
2538 //*************************************************************************************************
2544 template< typename MT // Type of the adapted sparse matrix
2545  , bool SO > // Storage order of the adapted sparse matrix
2546 inline HermitianMatrix<MT,SO,false>& HermitianMatrix<MT,SO,false>::transpose()
2547 {
2548  if( IsComplex_v<ElementType> )
2549  matrix_.transpose();
2550  return *this;
2551 }
2553 //*************************************************************************************************
2554 
2555 
2556 //*************************************************************************************************
2562 template< typename MT // Type of the adapted sparse matrix
2563  , bool SO > // Storage order of the adapted sparse matrix
2564 inline HermitianMatrix<MT,SO,false>& HermitianMatrix<MT,SO,false>::ctranspose()
2565 {
2566  return *this;
2567 }
2569 //*************************************************************************************************
2570 
2571 
2572 //*************************************************************************************************
2590 template< typename MT // Type of the adapted sparse matrix
2591  , bool SO > // Storage order of the adapted sparse matrix
2592 template< typename Other > // Data type of the scalar value
2593 inline HermitianMatrix<MT,SO,false>&
2594  HermitianMatrix<MT,SO,false>::scale( const Other& scalar )
2595 {
2596  matrix_.scale( scalar );
2597  return *this;
2598 }
2600 //*************************************************************************************************
2601 
2602 
2603 
2604 
2605 //=================================================================================================
2606 //
2607 // DEBUGGING FUNCTIONS
2608 //
2609 //=================================================================================================
2610 
2611 //*************************************************************************************************
2621 template< typename MT // Type of the adapted sparse matrix
2622  , bool SO > // Storage order of the adapted sparse matrix
2623 inline bool HermitianMatrix<MT,SO,false>::isIntact() const noexcept
2624 {
2625  using blaze::isIntact;
2626 
2627  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2628 }
2630 //*************************************************************************************************
2631 
2632 
2633 
2634 
2635 //=================================================================================================
2636 //
2637 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2638 //
2639 //=================================================================================================
2640 
2641 //*************************************************************************************************
2652 template< typename MT // Type of the adapted sparse matrix
2653  , bool SO > // Storage order of the adapted sparse matrix
2654 template< typename Other > // Data type of the foreign expression
2655 inline bool HermitianMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2656 {
2657  return matrix_.canAlias( alias );
2658 }
2660 //*************************************************************************************************
2661 
2662 
2663 //*************************************************************************************************
2674 template< typename MT // Type of the adapted sparse matrix
2675  , bool SO > // Storage order of the adapted sparse matrix
2676 template< typename Other > // Data type of the foreign expression
2677 inline bool HermitianMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2678 {
2679  return matrix_.isAliased( alias );
2680 }
2682 //*************************************************************************************************
2683 
2684 
2685 //*************************************************************************************************
2696 template< typename MT // Type of the adapted sparse matrix
2697  , bool SO > // Storage order of the adapted sparse matrix
2698 inline bool HermitianMatrix<MT,SO,false>::canSMPAssign() const noexcept
2699 {
2700  return matrix_.canSMPAssign();
2701 }
2703 //*************************************************************************************************
2704 
2705 
2706 
2707 
2708 //=================================================================================================
2709 //
2710 // CONSTRUCTION FUNCTIONS
2711 //
2712 //=================================================================================================
2713 
2714 //*************************************************************************************************
2716 template< typename MT // Type of the adapted dense matrix
2717  , bool SO > // Storage order of the adapted dense matrix
2718 template< typename MT2 // Type of the foreign matrix
2719  , bool SO2 // Storage order of the foreign matrix
2720  , typename T > // Type of the third argument
2721 inline decltype(auto) HermitianMatrix<MT,SO,false>::construct( const Matrix<MT2,SO2>& m, T )
2722 {
2723  return ~m;
2724 }
2726 //*************************************************************************************************
2727 
2728 
2729 //*************************************************************************************************
2731 template< typename MT // Type of the adapted dense matrix
2732  , bool SO > // Storage order of the adapted dense matrix
2733 template< typename MT2 > // Type of the foreign matrix
2734 inline decltype(auto) HermitianMatrix<MT,SO,false>::construct( const Matrix<MT2,!SO>& m, TrueType )
2735 {
2736  return trans( ~m );
2737 }
2739 //*************************************************************************************************
2740 
2741 } // namespace blaze
2742 
2743 #endif
bool isReal(const DiagonalProxy< MT > &proxy)
Returns whether the matrix element represents a real number.
Definition: DiagonalProxy.h:653
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3078
#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
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Header file for the isZero shim.
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5828
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:1539
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
Header file for the extended initializer_list functionality.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Constraint on the data type.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Constraint on the data type.
Constraint on the data type.
Header file for the SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:673
Header file for the implementation of a matrix representation of an initializer list.
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5890
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
Constraint on the data type.
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Header file for the implementation of the base template of the HeritianMatrix.
Header file for all forward declarations for expression class templates.
Header file for the HermitianElement class.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:617
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
Constraint on the data type.
Constraint on the data type.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
Header file for the HermitianProxy class.
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
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:631
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1326
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
Header file for the IsHermitian type trait.
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Header file for the Size 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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
Header file for the TrueType type/value trait base class.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825