Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_BAND_DENSE_H_
36 #define _BLAZE_MATH_VIEWS_BAND_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <iterator>
45 #include <blaze/math/Aliases.h>
55 #include <blaze/math/Exception.h>
60 #include <blaze/math/shims/Clear.h>
81 #include <blaze/math/views/Check.h>
83 #include <blaze/util/Assert.h>
86 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/TypeList.h>
88 #include <blaze/util/Types.h>
92 
93 
94 namespace blaze {
95 
96 //=================================================================================================
97 //
98 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
99 //
100 //=================================================================================================
101 
102 //*************************************************************************************************
109 template< typename MT // Type of the dense matrix
110  , bool TF // Transpose flag
111  , ptrdiff_t... CBAs > // Compile time band arguments
112 class Band<MT,TF,true,false,CBAs...>
113  : public View< DenseVector< Band<MT,TF,true,false,CBAs...>, TF > >
114  , private BandData<CBAs...>
115 {
116  private:
117  //**Type definitions****************************************************************************
118  using RT = ResultType_t<MT>;
119  using DataType = BandData<CBAs...>;
120  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
121  //**********************************************************************************************
122 
123  public:
124  //**Type definitions****************************************************************************
126  using This = Band<MT,TF,true,false,CBAs...>;
127 
128  using BaseType = DenseVector<This,TF>;
129  using ViewedType = MT;
130  using ResultType = BandTrait_t<RT,CBAs...>;
131  using TransposeType = TransposeType_t<ResultType>;
132  using ElementType = ElementType_t<MT>;
133  using ReturnType = ReturnType_t<MT>;
134 
136  using CompositeType = If_t< RequiresEvaluation_v<MT>, const ResultType, const Band& >;
137 
139  using ConstReference = ConstReference_t<MT>;
140 
142  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
143 
145  using ConstPointer = ConstPointer_t<MT>;
146 
148  using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
149  //**********************************************************************************************
150 
151  //**BandIterator class definition***************************************************************
154  template< typename MatrixType // Type of the dense matrix
155  , typename IteratorType > // Type of the dense matrix iterator
156  class BandIterator
157  {
158  public:
159  //**Type definitions*************************************************************************
161  using IteratorCategory = typename std::iterator_traits<IteratorType>::iterator_category;
162 
164  using ValueType = typename std::iterator_traits<IteratorType>::value_type;
165 
167  using PointerType = typename std::iterator_traits<IteratorType>::pointer;
168 
170  using ReferenceType = typename std::iterator_traits<IteratorType>::reference;
171 
173  using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
174 
175  // STL iterator requirements
176  using iterator_category = IteratorCategory;
177  using value_type = ValueType;
178  using pointer = PointerType;
179  using reference = ReferenceType;
180  using difference_type = DifferenceType;
181  //*******************************************************************************************
182 
183  //**Constructor******************************************************************************
186  inline BandIterator() noexcept
187  : matrix_( nullptr ) // The dense matrix containing the band
188  , row_ ( 0UL ) // The current row index
189  , column_( 0UL ) // The current column index
190  , pos_ ( ) // Iterator to the current dense element
191  {}
192  //*******************************************************************************************
193 
194  //**Constructor******************************************************************************
201  inline BandIterator( MatrixType& matrix, size_t rowIndex, size_t columnIndex ) noexcept
202  : matrix_( &matrix ) // The dense matrix containing the band
203  , row_ ( rowIndex ) // The current row index
204  , column_( columnIndex ) // The current column index
205  , pos_ ( ) // Iterator to the current dense element
206  {
207  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
208  pos_ = matrix_->begin( row_ ) + column_;
209  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
210  pos_ = matrix_->begin( column_ ) + row_;
211  }
212  //*******************************************************************************************
213 
214  //**Constructor******************************************************************************
219  template< typename MatrixType2, typename IteratorType2 >
220  inline BandIterator( const BandIterator<MatrixType2,IteratorType2>& it ) noexcept
221  : matrix_( it.matrix_ ) // The dense matrix containing the band
222  , row_ ( it.row_ ) // The current row index
223  , column_( it.column_ ) // The current column index
224  , pos_ ( it.pos_ ) // Iterator to the current dense element
225  {}
226  //*******************************************************************************************
227 
228  //**Addition assignment operator*************************************************************
234  inline BandIterator& operator+=( size_t inc ) noexcept {
235  using blaze::reset;
236 
237  row_ += inc;
238  column_ += inc;
239 
240  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
241  pos_ = matrix_->begin( row_ ) + column_;
242  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
243  pos_ = matrix_->begin( column_ ) + row_;
244  else reset( pos_ );
245 
246  return *this;
247  }
248  //*******************************************************************************************
249 
250  //**Subtraction assignment operator**********************************************************
256  inline BandIterator& operator-=( size_t dec ) noexcept {
257  using blaze::reset;
258 
259  row_ -= dec;
260  column_ -= dec;
261 
262  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
263  pos_ = matrix_->begin( row_ ) + column_;
264  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
265  pos_ = matrix_->begin( column_ ) + row_;
266  else reset( pos_ );
267 
268  return *this;
269  }
270  //*******************************************************************************************
271 
272  //**Prefix increment operator****************************************************************
277  inline BandIterator& operator++() noexcept {
278  using blaze::reset;
279 
280  ++row_;
281  ++column_;
282 
283  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
284  pos_ = matrix_->begin( row_ ) + column_;
285  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
286  pos_ = matrix_->begin( column_ ) + row_;
287  else reset( pos_ );
288 
289  return *this;
290  }
291  //*******************************************************************************************
292 
293  //**Postfix increment operator***************************************************************
298  inline const BandIterator operator++( int ) noexcept {
299  const BandIterator tmp( *this );
300  ++(*this);
301  return tmp;
302  }
303  //*******************************************************************************************
304 
305  //**Prefix decrement operator****************************************************************
310  inline BandIterator& operator--() noexcept {
311  using blaze::reset;
312 
313  --row_;
314  --column_;
315 
316  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
317  pos_ = matrix_->begin( row_ ) + column_;
318  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
319  pos_ = matrix_->begin( column_ ) + row_;
320  else reset( pos_ );
321 
322  return *this;
323  }
324  //*******************************************************************************************
325 
326  //**Postfix decrement operator***************************************************************
331  inline const BandIterator operator--( int ) noexcept {
332  const BandIterator tmp( *this );
333  --(*this);
334  return tmp;
335  }
336  //*******************************************************************************************
337 
338  //**Subscript operator***********************************************************************
344  inline ReferenceType operator[]( size_t index ) const {
345  BLAZE_USER_ASSERT( row_ +index < matrix_->rows() , "Invalid access index detected" );
346  BLAZE_USER_ASSERT( column_+index < matrix_->columns(), "Invalid access index detected" );
347  const IteratorType pos( IsRowMajorMatrix_v<MatrixType>
348  ? matrix_->begin( row_+index ) + column_ + index
349  : matrix_->begin( column_+index ) + row_ + index );
350  return *pos;
351  }
352  //*******************************************************************************************
353 
354  //**Element access operator******************************************************************
359  inline ReferenceType operator*() const {
360  return *pos_;
361  }
362  //*******************************************************************************************
363 
364  //**Element access operator******************************************************************
369  inline PointerType operator->() const {
370  return pos_;
371  }
372  //*******************************************************************************************
373 
374  //**Equality operator************************************************************************
380  template< typename MatrixType2, typename IteratorType2 >
381  inline bool operator==( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
382  return row_ == rhs.row_;
383  }
384  //*******************************************************************************************
385 
386  //**Inequality operator**********************************************************************
392  template< typename MatrixType2, typename IteratorType2 >
393  inline bool operator!=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
394  return !( *this == rhs );
395  }
396  //*******************************************************************************************
397 
398  //**Less-than operator***********************************************************************
404  template< typename MatrixType2, typename IteratorType2 >
405  inline bool operator<( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
406  return row_ < rhs.row_;
407  }
408  //*******************************************************************************************
409 
410  //**Greater-than operator********************************************************************
416  template< typename MatrixType2, typename IteratorType2 >
417  inline bool operator>( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
418  return row_ > rhs.row_;
419  }
420  //*******************************************************************************************
421 
422  //**Less-or-equal-than operator**************************************************************
428  template< typename MatrixType2, typename IteratorType2 >
429  inline bool operator<=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
430  return row_ <= rhs.row_;
431  }
432  //*******************************************************************************************
433 
434  //**Greater-or-equal-than operator***********************************************************
440  template< typename MatrixType2, typename IteratorType2 >
441  inline bool operator>=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
442  return row_ >= rhs.row_;
443  }
444  //*******************************************************************************************
445 
446  //**Subtraction operator*********************************************************************
452  inline DifferenceType operator-( const BandIterator& rhs ) const noexcept {
453  return row_ - rhs.row_;
454  }
455  //*******************************************************************************************
456 
457  //**Addition operator************************************************************************
464  friend inline const BandIterator operator+( const BandIterator& it, size_t inc ) noexcept {
465  return BandIterator( *it.matrix_, it.row_+inc, it.column_+inc );
466  }
467  //*******************************************************************************************
468 
469  //**Addition operator************************************************************************
476  friend inline const BandIterator operator+( size_t inc, const BandIterator& it ) noexcept {
477  return BandIterator( *it.matrix_, it.row_+inc, it.column_+inc );
478  }
479  //*******************************************************************************************
480 
481  //**Subtraction operator*********************************************************************
488  friend inline const BandIterator operator-( const BandIterator& it, size_t dec ) noexcept {
489  return BandIterator( *it.matrix_, it.row_-dec, it.column_-dec );
490  }
491  //*******************************************************************************************
492 
493  private:
494  //**Member variables*************************************************************************
495  MatrixType* matrix_;
496  size_t row_;
497  size_t column_;
498  IteratorType pos_;
499  //*******************************************************************************************
500 
501  //**Friend declarations**********************************************************************
502  template< typename MatrixType2, typename IteratorType2 > friend class BandIterator;
503  //*******************************************************************************************
504  };
505  //**********************************************************************************************
506 
507  //**Type definitions****************************************************************************
509  using ConstIterator = BandIterator< const MT, ConstIterator_t<MT> >;
510 
512  using Iterator = If_t< IsConst_v<MT>, ConstIterator, BandIterator< MT, Iterator_t<MT> > >;
513  //**********************************************************************************************
514 
515  //**Compilation flags***************************************************************************
517  static constexpr bool simdEnabled = false;
518 
520  static constexpr bool smpAssignable = MT::smpAssignable;
521  //**********************************************************************************************
522 
523  //**Constructors********************************************************************************
526  template< typename... RBAs >
527  explicit inline Band( MT& matrix, RBAs... args );
528 
529  Band( const Band& ) = default;
531  //**********************************************************************************************
532 
533  //**Destructor**********************************************************************************
536  ~Band() = default;
538  //**********************************************************************************************
539 
540  //**Data access functions***********************************************************************
543  inline Reference operator[]( size_t index );
544  inline ConstReference operator[]( size_t index ) const;
545  inline Reference at( size_t index );
546  inline ConstReference at( size_t index ) const;
547  inline Pointer data () noexcept;
548  inline ConstPointer data () const noexcept;
549  inline Iterator begin ();
550  inline ConstIterator begin () const;
551  inline ConstIterator cbegin() const;
552  inline Iterator end ();
553  inline ConstIterator end () const;
554  inline ConstIterator cend () const;
556  //**********************************************************************************************
557 
558  //**Assignment operators************************************************************************
561  inline Band& operator=( const ElementType& rhs );
562  inline Band& operator=( initializer_list<ElementType> list );
563  inline Band& operator=( const Band& rhs );
564 
565  template< typename VT > inline Band& operator= ( const Vector<VT,TF>& rhs );
566  template< typename VT > inline Band& operator+=( const Vector<VT,TF>& rhs );
567  template< typename VT > inline Band& operator-=( const Vector<VT,TF>& rhs );
568  template< typename VT > inline Band& operator*=( const Vector<VT,TF>& rhs );
569  template< typename VT > inline Band& operator/=( const DenseVector<VT,TF>& rhs );
570  template< typename VT > inline Band& operator%=( const Vector<VT,TF>& rhs );
572  //**********************************************************************************************
573 
574  //**Utility functions***************************************************************************
577  using DataType::band;
578  using DataType::row;
579  using DataType::column;
580 
581  inline MT& operand() noexcept;
582  inline const MT& operand() const noexcept;
583 
584  inline size_t size() const noexcept;
585  inline size_t spacing() const noexcept;
586  inline size_t capacity() const noexcept;
587  inline size_t nonZeros() const;
588  inline void reset();
590  //**********************************************************************************************
591 
592  //**Numeric functions***************************************************************************
595  template< typename Other > inline Band& scale( const Other& scalar );
597  //**********************************************************************************************
598 
599  //**Expression template evaluation functions****************************************************
602  template< typename Other >
603  inline bool canAlias( const Other* alias ) const noexcept;
604 
605  template< typename MT2, ptrdiff_t... CBAs2 >
606  inline bool canAlias( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept;
607 
608  template< typename Other >
609  inline bool isAliased( const Other* alias ) const noexcept;
610 
611  template< typename MT2, ptrdiff_t... CBAs2 >
612  inline bool isAliased( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept;
613 
614  inline bool isAligned () const noexcept;
615  inline bool canSMPAssign() const noexcept;
616 
617  template< typename VT > inline void assign ( const DenseVector <VT,TF>& rhs );
618  template< typename VT > inline void assign ( const SparseVector<VT,TF>& rhs );
619  template< typename VT > inline void addAssign ( const DenseVector <VT,TF>& rhs );
620  template< typename VT > inline void addAssign ( const SparseVector<VT,TF>& rhs );
621  template< typename VT > inline void subAssign ( const DenseVector <VT,TF>& rhs );
622  template< typename VT > inline void subAssign ( const SparseVector<VT,TF>& rhs );
623  template< typename VT > inline void multAssign( const DenseVector <VT,TF>& rhs );
624  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
625  template< typename VT > inline void divAssign ( const DenseVector <VT,TF>& rhs );
627  //**********************************************************************************************
628 
629  private:
630  //**Member variables****************************************************************************
633  Operand matrix_;
634 
635  //**********************************************************************************************
636 
637  //**Friend declarations*************************************************************************
638  template< typename MT2, bool TF2, bool DF2, bool MF2, ptrdiff_t... CBAs2 > friend class Band;
639  //**********************************************************************************************
640 
641  //**Compile time checks*************************************************************************
647  //**********************************************************************************************
648 };
650 //*************************************************************************************************
651 
652 
653 
654 
655 //=================================================================================================
656 //
657 // CONSTRUCTORS
658 //
659 //=================================================================================================
660 
661 //*************************************************************************************************
674 template< typename MT // Type of the dense matrix
675  , bool TF // Transpose flag
676  , ptrdiff_t... CBAs > // Compile time band arguments
677 template< typename... RBAs > // Runtime band arguments
678 inline Band<MT,TF,true,false,CBAs...>::Band( MT& matrix, RBAs... args )
679  : DataType( args... ) // Base class initialization
680  , matrix_ ( matrix ) // The matrix containing the band
681 {
682  if( !Contains_v< TypeList<RBAs...>, Unchecked > ) {
683  if( ( band() > 0L && column() >= matrix.columns() ) ||
684  ( band() < 0L && row() >= matrix.rows() ) ) {
685  BLAZE_THROW_INVALID_ARGUMENT( "Invalid band access index" );
686  }
687  }
688  else {
689  BLAZE_USER_ASSERT( band() <= 0L || column() < matrix.columns(), "Invalid band access index" );
690  BLAZE_USER_ASSERT( band() >= 0L || row() < matrix.rows(), "Invalid band access index" );
691  }
692 }
694 //*************************************************************************************************
695 
696 
697 
698 
699 //=================================================================================================
700 //
701 // DATA ACCESS FUNCTIONS
702 //
703 //=================================================================================================
704 
705 //*************************************************************************************************
715 template< typename MT // Type of the dense matrix
716  , bool TF // Transpose flag
717  , ptrdiff_t... CBAs > // Compile time band arguments
718 inline typename Band<MT,TF,true,false,CBAs...>::Reference
719  Band<MT,TF,true,false,CBAs...>::operator[]( size_t index )
720 {
721  BLAZE_USER_ASSERT( index < size(), "Invalid band access index" );
722  return matrix_(row()+index,column()+index);
723 }
725 //*************************************************************************************************
726 
727 
728 //*************************************************************************************************
738 template< typename MT // Type of the dense matrix
739  , bool TF // Transpose flag
740  , ptrdiff_t... CBAs > // Compile time band arguments
741 inline typename Band<MT,TF,true,false,CBAs...>::ConstReference
742  Band<MT,TF,true,false,CBAs...>::operator[]( size_t index ) const
743 {
744  BLAZE_USER_ASSERT( index < size(), "Invalid band access index" );
745  return const_cast<const MT&>( matrix_ )(row()+index,column()+index);
746 }
748 //*************************************************************************************************
749 
750 
751 //*************************************************************************************************
762 template< typename MT // Type of the dense matrix
763  , bool TF // Transpose flag
764  , ptrdiff_t... CBAs > // Compile time band arguments
765 inline typename Band<MT,TF,true,false,CBAs...>::Reference
766  Band<MT,TF,true,false,CBAs...>::at( size_t index )
767 {
768  if( index >= size() ) {
769  BLAZE_THROW_OUT_OF_RANGE( "Invalid band access index" );
770  }
771  return (*this)[index];
772 }
774 //*************************************************************************************************
775 
776 
777 //*************************************************************************************************
788 template< typename MT // Type of the dense matrix
789  , bool TF // Transpose flag
790  , ptrdiff_t... CBAs > // Compile time band arguments
791 inline typename Band<MT,TF,true,false,CBAs...>::ConstReference
792  Band<MT,TF,true,false,CBAs...>::at( size_t index ) const
793 {
794  if( index >= size() ) {
795  BLAZE_THROW_OUT_OF_RANGE( "Invalid band access index" );
796  }
797  return (*this)[index];
798 }
800 //*************************************************************************************************
801 
802 
803 //*************************************************************************************************
812 template< typename MT // Type of the dense matrix
813  , bool TF // Transpose flag
814  , ptrdiff_t... CBAs > // Compile time band arguments
815 inline typename Band<MT,TF,true,false,CBAs...>::Pointer
817 {
818  if( IsRowMajorMatrix_v<MT> )
819  return matrix_.data() + row() * matrix_.spacing() + column();
820  else
821  return matrix_.data() + row() + column() * matrix_.spacing();
822 }
824 //*************************************************************************************************
825 
826 
827 //*************************************************************************************************
836 template< typename MT // Type of the dense matrix
837  , bool TF // Transpose flag
838  , ptrdiff_t... CBAs > // Compile time band arguments
839 inline typename Band<MT,TF,true,false,CBAs...>::ConstPointer
840  Band<MT,TF,true,false,CBAs...>::data() const noexcept
841 {
842  if( IsRowMajorMatrix_v<MT> )
843  return matrix_.data() + row() * matrix_.spacing() + column();
844  else
845  return matrix_.data() + row() + column() * matrix_.spacing();
846 }
848 //*************************************************************************************************
849 
850 
851 //*************************************************************************************************
859 template< typename MT // Type of the dense matrix
860  , bool TF // Transpose flag
861  , ptrdiff_t... CBAs > // Compile time band arguments
862 inline typename Band<MT,TF,true,false,CBAs...>::Iterator
864 {
865  return Iterator( matrix_, row(), column() );
866 }
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
879 template< typename MT // Type of the dense matrix
880  , bool TF // Transpose flag
881  , ptrdiff_t... CBAs > // Compile time band arguments
882 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
884 {
885  return ConstIterator( matrix_, row(), column() );
886 }
888 //*************************************************************************************************
889 
890 
891 //*************************************************************************************************
899 template< typename MT // Type of the dense matrix
900  , bool TF // Transpose flag
901  , ptrdiff_t... CBAs > // Compile time band arguments
902 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
904 {
905  return ConstIterator( matrix_, row(), column() );
906 }
908 //*************************************************************************************************
909 
910 
911 //*************************************************************************************************
919 template< typename MT // Type of the dense matrix
920  , bool TF // Transpose flag
921  , ptrdiff_t... CBAs > // Compile time band arguments
922 inline typename Band<MT,TF,true,false,CBAs...>::Iterator
924 {
925  const size_t n( size() );
926  return Iterator( matrix_, row()+n, column()+n );
927 }
929 //*************************************************************************************************
930 
931 
932 //*************************************************************************************************
940 template< typename MT // Type of the dense matrix
941  , bool TF // Transpose flag
942  , ptrdiff_t... CBAs > // Compile time band arguments
943 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
945 {
946  const size_t n( size() );
947  return ConstIterator( matrix_, row()+n, column()+n );
948 }
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
961 template< typename MT // Type of the dense matrix
962  , bool TF // Transpose flag
963  , ptrdiff_t... CBAs > // Compile time band arguments
964 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
966 {
967  const size_t n( size() );
968  return ConstIterator( matrix_, row()+n, column()+n );
969 }
971 //*************************************************************************************************
972 
973 
974 
975 
976 //=================================================================================================
977 //
978 // ASSIGNMENT OPERATORS
979 //
980 //=================================================================================================
981 
982 //*************************************************************************************************
993 template< typename MT // Type of the dense matrix
994  , bool TF // Transpose flag
995  , ptrdiff_t... CBAs > // Compile time band arguments
996 inline Band<MT,TF,true,false,CBAs...>&
997  Band<MT,TF,true,false,CBAs...>::operator=( const ElementType& rhs )
998 {
999  decltype(auto) left( derestrict( matrix_ ) );
1000 
1001  if( ( IsLower_v<MT> && column() > 0UL ) ||
1002  ( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> ) && row() == 0UL ) ||
1003  ( IsUpper_v<MT> && row() > 0UL ) ||
1004  ( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> ) && column() == 0UL ) )
1005  return *this;
1006 
1007  const size_t n( size() );
1008  for( size_t i=0UL; i<n; ++i ) {
1009  if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, row()+i, column()+i, rhs ) )
1010  left(row()+i,column()+i) = rhs;
1011  }
1012 
1013  return *this;
1014 }
1016 //*************************************************************************************************
1017 
1018 
1019 //*************************************************************************************************
1034 template< typename MT // Type of the dense matrix
1035  , bool TF // Transpose flag
1036  , ptrdiff_t... CBAs > // Compile time band arguments
1037 inline Band<MT,TF,true,false,CBAs...>&
1038  Band<MT,TF,true,false,CBAs...>::operator=( initializer_list<ElementType> list )
1039 {
1040  if( list.size() > size() ) {
1041  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to band" );
1042  }
1043 
1044  if( IsRestricted_v<MT> ) {
1045  const InitializerVector<ElementType,false> tmp( list, size() );
1046  if( !tryAssign( matrix_, tmp, band(), row(), column() ) ) {
1047  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1048  }
1049  }
1050 
1051  decltype(auto) left( derestrict( *this ) );
1052 
1053  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
1054 
1055  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1056 
1057  return *this;
1058 }
1060 //*************************************************************************************************
1061 
1062 
1063 //*************************************************************************************************
1077 template< typename MT // Type of the dense matrix
1078  , bool TF // Transpose flag
1079  , ptrdiff_t... CBAs > // Compile time band arguments
1080 inline Band<MT,TF,true,false,CBAs...>&
1081  Band<MT,TF,true,false,CBAs...>::operator=( const Band& rhs )
1082 {
1083  if( &rhs == this ) return *this;
1084 
1085  if( size() != rhs.size() ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Band sizes do not match" );
1087  }
1088 
1089  if( !tryAssign( matrix_, rhs, band(), row(), column() ) ) {
1090  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1091  }
1092 
1093  decltype(auto) left( derestrict( *this ) );
1094 
1095  if( IsExpression_v<MT> && rhs.canAlias( &matrix_ ) ) {
1096  const ResultType tmp( rhs );
1097  smpAssign( left, tmp );
1098  }
1099  else {
1100  smpAssign( left, rhs );
1101  }
1102 
1103  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1104 
1105  return *this;
1106 }
1108 //*************************************************************************************************
1109 
1110 
1111 //*************************************************************************************************
1125 template< typename MT // Type of the dense matrix
1126  , bool TF // Transpose flag
1127  , ptrdiff_t... CBAs > // Compile time band arguments
1128 template< typename VT > // Type of the right-hand side vector
1129 inline Band<MT,TF,true,false,CBAs...>&
1130  Band<MT,TF,true,false,CBAs...>::operator=( const Vector<VT,TF>& rhs )
1131 {
1134 
1135  if( size() != (~rhs).size() ) {
1136  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1137  }
1138 
1139  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1140  Right right( ~rhs );
1141 
1142  if( !tryAssign( matrix_, right, band(), row(), column() ) ) {
1143  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1144  }
1145 
1146  decltype(auto) left( derestrict( *this ) );
1147 
1148  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1149  const ResultType_t<VT> tmp( right );
1150  smpAssign( left, tmp );
1151  }
1152  else {
1153  if( IsSparseVector_v<VT> )
1154  reset();
1155  smpAssign( left, right );
1156  }
1157 
1158  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1159 
1160  return *this;
1161 }
1163 //*************************************************************************************************
1164 
1165 
1166 //*************************************************************************************************
1180 template< typename MT // Type of the dense matrix
1181  , bool TF // Transpose flag
1182  , ptrdiff_t... CBAs > // Compile time band arguments
1183 template< typename VT > // Type of the right-hand side vector
1184 inline Band<MT,TF,true,false,CBAs...>&
1185  Band<MT,TF,true,false,CBAs...>::operator+=( const Vector<VT,TF>& rhs )
1186 {
1189 
1190  if( size() != (~rhs).size() ) {
1191  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1192  }
1193 
1194  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1195  Right right( ~rhs );
1196 
1197  if( !tryAddAssign( matrix_, right, band(), row(), column() ) ) {
1198  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1199  }
1200 
1201  decltype(auto) left( derestrict( *this ) );
1202 
1203  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1204  const ResultType_t<VT> tmp( right );
1205  smpAddAssign( left, tmp );
1206  }
1207  else {
1208  smpAddAssign( left, right );
1209  }
1210 
1211  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1212 
1213  return *this;
1214 }
1216 //*************************************************************************************************
1217 
1218 
1219 //*************************************************************************************************
1233 template< typename MT // Type of the dense matrix
1234  , bool TF // Transpose flag
1235  , ptrdiff_t... CBAs > // Compile time band arguments
1236 template< typename VT > // Type of the right-hand side vector
1237 inline Band<MT,TF,true,false,CBAs...>&
1238  Band<MT,TF,true,false,CBAs...>::operator-=( const Vector<VT,TF>& rhs )
1239 {
1242 
1243  if( size() != (~rhs).size() ) {
1244  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1245  }
1246 
1247  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1248  Right right( ~rhs );
1249 
1250  if( !trySubAssign( matrix_, right, band(), row(), column() ) ) {
1251  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1252  }
1253 
1254  decltype(auto) left( derestrict( *this ) );
1255 
1256  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1257  const ResultType_t<VT> tmp( right );
1258  smpSubAssign( left, tmp );
1259  }
1260  else {
1261  smpSubAssign( left, right );
1262  }
1263 
1264  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1265 
1266  return *this;
1267 }
1269 //*************************************************************************************************
1270 
1271 
1272 //*************************************************************************************************
1285 template< typename MT // Type of the dense matrix
1286  , bool TF // Transpose flag
1287  , ptrdiff_t... CBAs > // Compile time band arguments
1288 template< typename VT > // Type of the right-hand side vector
1289 inline Band<MT,TF,true,false,CBAs...>&
1290  Band<MT,TF,true,false,CBAs...>::operator*=( const Vector<VT,TF>& rhs )
1291 {
1297 
1298  if( size() != (~rhs).size() ) {
1299  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1300  }
1301 
1302  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1303  Right right( ~rhs );
1304 
1305  if( !tryMultAssign( matrix_, right, band(), row(), column() ) ) {
1306  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1307  }
1308 
1309  decltype(auto) left( derestrict( *this ) );
1310 
1311  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1312  const ResultType_t<VT> tmp( right );
1313  smpMultAssign( left, tmp );
1314  }
1315  else {
1316  smpMultAssign( left, right );
1317  }
1318 
1319  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1320 
1321  return *this;
1322 }
1324 //*************************************************************************************************
1325 
1326 
1327 //*************************************************************************************************
1339 template< typename MT // Type of the dense matrix
1340  , bool TF // Transpose flag
1341  , ptrdiff_t... CBAs > // Compile time band arguments
1342 template< typename VT > // Type of the right-hand side dense vector
1343 inline Band<MT,TF,true,false,CBAs...>&
1344  Band<MT,TF,true,false,CBAs...>::operator/=( const DenseVector<VT,TF>& rhs )
1345 {
1348 
1349  if( size() != (~rhs).size() ) {
1350  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1351  }
1352 
1353  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1354  Right right( ~rhs );
1355 
1356  if( !tryDivAssign( matrix_, right, band(), row(), column() ) ) {
1357  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1358  }
1359 
1360  decltype(auto) left( derestrict( *this ) );
1361 
1362  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1363  const ResultType_t<VT> tmp( right );
1364  smpDivAssign( left, tmp );
1365  }
1366  else {
1367  smpDivAssign( left, right );
1368  }
1369 
1370  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1371 
1372  return *this;
1373 }
1375 //*************************************************************************************************
1376 
1377 
1378 //*************************************************************************************************
1391 template< typename MT // Type of the dense matrix
1392  , bool TF // Transpose flag
1393  , ptrdiff_t... CBAs > // Compile time band arguments
1394 template< typename VT > // Type of the right-hand side vector
1395 inline Band<MT,TF,true,false,CBAs...>&
1396  Band<MT,TF,true,false,CBAs...>::operator%=( const Vector<VT,TF>& rhs )
1397 {
1398  using blaze::assign;
1399 
1402 
1403  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1404 
1408 
1409  if( size() != 3UL || (~rhs).size() != 3UL ) {
1410  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1411  }
1412 
1413  const CrossType right( *this % (~rhs) );
1414 
1415  if( !tryAssign( matrix_, right, band(), row(), column() ) ) {
1416  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1417  }
1418 
1419  decltype(auto) left( derestrict( *this ) );
1420 
1421  assign( left, right );
1422 
1423  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1424 
1425  return *this;
1426 }
1428 //*************************************************************************************************
1429 
1430 
1431 
1432 
1433 //=================================================================================================
1434 //
1435 // UTILITY FUNCTIONS
1436 //
1437 //=================================================================================================
1438 
1439 //*************************************************************************************************
1445 template< typename MT // Type of the dense matrix
1446  , bool TF // Transpose flag
1447  , ptrdiff_t... CBAs > // Compile time band arguments
1448 inline MT& Band<MT,TF,true,false,CBAs...>::operand() noexcept
1449 {
1450  return matrix_;
1451 }
1453 //*************************************************************************************************
1454 
1455 
1456 //*************************************************************************************************
1462 template< typename MT // Type of the dense matrix
1463  , bool TF // Transpose flag
1464  , ptrdiff_t... CBAs > // Compile time band arguments
1465 inline const MT& Band<MT,TF,true,false,CBAs...>::operand() const noexcept
1466 {
1467  return matrix_;
1468 }
1470 //*************************************************************************************************
1471 
1472 
1473 //*************************************************************************************************
1479 template< typename MT // Type of the dense matrix
1480  , bool TF // Transpose flag
1481  , ptrdiff_t... CBAs > // Compile time band arguments
1482 inline size_t Band<MT,TF,true,false,CBAs...>::size() const noexcept
1483 {
1484  return min( matrix_.rows() - row(), matrix_.columns() - column() );
1485 }
1487 //*************************************************************************************************
1488 
1489 
1490 //*************************************************************************************************
1499 template< typename MT // Type of the dense matrix
1500  , bool TF // Transpose flag
1501  , ptrdiff_t... CBAs > // Compile time band arguments
1502 inline size_t Band<MT,TF,true,false,CBAs...>::spacing() const noexcept
1503 {
1504  return size();
1505 }
1507 //*************************************************************************************************
1508 
1509 
1510 //*************************************************************************************************
1516 template< typename MT // Type of the dense matrix
1517  , bool TF // Transpose flag
1518  , ptrdiff_t... CBAs > // Compile time band arguments
1519 inline size_t Band<MT,TF,true,false,CBAs...>::capacity() const noexcept
1520 {
1521  return size();
1522 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1536 template< typename MT // Type of the dense matrix
1537  , bool TF // Transpose flag
1538  , ptrdiff_t... CBAs > // Compile time band arguments
1539 inline size_t Band<MT,TF,true,false,CBAs...>::nonZeros() const
1540 {
1541  const size_t n( size() );
1542  size_t nonzeros( 0UL );
1543 
1544  for( size_t i=0UL; i<n; ++i )
1545  if( !isDefault( matrix_(row()+i,column()+i) ) )
1546  ++nonzeros;
1547 
1548  return nonzeros;
1549 }
1551 //*************************************************************************************************
1552 
1553 
1554 //*************************************************************************************************
1560 template< typename MT // Type of the dense matrix
1561  , bool TF // Transpose flag
1562  , ptrdiff_t... CBAs > // Compile time band arguments
1564 {
1565  using blaze::clear;
1566 
1567  if( ( IsLower_v<MT> && column() > 0UL ) ||
1568  ( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> ) && row() == 0UL ) ||
1569  ( IsUpper_v<MT> && row() > 0UL ) ||
1570  ( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> ) && column() == 0UL ) )
1571  return;
1572 
1573  const size_t n( size() );
1574  for( size_t i=0UL; i<n; ++i )
1575  clear( matrix_(row()+i,column()+i) );
1576 }
1578 //*************************************************************************************************
1579 
1580 
1581 
1582 
1583 //=================================================================================================
1584 //
1585 // NUMERIC FUNCTIONS
1586 //
1587 //=================================================================================================
1588 
1589 //*************************************************************************************************
1602 template< typename MT // Type of the dense matrix
1603  , bool TF // Transpose flag
1604  , ptrdiff_t... CBAs > // Compile time band arguments
1605 template< typename Other > // Data type of the scalar value
1606 inline Band<MT,TF,true,false,CBAs...>&
1607  Band<MT,TF,true,false,CBAs...>::scale( const Other& scalar )
1608 {
1610 
1611  if( ( IsLower_v<MT> && column() > 0UL ) ||
1612  ( IsStrictlyLower_v<MT> && row() == 0UL ) ||
1613  ( IsUpper_v<MT> && row() > 0UL ) ||
1614  ( IsStrictlyUpper_v<MT> && column() == 0UL ) )
1615  return *this;
1616 
1617  const size_t n( size() );
1618  for( size_t i=0UL; i<n; ++i ) {
1619  matrix_(row()+i,column()+i) *= scalar;
1620  }
1621 
1622  return *this;
1623 }
1625 //*************************************************************************************************
1626 
1627 
1628 
1629 
1630 //=================================================================================================
1631 //
1632 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1633 //
1634 //=================================================================================================
1635 
1636 //*************************************************************************************************
1647 template< typename MT // Type of the dense matrix
1648  , bool TF // Transpose flag
1649  , ptrdiff_t... CBAs > // Compile time band arguments
1650 template< typename Other > // Data type of the foreign expression
1651 inline bool Band<MT,TF,true,false,CBAs...>::canAlias( const Other* alias ) const noexcept
1652 {
1653  return matrix_.isAliased( alias );
1654 }
1656 //*************************************************************************************************
1657 
1658 
1659 //*************************************************************************************************
1670 template< typename MT // Type of the dense matrix
1671  , bool TF // Transpose flag
1672  , ptrdiff_t... CBAs > // Compile time band arguments
1673 template< typename MT2 // Matrix type of the foreign dense band
1674  , ptrdiff_t... CBAs2 > // Compile time band arguments of the foreign dense band
1675 inline bool
1676  Band<MT,TF,true,false,CBAs...>::canAlias( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept
1677 {
1678  return matrix_.isAliased( &alias->matrix_ ) && ( band() == alias->band() );
1679 }
1681 //*************************************************************************************************
1682 
1683 
1684 //*************************************************************************************************
1695 template< typename MT // Type of the dense matrix
1696  , bool TF // Transpose flag
1697  , ptrdiff_t... CBAs > // Compile time band arguments
1698 template< typename Other > // Data type of the foreign expression
1699 inline bool Band<MT,TF,true,false,CBAs...>::isAliased( const Other* alias ) const noexcept
1700 {
1701  return matrix_.isAliased( alias );
1702 }
1704 //*************************************************************************************************
1705 
1706 
1707 //*************************************************************************************************
1718 template< typename MT // Type of the dense matrix
1719  , bool TF // Transpose flag
1720  , ptrdiff_t... CBAs > // Compile time band arguments
1721 template< typename MT2 // Matrix type of the foreign dense band
1722  , ptrdiff_t... CBAs2 > // Compile time band arguments of the foreign dense band
1723 inline bool
1724  Band<MT,TF,true,false,CBAs...>::isAliased( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept
1725 {
1726  return matrix_.isAliased( &alias->matrix_ ) && ( band() == alias->band() );
1727 }
1729 //*************************************************************************************************
1730 
1731 
1732 //*************************************************************************************************
1742 template< typename MT // Type of the dense matrix
1743  , bool TF // Transpose flag
1744  , ptrdiff_t... CBAs > // Compile time band arguments
1745 inline bool Band<MT,TF,true,false,CBAs...>::isAligned() const noexcept
1746 {
1747  return false;
1748 }
1750 //*************************************************************************************************
1751 
1752 
1753 //*************************************************************************************************
1764 template< typename MT // Type of the dense matrix
1765  , bool TF // Transpose flag
1766  , ptrdiff_t... CBAs > // Compile time band arguments
1767 inline bool Band<MT,TF,true,false,CBAs...>::canSMPAssign() const noexcept
1768 {
1769  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1770 }
1772 //*************************************************************************************************
1773 
1774 
1775 //*************************************************************************************************
1787 template< typename MT // Type of the dense matrix
1788  , bool TF // Transpose flag
1789  , ptrdiff_t... CBAs > // Compile time band arguments
1790 template< typename VT > // Type of the right-hand side dense vector
1791 inline void Band<MT,TF,true,false,CBAs...>::assign( const DenseVector<VT,TF>& rhs )
1792 {
1793  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1794 
1795  const size_t ipos( (~rhs).size() & size_t(-2) );
1796  for( size_t i=0UL; i<ipos; i+=2UL ) {
1797  matrix_(row()+i ,column()+i ) = (~rhs)[i ];
1798  matrix_(row()+i+1UL,column()+i+1UL) = (~rhs)[i+1UL];
1799  }
1800  if( ipos < (~rhs).size() ) {
1801  matrix_(row()+ipos,column()+ipos) = (~rhs)[ipos];
1802  }
1803 }
1805 //*************************************************************************************************
1806 
1807 
1808 //*************************************************************************************************
1820 template< typename MT // Type of the dense matrix
1821  , bool TF // Transpose flag
1822  , ptrdiff_t... CBAs > // Compile time band arguments
1823 template< typename VT > // Type of the right-hand side sparse vector
1824 inline void Band<MT,TF,true,false,CBAs...>::assign( const SparseVector<VT,TF>& rhs )
1825 {
1826  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1827 
1828  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1829  const size_t index( element->index() );
1830  matrix_(row()+index,column()+index) = element->value();
1831  }
1832 }
1834 //*************************************************************************************************
1835 
1836 
1837 //*************************************************************************************************
1849 template< typename MT // Type of the dense matrix
1850  , bool TF // Transpose flag
1851  , ptrdiff_t... CBAs > // Compile time band arguments
1852 template< typename VT > // Type of the right-hand side dense vector
1853 inline void Band<MT,TF,true,false,CBAs...>::addAssign( const DenseVector<VT,TF>& rhs )
1854 {
1855  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1856 
1857  const size_t ipos( (~rhs).size() & size_t(-2) );
1858  for( size_t i=0UL; i<ipos; i+=2UL ) {
1859  matrix_(row()+i ,column()+i ) += (~rhs)[i ];
1860  matrix_(row()+i+1UL,column()+i+1UL) += (~rhs)[i+1UL];
1861  }
1862  if( ipos < (~rhs).size() ) {
1863  matrix_(row()+ipos,column()+ipos) += (~rhs)[ipos];
1864  }
1865 }
1867 //*************************************************************************************************
1868 
1869 
1870 //*************************************************************************************************
1882 template< typename MT // Type of the dense matrix
1883  , bool TF // Transpose flag
1884  , ptrdiff_t... CBAs > // Compile time band arguments
1885 template< typename VT > // Type of the right-hand side sparse vector
1886 inline void Band<MT,TF,true,false,CBAs...>::addAssign( const SparseVector<VT,TF>& rhs )
1887 {
1888  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1889 
1890  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1891  const size_t index( element->index() );
1892  matrix_(row()+index,column()+index) += element->value();
1893  }
1894 }
1896 //*************************************************************************************************
1897 
1898 
1899 //*************************************************************************************************
1911 template< typename MT // Type of the dense matrix
1912  , bool TF // Transpose flag
1913  , ptrdiff_t... CBAs > // Compile time band arguments
1914 template< typename VT > // Type of the right-hand side dense vector
1915 inline void Band<MT,TF,true,false,CBAs...>::subAssign( const DenseVector<VT,TF>& rhs )
1916 {
1917  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1918 
1919  const size_t ipos( (~rhs).size() & size_t(-2) );
1920  for( size_t i=0UL; i<ipos; i+=2UL ) {
1921  matrix_(row()+i ,column()+i ) -= (~rhs)[i ];
1922  matrix_(row()+i+1UL,column()+i+1UL) -= (~rhs)[i+1UL];
1923  }
1924  if( ipos < (~rhs).size() ) {
1925  matrix_(row()+ipos,column()+ipos) -= (~rhs)[ipos];
1926  }
1927 }
1929 //*************************************************************************************************
1930 
1931 
1932 //*************************************************************************************************
1944 template< typename MT // Type of the dense matrix
1945  , bool TF // Transpose flag
1946  , ptrdiff_t... CBAs > // Compile time band arguments
1947 template< typename VT > // Type of the right-hand side sparse vector
1948 inline void Band<MT,TF,true,false,CBAs...>::subAssign( const SparseVector<VT,TF>& rhs )
1949 {
1950  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1951 
1952  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1953  const size_t index( element->index() );
1954  matrix_(row()+index,column()+index) -= element->value();
1955  }
1956 }
1958 //*************************************************************************************************
1959 
1960 
1961 //*************************************************************************************************
1973 template< typename MT // Type of the dense matrix
1974  , bool TF // Transpose flag
1975  , ptrdiff_t... CBAs > // Compile time band arguments
1976 template< typename VT > // Type of the right-hand side dense vector
1977 inline void Band<MT,TF,true,false,CBAs...>::multAssign( const DenseVector<VT,TF>& rhs )
1978 {
1979  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1980 
1981  const size_t ipos( (~rhs).size() & size_t(-2) );
1982  for( size_t i=0UL; i<ipos; i+=2UL ) {
1983  matrix_(row()+i ,column()+i ) *= (~rhs)[i ];
1984  matrix_(row()+i+1UL,column()+i+1UL) *= (~rhs)[i+1UL];
1985  }
1986  if( ipos < (~rhs).size() ) {
1987  matrix_(row()+ipos,column()+ipos) *= (~rhs)[ipos];
1988  }
1989 }
1991 //*************************************************************************************************
1992 
1993 
1994 //*************************************************************************************************
2006 template< typename MT // Type of the dense matrix
2007  , bool TF // Transpose flag
2008  , ptrdiff_t... CBAs > // Compile time band arguments
2009 template< typename VT > // Type of the right-hand side sparse vector
2010 inline void Band<MT,TF,true,false,CBAs...>::multAssign( const SparseVector<VT,TF>& rhs )
2011 {
2012  using blaze::reset;
2013 
2014  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2015 
2016  size_t i( 0UL );
2017 
2018  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2019  const size_t index( element->index() );
2020  for( ; i<index; ++i )
2021  reset( matrix_(row()+i,column()+i) );
2022  matrix_(row()+index,column()+index) *= element->value();
2023  ++i;
2024  }
2025 
2026  for( ; i<size(); ++i ) {
2027  reset( matrix_(row()+i,column()+i) );
2028  }
2029 }
2031 //*************************************************************************************************
2032 
2033 
2034 //*************************************************************************************************
2046 template< typename MT // Type of the dense matrix
2047  , bool TF // Transpose flag
2048  , ptrdiff_t... CBAs > // Compile time band arguments
2049 template< typename VT > // Type of the right-hand side dense vector
2050 inline void Band<MT,TF,true,false,CBAs...>::divAssign( const DenseVector<VT,TF>& rhs )
2051 {
2052  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2053 
2054  const size_t ipos( (~rhs).size() & size_t(-2) );
2055  for( size_t i=0UL; i<ipos; i+=2UL ) {
2056  matrix_(row()+i ,column()+i ) /= (~rhs)[i ];
2057  matrix_(row()+i+1UL,column()+i+1UL) /= (~rhs)[i+1UL];
2058  }
2059  if( ipos < (~rhs).size() ) {
2060  matrix_(row()+ipos,column()+ipos) /= (~rhs)[ipos];
2061  }
2062 }
2064 //*************************************************************************************************
2065 
2066 
2067 
2068 
2069 //=================================================================================================
2070 //
2071 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRIX MULTIPLICATIONS
2072 //
2073 //=================================================================================================
2074 
2075 //*************************************************************************************************
2083 template< typename MT // Type of the dense matrix multiplication
2084  , bool TF // Transpose flag
2085  , ptrdiff_t... CBAs > // Compile time band arguments
2086 class Band<MT,TF,true,true,CBAs...>
2087  : public View< DenseVector< Band<MT,TF,true,true,CBAs...>, TF > >
2088  , private BandData<CBAs...>
2089  , private Computation
2090 {
2091  private:
2092  //**Type definitions****************************************************************************
2094  using DataType = BandData<CBAs...>;
2095 
2097  using LeftOperand = RemoveReference_t< LeftOperand_t<MT> >;
2098 
2100  using RightOperand = RemoveReference_t< RightOperand_t<MT> >;
2101  //**********************************************************************************************
2102 
2103  public:
2104  //**Type definitions****************************************************************************
2106  using This = Band<MT,TF,true,true,CBAs...>;
2107 
2109  using BaseType = DenseVector<This,TF>;
2110 
2112  using ViewedType = MT;
2113 
2115  using ResultType = BandTrait_t<ResultType_t<MT>,CBAs...>;
2116 
2117  using TransposeType = TransposeType_t<ResultType>;
2118  using ElementType = ElementType_t<ResultType>;
2119  using ReturnType = ReturnType_t<MT>;
2120 
2122  using CompositeType = If_t< RequiresEvaluation_v<LeftOperand> ||
2123  RequiresEvaluation_v<RightOperand>
2124  , const ResultType, const Band& >;
2125 
2127  using LT = If_t< IsSparseMatrix_v<LeftOperand> && IsColumnMajorMatrix_v<LeftOperand>
2128  , ResultType_t<LeftOperand>
2129  , CompositeType_t<LeftOperand> >;
2130 
2132  using RT = If_t< IsSparseMatrix_v<RightOperand> && IsRowMajorMatrix_v<RightOperand>
2133  , ResultType_t<RightOperand>
2134  , CompositeType_t<RightOperand> >;
2135  //**********************************************************************************************
2136 
2137  //**Compilation flags***************************************************************************
2139  static constexpr bool simdEnabled = false;
2140 
2142  static constexpr bool smpAssignable = false;
2143  //**********************************************************************************************
2144 
2145  //**Constructor*********************************************************************************
2152  template< typename... RBAs > // Runtime band arguments
2153  explicit inline Band( const MT& mmm, RBAs... args )
2154  : DataType( args... ) // Base class initialization
2155  , matrix_ ( mmm ) // The matrix multiplication containing the band
2156  {
2157  if( !Contains_v< TypeList<RBAs...>, Unchecked > ) {
2158  if( ( band() > 0L && column() >= mmm.columns() ) ||
2159  ( band() < 0L && row() >= mmm.rows() ) ) {
2160  BLAZE_THROW_INVALID_ARGUMENT( "Invalid band access index" );
2161  }
2162  }
2163  else {
2164  BLAZE_USER_ASSERT( band() <= 0L || column() < mmm.columns(), "Invalid band access index" );
2165  BLAZE_USER_ASSERT( band() >= 0L || row() < mmm.rows(), "Invalid band access index" );
2166  }
2167  }
2168  //**********************************************************************************************
2169 
2170  //**Subscript operator**************************************************************************
2176  inline ReturnType operator[]( size_t index ) const {
2177  BLAZE_INTERNAL_ASSERT( index < size(), "Invalid vector access index" );
2178  return matrix_(row()+index,column()+index);
2179  }
2180  //**********************************************************************************************
2181 
2182  //**At function*********************************************************************************
2189  inline ReturnType at( size_t index ) const {
2190  if( index >= size() ) {
2191  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
2192  }
2193  return (*this)[index];
2194  }
2195  //**********************************************************************************************
2196 
2197  //**Size function*******************************************************************************
2202  inline size_t size() const noexcept {
2203  return min( matrix_.rows() - row(), matrix_.columns() - column() );
2204  }
2205  //**********************************************************************************************
2206 
2207  //**********************************************************************************************
2208  using DataType::band;
2209  using DataType::row;
2210  using DataType::column;
2211  //**********************************************************************************************
2212 
2213  //**Operand access******************************************************************************
2218  inline const MT& operand() const noexcept {
2219  return matrix_;
2220  }
2221  //**********************************************************************************************
2222 
2223  //**********************************************************************************************
2229  template< typename T >
2230  inline bool canAlias( const T* alias ) const noexcept {
2231  return matrix_.isAliased( alias );
2232  }
2233  //**********************************************************************************************
2234 
2235  //**********************************************************************************************
2241  template< typename T >
2242  inline bool isAliased( const T* alias ) const noexcept {
2243  return matrix_.isAliased( alias );
2244  }
2245  //**********************************************************************************************
2246 
2247  //**********************************************************************************************
2252  inline constexpr bool isAligned() const noexcept {
2253  return false;
2254  }
2255  //**********************************************************************************************
2256 
2257  private:
2258  //**Member variables****************************************************************************
2259  MT matrix_;
2260  //**********************************************************************************************
2261 
2262  //**Assignment to dense vectors*****************************************************************
2274  template< typename VT > // Type of the target dense vector
2275  friend inline void assign( DenseVector<VT,TF>& lhs, const Band& rhs )
2276  {
2277  using blaze::row;
2278  using blaze::column;
2279 
2281 
2282  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2283 
2284  LT A( serial( rhs.operand().leftOperand() ) );
2285  RT B( serial( rhs.operand().rightOperand() ) );
2286 
2287  const size_t n( rhs.size() );
2288  for( size_t i=0UL; i<n; ++i ) {
2289  (~lhs)[i] = row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2290  }
2291  }
2293  //**********************************************************************************************
2294 
2295  //**Assignment to sparse vectors****************************************************************
2307  template< typename VT > // Type of the target sparse vector
2308  friend inline void assign( SparseVector<VT,TF>& lhs, const Band& rhs )
2309  {
2311 
2315 
2316  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2317 
2318  const ResultType tmp( serial( rhs ) );
2319  assign( ~lhs, tmp );
2320  }
2322  //**********************************************************************************************
2323 
2324  //**Addition assignment to dense vectors********************************************************
2336  template< typename VT > // Type of the target dense vector
2337  friend inline void addAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2338  {
2339  using blaze::row;
2340  using blaze::column;
2341 
2343 
2344  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2345 
2346  LT A( serial( rhs.operand().leftOperand() ) );
2347  RT B( serial( rhs.operand().rightOperand() ) );
2348 
2349  const size_t n( rhs.size() );
2350  for( size_t i=0UL; i<n; ++i ) {
2351  (~lhs)[i] += row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2352  }
2353  }
2355  //**********************************************************************************************
2356 
2357  //**Addition assignment to sparse vectors*******************************************************
2358  // No special implementation for the addition assignment to sparse vectors.
2359  //**********************************************************************************************
2360 
2361  //**Subtraction assignment to dense vectors*****************************************************
2373  template< typename VT > // Type of the target dense vector
2374  friend inline void subAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2375  {
2376  using blaze::row;
2377  using blaze::column;
2378 
2380 
2381  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2382 
2383  LT A( serial( rhs.operand().leftOperand() ) );
2384  RT B( serial( rhs.operand().rightOperand() ) );
2385 
2386  const size_t n( rhs.size() );
2387  for( size_t i=0UL; i<n; ++i ) {
2388  (~lhs)[i] -= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2389  }
2390  }
2392  //**********************************************************************************************
2393 
2394  //**Subtraction assignment to sparse vectors****************************************************
2395  // No special implementation for the subtraction assignment to sparse vectors.
2396  //**********************************************************************************************
2397 
2398  //**Multiplication assignment to dense vectors**************************************************
2411  template< typename VT > // Type of the target dense vector
2412  friend inline void multAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2413  {
2414  using blaze::row;
2415  using blaze::column;
2416 
2418 
2419  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2420 
2421  LT A( serial( rhs.operand().leftOperand() ) );
2422  RT B( serial( rhs.operand().rightOperand() ) );
2423 
2424  const size_t n( rhs.size() );
2425  for( size_t i=0UL; i<n; ++i ) {
2426  (~lhs)[i] *= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2427  }
2428  }
2430  //**********************************************************************************************
2431 
2432  //**Multiplication assignment to sparse vectors*************************************************
2433  // No special implementation for the multiplication assignment to sparse vectors.
2434  //**********************************************************************************************
2435 
2436  //**Division assignment to dense vectors********************************************************
2448  template< typename VT > // Type of the target dense vector
2449  friend inline void divAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2450  {
2451  using blaze::row;
2452  using blaze::column;
2453 
2455 
2456  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2457 
2458  LT A( serial( rhs.operand().leftOperand() ) );
2459  RT B( serial( rhs.operand().rightOperand() ) );
2460 
2461  const size_t n( rhs.size() );
2462  for( size_t i=0UL; i<n; ++i ) {
2463  (~lhs)[i] /= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2464  }
2465  }
2467  //**********************************************************************************************
2468 
2469  //**Division assignment to sparse vectors*******************************************************
2470  // No special implementation for the division assignment to sparse vectors.
2471  //**********************************************************************************************
2472 
2473  //**Compile time checks*************************************************************************
2480  //**********************************************************************************************
2481 };
2482 //*************************************************************************************************
2483 
2484 } // namespace blaze
2485 
2486 #endif
#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
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.The IsUniUpper_v variable template provides...
Definition: IsUniUpper.h:172
#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 IsUniUpper type trait.
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
Header file for the SparseVector base class.
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
Header file for the View base class.
Header file for the IsSparseMatrix type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
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
Header file for the IsColumnMajorMatrix type trait.
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
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the implementation of the Band base template.
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.The IsUpper_v variable template provides a con...
Definition: IsUpper.h:174
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
Header file for the RequiresEvaluation type trait.
Header file for the extended initializer_list functionality.
STL namespace.
Header file for the IsUniLower type trait.
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
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
Header file for the band trait.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Constraint on the data type.
Header file for the IsStrictlyUpper type trait.
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
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#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
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:446
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
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
Constraint on the data type.
Constraint on the data type.
Header file for the IsTriangular type trait.
Constraint on the data type.
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:172
Header file for the exception macros of the math module.
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
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is not a matrix/matrix multiplication expre...
Definition: MatMatMultExpr.h:63
Header file for the IsSparseVector type trait.
Header file for the IsConst type trait.
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.
constexpr bool IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.The IsUniLower_v variable template provides...
Definition: IsUniLower.h:172
Header file for the cross product trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.The IsStrictlyUpper_v variable templat...
Definition: IsStrictlyUpper.h:172
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.The IsLower_v variable template provides a con...
Definition: IsLower.h:174
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Constraint on the data type.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMutableDataAccess type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the IsReference type trait.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
Header file for the RemoveReference type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.The IsExpression_v variable template prov...
Definition: IsExpression.h:131
Header file for the IsRowMajorMatrix type trait.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
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
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
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
Header file for the IsUpper type trait.
Constraint on the data type.
typename BandTrait< MT, CBAs... >::Type BandTrait_t
Auxiliary alias declaration for the BandTrait type trait.The BandTrait_t alias declaration provides a...
Definition: BandTrait.h:170
Header file for the IsRestricted type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the clear shim.
Header file for the IsExpression type trait class.
Header file for the implementation of the BandData class template.