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/And.h>
87 #include <blaze/util/mpl/If.h>
88 #include <blaze/util/mpl/Not.h>
89 #include <blaze/util/mpl/Or.h>
90 #include <blaze/util/TypeList.h>
91 #include <blaze/util/Types.h>
95 
96 
97 namespace blaze {
98 
99 //=================================================================================================
100 //
101 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
102 //
103 //=================================================================================================
104 
105 //*************************************************************************************************
112 template< typename MT // Type of the dense matrix
113  , bool TF // Transpose flag
114  , ptrdiff_t... CBAs > // Compile time band arguments
115 class Band<MT,TF,true,false,CBAs...>
116  : public View< DenseVector< Band<MT,TF,true,false,CBAs...>, TF > >
117  , private BandData<CBAs...>
118 {
119  private:
120  //**Type definitions****************************************************************************
121  using RT = ResultType_<MT>;
122  using DataType = BandData<CBAs...>;
123  using Operand = If_< IsExpression<MT>, MT, MT& >;
124  //**********************************************************************************************
125 
126  public:
127  //**Type definitions****************************************************************************
129  using This = Band<MT,TF,true,false,CBAs...>;
130 
131  using BaseType = DenseVector<This,TF>;
132  using ViewedType = MT;
133  using ResultType = BandTrait_<RT,CBAs...>;
134  using TransposeType = TransposeType_<ResultType>;
135  using ElementType = ElementType_<MT>;
136  using ReturnType = ReturnType_<MT>;
137 
139  using CompositeType = IfTrue_< RequiresEvaluation<MT>::value, const ResultType, const Band& >;
140 
142  using ConstReference = ConstReference_<MT>;
143 
145  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
146 
148  using ConstPointer = ConstPointer_<MT>;
149 
151  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
152  //**********************************************************************************************
153 
154  //**BandIterator class definition***************************************************************
157  template< typename MatrixType // Type of the dense matrix
158  , typename IteratorType > // Type of the dense matrix iterator
159  class BandIterator
160  {
161  public:
162  //**Type definitions*************************************************************************
164  using IteratorCategory = typename std::iterator_traits<IteratorType>::iterator_category;
165 
167  using ValueType = typename std::iterator_traits<IteratorType>::value_type;
168 
170  using PointerType = typename std::iterator_traits<IteratorType>::pointer;
171 
173  using ReferenceType = typename std::iterator_traits<IteratorType>::reference;
174 
176  using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
177 
178  // STL iterator requirements
179  using iterator_category = IteratorCategory;
180  using value_type = ValueType;
181  using pointer = PointerType;
182  using reference = ReferenceType;
183  using difference_type = DifferenceType;
184  //*******************************************************************************************
185 
186  //**Constructor******************************************************************************
189  inline BandIterator() noexcept
190  : matrix_( nullptr ) // The dense matrix containing the band
191  , row_ ( 0UL ) // The current row index
192  , column_( 0UL ) // The current column index
193  , pos_ ( ) // Iterator to the current dense element
194  {}
195  //*******************************************************************************************
196 
197  //**Constructor******************************************************************************
204  inline BandIterator( MatrixType& matrix, size_t rowIndex, size_t columnIndex ) noexcept
205  : matrix_( &matrix ) // The dense matrix containing the band
206  , row_ ( rowIndex ) // The current row index
207  , column_( columnIndex ) // The current column index
208  , pos_ ( ) // Iterator to the current dense element
209  {
210  if( IsRowMajorMatrix<MatrixType>::value && row_ != matrix_->rows() )
211  pos_ = matrix_->begin( row_ ) + column_;
212  else if( IsColumnMajorMatrix<MatrixType>::value && column_ != matrix_->columns() )
213  pos_ = matrix_->begin( column_ ) + row_;
214  }
215  //*******************************************************************************************
216 
217  //**Constructor******************************************************************************
222  template< typename MatrixType2, typename IteratorType2 >
223  inline BandIterator( const BandIterator<MatrixType2,IteratorType2>& it ) noexcept
224  : matrix_( it.matrix_ ) // The dense matrix containing the band
225  , row_ ( it.row_ ) // The current row index
226  , column_( it.column_ ) // The current column index
227  , pos_ ( it.pos_ ) // Iterator to the current dense element
228  {}
229  //*******************************************************************************************
230 
231  //**Addition assignment operator*************************************************************
237  inline BandIterator& operator+=( size_t inc ) noexcept {
238  using blaze::reset;
239 
240  row_ += inc;
241  column_ += inc;
242 
243  if( IsRowMajorMatrix<MatrixType>::value && row_ != matrix_->rows() )
244  pos_ = matrix_->begin( row_ ) + column_;
245  else if( IsColumnMajorMatrix<MatrixType>::value && column_ != matrix_->columns() )
246  pos_ = matrix_->begin( column_ ) + row_;
247  else reset( pos_ );
248 
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Subtraction assignment operator**********************************************************
259  inline BandIterator& operator-=( size_t dec ) noexcept {
260  using blaze::reset;
261 
262  row_ -= dec;
263  column_ -= dec;
264 
265  if( IsRowMajorMatrix<MatrixType>::value && row_ != matrix_->rows() )
266  pos_ = matrix_->begin( row_ ) + column_;
267  else if( IsColumnMajorMatrix<MatrixType>::value && column_ != matrix_->columns() )
268  pos_ = matrix_->begin( column_ ) + row_;
269  else reset( pos_ );
270 
271  return *this;
272  }
273  //*******************************************************************************************
274 
275  //**Prefix increment operator****************************************************************
280  inline BandIterator& operator++() noexcept {
281  using blaze::reset;
282 
283  ++row_;
284  ++column_;
285 
286  if( IsRowMajorMatrix<MatrixType>::value && row_ != matrix_->rows() )
287  pos_ = matrix_->begin( row_ ) + column_;
288  else if( IsColumnMajorMatrix<MatrixType>::value && column_ != matrix_->columns() )
289  pos_ = matrix_->begin( column_ ) + row_;
290  else reset( pos_ );
291 
292  return *this;
293  }
294  //*******************************************************************************************
295 
296  //**Postfix increment operator***************************************************************
301  inline const BandIterator operator++( int ) noexcept {
302  const BandIterator tmp( *this );
303  ++(*this);
304  return tmp;
305  }
306  //*******************************************************************************************
307 
308  //**Prefix decrement operator****************************************************************
313  inline BandIterator& operator--() noexcept {
314  using blaze::reset;
315 
316  --row_;
317  --column_;
318 
319  if( IsRowMajorMatrix<MatrixType>::value && row_ != matrix_->rows() )
320  pos_ = matrix_->begin( row_ ) + column_;
321  else if( IsColumnMajorMatrix<MatrixType>::value && column_ != matrix_->columns() )
322  pos_ = matrix_->begin( column_ ) + row_;
323  else reset( pos_ );
324 
325  return *this;
326  }
327  //*******************************************************************************************
328 
329  //**Postfix decrement operator***************************************************************
334  inline const BandIterator operator--( int ) noexcept {
335  const BandIterator tmp( *this );
336  --(*this);
337  return tmp;
338  }
339  //*******************************************************************************************
340 
341  //**Subscript operator***********************************************************************
347  inline ReferenceType operator[]( size_t index ) const {
348  BLAZE_USER_ASSERT( row_ +index < matrix_->rows() , "Invalid access index detected" );
349  BLAZE_USER_ASSERT( column_+index < matrix_->columns(), "Invalid access index detected" );
350  const IteratorType pos( IsRowMajorMatrix<MatrixType>::value
351  ? matrix_->begin( row_+index ) + column_ + index
352  : matrix_->begin( column_+index ) + row_ + index );
353  return *pos;
354  }
355  //*******************************************************************************************
356 
357  //**Element access operator******************************************************************
362  inline ReferenceType operator*() const {
363  return *pos_;
364  }
365  //*******************************************************************************************
366 
367  //**Element access operator******************************************************************
372  inline PointerType operator->() const {
373  return pos_;
374  }
375  //*******************************************************************************************
376 
377  //**Equality operator************************************************************************
383  template< typename MatrixType2, typename IteratorType2 >
384  inline bool operator==( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
385  return row_ == rhs.row_;
386  }
387  //*******************************************************************************************
388 
389  //**Inequality operator**********************************************************************
395  template< typename MatrixType2, typename IteratorType2 >
396  inline bool operator!=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
397  return !( *this == rhs );
398  }
399  //*******************************************************************************************
400 
401  //**Less-than operator***********************************************************************
407  template< typename MatrixType2, typename IteratorType2 >
408  inline bool operator<( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
409  return row_ < rhs.row_;
410  }
411  //*******************************************************************************************
412 
413  //**Greater-than operator********************************************************************
419  template< typename MatrixType2, typename IteratorType2 >
420  inline bool operator>( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
421  return row_ > rhs.row_;
422  }
423  //*******************************************************************************************
424 
425  //**Less-or-equal-than operator**************************************************************
431  template< typename MatrixType2, typename IteratorType2 >
432  inline bool operator<=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
433  return row_ <= rhs.row_;
434  }
435  //*******************************************************************************************
436 
437  //**Greater-or-equal-than operator***********************************************************
443  template< typename MatrixType2, typename IteratorType2 >
444  inline bool operator>=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
445  return row_ >= rhs.row_;
446  }
447  //*******************************************************************************************
448 
449  //**Subtraction operator*********************************************************************
455  inline DifferenceType operator-( const BandIterator& rhs ) const noexcept {
456  return row_ - rhs.row_;
457  }
458  //*******************************************************************************************
459 
460  //**Addition operator************************************************************************
467  friend inline const BandIterator operator+( const BandIterator& it, size_t inc ) noexcept {
468  return BandIterator( *it.matrix_, it.row_+inc, it.column_+inc );
469  }
470  //*******************************************************************************************
471 
472  //**Addition operator************************************************************************
479  friend inline const BandIterator operator+( size_t inc, const BandIterator& it ) noexcept {
480  return BandIterator( *it.matrix_, it.row_+inc, it.column_+inc );
481  }
482  //*******************************************************************************************
483 
484  //**Subtraction operator*********************************************************************
491  friend inline const BandIterator operator-( const BandIterator& it, size_t dec ) noexcept {
492  return BandIterator( *it.matrix_, it.row_-dec, it.column_-dec );
493  }
494  //*******************************************************************************************
495 
496  private:
497  //**Member variables*************************************************************************
498  MatrixType* matrix_;
499  size_t row_;
500  size_t column_;
501  IteratorType pos_;
502  //*******************************************************************************************
503 
504  //**Friend declarations**********************************************************************
505  template< typename MatrixType2, typename IteratorType2 > friend class BandIterator;
506  //*******************************************************************************************
507  };
508  //**********************************************************************************************
509 
510  //**Type definitions****************************************************************************
512  using ConstIterator = BandIterator< const MT, ConstIterator_<MT> >;
513 
515  using Iterator = If_< IsConst<MT>, ConstIterator, BandIterator< MT, Iterator_<MT> > >;
516  //**********************************************************************************************
517 
518  //**Compilation flags***************************************************************************
520  enum : bool { simdEnabled = false };
521 
523  enum : bool { smpAssignable = MT::smpAssignable };
524  //**********************************************************************************************
525 
526  //**Constructors********************************************************************************
529  template< typename... RBAs >
530  explicit inline Band( MT& matrix, RBAs... args );
531  // No explicitly declared copy constructor.
533  //**********************************************************************************************
534 
535  //**Destructor**********************************************************************************
536  // No explicitly declared destructor.
537  //**********************************************************************************************
538 
539  //**Data access functions***********************************************************************
542  inline Reference operator[]( size_t index );
543  inline ConstReference operator[]( size_t index ) const;
544  inline Reference at( size_t index );
545  inline ConstReference at( size_t index ) const;
546  inline Pointer data () noexcept;
547  inline ConstPointer data () const noexcept;
548  inline Iterator begin ();
549  inline ConstIterator begin () const;
550  inline ConstIterator cbegin() const;
551  inline Iterator end ();
552  inline ConstIterator end () const;
553  inline ConstIterator cend () const;
555  //**********************************************************************************************
556 
557  //**Assignment operators************************************************************************
560  inline Band& operator=( const ElementType& rhs );
561  inline Band& operator=( initializer_list<ElementType> list );
562  inline Band& operator=( const Band& rhs );
563 
564  template< typename VT > inline Band& operator= ( const Vector<VT,TF>& rhs );
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 DenseVector<VT,TF>& rhs );
569  template< typename VT > inline Band& operator%=( const Vector<VT,TF>& rhs );
571  //**********************************************************************************************
572 
573  //**Utility functions***************************************************************************
576  using DataType::band;
577  using DataType::row;
578  using DataType::column;
579 
580  inline MT& operand() noexcept;
581  inline const MT& operand() const noexcept;
582 
583  inline size_t size() const noexcept;
584  inline size_t spacing() const noexcept;
585  inline size_t capacity() const noexcept;
586  inline size_t nonZeros() const;
587  inline void reset();
589  //**********************************************************************************************
590 
591  //**Numeric functions***************************************************************************
594  template< typename Other > inline Band& scale( const Other& scalar );
596  //**********************************************************************************************
597 
598  //**Expression template evaluation functions****************************************************
601  template< typename Other >
602  inline bool canAlias( const Other* alias ) const noexcept;
603 
604  template< typename MT2, ptrdiff_t... CBAs2 >
605  inline bool canAlias( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept;
606 
607  template< typename Other >
608  inline bool isAliased( const Other* alias ) const noexcept;
609 
610  template< typename MT2, ptrdiff_t... CBAs2 >
611  inline bool isAliased( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept;
612 
613  inline bool isAligned () const noexcept;
614  inline bool canSMPAssign() const noexcept;
615 
616  template< typename VT > inline void assign ( const DenseVector <VT,TF>& rhs );
617  template< typename VT > inline void assign ( const SparseVector<VT,TF>& rhs );
618  template< typename VT > inline void addAssign ( const DenseVector <VT,TF>& rhs );
619  template< typename VT > inline void addAssign ( const SparseVector<VT,TF>& rhs );
620  template< typename VT > inline void subAssign ( const DenseVector <VT,TF>& rhs );
621  template< typename VT > inline void subAssign ( const SparseVector<VT,TF>& rhs );
622  template< typename VT > inline void multAssign( const DenseVector <VT,TF>& rhs );
623  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
624  template< typename VT > inline void divAssign ( const DenseVector <VT,TF>& rhs );
626  //**********************************************************************************************
627 
628  private:
629  //**Member variables****************************************************************************
632  Operand matrix_;
633 
634  //**********************************************************************************************
635 
636  //**Friend declarations*************************************************************************
637  template< typename MT2, bool TF2, bool DF2, bool MF2, ptrdiff_t... CBAs2 > friend class Band;
638  //**********************************************************************************************
639 
640  //**Compile time checks*************************************************************************
646  //**********************************************************************************************
647 };
649 //*************************************************************************************************
650 
651 
652 
653 
654 //=================================================================================================
655 //
656 // CONSTRUCTORS
657 //
658 //=================================================================================================
659 
660 //*************************************************************************************************
673 template< typename MT // Type of the dense matrix
674  , bool TF // Transpose flag
675  , ptrdiff_t... CBAs > // Compile time band arguments
676 template< typename... RBAs > // Runtime band arguments
677 inline Band<MT,TF,true,false,CBAs...>::Band( MT& matrix, RBAs... args )
678  : DataType( args... ) // Base class initialization
679  , matrix_ ( matrix ) // The matrix containing the band
680 {
681  if( !Contains< TypeList<RBAs...>, Unchecked >::value ) {
682  if( ( band() > 0L && column() >= matrix.columns() ) ||
683  ( band() < 0L && row() >= matrix.rows() ) ) {
684  BLAZE_THROW_INVALID_ARGUMENT( "Invalid band access index" );
685  }
686  }
687  else {
688  BLAZE_USER_ASSERT( band() < 0L || column() < matrix.columns(), "Invalid band access index" );
689  BLAZE_USER_ASSERT( band() > 0L || row() < matrix.rows(), "Invalid band access index" );
690  }
691 }
693 //*************************************************************************************************
694 
695 
696 
697 
698 //=================================================================================================
699 //
700 // DATA ACCESS FUNCTIONS
701 //
702 //=================================================================================================
703 
704 //*************************************************************************************************
714 template< typename MT // Type of the dense matrix
715  , bool TF // Transpose flag
716  , ptrdiff_t... CBAs > // Compile time band arguments
717 inline typename Band<MT,TF,true,false,CBAs...>::Reference
718  Band<MT,TF,true,false,CBAs...>::operator[]( size_t index )
719 {
720  BLAZE_USER_ASSERT( index < size(), "Invalid band access index" );
721  return matrix_(row()+index,column()+index);
722 }
724 //*************************************************************************************************
725 
726 
727 //*************************************************************************************************
737 template< typename MT // Type of the dense matrix
738  , bool TF // Transpose flag
739  , ptrdiff_t... CBAs > // Compile time band arguments
740 inline typename Band<MT,TF,true,false,CBAs...>::ConstReference
741  Band<MT,TF,true,false,CBAs...>::operator[]( size_t index ) const
742 {
743  BLAZE_USER_ASSERT( index < size(), "Invalid band access index" );
744  return const_cast<const MT&>( matrix_ )(row()+index,column()+index);
745 }
747 //*************************************************************************************************
748 
749 
750 //*************************************************************************************************
761 template< typename MT // Type of the dense matrix
762  , bool TF // Transpose flag
763  , ptrdiff_t... CBAs > // Compile time band arguments
764 inline typename Band<MT,TF,true,false,CBAs...>::Reference
765  Band<MT,TF,true,false,CBAs...>::at( size_t index )
766 {
767  if( index >= size() ) {
768  BLAZE_THROW_OUT_OF_RANGE( "Invalid band access index" );
769  }
770  return (*this)[index];
771 }
773 //*************************************************************************************************
774 
775 
776 //*************************************************************************************************
787 template< typename MT // Type of the dense matrix
788  , bool TF // Transpose flag
789  , ptrdiff_t... CBAs > // Compile time band arguments
790 inline typename Band<MT,TF,true,false,CBAs...>::ConstReference
791  Band<MT,TF,true,false,CBAs...>::at( size_t index ) const
792 {
793  if( index >= size() ) {
794  BLAZE_THROW_OUT_OF_RANGE( "Invalid band access index" );
795  }
796  return (*this)[index];
797 }
799 //*************************************************************************************************
800 
801 
802 //*************************************************************************************************
811 template< typename MT // Type of the dense matrix
812  , bool TF // Transpose flag
813  , ptrdiff_t... CBAs > // Compile time band arguments
814 inline typename Band<MT,TF,true,false,CBAs...>::Pointer
816 {
817  if( IsRowMajorMatrix<MT>::value )
818  return matrix_.data() + row() * matrix_.spacing() + column();
819  else
820  return matrix_.data() + row() + column() * matrix_.spacing();
821 }
823 //*************************************************************************************************
824 
825 
826 //*************************************************************************************************
835 template< typename MT // Type of the dense matrix
836  , bool TF // Transpose flag
837  , ptrdiff_t... CBAs > // Compile time band arguments
838 inline typename Band<MT,TF,true,false,CBAs...>::ConstPointer
839  Band<MT,TF,true,false,CBAs...>::data() const noexcept
840 {
841  if( IsRowMajorMatrix<MT>::value )
842  return matrix_.data() + row() * matrix_.spacing() + column();
843  else
844  return matrix_.data() + row() + column() * matrix_.spacing();
845 }
847 //*************************************************************************************************
848 
849 
850 //*************************************************************************************************
858 template< typename MT // Type of the dense matrix
859  , bool TF // Transpose flag
860  , ptrdiff_t... CBAs > // Compile time band arguments
861 inline typename Band<MT,TF,true,false,CBAs...>::Iterator
863 {
864  return Iterator( matrix_, row(), column() );
865 }
867 //*************************************************************************************************
868 
869 
870 //*************************************************************************************************
878 template< typename MT // Type of the dense matrix
879  , bool TF // Transpose flag
880  , ptrdiff_t... CBAs > // Compile time band arguments
881 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
883 {
884  return ConstIterator( matrix_, row(), column() );
885 }
887 //*************************************************************************************************
888 
889 
890 //*************************************************************************************************
898 template< typename MT // Type of the dense matrix
899  , bool TF // Transpose flag
900  , ptrdiff_t... CBAs > // Compile time band arguments
901 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
903 {
904  return ConstIterator( matrix_, row(), column() );
905 }
907 //*************************************************************************************************
908 
909 
910 //*************************************************************************************************
918 template< typename MT // Type of the dense matrix
919  , bool TF // Transpose flag
920  , ptrdiff_t... CBAs > // Compile time band arguments
921 inline typename Band<MT,TF,true,false,CBAs...>::Iterator
923 {
924  const size_t n( size() );
925  return Iterator( matrix_, row()+n, column()+n );
926 }
928 //*************************************************************************************************
929 
930 
931 //*************************************************************************************************
939 template< typename MT // Type of the dense matrix
940  , bool TF // Transpose flag
941  , ptrdiff_t... CBAs > // Compile time band arguments
942 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
944 {
945  const size_t n( size() );
946  return ConstIterator( matrix_, row()+n, column()+n );
947 }
949 //*************************************************************************************************
950 
951 
952 //*************************************************************************************************
960 template< typename MT // Type of the dense matrix
961  , bool TF // Transpose flag
962  , ptrdiff_t... CBAs > // Compile time band arguments
963 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
965 {
966  const size_t n( size() );
967  return ConstIterator( matrix_, row()+n, column()+n );
968 }
970 //*************************************************************************************************
971 
972 
973 
974 
975 //=================================================================================================
976 //
977 // ASSIGNMENT OPERATORS
978 //
979 //=================================================================================================
980 
981 //*************************************************************************************************
992 template< typename MT // Type of the dense matrix
993  , bool TF // Transpose flag
994  , ptrdiff_t... CBAs > // Compile time band arguments
995 inline Band<MT,TF,true,false,CBAs...>&
996  Band<MT,TF,true,false,CBAs...>::operator=( const ElementType& rhs )
997 {
998  decltype(auto) left( derestrict( matrix_ ) );
999 
1000  if( ( IsLower<MT>::value && column() > 0UL ) ||
1001  ( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value ) && row() == 0UL ) ||
1002  ( IsUpper<MT>::value && row() > 0UL ) ||
1003  ( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value ) && column() == 0UL ) )
1004  return *this;
1005 
1006  const size_t n( size() );
1007  for( size_t i=0UL; i<n; ++i ) {
1008  if( !IsRestricted<MT>::value || IsTriangular<MT>::value || trySet( matrix_, row()+i, column()+i, rhs ) )
1009  left(row()+i,column()+i) = rhs;
1010  }
1011 
1012  return *this;
1013 }
1015 //*************************************************************************************************
1016 
1017 
1018 //*************************************************************************************************
1033 template< typename MT // Type of the dense matrix
1034  , bool TF // Transpose flag
1035  , ptrdiff_t... CBAs > // Compile time band arguments
1036 inline Band<MT,TF,true,false,CBAs...>&
1037  Band<MT,TF,true,false,CBAs...>::operator=( initializer_list<ElementType> list )
1038 {
1039  if( list.size() > size() ) {
1040  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to band" );
1041  }
1042 
1043  if( IsRestricted<MT>::value ) {
1044  const InitializerVector<ElementType,false> tmp( list, size() );
1045  if( !tryAssign( matrix_, tmp, band(), row(), column() ) ) {
1046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1047  }
1048  }
1049 
1050  decltype(auto) left( derestrict( *this ) );
1051 
1052  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
1053 
1054  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1055 
1056  return *this;
1057 }
1059 //*************************************************************************************************
1060 
1061 
1062 //*************************************************************************************************
1076 template< typename MT // Type of the dense matrix
1077  , bool TF // Transpose flag
1078  , ptrdiff_t... CBAs > // Compile time band arguments
1079 inline Band<MT,TF,true,false,CBAs...>&
1080  Band<MT,TF,true,false,CBAs...>::operator=( const Band& rhs )
1081 {
1082  if( &rhs == this ) return *this;
1083 
1084  if( size() != rhs.size() ) {
1085  BLAZE_THROW_INVALID_ARGUMENT( "Band sizes do not match" );
1086  }
1087 
1088  if( !tryAssign( matrix_, rhs, band(), row(), column() ) ) {
1089  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1090  }
1091 
1092  decltype(auto) left( derestrict( *this ) );
1093 
1094  if( IsExpression<MT>::value && rhs.canAlias( &matrix_ ) ) {
1095  const ResultType tmp( rhs );
1096  smpAssign( left, tmp );
1097  }
1098  else {
1099  smpAssign( left, rhs );
1100  }
1101 
1102  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1103 
1104  return *this;
1105 }
1107 //*************************************************************************************************
1108 
1109 
1110 //*************************************************************************************************
1124 template< typename MT // Type of the dense matrix
1125  , bool TF // Transpose flag
1126  , ptrdiff_t... CBAs > // Compile time band arguments
1127 template< typename VT > // Type of the right-hand side vector
1128 inline Band<MT,TF,true,false,CBAs...>&
1129  Band<MT,TF,true,false,CBAs...>::operator=( const Vector<VT,TF>& rhs )
1130 {
1133 
1134  if( size() != (~rhs).size() ) {
1135  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1136  }
1137 
1138  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1139  Right right( ~rhs );
1140 
1141  if( !tryAssign( matrix_, right, band(), row(), column() ) ) {
1142  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1143  }
1144 
1145  decltype(auto) left( derestrict( *this ) );
1146 
1147  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1148  const ResultType_<VT> tmp( right );
1149  smpAssign( left, tmp );
1150  }
1151  else {
1152  if( IsSparseVector<VT>::value )
1153  reset();
1154  smpAssign( left, right );
1155  }
1156 
1157  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1158 
1159  return *this;
1160 }
1162 //*************************************************************************************************
1163 
1164 
1165 //*************************************************************************************************
1179 template< typename MT // Type of the dense matrix
1180  , bool TF // Transpose flag
1181  , ptrdiff_t... CBAs > // Compile time band arguments
1182 template< typename VT > // Type of the right-hand side vector
1183 inline Band<MT,TF,true,false,CBAs...>&
1184  Band<MT,TF,true,false,CBAs...>::operator+=( const Vector<VT,TF>& rhs )
1185 {
1188 
1189  if( size() != (~rhs).size() ) {
1190  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1191  }
1192 
1193  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1194  Right right( ~rhs );
1195 
1196  if( !tryAddAssign( matrix_, right, band(), row(), column() ) ) {
1197  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1198  }
1199 
1200  decltype(auto) left( derestrict( *this ) );
1201 
1202  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1203  const ResultType_<VT> tmp( right );
1204  smpAddAssign( left, tmp );
1205  }
1206  else {
1207  smpAddAssign( left, right );
1208  }
1209 
1210  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1211 
1212  return *this;
1213 }
1215 //*************************************************************************************************
1216 
1217 
1218 //*************************************************************************************************
1232 template< typename MT // Type of the dense matrix
1233  , bool TF // Transpose flag
1234  , ptrdiff_t... CBAs > // Compile time band arguments
1235 template< typename VT > // Type of the right-hand side vector
1236 inline Band<MT,TF,true,false,CBAs...>&
1237  Band<MT,TF,true,false,CBAs...>::operator-=( const Vector<VT,TF>& rhs )
1238 {
1241 
1242  if( size() != (~rhs).size() ) {
1243  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1244  }
1245 
1246  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1247  Right right( ~rhs );
1248 
1249  if( !trySubAssign( matrix_, right, band(), row(), column() ) ) {
1250  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1251  }
1252 
1253  decltype(auto) left( derestrict( *this ) );
1254 
1255  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1256  const ResultType_<VT> tmp( right );
1257  smpSubAssign( left, tmp );
1258  }
1259  else {
1260  smpSubAssign( left, right );
1261  }
1262 
1263  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1264 
1265  return *this;
1266 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1284 template< typename MT // Type of the dense matrix
1285  , bool TF // Transpose flag
1286  , ptrdiff_t... CBAs > // Compile time band arguments
1287 template< typename VT > // Type of the right-hand side vector
1288 inline Band<MT,TF,true,false,CBAs...>&
1289  Band<MT,TF,true,false,CBAs...>::operator*=( const Vector<VT,TF>& rhs )
1290 {
1296 
1297  if( size() != (~rhs).size() ) {
1298  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1299  }
1300 
1301  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1302  Right right( ~rhs );
1303 
1304  if( !tryMultAssign( matrix_, right, band(), row(), column() ) ) {
1305  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1306  }
1307 
1308  decltype(auto) left( derestrict( *this ) );
1309 
1310  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1311  const ResultType_<VT> tmp( right );
1312  smpMultAssign( left, tmp );
1313  }
1314  else {
1315  smpMultAssign( left, right );
1316  }
1317 
1318  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1319 
1320  return *this;
1321 }
1323 //*************************************************************************************************
1324 
1325 
1326 //*************************************************************************************************
1338 template< typename MT // Type of the dense matrix
1339  , bool TF // Transpose flag
1340  , ptrdiff_t... CBAs > // Compile time band arguments
1341 template< typename VT > // Type of the right-hand side dense vector
1342 inline Band<MT,TF,true,false,CBAs...>&
1343  Band<MT,TF,true,false,CBAs...>::operator/=( const DenseVector<VT,TF>& rhs )
1344 {
1347 
1348  if( size() != (~rhs).size() ) {
1349  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1350  }
1351 
1352  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1353  Right right( ~rhs );
1354 
1355  if( !tryDivAssign( matrix_, right, band(), row(), column() ) ) {
1356  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1357  }
1358 
1359  decltype(auto) left( derestrict( *this ) );
1360 
1361  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1362  const ResultType_<VT> tmp( right );
1363  smpDivAssign( left, tmp );
1364  }
1365  else {
1366  smpDivAssign( left, right );
1367  }
1368 
1369  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1370 
1371  return *this;
1372 }
1374 //*************************************************************************************************
1375 
1376 
1377 //*************************************************************************************************
1390 template< typename MT // Type of the dense matrix
1391  , bool TF // Transpose flag
1392  , ptrdiff_t... CBAs > // Compile time band arguments
1393 template< typename VT > // Type of the right-hand side vector
1394 inline Band<MT,TF,true,false,CBAs...>&
1395  Band<MT,TF,true,false,CBAs...>::operator%=( const Vector<VT,TF>& rhs )
1396 {
1397  using blaze::assign;
1398 
1401 
1402  using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1403 
1407 
1408  if( size() != 3UL || (~rhs).size() != 3UL ) {
1409  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1410  }
1411 
1412  const CrossType right( *this % (~rhs) );
1413 
1414  if( !tryAssign( matrix_, right, band(), row(), column() ) ) {
1415  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1416  }
1417 
1418  decltype(auto) left( derestrict( *this ) );
1419 
1420  assign( left, right );
1421 
1422  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1423 
1424  return *this;
1425 }
1427 //*************************************************************************************************
1428 
1429 
1430 
1431 
1432 //=================================================================================================
1433 //
1434 // UTILITY FUNCTIONS
1435 //
1436 //=================================================================================================
1437 
1438 //*************************************************************************************************
1444 template< typename MT // Type of the dense matrix
1445  , bool TF // Transpose flag
1446  , ptrdiff_t... CBAs > // Compile time band arguments
1447 inline MT& Band<MT,TF,true,false,CBAs...>::operand() noexcept
1448 {
1449  return matrix_;
1450 }
1452 //*************************************************************************************************
1453 
1454 
1455 //*************************************************************************************************
1461 template< typename MT // Type of the dense matrix
1462  , bool TF // Transpose flag
1463  , ptrdiff_t... CBAs > // Compile time band arguments
1464 inline const MT& Band<MT,TF,true,false,CBAs...>::operand() const noexcept
1465 {
1466  return matrix_;
1467 }
1469 //*************************************************************************************************
1470 
1471 
1472 //*************************************************************************************************
1478 template< typename MT // Type of the dense matrix
1479  , bool TF // Transpose flag
1480  , ptrdiff_t... CBAs > // Compile time band arguments
1481 inline size_t Band<MT,TF,true,false,CBAs...>::size() const noexcept
1482 {
1483  return min( matrix_.rows() - row(), matrix_.columns() - column() );
1484 }
1486 //*************************************************************************************************
1487 
1488 
1489 //*************************************************************************************************
1498 template< typename MT // Type of the dense matrix
1499  , bool TF // Transpose flag
1500  , ptrdiff_t... CBAs > // Compile time band arguments
1501 inline size_t Band<MT,TF,true,false,CBAs...>::spacing() const noexcept
1502 {
1503  return size();
1504 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1515 template< typename MT // Type of the dense matrix
1516  , bool TF // Transpose flag
1517  , ptrdiff_t... CBAs > // Compile time band arguments
1518 inline size_t Band<MT,TF,true,false,CBAs...>::capacity() const noexcept
1519 {
1520  return size();
1521 }
1523 //*************************************************************************************************
1524 
1525 
1526 //*************************************************************************************************
1535 template< typename MT // Type of the dense matrix
1536  , bool TF // Transpose flag
1537  , ptrdiff_t... CBAs > // Compile time band arguments
1538 inline size_t Band<MT,TF,true,false,CBAs...>::nonZeros() const
1539 {
1540  const size_t n( size() );
1541  size_t nonzeros( 0UL );
1542 
1543  for( size_t i=0UL; i<n; ++i )
1544  if( !isDefault( matrix_(row()+i,column()+i) ) )
1545  ++nonzeros;
1546 
1547  return nonzeros;
1548 }
1550 //*************************************************************************************************
1551 
1552 
1553 //*************************************************************************************************
1559 template< typename MT // Type of the dense matrix
1560  , bool TF // Transpose flag
1561  , ptrdiff_t... CBAs > // Compile time band arguments
1563 {
1564  using blaze::clear;
1565 
1566  if( ( IsLower<MT>::value && column() > 0UL ) ||
1567  ( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value ) && row() == 0UL ) ||
1568  ( IsUpper<MT>::value && row() > 0UL ) ||
1569  ( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value ) && column() == 0UL ) )
1570  return;
1571 
1572  const size_t n( size() );
1573  for( size_t i=0UL; i<n; ++i )
1574  clear( matrix_(row()+i,column()+i) );
1575 }
1577 //*************************************************************************************************
1578 
1579 
1580 
1581 
1582 //=================================================================================================
1583 //
1584 // NUMERIC FUNCTIONS
1585 //
1586 //=================================================================================================
1587 
1588 //*************************************************************************************************
1601 template< typename MT // Type of the dense matrix
1602  , bool TF // Transpose flag
1603  , ptrdiff_t... CBAs > // Compile time band arguments
1604 template< typename Other > // Data type of the scalar value
1605 inline Band<MT,TF,true,false,CBAs...>&
1606  Band<MT,TF,true,false,CBAs...>::scale( const Other& scalar )
1607 {
1609 
1610  if( ( IsLower<MT>::value && column() > 0UL ) ||
1611  ( IsStrictlyLower<MT>::value && row() == 0UL ) ||
1612  ( IsUpper<MT>::value && row() > 0UL ) ||
1613  ( IsStrictlyUpper<MT>::value && column() == 0UL ) )
1614  return *this;
1615 
1616  const size_t n( size() );
1617  for( size_t i=0UL; i<n; ++i ) {
1618  matrix_(row()+i,column()+i) *= scalar;
1619  }
1620 
1621  return *this;
1622 }
1624 //*************************************************************************************************
1625 
1626 
1627 
1628 
1629 //=================================================================================================
1630 //
1631 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1632 //
1633 //=================================================================================================
1634 
1635 //*************************************************************************************************
1646 template< typename MT // Type of the dense matrix
1647  , bool TF // Transpose flag
1648  , ptrdiff_t... CBAs > // Compile time band arguments
1649 template< typename Other > // Data type of the foreign expression
1650 inline bool Band<MT,TF,true,false,CBAs...>::canAlias( const Other* alias ) const noexcept
1651 {
1652  return matrix_.isAliased( alias );
1653 }
1655 //*************************************************************************************************
1656 
1657 
1658 //*************************************************************************************************
1669 template< typename MT // Type of the dense matrix
1670  , bool TF // Transpose flag
1671  , ptrdiff_t... CBAs > // Compile time band arguments
1672 template< typename MT2 // Matrix type of the foreign dense band
1673  , ptrdiff_t... CBAs2 > // Compile time band arguments of the foreign dense band
1674 inline bool
1675  Band<MT,TF,true,false,CBAs...>::canAlias( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept
1676 {
1677  return matrix_.isAliased( &alias->matrix_ ) && ( band() == alias->band() );
1678 }
1680 //*************************************************************************************************
1681 
1682 
1683 //*************************************************************************************************
1694 template< typename MT // Type of the dense matrix
1695  , bool TF // Transpose flag
1696  , ptrdiff_t... CBAs > // Compile time band arguments
1697 template< typename Other > // Data type of the foreign expression
1698 inline bool Band<MT,TF,true,false,CBAs...>::isAliased( const Other* alias ) const noexcept
1699 {
1700  return matrix_.isAliased( alias );
1701 }
1703 //*************************************************************************************************
1704 
1705 
1706 //*************************************************************************************************
1717 template< typename MT // Type of the dense matrix
1718  , bool TF // Transpose flag
1719  , ptrdiff_t... CBAs > // Compile time band arguments
1720 template< typename MT2 // Matrix type of the foreign dense band
1721  , ptrdiff_t... CBAs2 > // Compile time band arguments of the foreign dense band
1722 inline bool
1723  Band<MT,TF,true,false,CBAs...>::isAliased( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept
1724 {
1725  return matrix_.isAliased( &alias->matrix_ ) && ( band() == alias->band() );
1726 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1741 template< typename MT // Type of the dense matrix
1742  , bool TF // Transpose flag
1743  , ptrdiff_t... CBAs > // Compile time band arguments
1744 inline bool Band<MT,TF,true,false,CBAs...>::isAligned() const noexcept
1745 {
1746  return false;
1747 }
1749 //*************************************************************************************************
1750 
1751 
1752 //*************************************************************************************************
1763 template< typename MT // Type of the dense matrix
1764  , bool TF // Transpose flag
1765  , ptrdiff_t... CBAs > // Compile time band arguments
1766 inline bool Band<MT,TF,true,false,CBAs...>::canSMPAssign() const noexcept
1767 {
1768  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1769 }
1771 //*************************************************************************************************
1772 
1773 
1774 //*************************************************************************************************
1786 template< typename MT // Type of the dense matrix
1787  , bool TF // Transpose flag
1788  , ptrdiff_t... CBAs > // Compile time band arguments
1789 template< typename VT > // Type of the right-hand side dense vector
1790 inline void Band<MT,TF,true,false,CBAs...>::assign( const DenseVector<VT,TF>& rhs )
1791 {
1792  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1793 
1794  const size_t ipos( (~rhs).size() & size_t(-2) );
1795  for( size_t i=0UL; i<ipos; i+=2UL ) {
1796  matrix_(row()+i ,column()+i ) = (~rhs)[i ];
1797  matrix_(row()+i+1UL,column()+i+1UL) = (~rhs)[i+1UL];
1798  }
1799  if( ipos < (~rhs).size() ) {
1800  matrix_(row()+ipos,column()+ipos) = (~rhs)[ipos];
1801  }
1802 }
1804 //*************************************************************************************************
1805 
1806 
1807 //*************************************************************************************************
1819 template< typename MT // Type of the dense matrix
1820  , bool TF // Transpose flag
1821  , ptrdiff_t... CBAs > // Compile time band arguments
1822 template< typename VT > // Type of the right-hand side sparse vector
1823 inline void Band<MT,TF,true,false,CBAs...>::assign( const SparseVector<VT,TF>& rhs )
1824 {
1825  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1826 
1827  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1828  const size_t index( element->index() );
1829  matrix_(row()+index,column()+index) = element->value();
1830  }
1831 }
1833 //*************************************************************************************************
1834 
1835 
1836 //*************************************************************************************************
1848 template< typename MT // Type of the dense matrix
1849  , bool TF // Transpose flag
1850  , ptrdiff_t... CBAs > // Compile time band arguments
1851 template< typename VT > // Type of the right-hand side dense vector
1852 inline void Band<MT,TF,true,false,CBAs...>::addAssign( const DenseVector<VT,TF>& rhs )
1853 {
1854  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1855 
1856  const size_t ipos( (~rhs).size() & size_t(-2) );
1857  for( size_t i=0UL; i<ipos; i+=2UL ) {
1858  matrix_(row()+i ,column()+i ) += (~rhs)[i ];
1859  matrix_(row()+i+1UL,column()+i+1UL) += (~rhs)[i+1UL];
1860  }
1861  if( ipos < (~rhs).size() ) {
1862  matrix_(row()+ipos,column()+ipos) += (~rhs)[ipos];
1863  }
1864 }
1866 //*************************************************************************************************
1867 
1868 
1869 //*************************************************************************************************
1881 template< typename MT // Type of the dense matrix
1882  , bool TF // Transpose flag
1883  , ptrdiff_t... CBAs > // Compile time band arguments
1884 template< typename VT > // Type of the right-hand side sparse vector
1885 inline void Band<MT,TF,true,false,CBAs...>::addAssign( const SparseVector<VT,TF>& rhs )
1886 {
1887  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1888 
1889  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1890  const size_t index( element->index() );
1891  matrix_(row()+index,column()+index) += element->value();
1892  }
1893 }
1895 //*************************************************************************************************
1896 
1897 
1898 //*************************************************************************************************
1910 template< typename MT // Type of the dense matrix
1911  , bool TF // Transpose flag
1912  , ptrdiff_t... CBAs > // Compile time band arguments
1913 template< typename VT > // Type of the right-hand side dense vector
1914 inline void Band<MT,TF,true,false,CBAs...>::subAssign( const DenseVector<VT,TF>& rhs )
1915 {
1916  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1917 
1918  const size_t ipos( (~rhs).size() & size_t(-2) );
1919  for( size_t i=0UL; i<ipos; i+=2UL ) {
1920  matrix_(row()+i ,column()+i ) -= (~rhs)[i ];
1921  matrix_(row()+i+1UL,column()+i+1UL) -= (~rhs)[i+1UL];
1922  }
1923  if( ipos < (~rhs).size() ) {
1924  matrix_(row()+ipos,column()+ipos) -= (~rhs)[ipos];
1925  }
1926 }
1928 //*************************************************************************************************
1929 
1930 
1931 //*************************************************************************************************
1943 template< typename MT // Type of the dense matrix
1944  , bool TF // Transpose flag
1945  , ptrdiff_t... CBAs > // Compile time band arguments
1946 template< typename VT > // Type of the right-hand side sparse vector
1947 inline void Band<MT,TF,true,false,CBAs...>::subAssign( const SparseVector<VT,TF>& rhs )
1948 {
1949  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1950 
1951  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1952  const size_t index( element->index() );
1953  matrix_(row()+index,column()+index) -= element->value();
1954  }
1955 }
1957 //*************************************************************************************************
1958 
1959 
1960 //*************************************************************************************************
1972 template< typename MT // Type of the dense matrix
1973  , bool TF // Transpose flag
1974  , ptrdiff_t... CBAs > // Compile time band arguments
1975 template< typename VT > // Type of the right-hand side dense vector
1976 inline void Band<MT,TF,true,false,CBAs...>::multAssign( const DenseVector<VT,TF>& rhs )
1977 {
1978  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1979 
1980  const size_t ipos( (~rhs).size() & size_t(-2) );
1981  for( size_t i=0UL; i<ipos; i+=2UL ) {
1982  matrix_(row()+i ,column()+i ) *= (~rhs)[i ];
1983  matrix_(row()+i+1UL,column()+i+1UL) *= (~rhs)[i+1UL];
1984  }
1985  if( ipos < (~rhs).size() ) {
1986  matrix_(row()+ipos,column()+ipos) *= (~rhs)[ipos];
1987  }
1988 }
1990 //*************************************************************************************************
1991 
1992 
1993 //*************************************************************************************************
2005 template< typename MT // Type of the dense matrix
2006  , bool TF // Transpose flag
2007  , ptrdiff_t... CBAs > // Compile time band arguments
2008 template< typename VT > // Type of the right-hand side sparse vector
2009 inline void Band<MT,TF,true,false,CBAs...>::multAssign( const SparseVector<VT,TF>& rhs )
2010 {
2011  using blaze::reset;
2012 
2013  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2014 
2015  size_t i( 0UL );
2016 
2017  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2018  const size_t index( element->index() );
2019  for( ; i<index; ++i )
2020  reset( matrix_(row()+i,column()+i) );
2021  matrix_(row()+index,column()+index) *= element->value();
2022  ++i;
2023  }
2024 
2025  for( ; i<size(); ++i ) {
2026  reset( matrix_(row()+i,column()+i) );
2027  }
2028 }
2030 //*************************************************************************************************
2031 
2032 
2033 //*************************************************************************************************
2045 template< typename MT // Type of the dense matrix
2046  , bool TF // Transpose flag
2047  , ptrdiff_t... CBAs > // Compile time band arguments
2048 template< typename VT > // Type of the right-hand side dense vector
2049 inline void Band<MT,TF,true,false,CBAs...>::divAssign( const DenseVector<VT,TF>& rhs )
2050 {
2051  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2052 
2053  const size_t ipos( (~rhs).size() & size_t(-2) );
2054  for( size_t i=0UL; i<ipos; i+=2UL ) {
2055  matrix_(row()+i ,column()+i ) /= (~rhs)[i ];
2056  matrix_(row()+i+1UL,column()+i+1UL) /= (~rhs)[i+1UL];
2057  }
2058  if( ipos < (~rhs).size() ) {
2059  matrix_(row()+ipos,column()+ipos) /= (~rhs)[ipos];
2060  }
2061 }
2063 //*************************************************************************************************
2064 
2065 
2066 
2067 
2068 //=================================================================================================
2069 //
2070 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRIX MULTIPLICATIONS
2071 //
2072 //=================================================================================================
2073 
2074 //*************************************************************************************************
2082 template< typename MT // Type of the dense matrix multiplication
2083  , bool TF // Transpose flag
2084  , ptrdiff_t... CBAs > // Compile time band arguments
2085 class Band<MT,TF,true,true,CBAs...>
2086  : public View< DenseVector< Band<MT,TF,true,true,CBAs...>, TF > >
2087  , private BandData<CBAs...>
2088  , private Computation
2089 {
2090  private:
2091  //**Type definitions****************************************************************************
2093  using DataType = BandData<CBAs...>;
2094 
2096  using LeftOperand = RemoveReference_< LeftOperand_<MT> >;
2097 
2099  using RightOperand = RemoveReference_< RightOperand_<MT> >;
2100  //**********************************************************************************************
2101 
2102  public:
2103  //**Type definitions****************************************************************************
2105  using This = Band<MT,TF,true,true,CBAs...>;
2106 
2108  using BaseType = DenseVector<This,TF>;
2109 
2111  using ViewedType = MT;
2112 
2114  using ResultType = BandTrait_<ResultType_<MT>,CBAs...>;
2115 
2116  using TransposeType = TransposeType_<ResultType>;
2117  using ElementType = ElementType_<ResultType>;
2118  using ReturnType = ReturnType_<MT>;
2119 
2121  using CompositeType = If_< Or< RequiresEvaluation<LeftOperand>
2122  , RequiresEvaluation<RightOperand> >
2123  , const ResultType, const Band& >;
2124 
2126  using LT = If_< And< IsSparseMatrix<LeftOperand>, IsColumnMajorMatrix<LeftOperand> >
2127  , ResultType_<LeftOperand>
2128  , CompositeType_<LeftOperand> >;
2129 
2131  using RT = If_< And< IsSparseMatrix<RightOperand>, IsRowMajorMatrix<RightOperand> >
2132  , ResultType_<RightOperand>
2133  , CompositeType_<RightOperand> >;
2134  //**********************************************************************************************
2135 
2136  //**Compilation flags***************************************************************************
2138  enum : bool { simdEnabled = false };
2139 
2141  enum : bool { smpAssignable = false };
2142  //**********************************************************************************************
2143 
2144  //**Constructor*********************************************************************************
2151  template< typename... RBAs > // Runtime band arguments
2152  explicit inline Band( const MT& mmm, RBAs... args )
2153  : DataType( args... ) // Base class initialization
2154  , matrix_ ( mmm ) // The matrix multiplication containing the band
2155  {
2156  if( !Contains< TypeList<RBAs...>, Unchecked >::value ) {
2157  if( ( band() > 0L && column() >= mmm.columns() ) ||
2158  ( band() < 0L && row() >= mmm.rows() ) ) {
2159  BLAZE_THROW_INVALID_ARGUMENT( "Invalid band access index" );
2160  }
2161  }
2162  else {
2163  BLAZE_USER_ASSERT( band() < 0L || column() < mmm.columns(), "Invalid band access index" );
2164  BLAZE_USER_ASSERT( band() > 0L || row() < mmm.rows(), "Invalid band access index" );
2165  }
2166  }
2167  //**********************************************************************************************
2168 
2169  //**Subscript operator**************************************************************************
2175  inline ReturnType operator[]( size_t index ) const {
2176  BLAZE_INTERNAL_ASSERT( index < size(), "Invalid vector access index" );
2177  return matrix_(row()+index,column()+index);
2178  }
2179  //**********************************************************************************************
2180 
2181  //**At function*********************************************************************************
2188  inline ReturnType at( size_t index ) const {
2189  if( index >= size() ) {
2190  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
2191  }
2192  return (*this)[index];
2193  }
2194  //**********************************************************************************************
2195 
2196  //**Size function*******************************************************************************
2201  inline size_t size() const noexcept {
2202  return min( matrix_.rows() - row(), matrix_.columns() - column() );
2203  }
2204  //**********************************************************************************************
2205 
2206  //**********************************************************************************************
2207  using DataType::band;
2208  using DataType::row;
2209  using DataType::column;
2210  //**********************************************************************************************
2211 
2212  //**Operand access******************************************************************************
2217  inline const MT& operand() const noexcept {
2218  return matrix_;
2219  }
2220  //**********************************************************************************************
2221 
2222  //**********************************************************************************************
2228  template< typename T >
2229  inline bool canAlias( const T* alias ) const noexcept {
2230  return matrix_.isAliased( alias );
2231  }
2232  //**********************************************************************************************
2233 
2234  //**********************************************************************************************
2240  template< typename T >
2241  inline bool isAliased( const T* alias ) const noexcept {
2242  return matrix_.isAliased( alias );
2243  }
2244  //**********************************************************************************************
2245 
2246  //**********************************************************************************************
2251  inline constexpr bool isAligned() const noexcept {
2252  return false;
2253  }
2254  //**********************************************************************************************
2255 
2256  private:
2257  //**Member variables****************************************************************************
2258  MT matrix_;
2259  //**********************************************************************************************
2260 
2261  //**Assignment to dense vectors*****************************************************************
2273  template< typename VT > // Type of the target dense vector
2274  friend inline void assign( DenseVector<VT,TF>& lhs, const Band& rhs )
2275  {
2276  using blaze::row;
2277  using blaze::column;
2278 
2280 
2281  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2282 
2283  LT A( serial( rhs.operand().leftOperand() ) );
2284  RT B( serial( rhs.operand().rightOperand() ) );
2285 
2286  const size_t n( rhs.size() );
2287  for( size_t i=0UL; i<n; ++i ) {
2288  (~lhs)[i] = row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2289  }
2290  }
2292  //**********************************************************************************************
2293 
2294  //**Assignment to sparse vectors****************************************************************
2306  template< typename VT > // Type of the target sparse vector
2307  friend inline void assign( SparseVector<VT,TF>& lhs, const Band& rhs )
2308  {
2310 
2314 
2315  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2316 
2317  const ResultType tmp( serial( rhs ) );
2318  assign( ~lhs, tmp );
2319  }
2321  //**********************************************************************************************
2322 
2323  //**Addition assignment to dense vectors********************************************************
2335  template< typename VT > // Type of the target dense vector
2336  friend inline void addAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2337  {
2338  using blaze::row;
2339  using blaze::column;
2340 
2342 
2343  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2344 
2345  LT A( serial( rhs.operand().leftOperand() ) );
2346  RT B( serial( rhs.operand().rightOperand() ) );
2347 
2348  const size_t n( rhs.size() );
2349  for( size_t i=0UL; i<n; ++i ) {
2350  (~lhs)[i] += row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2351  }
2352  }
2354  //**********************************************************************************************
2355 
2356  //**Addition assignment to sparse vectors*******************************************************
2357  // No special implementation for the addition assignment to sparse vectors.
2358  //**********************************************************************************************
2359 
2360  //**Subtraction assignment to dense vectors*****************************************************
2372  template< typename VT > // Type of the target dense vector
2373  friend inline void subAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2374  {
2375  using blaze::row;
2376  using blaze::column;
2377 
2379 
2380  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2381 
2382  LT A( serial( rhs.operand().leftOperand() ) );
2383  RT B( serial( rhs.operand().rightOperand() ) );
2384 
2385  const size_t n( rhs.size() );
2386  for( size_t i=0UL; i<n; ++i ) {
2387  (~lhs)[i] -= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2388  }
2389  }
2391  //**********************************************************************************************
2392 
2393  //**Subtraction assignment to sparse vectors****************************************************
2394  // No special implementation for the subtraction assignment to sparse vectors.
2395  //**********************************************************************************************
2396 
2397  //**Multiplication assignment to dense vectors**************************************************
2410  template< typename VT > // Type of the target dense vector
2411  friend inline void multAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2412  {
2413  using blaze::row;
2414  using blaze::column;
2415 
2417 
2418  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2419 
2420  LT A( serial( rhs.operand().leftOperand() ) );
2421  RT B( serial( rhs.operand().rightOperand() ) );
2422 
2423  const size_t n( rhs.size() );
2424  for( size_t i=0UL; i<n; ++i ) {
2425  (~lhs)[i] *= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2426  }
2427  }
2429  //**********************************************************************************************
2430 
2431  //**Multiplication assignment to sparse vectors*************************************************
2432  // No special implementation for the multiplication assignment to sparse vectors.
2433  //**********************************************************************************************
2434 
2435  //**Division assignment to dense vectors********************************************************
2447  template< typename VT > // Type of the target dense vector
2448  friend inline void divAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2449  {
2450  using blaze::row;
2451  using blaze::column;
2452 
2454 
2455  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2456 
2457  LT A( serial( rhs.operand().leftOperand() ) );
2458  RT B( serial( rhs.operand().rightOperand() ) );
2459 
2460  const size_t n( rhs.size() );
2461  for( size_t i=0UL; i<n; ++i ) {
2462  (~lhs)[i] /= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2463  }
2464  }
2466  //**********************************************************************************************
2467 
2468  //**Division assignment to sparse vectors*******************************************************
2469  // No special implementation for the division assignment to sparse vectors.
2470  //**********************************************************************************************
2471 
2472  //**Compile time checks*************************************************************************
2479  //**********************************************************************************************
2480 };
2481 //*************************************************************************************************
2482 
2483 } // namespace blaze
2484 
2485 #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:131
Header file for the blaze::checked and blaze::unchecked instances.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the IsUniUpper type trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the View base class.
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the IsSparseMatrix type trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#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:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
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:588
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:701
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
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:3083
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
Header file for the implementation of the Band base template.
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:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
#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.
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
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:474
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:408
Header file for the band trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE 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:3082
Header file for the clear shim.
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:3075
#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
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
Header file for the Or class template.
#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:367
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:443
Header file for the Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
Constraint on the data type.
Constraint on the data type.
Header file for the IsTriangular type trait.
Constraint on the data type.
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
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:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
typename BandTrait< MT, CBAs... >::Type BandTrait_
Auxiliary alias declaration for the BandTrait type trait.The BandTrait_ alias declaration provides a ...
Definition: BandTrait.h:145
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:134
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:67
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.
Header file for the cross product trait.
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:131
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
#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.
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:816
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.
Header file for the RemoveReference type trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#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
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
Header file for the IsRowMajorMatrix type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
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.
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the 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
Header file for the IsExpression type trait class.
Header file for the implementation of the BandData class template.