Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UPPERMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_UPPERMATRIX_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <vector>
57 #include <blaze/math/shims/Clear.h>
59 #include <blaze/math/shims/Move.h>
66 #include <blaze/util/Assert.h>
71 #include <blaze/util/DisableIf.h>
72 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/Exception.h>
76 #include <blaze/util/Types.h>
77 
78 
79 namespace blaze {
80 
81 //=================================================================================================
82 //
83 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
84 //
85 //=================================================================================================
86 
87 //*************************************************************************************************
95 template< typename MT // Type of the adapted sparse matrix
96  , bool SO > // Storage order of the adapted sparse matrix
97 class UpperMatrix<MT,SO,false>
98  : public SparseMatrix< UpperMatrix<MT,SO,false>, SO >
99 {
100  private:
101  //**Type definitions****************************************************************************
102  typedef typename MT::OppositeType OT;
103  typedef typename MT::TransposeType TT;
104  typedef typename MT::ElementType ET;
105  //**********************************************************************************************
106 
107  public:
108  //**Type definitions****************************************************************************
109  typedef UpperMatrix<MT,SO,false> This;
110  typedef This ResultType;
111  typedef UpperMatrix<OT,!SO,false> OppositeType;
112  typedef LowerMatrix<TT,!SO,false> TransposeType;
113  typedef ET ElementType;
114  typedef typename MT::ReturnType ReturnType;
115  typedef const This& CompositeType;
116  typedef UpperProxy<MT> Reference;
117  typedef typename MT::ConstReference ConstReference;
118  typedef typename MT::Iterator Iterator;
119  typedef typename MT::ConstIterator ConstIterator;
120  //**********************************************************************************************
121 
122  //**Rebind struct definition********************************************************************
125  template< typename ET > // Data type of the other matrix
126  struct Rebind {
128  typedef UpperMatrix< typename MT::template Rebind<ET>::Other > Other;
129  };
130  //**********************************************************************************************
131 
132  //**Compilation flags***************************************************************************
134  enum { smpAssignable = 0 };
135  //**********************************************************************************************
136 
137  //**Constructors********************************************************************************
140  explicit inline UpperMatrix();
141  explicit inline UpperMatrix( size_t n );
142  explicit inline UpperMatrix( size_t n, size_t nonzeros );
143  explicit inline UpperMatrix( size_t n, const std::vector<size_t>& nonzeros );
144 
145  inline UpperMatrix( const UpperMatrix& m );
146  template< typename MT2, bool SO2 > inline UpperMatrix( const Matrix<MT2,SO2>& m );
148  //**********************************************************************************************
149 
150  //**Destructor**********************************************************************************
151  // No explicitly declared destructor.
152  //**********************************************************************************************
153 
154  //**Data access functions***********************************************************************
157  inline Reference operator()( size_t i, size_t j );
158  inline ConstReference operator()( size_t i, size_t j ) const;
159  inline Reference at( size_t i, size_t j );
160  inline ConstReference at( size_t i, size_t j ) const;
161  inline Iterator begin ( size_t i );
162  inline ConstIterator begin ( size_t i ) const;
163  inline ConstIterator cbegin( size_t i ) const;
164  inline Iterator end ( size_t i );
165  inline ConstIterator end ( size_t i ) const;
166  inline ConstIterator cend ( size_t i ) const;
168  //**********************************************************************************************
169 
170  //**Assignment operators************************************************************************
173  inline UpperMatrix& operator=( const UpperMatrix& rhs );
174 
175  template< typename MT2, bool SO2 >
176  inline typename DisableIf< IsComputation<MT2>, UpperMatrix& >::Type
177  operator=( const Matrix<MT2,SO2>& rhs );
178 
179  template< typename MT2, bool SO2 >
180  inline typename EnableIf< IsComputation<MT2>, UpperMatrix& >::Type
181  operator=( const Matrix<MT2,SO2>& rhs );
182 
183  template< typename MT2, bool SO2 >
184  inline typename DisableIf< IsComputation<MT2>, UpperMatrix& >::Type
185  operator+=( const Matrix<MT2,SO2>& rhs );
186 
187  template< typename MT2, bool SO2 >
188  inline typename EnableIf< IsComputation<MT2>, UpperMatrix& >::Type
189  operator+=( const Matrix<MT2,SO2>& rhs );
190 
191  template< typename MT2, bool SO2 >
192  inline typename DisableIf< IsComputation<MT2>, UpperMatrix& >::Type
193  operator-=( const Matrix<MT2,SO2>& rhs );
194 
195  template< typename MT2, bool SO2 >
196  inline typename EnableIf< IsComputation<MT2>, UpperMatrix& >::Type
197  operator-=( const Matrix<MT2,SO2>& rhs );
198 
199  template< typename MT2, bool SO2 >
200  inline UpperMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
201 
202  template< typename Other >
203  inline typename EnableIf< IsNumeric<Other>, UpperMatrix >::Type&
204  operator*=( Other rhs );
205 
206  template< typename Other >
207  inline typename EnableIf< IsNumeric<Other>, UpperMatrix >::Type&
208  operator/=( Other rhs );
210  //**********************************************************************************************
211 
212  //**Utility functions***************************************************************************
215  inline size_t rows() const;
216  inline size_t columns() const;
217  inline size_t capacity() const;
218  inline size_t capacity( size_t i ) const;
219  inline size_t nonZeros() const;
220  inline size_t nonZeros( size_t i ) const;
221  inline void reset();
222  inline void reset( size_t i );
223  inline void clear();
224  inline Iterator set( size_t i, size_t j, const ElementType& value );
225  inline Iterator insert( size_t i, size_t j, const ElementType& value );
226  inline void erase( size_t i, size_t j );
227  inline Iterator erase( size_t i, Iterator pos );
228  inline Iterator erase( size_t i, Iterator first, Iterator last );
229  inline void resize ( size_t n, bool preserve=true );
230  inline void reserve( size_t nonzeros );
231  inline void reserve( size_t i, size_t nonzeros );
232  inline void trim();
233  inline void trim( size_t i );
234  template< typename Other > inline UpperMatrix& scale( const Other& scalar );
235  template< typename Other > inline UpperMatrix& scaleDiagonal( Other scale );
236  inline void swap( UpperMatrix& m ) /* throw() */;
237 
238  static inline size_t maxNonZeros();
239  static inline size_t maxNonZeros( size_t n );
241  //**********************************************************************************************
242 
243  //**Lookup functions****************************************************************************
246  inline Iterator find ( size_t i, size_t j );
247  inline ConstIterator find ( size_t i, size_t j ) const;
248  inline Iterator lowerBound( size_t i, size_t j );
249  inline ConstIterator lowerBound( size_t i, size_t j ) const;
250  inline Iterator upperBound( size_t i, size_t j );
251  inline ConstIterator upperBound( size_t i, size_t j ) const;
253  //**********************************************************************************************
254 
255  //**Low-level utility functions*****************************************************************
258  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
259  inline void finalize( size_t i );
261  //**********************************************************************************************
262 
263  //**Debugging functions*************************************************************************
266  inline bool isIntact() const;
268  //**********************************************************************************************
269 
270  //**Expression template evaluation functions****************************************************
273  template< typename Other > inline bool canAlias ( const Other* alias ) const;
274  template< typename Other > inline bool isAliased( const Other* alias ) const;
275 
276  inline bool canSMPAssign() const;
278  //**********************************************************************************************
279 
280  private:
281  //**Utility functions***************************************************************************
284  inline void resetLower();
286  //**********************************************************************************************
287 
288  //**Member variables****************************************************************************
291  MT matrix_;
292 
293  //**********************************************************************************************
294 
295  //**Friend declarations*************************************************************************
296  template< typename MT2, bool SO2, bool DF2 >
297  friend bool isDefault( const UpperMatrix<MT2,SO2,DF2>& m );
298 
299  template< typename MT2, bool SO2, bool DF2 >
300  friend MT2& derestrict( UpperMatrix<MT2,SO2,DF2>& m );
301  //**********************************************************************************************
302 
303  //**Compile time checks*************************************************************************
316  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
317  //**********************************************************************************************
318 };
320 //*************************************************************************************************
321 
322 
323 
324 
325 //=================================================================================================
326 //
327 // CONSTRUCTORS
328 //
329 //=================================================================================================
330 
331 //*************************************************************************************************
335 template< typename MT // Type of the adapted sparse matrix
336  , bool SO > // Storage order of the adapted sparse matrix
337 inline UpperMatrix<MT,SO,false>::UpperMatrix()
338  : matrix_() // The adapted sparse matrix
339 {
340  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
341 }
343 //*************************************************************************************************
344 
345 
346 //*************************************************************************************************
354 template< typename MT // Type of the adapted sparse matrix
355  , bool SO > // Storage order of the adapted sparse matrix
356 inline UpperMatrix<MT,SO,false>::UpperMatrix( size_t n )
357  : matrix_( n, n ) // The adapted sparse matrix
358 {
360 
361  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
362 }
364 //*************************************************************************************************
365 
366 
367 //*************************************************************************************************
376 template< typename MT // Type of the adapted sparse matrix
377  , bool SO > // Storage order of the adapted sparse matrix
378 inline UpperMatrix<MT,SO,false>::UpperMatrix( size_t n, size_t nonzeros )
379  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
380 {
382 
383  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
384 }
386 //*************************************************************************************************
387 
388 
389 //*************************************************************************************************
400 template< typename MT // Type of the adapted sparse matrix
401  , bool SO > // Storage order of the adapted sparse matrix
402 inline UpperMatrix<MT,SO,false>::UpperMatrix( size_t n, const std::vector<size_t>& nonzeros )
403  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
404 {
406 
407  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
408 }
410 //*************************************************************************************************
411 
412 
413 //*************************************************************************************************
419 template< typename MT // Type of the adapted sparse matrix
420  , bool SO > // Storage order of the adapted sparse matrix
421 inline UpperMatrix<MT,SO,false>::UpperMatrix( const UpperMatrix& m )
422  : matrix_( m.matrix_ ) // The adapted sparse matrix
423 {
424  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
425  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
426 }
428 //*************************************************************************************************
429 
430 
431 //*************************************************************************************************
441 template< typename MT // Type of the adapted sparse matrix
442  , bool SO > // Storage order of the adapted sparse matrix
443 template< typename MT2 // Type of the foreign matrix
444  , bool SO2 > // Storage order of the foreign matrix
445 inline UpperMatrix<MT,SO,false>::UpperMatrix( const Matrix<MT2,SO2>& m )
446  : matrix_( ~m ) // The adapted sparse matrix
447 {
448  if( !IsUpper<MT2>::value && !isUpper( matrix_ ) ) {
449  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
450  }
451 
452  if( !IsUpper<MT2>::value )
453  resetLower();
454 
455  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
456  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
457 }
459 //*************************************************************************************************
460 
461 
462 
463 
464 //=================================================================================================
465 //
466 // DATA ACCESS FUNCTIONS
467 //
468 //=================================================================================================
469 
470 //*************************************************************************************************
486 template< typename MT // Type of the adapted sparse matrix
487  , bool SO > // Storage order of the adapted sparse matrix
489  UpperMatrix<MT,SO,false>::operator()( size_t i, size_t j )
490 {
491  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
492  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
493 
494  return Reference( matrix_, i, j );
495 }
497 //*************************************************************************************************
498 
499 
500 //*************************************************************************************************
516 template< typename MT // Type of the adapted sparse matrix
517  , bool SO > // Storage order of the adapted sparse matrix
519  UpperMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
520 {
521  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
522  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
523 
524  return matrix_(i,j);
525 }
527 //*************************************************************************************************
528 
529 
530 //*************************************************************************************************
547 template< typename MT // Type of the adapted sparse matrix
548  , bool SO > // Storage order of the adapted sparse matrix
550  UpperMatrix<MT,SO,false>::at( size_t i, size_t j )
551 {
552  if( i >= rows() ) {
553  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
554  }
555  if( j >= columns() ) {
556  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
557  }
558  return (*this)(i,j);
559 }
561 //*************************************************************************************************
562 
563 
564 //*************************************************************************************************
581 template< typename MT // Type of the adapted sparse matrix
582  , bool SO > // Storage order of the adapted sparse matrix
584  UpperMatrix<MT,SO,false>::at( size_t i, size_t j ) const
585 {
586  if( i >= rows() ) {
587  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
588  }
589  if( j >= columns() ) {
590  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
591  }
592  return (*this)(i,j);
593 }
595 //*************************************************************************************************
596 
597 
598 //*************************************************************************************************
610 template< typename MT // Type of the adapted sparse matrix
611  , bool SO > // Storage order of the adapted sparse matrix
614 {
615  return matrix_.begin(i);
616 }
618 //*************************************************************************************************
619 
620 
621 //*************************************************************************************************
633 template< typename MT // Type of the adapted sparse matrix
634  , bool SO > // Storage order of the adapted sparse matrix
636  UpperMatrix<MT,SO,false>::begin( size_t i ) const
637 {
638  return matrix_.begin(i);
639 }
641 //*************************************************************************************************
642 
643 
644 //*************************************************************************************************
656 template< typename MT // Type of the adapted sparse matrix
657  , bool SO > // Storage order of the adapted sparse matrix
659  UpperMatrix<MT,SO,false>::cbegin( size_t i ) const
660 {
661  return matrix_.cbegin(i);
662 }
664 //*************************************************************************************************
665 
666 
667 //*************************************************************************************************
679 template< typename MT // Type of the adapted sparse matrix
680  , bool SO > // Storage order of the adapted sparse matrix
683 {
684  return matrix_.end(i);
685 }
687 //*************************************************************************************************
688 
689 
690 //*************************************************************************************************
702 template< typename MT // Type of the adapted sparse matrix
703  , bool SO > // Storage order of the adapted sparse matrix
705  UpperMatrix<MT,SO,false>::end( size_t i ) const
706 {
707  return matrix_.end(i);
708 }
710 //*************************************************************************************************
711 
712 
713 //*************************************************************************************************
725 template< typename MT // Type of the adapted sparse matrix
726  , bool SO > // Storage order of the adapted sparse matrix
728  UpperMatrix<MT,SO,false>::cend( size_t i ) const
729 {
730  return matrix_.cend(i);
731 }
733 //*************************************************************************************************
734 
735 
736 
737 
738 //=================================================================================================
739 //
740 // ASSIGNMENT OPERATORS
741 //
742 //=================================================================================================
743 
744 //*************************************************************************************************
754 template< typename MT // Type of the adapted sparse matrix
755  , bool SO > // Storage order of the adapted sparse matrix
756 inline UpperMatrix<MT,SO,false>&
757  UpperMatrix<MT,SO,false>::operator=( const UpperMatrix& rhs )
758 {
759  matrix_ = rhs.matrix_;
760 
761  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
762  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
763 
764  return *this;
765 }
767 //*************************************************************************************************
768 
769 
770 //*************************************************************************************************
783 template< typename MT // Type of the adapted sparse matrix
784  , bool SO > // Storage order of the adapted sparse matrix
785 template< typename MT2 // Type of the right-hand side matrix
786  , bool SO2 > // Storage order of the right-hand side matrix
787 inline typename DisableIf< IsComputation<MT2>, UpperMatrix<MT,SO,false>& >::Type
788  UpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
789 {
790  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
791  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
792  }
793 
794  matrix_ = ~rhs;
795 
796  if( !IsUpper<MT2>::value )
797  resetLower();
798 
799  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
800  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
801 
802  return *this;
803 }
805 //*************************************************************************************************
806 
807 
808 //*************************************************************************************************
821 template< typename MT // Type of the adapted sparse matrix
822  , bool SO > // Storage order of the adapted sparse matrix
823 template< typename MT2 // Type of the right-hand side matrix
824  , bool SO2 > // Storage order of the right-hand side matrix
825 inline typename EnableIf< IsComputation<MT2>, UpperMatrix<MT,SO,false>& >::Type
826  UpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
827 {
828  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
829  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
830  }
831 
832  if( IsUpper<MT2>::value ) {
833  matrix_ = ~rhs;
834  }
835  else {
836  MT tmp( ~rhs );
837 
838  if( !isUpper( tmp ) ) {
839  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
840  }
841 
842  move( matrix_, tmp );
843  }
844 
845  if( !IsUpper<MT2>::value )
846  resetLower();
847 
848  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
849  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
850 
851  return *this;
852 }
854 //*************************************************************************************************
855 
856 
857 //*************************************************************************************************
870 template< typename MT // Type of the adapted sparse matrix
871  , bool SO > // Storage order of the adapted sparse matrix
872 template< typename MT2 // Type of the right-hand side matrix
873  , bool SO2 > // Storage order of the right-hand side matrix
874 inline typename DisableIf< IsComputation<MT2>, UpperMatrix<MT,SO,false>& >::Type
875  UpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
876 {
877  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
878  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
879  }
880 
881  matrix_ += ~rhs;
882 
883  if( !IsUpper<MT2>::value )
884  resetLower();
885 
886  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
887  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
888 
889  return *this;
890 }
892 //*************************************************************************************************
893 
894 
895 //*************************************************************************************************
908 template< typename MT // Type of the adapted sparse matrix
909  , bool SO > // Storage order of the adapted sparse matrix
910 template< typename MT2 // Type of the right-hand side matrix
911  , bool SO2 > // Storage order of the right-hand side matrix
912 inline typename EnableIf< IsComputation<MT2>, UpperMatrix<MT,SO,false>& >::Type
913  UpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
914 {
915  if( IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
916  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
917  }
918 
919  if( IsUpper<MT2>::value ) {
920  matrix_ += ~rhs;
921  }
922  else {
923  typename MT2::ResultType tmp( ~rhs );
924 
925  if( !isUpper( tmp ) ) {
926  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
927  }
928 
929  matrix_ += tmp;
930  }
931 
932  if( !IsUpper<MT2>::value )
933  resetLower();
934 
935  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
936  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
937 
938  return *this;
939 }
941 //*************************************************************************************************
942 
943 
944 //*************************************************************************************************
957 template< typename MT // Type of the adapted sparse matrix
958  , bool SO > // Storage order of the adapted sparse matrix
959 template< typename MT2 // Type of the right-hand side matrix
960  , bool SO2 > // Storage order of the right-hand side matrix
961 inline typename DisableIf< IsComputation<MT2>, UpperMatrix<MT,SO,false>& >::Type
962  UpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
963 {
964  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
965  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
966  }
967 
968  matrix_ -= ~rhs;
969 
970  if( !IsUpper<MT2>::value )
971  resetLower();
972 
973  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
974  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
975 
976  return *this;
977 }
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
995 template< typename MT // Type of the adapted sparse matrix
996  , bool SO > // Storage order of the adapted sparse matrix
997 template< typename MT2 // Type of the right-hand side matrix
998  , bool SO2 > // Storage order of the right-hand side matrix
999 inline typename EnableIf< IsComputation<MT2>, UpperMatrix<MT,SO,false>& >::Type
1000  UpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1001 {
1002  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1004  }
1005 
1006  if( IsUpper<MT2>::value ) {
1007  matrix_ -= ~rhs;
1008  }
1009  else {
1010  typename MT2::ResultType tmp( ~rhs );
1011 
1012  if( !isUpper( tmp ) ) {
1013  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1014  }
1015 
1016  matrix_ -= tmp;
1017  }
1018 
1019  if( !IsUpper<MT2>::value )
1020  resetLower();
1021 
1022  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1023  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1024 
1025  return *this;
1026 }
1028 //*************************************************************************************************
1029 
1030 
1031 //*************************************************************************************************
1043 template< typename MT // Type of the adapted sparse matrix
1044  , bool SO > // Storage order of the adapted sparse matrix
1045 template< typename MT2 // Type of the right-hand side matrix
1046  , bool SO2 > // Storage order of the right-hand side matrix
1047 inline UpperMatrix<MT,SO,false>&
1048  UpperMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1049 {
1050  if( matrix_.rows() != (~rhs).columns() ) {
1051  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1052  }
1053 
1054  MT tmp( matrix_ * ~rhs );
1055 
1056  if( !isUpper( tmp ) ) {
1057  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1058  }
1059 
1060  move( matrix_, tmp );
1061 
1062  if( !IsUpper<MT2>::value )
1063  resetLower();
1064 
1065  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1066  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1067 
1068  return *this;
1069 }
1071 //*************************************************************************************************
1072 
1073 
1074 //*************************************************************************************************
1082 template< typename MT // Type of the adapted sparse matrix
1083  , bool SO > // Storage order of the adapted sparse matrix
1084 template< typename Other > // Data type of the right-hand side scalar
1085 inline typename EnableIf< IsNumeric<Other>, UpperMatrix<MT,SO,false> >::Type&
1086  UpperMatrix<MT,SO,false>::operator*=( Other rhs )
1087 {
1088  matrix_ *= rhs;
1089  return *this;
1090 }
1091 //*************************************************************************************************
1092 
1093 
1094 //*************************************************************************************************
1102 template< typename MT // Type of the adapted sparse matrix
1103  , bool SO > // Storage order of the adapted sparse matrix
1104 template< typename Other > // Data type of the right-hand side scalar
1105 inline typename EnableIf< IsNumeric<Other>, UpperMatrix<MT,SO,false> >::Type&
1106  UpperMatrix<MT,SO,false>::operator/=( Other rhs )
1107 {
1108  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1109 
1110  matrix_ /= rhs;
1111  return *this;
1112 }
1114 //*************************************************************************************************
1115 
1116 
1117 
1118 
1119 //=================================================================================================
1120 //
1121 // UTILITY FUNCTIONS
1122 //
1123 //=================================================================================================
1124 
1125 //*************************************************************************************************
1131 template< typename MT // Type of the adapted sparse matrix
1132  , bool SO > // Storage order of the adapted sparse matrix
1133 inline size_t UpperMatrix<MT,SO,false>::rows() const
1134 {
1135  return matrix_.rows();
1136 }
1138 //*************************************************************************************************
1139 
1140 
1141 //*************************************************************************************************
1147 template< typename MT // Type of the adapted sparse matrix
1148  , bool SO > // Storage order of the adapted sparse matrix
1149 inline size_t UpperMatrix<MT,SO,false>::columns() const
1150 {
1151  return matrix_.columns();
1152 }
1154 //*************************************************************************************************
1155 
1156 
1157 //*************************************************************************************************
1163 template< typename MT // Type of the adapted sparse matrix
1164  , bool SO > // Storage order of the adapted sparse matrix
1165 inline size_t UpperMatrix<MT,SO,false>::capacity() const
1166 {
1167  return matrix_.capacity();
1168 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1185 template< typename MT // Type of the adapted sparse matrix
1186  , bool SO > // Storage order of the adapted sparse matrix
1187 inline size_t UpperMatrix<MT,SO,false>::capacity( size_t i ) const
1188 {
1189  return matrix_.capacity(i);
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 //*************************************************************************************************
1201 template< typename MT // Type of the adapted sparse matrix
1202  , bool SO > // Storage order of the adapted sparse matrix
1203 inline size_t UpperMatrix<MT,SO,false>::nonZeros() const
1204 {
1205  return matrix_.nonZeros();
1206 }
1208 //*************************************************************************************************
1209 
1210 
1211 //*************************************************************************************************
1223 template< typename MT // Type of the adapted sparse matrix
1224  , bool SO > // Storage order of the adapted sparse matrix
1225 inline size_t UpperMatrix<MT,SO,false>::nonZeros( size_t i ) const
1226 {
1227  return matrix_.nonZeros(i);
1228 }
1230 //*************************************************************************************************
1231 
1232 
1233 //*************************************************************************************************
1239 template< typename MT // Type of the adapted sparse matrix
1240  , bool SO > // Storage order of the adapted sparse matrix
1241 inline void UpperMatrix<MT,SO,false>::reset()
1242 {
1243  matrix_.reset();
1244 }
1246 //*************************************************************************************************
1247 
1248 
1249 //*************************************************************************************************
1262 template< typename MT // Type of the adapted sparse matrix
1263  , bool SO > // Storage order of the adapted sparse matrix
1264 inline void UpperMatrix<MT,SO,false>::reset( size_t i )
1265 {
1266  matrix_.reset( i );
1267 }
1269 //*************************************************************************************************
1270 
1271 
1272 //*************************************************************************************************
1280 template< typename MT // Type of the adapted sparse matrix
1281  , bool SO > // Storage order of the adapted sparse matrix
1282 inline void UpperMatrix<MT,SO,false>::clear()
1283 {
1284  using blaze::clear;
1285 
1286  clear( matrix_ );
1287 }
1289 //*************************************************************************************************
1290 
1291 
1292 //*************************************************************************************************
1308 template< typename MT // Type of the adapted sparse matrix
1309  , bool SO > // Storage order of the adapted sparse matrix
1310 inline typename UpperMatrix<MT,SO,false>::Iterator
1311  UpperMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1312 {
1313  if( i > j ) {
1314  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to lower matrix element" );
1315  }
1316 
1317  return matrix_.set( i, j, value );
1318 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1340 template< typename MT // Type of the adapted sparse matrix
1341  , bool SO > // Storage order of the adapted sparse matrix
1342 inline typename UpperMatrix<MT,SO,false>::Iterator
1343  UpperMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1344 {
1345  if( i > j ) {
1346  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to lower matrix element" );
1347  }
1348 
1349  return matrix_.insert( i, j, value );
1350 }
1352 //*************************************************************************************************
1353 
1354 
1355 //*************************************************************************************************
1365 template< typename MT // Type of the adapted sparse matrix
1366  , bool SO > // Storage order of the adapted sparse matrix
1367 inline void UpperMatrix<MT,SO,false>::erase( size_t i, size_t j )
1368 {
1369  matrix_.erase( i, j );
1370 }
1372 //*************************************************************************************************
1373 
1374 
1375 //*************************************************************************************************
1387 template< typename MT // Type of the adapted sparse matrix
1388  , bool SO > // Storage order of the adapted sparse matrix
1389 inline typename UpperMatrix<MT,SO,false>::Iterator
1390  UpperMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1391 {
1392  return matrix_.erase( i, pos );
1393 }
1395 //*************************************************************************************************
1396 
1397 
1398 //*************************************************************************************************
1411 template< typename MT // Type of the adapted sparse matrix
1412  , bool SO > // Storage order of the adapted sparse matrix
1413 inline typename UpperMatrix<MT,SO,false>::Iterator
1414  UpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1415 {
1416  return matrix_.erase( i, first, last );
1417 }
1419 //*************************************************************************************************
1420 
1421 
1422 //*************************************************************************************************
1437 template< typename MT // Type of the adapted sparse matrix
1438  , bool SO > // Storage order of the adapted sparse matrix
1439 void UpperMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1440 {
1442 
1443  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1444 
1445  matrix_.resize( n, n, preserve );
1446 }
1448 //*************************************************************************************************
1449 
1450 
1451 //*************************************************************************************************
1462 template< typename MT // Type of the adapted sparse matrix
1463  , bool SO > // Storage order of the adapted sparse matrix
1464 inline void UpperMatrix<MT,SO,false>::reserve( size_t nonzeros )
1465 {
1466  matrix_.reserve( nonzeros );
1467 }
1469 //*************************************************************************************************
1470 
1471 
1472 //*************************************************************************************************
1486 template< typename MT // Type of the adapted sparse matrix
1487  , bool SO > // Storage order of the adapted sparse matrix
1488 inline void UpperMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1489 {
1490  matrix_.reserve( i, nonzeros );
1491 }
1493 //*************************************************************************************************
1494 
1495 
1496 //*************************************************************************************************
1507 template< typename MT // Type of the adapted sparse matrix
1508  , bool SO > // Storage order of the adapted sparse matrix
1509 inline void UpperMatrix<MT,SO,false>::trim()
1510 {
1511  matrix_.trim();
1512 }
1514 //*************************************************************************************************
1515 
1516 
1517 //*************************************************************************************************
1529 template< typename MT // Type of the adapted sparse matrix
1530  , bool SO > // Storage order of the adapted sparse matrix
1531 inline void UpperMatrix<MT,SO,false>::trim( size_t i )
1532 {
1533  matrix_.trim( i );
1534 }
1536 //*************************************************************************************************
1537 
1538 
1539 //*************************************************************************************************
1546 template< typename MT // Type of the adapted sparse matrix
1547  , bool SO > // Storage order of the adapted sparse matrix
1548 template< typename Other > // Data type of the scalar value
1549 inline UpperMatrix<MT,SO,false>&
1550  UpperMatrix<MT,SO,false>::scale( const Other& scalar )
1551 {
1552  matrix_.scale( scalar );
1553  return *this;
1554 }
1556 //*************************************************************************************************
1557 
1558 
1559 //*************************************************************************************************
1566 template< typename MT // Type of the adapted sparse matrix
1567  , bool SO > // Storage order of the adapted sparse matrix
1568 template< typename Other > // Data type of the scalar value
1569 inline UpperMatrix<MT,SO,false>&
1570  UpperMatrix<MT,SO,false>::scaleDiagonal( Other scalar )
1571 {
1572  matrix_.scaleDiagonal( scalar );
1573  return *this;
1574 }
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1587 template< typename MT // Type of the adapted sparse matrix
1588  , bool SO > // Storage order of the adapted sparse matrix
1589 inline void UpperMatrix<MT,SO,false>::swap( UpperMatrix& m ) /* throw() */
1590 {
1591  using std::swap;
1592 
1593  swap( matrix_, m.matrix_ );
1594 }
1596 //*************************************************************************************************
1597 
1598 
1599 //*************************************************************************************************
1610 template< typename MT // Type of the adapted dense matrix
1611  , bool SO > // Storage order of the adapted dense matrix
1612 inline size_t UpperMatrix<MT,SO,false>::maxNonZeros()
1613 {
1615 
1616  return maxNonZeros( Rows<MT>::value );
1617 }
1619 //*************************************************************************************************
1620 
1621 
1622 //*************************************************************************************************
1632 template< typename MT // Type of the adapted dense matrix
1633  , bool SO > // Storage order of the adapted dense matrix
1634 inline size_t UpperMatrix<MT,SO,false>::maxNonZeros( size_t n )
1635 {
1636  return ( ( n + 1UL ) * n ) / 2UL;
1637 }
1639 //*************************************************************************************************
1640 
1641 
1642 //*************************************************************************************************
1648 template< typename MT // Type of the adapted dense matrix
1649  , bool SO > // Storage order of the adapted dense matrix
1650 inline void UpperMatrix<MT,SO,false>::resetLower()
1651 {
1652  if( SO ) {
1653  for( size_t j=0UL; j<columns(); ++j )
1654  matrix_.erase( j, matrix_.upperBound( j, j ), matrix_.end( j ) );
1655  }
1656  else {
1657  for( size_t i=1UL; i<rows(); ++i )
1658  matrix_.erase( i, matrix_.begin( i ), matrix_.lowerBound( i, i ) );
1659  }
1660 }
1662 //*************************************************************************************************
1663 
1664 
1665 
1666 
1667 //=================================================================================================
1668 //
1669 // LOOKUP FUNCTIONS
1670 //
1671 //=================================================================================================
1672 
1673 //*************************************************************************************************
1689 template< typename MT // Type of the adapted sparse matrix
1690  , bool SO > // Storage order of the adapted sparse matrix
1691 inline typename UpperMatrix<MT,SO,false>::Iterator
1692  UpperMatrix<MT,SO,false>::find( size_t i, size_t j )
1693 {
1694  return matrix_.find( i, j );
1695 }
1697 //*************************************************************************************************
1698 
1699 
1700 //*************************************************************************************************
1716 template< typename MT // Type of the adapted sparse matrix
1717  , bool SO > // Storage order of the adapted sparse matrix
1719  UpperMatrix<MT,SO,false>::find( size_t i, size_t j ) const
1720 {
1721  return matrix_.find( i, j );
1722 }
1724 //*************************************************************************************************
1725 
1726 
1727 //*************************************************************************************************
1743 template< typename MT // Type of the adapted sparse matrix
1744  , bool SO > // Storage order of the adapted sparse matrix
1745 inline typename UpperMatrix<MT,SO,false>::Iterator
1746  UpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
1747 {
1748  return matrix_.lowerBound( i, j );
1749 }
1751 //*************************************************************************************************
1752 
1753 
1754 //*************************************************************************************************
1770 template< typename MT // Type of the adapted sparse matrix
1771  , bool SO > // Storage order of the adapted sparse matrix
1773  UpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
1774 {
1775  return matrix_.lowerBound( i, j );
1776 }
1778 //*************************************************************************************************
1779 
1780 
1781 //*************************************************************************************************
1797 template< typename MT // Type of the adapted sparse matrix
1798  , bool SO > // Storage order of the adapted sparse matrix
1799 inline typename UpperMatrix<MT,SO,false>::Iterator
1800  UpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
1801 {
1802  return matrix_.upperBound( i, j );
1803 }
1805 //*************************************************************************************************
1806 
1807 
1808 //*************************************************************************************************
1824 template< typename MT // Type of the adapted sparse matrix
1825  , bool SO > // Storage order of the adapted sparse matrix
1827  UpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
1828 {
1829  return matrix_.upperBound( i, j );
1830 }
1832 //*************************************************************************************************
1833 
1834 
1835 
1836 
1837 //=================================================================================================
1838 //
1839 // LOW-LEVEL UTILITY FUNCTIONS
1840 //
1841 //=================================================================================================
1842 
1843 //*************************************************************************************************
1893 template< typename MT // Type of the adapted sparse matrix
1894  , bool SO > // Storage order of the adapted sparse matrix
1895 inline void UpperMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1896 {
1897  if( i > j ) {
1898  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to lower matrix element" );
1899  }
1900 
1901  matrix_.append( i, j, value, check );
1902 }
1904 //*************************************************************************************************
1905 
1906 
1907 //*************************************************************************************************
1921 template< typename MT // Type of the adapted sparse matrix
1922  , bool SO > // Storage order of the adapted sparse matrix
1923 inline void UpperMatrix<MT,SO,false>::finalize( size_t i )
1924 {
1925  matrix_.finalize( i );
1926 }
1928 //*************************************************************************************************
1929 
1930 
1931 
1932 
1933 //=================================================================================================
1934 //
1935 // DEBUGGING FUNCTIONS
1936 //
1937 //=================================================================================================
1938 
1939 //*************************************************************************************************
1949 template< typename MT // Type of the adapted sparse matrix
1950  , bool SO > // Storage order of the adapted sparse matrix
1951 inline bool UpperMatrix<MT,SO,false>::isIntact() const
1952 {
1953  using blaze::isIntact;
1954 
1955  return ( isIntact( matrix_ ) && isUpper( matrix_ ) );
1956 }
1958 //*************************************************************************************************
1959 
1960 
1961 
1962 
1963 //=================================================================================================
1964 //
1965 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1966 //
1967 //=================================================================================================
1968 
1969 //*************************************************************************************************
1980 template< typename MT // Type of the adapted sparse matrix
1981  , bool SO > // Storage order of the adapted sparse matrix
1982 template< typename Other > // Data type of the foreign expression
1983 inline bool UpperMatrix<MT,SO,false>::canAlias( const Other* alias ) const
1984 {
1985  return matrix_.canAlias( alias );
1986 }
1988 //*************************************************************************************************
1989 
1990 
1991 //*************************************************************************************************
2002 template< typename MT // Type of the adapted sparse matrix
2003  , bool SO > // Storage order of the adapted sparse matrix
2004 template< typename Other > // Data type of the foreign expression
2005 inline bool UpperMatrix<MT,SO,false>::isAliased( const Other* alias ) const
2006 {
2007  return matrix_.isAliased( alias );
2008 }
2010 //*************************************************************************************************
2011 
2012 
2013 //*************************************************************************************************
2024 template< typename MT // Type of the adapted sparse matrix
2025  , bool SO > // Storage order of the adapted sparse matrix
2026 inline bool UpperMatrix<MT,SO,false>::canSMPAssign() const
2027 {
2028  return matrix_.canSMPAssign();
2029 }
2031 //*************************************************************************************************
2032 
2033 } // namespace blaze
2034 
2035 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:116
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
#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 Rows type trait.
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:603
BLAZE_ALWAYS_INLINE 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:229
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:5016
BLAZE_ALWAYS_INLINE 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:292
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:250
#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:81
Constraint on the data type.
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4926
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2582
#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:116
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:378
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of the base template of the UpperMatrix.
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.
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Compile time assertion.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:4980
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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:116
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the Columns type trait.
Constraint on the data type.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1277
Constraints on the storage order of matrix types.
#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:118
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:187
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the UpperProxy class.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Header file for the IsNumeric type trait.
Header file for all adaptor forward declarations.
#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:116
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#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:118
#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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a 'resize' member fu...
Definition: Resizable.h:118
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Header file for the move shim.
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:79
Header file for the IsComputation type trait class.
#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:118
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
#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:116
Header file for the IsUpper type trait.
Header file for exception macros.
#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:143
#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:79