Blaze  3.6
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>
62 #include <blaze/math/shims/Reset.h>
82 #include <blaze/math/views/Check.h>
85 #include <blaze/util/Assert.h>
88 #include <blaze/util/mpl/If.h>
89 #include <blaze/util/TypeList.h>
90 #include <blaze/util/Types.h>
94 
95 
96 namespace blaze {
97 
98 //=================================================================================================
99 //
100 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
101 //
102 //=================================================================================================
103 
104 //*************************************************************************************************
111 template< typename MT // Type of the dense matrix
112  , bool TF // Transpose flag
113  , ptrdiff_t... CBAs > // Compile time band arguments
114 class Band<MT,TF,true,false,CBAs...>
115  : public View< DenseVector< Band<MT,TF,true,false,CBAs...>, TF > >
116  , private BandData<CBAs...>
117 {
118  private:
119  //**Type definitions****************************************************************************
120  using RT = ResultType_t<MT>;
121  using DataType = BandData<CBAs...>;
122  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
123  //**********************************************************************************************
124 
125  public:
126  //**Type definitions****************************************************************************
128  using This = Band<MT,TF,true,false,CBAs...>;
129 
130  using BaseType = DenseVector<This,TF>;
131  using ViewedType = MT;
132  using ResultType = BandTrait_t<RT,CBAs...>;
133  using TransposeType = TransposeType_t<ResultType>;
134  using ElementType = ElementType_t<MT>;
135  using ReturnType = ReturnType_t<MT>;
136 
138  using CompositeType = If_t< RequiresEvaluation_v<MT>, const ResultType, const Band& >;
139 
141  using ConstReference = ConstReference_t<MT>;
142 
144  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
145 
147  using ConstPointer = ConstPointer_t<MT>;
148 
150  using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
151  //**********************************************************************************************
152 
153  //**BandIterator class definition***************************************************************
156  template< typename MatrixType // Type of the dense matrix
157  , typename IteratorType > // Type of the dense matrix iterator
158  class BandIterator
159  {
160  public:
161  //**Type definitions*************************************************************************
163  using IteratorCategory = typename std::iterator_traits<IteratorType>::iterator_category;
164 
166  using ValueType = typename std::iterator_traits<IteratorType>::value_type;
167 
169  using PointerType = typename std::iterator_traits<IteratorType>::pointer;
170 
172  using ReferenceType = typename std::iterator_traits<IteratorType>::reference;
173 
175  using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
176 
177  // STL iterator requirements
178  using iterator_category = IteratorCategory;
179  using value_type = ValueType;
180  using pointer = PointerType;
181  using reference = ReferenceType;
182  using difference_type = DifferenceType;
183  //*******************************************************************************************
184 
185  //**Constructor******************************************************************************
188  inline BandIterator() noexcept
189  : matrix_( nullptr ) // The dense matrix containing the band
190  , row_ ( 0UL ) // The current row index
191  , column_( 0UL ) // The current column index
192  , pos_ ( ) // Iterator to the current dense element
193  {}
194  //*******************************************************************************************
195 
196  //**Constructor******************************************************************************
203  inline BandIterator( MatrixType& matrix, size_t rowIndex, size_t columnIndex ) noexcept
204  : matrix_( &matrix ) // The dense matrix containing the band
205  , row_ ( rowIndex ) // The current row index
206  , column_( columnIndex ) // The current column index
207  , pos_ ( ) // Iterator to the current dense element
208  {
209  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
210  pos_ = matrix_->begin( row_ ) + column_;
211  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
212  pos_ = matrix_->begin( column_ ) + row_;
213  }
214  //*******************************************************************************************
215 
216  //**Constructor******************************************************************************
221  template< typename MatrixType2, typename IteratorType2 >
222  inline BandIterator( const BandIterator<MatrixType2,IteratorType2>& it ) noexcept
223  : matrix_( it.matrix_ ) // The dense matrix containing the band
224  , row_ ( it.row_ ) // The current row index
225  , column_( it.column_ ) // The current column index
226  , pos_ ( it.pos_ ) // Iterator to the current dense element
227  {}
228  //*******************************************************************************************
229 
230  //**Addition assignment operator*************************************************************
236  inline BandIterator& operator+=( size_t inc ) noexcept {
237  using blaze::reset;
238 
239  row_ += inc;
240  column_ += inc;
241 
242  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
243  pos_ = matrix_->begin( row_ ) + column_;
244  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
245  pos_ = matrix_->begin( column_ ) + row_;
246  else reset( pos_ );
247 
248  return *this;
249  }
250  //*******************************************************************************************
251 
252  //**Subtraction assignment operator**********************************************************
258  inline BandIterator& operator-=( size_t dec ) noexcept {
259  using blaze::reset;
260 
261  row_ -= dec;
262  column_ -= dec;
263 
264  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
265  pos_ = matrix_->begin( row_ ) + column_;
266  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
267  pos_ = matrix_->begin( column_ ) + row_;
268  else reset( pos_ );
269 
270  return *this;
271  }
272  //*******************************************************************************************
273 
274  //**Prefix increment operator****************************************************************
279  inline BandIterator& operator++() noexcept {
280  using blaze::reset;
281 
282  ++row_;
283  ++column_;
284 
285  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
286  pos_ = matrix_->begin( row_ ) + column_;
287  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
288  pos_ = matrix_->begin( column_ ) + row_;
289  else reset( pos_ );
290 
291  return *this;
292  }
293  //*******************************************************************************************
294 
295  //**Postfix increment operator***************************************************************
300  inline const BandIterator operator++( int ) noexcept {
301  const BandIterator tmp( *this );
302  ++(*this);
303  return tmp;
304  }
305  //*******************************************************************************************
306 
307  //**Prefix decrement operator****************************************************************
312  inline BandIterator& operator--() noexcept {
313  using blaze::reset;
314 
315  --row_;
316  --column_;
317 
318  if( IsRowMajorMatrix_v<MatrixType> && row_ != matrix_->rows() )
319  pos_ = matrix_->begin( row_ ) + column_;
320  else if( IsColumnMajorMatrix_v<MatrixType> && column_ != matrix_->columns() )
321  pos_ = matrix_->begin( column_ ) + row_;
322  else reset( pos_ );
323 
324  return *this;
325  }
326  //*******************************************************************************************
327 
328  //**Postfix decrement operator***************************************************************
333  inline const BandIterator operator--( int ) noexcept {
334  const BandIterator tmp( *this );
335  --(*this);
336  return tmp;
337  }
338  //*******************************************************************************************
339 
340  //**Subscript operator***********************************************************************
346  inline ReferenceType operator[]( size_t index ) const {
347  BLAZE_USER_ASSERT( row_ +index < matrix_->rows() , "Invalid access index detected" );
348  BLAZE_USER_ASSERT( column_+index < matrix_->columns(), "Invalid access index detected" );
349  const IteratorType pos( IsRowMajorMatrix_v<MatrixType>
350  ? matrix_->begin( row_+index ) + column_ + index
351  : matrix_->begin( column_+index ) + row_ + index );
352  return *pos;
353  }
354  //*******************************************************************************************
355 
356  //**Element access operator******************************************************************
361  inline ReferenceType operator*() const {
362  return *pos_;
363  }
364  //*******************************************************************************************
365 
366  //**Element access operator******************************************************************
371  inline PointerType operator->() const {
372  return pos_;
373  }
374  //*******************************************************************************************
375 
376  //**Equality operator************************************************************************
382  template< typename MatrixType2, typename IteratorType2 >
383  inline bool operator==( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
384  return row_ == rhs.row_;
385  }
386  //*******************************************************************************************
387 
388  //**Inequality operator**********************************************************************
394  template< typename MatrixType2, typename IteratorType2 >
395  inline bool operator!=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
396  return !( *this == rhs );
397  }
398  //*******************************************************************************************
399 
400  //**Less-than operator***********************************************************************
406  template< typename MatrixType2, typename IteratorType2 >
407  inline bool operator<( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
408  return row_ < rhs.row_;
409  }
410  //*******************************************************************************************
411 
412  //**Greater-than operator********************************************************************
418  template< typename MatrixType2, typename IteratorType2 >
419  inline bool operator>( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
420  return row_ > rhs.row_;
421  }
422  //*******************************************************************************************
423 
424  //**Less-or-equal-than operator**************************************************************
430  template< typename MatrixType2, typename IteratorType2 >
431  inline bool operator<=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
432  return row_ <= rhs.row_;
433  }
434  //*******************************************************************************************
435 
436  //**Greater-or-equal-than operator***********************************************************
442  template< typename MatrixType2, typename IteratorType2 >
443  inline bool operator>=( const BandIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
444  return row_ >= rhs.row_;
445  }
446  //*******************************************************************************************
447 
448  //**Subtraction operator*********************************************************************
454  inline DifferenceType operator-( const BandIterator& rhs ) const noexcept {
455  return row_ - rhs.row_;
456  }
457  //*******************************************************************************************
458 
459  //**Addition operator************************************************************************
466  friend inline const BandIterator operator+( const BandIterator& it, size_t inc ) noexcept {
467  return BandIterator( *it.matrix_, it.row_+inc, it.column_+inc );
468  }
469  //*******************************************************************************************
470 
471  //**Addition operator************************************************************************
478  friend inline const BandIterator operator+( size_t inc, const BandIterator& it ) noexcept {
479  return BandIterator( *it.matrix_, it.row_+inc, it.column_+inc );
480  }
481  //*******************************************************************************************
482 
483  //**Subtraction operator*********************************************************************
490  friend inline const BandIterator operator-( const BandIterator& it, size_t dec ) noexcept {
491  return BandIterator( *it.matrix_, it.row_-dec, it.column_-dec );
492  }
493  //*******************************************************************************************
494 
495  private:
496  //**Member variables*************************************************************************
497  MatrixType* matrix_;
498  size_t row_;
499  size_t column_;
500  IteratorType pos_;
501  //*******************************************************************************************
502 
503  //**Friend declarations**********************************************************************
504  template< typename MatrixType2, typename IteratorType2 > friend class BandIterator;
505  //*******************************************************************************************
506  };
507  //**********************************************************************************************
508 
509  //**Type definitions****************************************************************************
511  using ConstIterator = BandIterator< const MT, ConstIterator_t<MT> >;
512 
514  using Iterator = If_t< IsConst_v<MT>, ConstIterator, BandIterator< MT, Iterator_t<MT> > >;
515  //**********************************************************************************************
516 
517  //**Compilation flags***************************************************************************
519  static constexpr bool simdEnabled = false;
520 
522  static constexpr bool smpAssignable = MT::smpAssignable;
523 
525  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
526  //**********************************************************************************************
527 
528  //**Constructors********************************************************************************
531  template< typename... RBAs >
532  explicit inline Band( MT& matrix, RBAs... args );
533 
534  Band( const Band& ) = default;
536  //**********************************************************************************************
537 
538  //**Destructor**********************************************************************************
541  ~Band() = default;
543  //**********************************************************************************************
544 
545  //**Data access functions***********************************************************************
548  inline Reference operator[]( size_t index );
549  inline ConstReference operator[]( size_t index ) const;
550  inline Reference at( size_t index );
551  inline ConstReference at( size_t index ) const;
552  inline Pointer data () noexcept;
553  inline ConstPointer data () const noexcept;
554  inline Iterator begin ();
555  inline ConstIterator begin () const;
556  inline ConstIterator cbegin() const;
557  inline Iterator end ();
558  inline ConstIterator end () const;
559  inline ConstIterator cend () const;
561  //**********************************************************************************************
562 
563  //**Assignment operators************************************************************************
566  inline Band& operator=( const ElementType& rhs );
567  inline Band& operator=( initializer_list<ElementType> list );
568  inline Band& operator=( const Band& rhs );
569 
570  template< typename VT > inline Band& operator= ( const Vector<VT,TF>& rhs );
571  template< typename VT > inline Band& operator+=( const Vector<VT,TF>& rhs );
572  template< typename VT > inline Band& operator-=( const Vector<VT,TF>& rhs );
573  template< typename VT > inline Band& operator*=( const Vector<VT,TF>& rhs );
574  template< typename VT > inline Band& operator/=( const DenseVector<VT,TF>& rhs );
575  template< typename VT > inline Band& operator%=( const Vector<VT,TF>& rhs );
577  //**********************************************************************************************
578 
579  //**Utility functions***************************************************************************
582  using DataType::band;
583  using DataType::row;
584  using DataType::column;
585 
586  inline MT& operand() noexcept;
587  inline const MT& operand() const noexcept;
588 
589  inline size_t size() const noexcept;
590  inline size_t spacing() const noexcept;
591  inline size_t capacity() const noexcept;
592  inline size_t nonZeros() const;
593  inline void reset();
595  //**********************************************************************************************
596 
597  //**Numeric functions***************************************************************************
600  template< typename Other > inline Band& scale( const Other& scalar );
602  //**********************************************************************************************
603 
604  //**Expression template evaluation functions****************************************************
607  template< typename Other >
608  inline bool canAlias( const Other* alias ) const noexcept;
609 
610  template< typename MT2, ptrdiff_t... CBAs2 >
611  inline bool canAlias( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept;
612 
613  template< typename Other >
614  inline bool isAliased( const Other* alias ) const noexcept;
615 
616  template< typename MT2, ptrdiff_t... CBAs2 >
617  inline bool isAliased( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept;
618 
619  inline bool isAligned () const noexcept;
620  inline bool canSMPAssign() const noexcept;
621 
622  template< typename VT > inline void assign ( const DenseVector <VT,TF>& rhs );
623  template< typename VT > inline void assign ( const SparseVector<VT,TF>& rhs );
624  template< typename VT > inline void addAssign ( const DenseVector <VT,TF>& rhs );
625  template< typename VT > inline void addAssign ( const SparseVector<VT,TF>& rhs );
626  template< typename VT > inline void subAssign ( const DenseVector <VT,TF>& rhs );
627  template< typename VT > inline void subAssign ( const SparseVector<VT,TF>& rhs );
628  template< typename VT > inline void multAssign( const DenseVector <VT,TF>& rhs );
629  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
630  template< typename VT > inline void divAssign ( const DenseVector <VT,TF>& rhs );
632  //**********************************************************************************************
633 
634  private:
635  //**Member variables****************************************************************************
638  Operand matrix_;
639 
640  //**********************************************************************************************
641 
642  //**Friend declarations*************************************************************************
643  template< typename MT2, bool TF2, bool DF2, bool MF2, ptrdiff_t... CBAs2 > friend class Band;
644  //**********************************************************************************************
645 
646  //**Compile time checks*************************************************************************
652  //**********************************************************************************************
653 };
655 //*************************************************************************************************
656 
657 
658 
659 
660 //=================================================================================================
661 //
662 // CONSTRUCTORS
663 //
664 //=================================================================================================
665 
666 //*************************************************************************************************
679 template< typename MT // Type of the dense matrix
680  , bool TF // Transpose flag
681  , ptrdiff_t... CBAs > // Compile time band arguments
682 template< typename... RBAs > // Runtime band arguments
683 inline Band<MT,TF,true,false,CBAs...>::Band( MT& matrix, RBAs... args )
684  : DataType( args... ) // Base class initialization
685  , matrix_ ( matrix ) // The matrix containing the band
686 {
687  if( !Contains_v< TypeList<RBAs...>, Unchecked > ) {
688  if( ( band() > 0L && column() >= matrix.columns() ) ||
689  ( band() < 0L && row() >= matrix.rows() ) ) {
690  BLAZE_THROW_INVALID_ARGUMENT( "Invalid band access index" );
691  }
692  }
693  else {
694  BLAZE_USER_ASSERT( band() <= 0L || column() < matrix.columns(), "Invalid band access index" );
695  BLAZE_USER_ASSERT( band() >= 0L || row() < matrix.rows(), "Invalid band access index" );
696  }
697 }
699 //*************************************************************************************************
700 
701 
702 
703 
704 //=================================================================================================
705 //
706 // DATA ACCESS FUNCTIONS
707 //
708 //=================================================================================================
709 
710 //*************************************************************************************************
720 template< typename MT // Type of the dense matrix
721  , bool TF // Transpose flag
722  , ptrdiff_t... CBAs > // Compile time band arguments
723 inline typename Band<MT,TF,true,false,CBAs...>::Reference
724  Band<MT,TF,true,false,CBAs...>::operator[]( size_t index )
725 {
726  BLAZE_USER_ASSERT( index < size(), "Invalid band access index" );
727  return matrix_(row()+index,column()+index);
728 }
730 //*************************************************************************************************
731 
732 
733 //*************************************************************************************************
743 template< typename MT // Type of the dense matrix
744  , bool TF // Transpose flag
745  , ptrdiff_t... CBAs > // Compile time band arguments
746 inline typename Band<MT,TF,true,false,CBAs...>::ConstReference
747  Band<MT,TF,true,false,CBAs...>::operator[]( size_t index ) const
748 {
749  BLAZE_USER_ASSERT( index < size(), "Invalid band access index" );
750  return const_cast<const MT&>( matrix_ )(row()+index,column()+index);
751 }
753 //*************************************************************************************************
754 
755 
756 //*************************************************************************************************
767 template< typename MT // Type of the dense matrix
768  , bool TF // Transpose flag
769  , ptrdiff_t... CBAs > // Compile time band arguments
770 inline typename Band<MT,TF,true,false,CBAs...>::Reference
771  Band<MT,TF,true,false,CBAs...>::at( size_t index )
772 {
773  if( index >= size() ) {
774  BLAZE_THROW_OUT_OF_RANGE( "Invalid band access index" );
775  }
776  return (*this)[index];
777 }
779 //*************************************************************************************************
780 
781 
782 //*************************************************************************************************
793 template< typename MT // Type of the dense matrix
794  , bool TF // Transpose flag
795  , ptrdiff_t... CBAs > // Compile time band arguments
796 inline typename Band<MT,TF,true,false,CBAs...>::ConstReference
797  Band<MT,TF,true,false,CBAs...>::at( size_t index ) const
798 {
799  if( index >= size() ) {
800  BLAZE_THROW_OUT_OF_RANGE( "Invalid band access index" );
801  }
802  return (*this)[index];
803 }
805 //*************************************************************************************************
806 
807 
808 //*************************************************************************************************
817 template< typename MT // Type of the dense matrix
818  , bool TF // Transpose flag
819  , ptrdiff_t... CBAs > // Compile time band arguments
820 inline typename Band<MT,TF,true,false,CBAs...>::Pointer
822 {
823  if( IsRowMajorMatrix_v<MT> )
824  return matrix_.data() + row() * matrix_.spacing() + column();
825  else
826  return matrix_.data() + row() + column() * matrix_.spacing();
827 }
829 //*************************************************************************************************
830 
831 
832 //*************************************************************************************************
841 template< typename MT // Type of the dense matrix
842  , bool TF // Transpose flag
843  , ptrdiff_t... CBAs > // Compile time band arguments
844 inline typename Band<MT,TF,true,false,CBAs...>::ConstPointer
845  Band<MT,TF,true,false,CBAs...>::data() const noexcept
846 {
847  if( IsRowMajorMatrix_v<MT> )
848  return matrix_.data() + row() * matrix_.spacing() + column();
849  else
850  return matrix_.data() + row() + column() * matrix_.spacing();
851 }
853 //*************************************************************************************************
854 
855 
856 //*************************************************************************************************
864 template< typename MT // Type of the dense matrix
865  , bool TF // Transpose flag
866  , ptrdiff_t... CBAs > // Compile time band arguments
867 inline typename Band<MT,TF,true,false,CBAs...>::Iterator
869 {
870  return Iterator( matrix_, row(), column() );
871 }
873 //*************************************************************************************************
874 
875 
876 //*************************************************************************************************
884 template< typename MT // Type of the dense matrix
885  , bool TF // Transpose flag
886  , ptrdiff_t... CBAs > // Compile time band arguments
887 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
889 {
890  return ConstIterator( matrix_, row(), column() );
891 }
893 //*************************************************************************************************
894 
895 
896 //*************************************************************************************************
904 template< typename MT // Type of the dense matrix
905  , bool TF // Transpose flag
906  , ptrdiff_t... CBAs > // Compile time band arguments
907 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
909 {
910  return ConstIterator( matrix_, row(), column() );
911 }
913 //*************************************************************************************************
914 
915 
916 //*************************************************************************************************
924 template< typename MT // Type of the dense matrix
925  , bool TF // Transpose flag
926  , ptrdiff_t... CBAs > // Compile time band arguments
927 inline typename Band<MT,TF,true,false,CBAs...>::Iterator
929 {
930  const size_t n( size() );
931  return Iterator( matrix_, row()+n, column()+n );
932 }
934 //*************************************************************************************************
935 
936 
937 //*************************************************************************************************
945 template< typename MT // Type of the dense matrix
946  , bool TF // Transpose flag
947  , ptrdiff_t... CBAs > // Compile time band arguments
948 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
950 {
951  const size_t n( size() );
952  return ConstIterator( matrix_, row()+n, column()+n );
953 }
955 //*************************************************************************************************
956 
957 
958 //*************************************************************************************************
966 template< typename MT // Type of the dense matrix
967  , bool TF // Transpose flag
968  , ptrdiff_t... CBAs > // Compile time band arguments
969 inline typename Band<MT,TF,true,false,CBAs...>::ConstIterator
971 {
972  const size_t n( size() );
973  return ConstIterator( matrix_, row()+n, column()+n );
974 }
976 //*************************************************************************************************
977 
978 
979 
980 
981 //=================================================================================================
982 //
983 // ASSIGNMENT OPERATORS
984 //
985 //=================================================================================================
986 
987 //*************************************************************************************************
998 template< typename MT // Type of the dense matrix
999  , bool TF // Transpose flag
1000  , ptrdiff_t... CBAs > // Compile time band arguments
1001 inline Band<MT,TF,true,false,CBAs...>&
1002  Band<MT,TF,true,false,CBAs...>::operator=( const ElementType& rhs )
1003 {
1004  decltype(auto) left( derestrict( matrix_ ) );
1005 
1006  if( ( IsLower_v<MT> && column() > 0UL ) ||
1007  ( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> ) && row() == 0UL ) ||
1008  ( IsUpper_v<MT> && row() > 0UL ) ||
1009  ( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> ) && column() == 0UL ) )
1010  return *this;
1011 
1012  const size_t n( size() );
1013  for( size_t i=0UL; i<n; ++i ) {
1014  if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, row()+i, column()+i, rhs ) )
1015  left(row()+i,column()+i) = rhs;
1016  }
1017 
1018  return *this;
1019 }
1021 //*************************************************************************************************
1022 
1023 
1024 //*************************************************************************************************
1039 template< typename MT // Type of the dense matrix
1040  , bool TF // Transpose flag
1041  , ptrdiff_t... CBAs > // Compile time band arguments
1042 inline Band<MT,TF,true,false,CBAs...>&
1043  Band<MT,TF,true,false,CBAs...>::operator=( initializer_list<ElementType> list )
1044 {
1045  if( list.size() > size() ) {
1046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to band" );
1047  }
1048 
1049  if( IsRestricted_v<MT> ) {
1050  const InitializerVector<ElementType,false> tmp( list, size() );
1051  if( !tryAssign( matrix_, tmp, band(), row(), column() ) ) {
1052  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1053  }
1054  }
1055 
1056  decltype(auto) left( derestrict( *this ) );
1057 
1058  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
1059 
1060  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1061 
1062  return *this;
1063 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1082 template< typename MT // Type of the dense matrix
1083  , bool TF // Transpose flag
1084  , ptrdiff_t... CBAs > // Compile time band arguments
1085 inline Band<MT,TF,true,false,CBAs...>&
1086  Band<MT,TF,true,false,CBAs...>::operator=( const Band& rhs )
1087 {
1088  if( &rhs == this ) return *this;
1089 
1090  if( size() != rhs.size() ) {
1091  BLAZE_THROW_INVALID_ARGUMENT( "Band sizes do not match" );
1092  }
1093 
1094  if( !tryAssign( matrix_, rhs, band(), row(), column() ) ) {
1095  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1096  }
1097 
1098  decltype(auto) left( derestrict( *this ) );
1099 
1100  if( IsExpression_v<MT> && rhs.canAlias( &matrix_ ) ) {
1101  const ResultType tmp( rhs );
1102  smpAssign( left, tmp );
1103  }
1104  else {
1105  smpAssign( left, rhs );
1106  }
1107 
1108  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1109 
1110  return *this;
1111 }
1113 //*************************************************************************************************
1114 
1115 
1116 //*************************************************************************************************
1130 template< typename MT // Type of the dense matrix
1131  , bool TF // Transpose flag
1132  , ptrdiff_t... CBAs > // Compile time band arguments
1133 template< typename VT > // Type of the right-hand side vector
1134 inline Band<MT,TF,true,false,CBAs...>&
1135  Band<MT,TF,true,false,CBAs...>::operator=( const Vector<VT,TF>& rhs )
1136 {
1139 
1140  if( size() != (~rhs).size() ) {
1141  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1142  }
1143 
1144  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1145  Right right( ~rhs );
1146 
1147  if( !tryAssign( matrix_, right, band(), row(), column() ) ) {
1148  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1149  }
1150 
1151  decltype(auto) left( derestrict( *this ) );
1152 
1153  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1154  const ResultType_t<VT> tmp( right );
1155  smpAssign( left, tmp );
1156  }
1157  else {
1158  if( IsSparseVector_v<VT> )
1159  reset();
1160  smpAssign( left, right );
1161  }
1162 
1163  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1164 
1165  return *this;
1166 }
1168 //*************************************************************************************************
1169 
1170 
1171 //*************************************************************************************************
1185 template< typename MT // Type of the dense matrix
1186  , bool TF // Transpose flag
1187  , ptrdiff_t... CBAs > // Compile time band arguments
1188 template< typename VT > // Type of the right-hand side vector
1189 inline Band<MT,TF,true,false,CBAs...>&
1190  Band<MT,TF,true,false,CBAs...>::operator+=( const Vector<VT,TF>& rhs )
1191 {
1194 
1195  if( size() != (~rhs).size() ) {
1196  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1197  }
1198 
1199  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1200  Right right( ~rhs );
1201 
1202  if( !tryAddAssign( matrix_, right, band(), row(), column() ) ) {
1203  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1204  }
1205 
1206  decltype(auto) left( derestrict( *this ) );
1207 
1208  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1209  const ResultType_t<VT> tmp( right );
1210  smpAddAssign( left, tmp );
1211  }
1212  else {
1213  smpAddAssign( left, right );
1214  }
1215 
1216  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1217 
1218  return *this;
1219 }
1221 //*************************************************************************************************
1222 
1223 
1224 //*************************************************************************************************
1238 template< typename MT // Type of the dense matrix
1239  , bool TF // Transpose flag
1240  , ptrdiff_t... CBAs > // Compile time band arguments
1241 template< typename VT > // Type of the right-hand side vector
1242 inline Band<MT,TF,true,false,CBAs...>&
1243  Band<MT,TF,true,false,CBAs...>::operator-=( const Vector<VT,TF>& rhs )
1244 {
1247 
1248  if( size() != (~rhs).size() ) {
1249  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1250  }
1251 
1252  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1253  Right right( ~rhs );
1254 
1255  if( !trySubAssign( matrix_, right, band(), row(), column() ) ) {
1256  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1257  }
1258 
1259  decltype(auto) left( derestrict( *this ) );
1260 
1261  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1262  const ResultType_t<VT> tmp( right );
1263  smpSubAssign( left, tmp );
1264  }
1265  else {
1266  smpSubAssign( left, right );
1267  }
1268 
1269  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1270 
1271  return *this;
1272 }
1274 //*************************************************************************************************
1275 
1276 
1277 //*************************************************************************************************
1290 template< typename MT // Type of the dense matrix
1291  , bool TF // Transpose flag
1292  , ptrdiff_t... CBAs > // Compile time band arguments
1293 template< typename VT > // Type of the right-hand side vector
1294 inline Band<MT,TF,true,false,CBAs...>&
1295  Band<MT,TF,true,false,CBAs...>::operator*=( const Vector<VT,TF>& rhs )
1296 {
1302 
1303  if( size() != (~rhs).size() ) {
1304  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1305  }
1306 
1307  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1308  Right right( ~rhs );
1309 
1310  if( !tryMultAssign( matrix_, right, band(), row(), column() ) ) {
1311  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1312  }
1313 
1314  decltype(auto) left( derestrict( *this ) );
1315 
1316  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1317  const ResultType_t<VT> tmp( right );
1318  smpMultAssign( left, tmp );
1319  }
1320  else {
1321  smpMultAssign( left, right );
1322  }
1323 
1324  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1325 
1326  return *this;
1327 }
1329 //*************************************************************************************************
1330 
1331 
1332 //*************************************************************************************************
1344 template< typename MT // Type of the dense matrix
1345  , bool TF // Transpose flag
1346  , ptrdiff_t... CBAs > // Compile time band arguments
1347 template< typename VT > // Type of the right-hand side dense vector
1348 inline Band<MT,TF,true,false,CBAs...>&
1349  Band<MT,TF,true,false,CBAs...>::operator/=( const DenseVector<VT,TF>& rhs )
1350 {
1353 
1354  if( size() != (~rhs).size() ) {
1355  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1356  }
1357 
1358  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1359  Right right( ~rhs );
1360 
1361  if( !tryDivAssign( matrix_, right, band(), row(), column() ) ) {
1362  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1363  }
1364 
1365  decltype(auto) left( derestrict( *this ) );
1366 
1367  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1368  const ResultType_t<VT> tmp( right );
1369  smpDivAssign( left, tmp );
1370  }
1371  else {
1372  smpDivAssign( left, right );
1373  }
1374 
1375  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1376 
1377  return *this;
1378 }
1380 //*************************************************************************************************
1381 
1382 
1383 //*************************************************************************************************
1396 template< typename MT // Type of the dense matrix
1397  , bool TF // Transpose flag
1398  , ptrdiff_t... CBAs > // Compile time band arguments
1399 template< typename VT > // Type of the right-hand side vector
1400 inline Band<MT,TF,true,false,CBAs...>&
1401  Band<MT,TF,true,false,CBAs...>::operator%=( const Vector<VT,TF>& rhs )
1402 {
1403  using blaze::assign;
1404 
1407 
1408  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1409 
1413 
1414  if( size() != 3UL || (~rhs).size() != 3UL ) {
1415  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1416  }
1417 
1418  const CrossType right( *this % (~rhs) );
1419 
1420  if( !tryAssign( matrix_, right, band(), row(), column() ) ) {
1421  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1422  }
1423 
1424  decltype(auto) left( derestrict( *this ) );
1425 
1426  assign( left, right );
1427 
1428  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1429 
1430  return *this;
1431 }
1433 //*************************************************************************************************
1434 
1435 
1436 
1437 
1438 //=================================================================================================
1439 //
1440 // UTILITY FUNCTIONS
1441 //
1442 //=================================================================================================
1443 
1444 //*************************************************************************************************
1450 template< typename MT // Type of the dense matrix
1451  , bool TF // Transpose flag
1452  , ptrdiff_t... CBAs > // Compile time band arguments
1453 inline MT& Band<MT,TF,true,false,CBAs...>::operand() noexcept
1454 {
1455  return matrix_;
1456 }
1458 //*************************************************************************************************
1459 
1460 
1461 //*************************************************************************************************
1467 template< typename MT // Type of the dense matrix
1468  , bool TF // Transpose flag
1469  , ptrdiff_t... CBAs > // Compile time band arguments
1470 inline const MT& Band<MT,TF,true,false,CBAs...>::operand() const noexcept
1471 {
1472  return matrix_;
1473 }
1475 //*************************************************************************************************
1476 
1477 
1478 //*************************************************************************************************
1484 template< typename MT // Type of the dense matrix
1485  , bool TF // Transpose flag
1486  , ptrdiff_t... CBAs > // Compile time band arguments
1487 inline size_t Band<MT,TF,true,false,CBAs...>::size() const noexcept
1488 {
1489  return min( matrix_.rows() - row(), matrix_.columns() - column() );
1490 }
1492 //*************************************************************************************************
1493 
1494 
1495 //*************************************************************************************************
1504 template< typename MT // Type of the dense matrix
1505  , bool TF // Transpose flag
1506  , ptrdiff_t... CBAs > // Compile time band arguments
1507 inline size_t Band<MT,TF,true,false,CBAs...>::spacing() const noexcept
1508 {
1509  return size();
1510 }
1512 //*************************************************************************************************
1513 
1514 
1515 //*************************************************************************************************
1521 template< typename MT // Type of the dense matrix
1522  , bool TF // Transpose flag
1523  , ptrdiff_t... CBAs > // Compile time band arguments
1524 inline size_t Band<MT,TF,true,false,CBAs...>::capacity() const noexcept
1525 {
1526  return size();
1527 }
1529 //*************************************************************************************************
1530 
1531 
1532 //*************************************************************************************************
1541 template< typename MT // Type of the dense matrix
1542  , bool TF // Transpose flag
1543  , ptrdiff_t... CBAs > // Compile time band arguments
1544 inline size_t Band<MT,TF,true,false,CBAs...>::nonZeros() const
1545 {
1546  const size_t n( size() );
1547  size_t nonzeros( 0UL );
1548 
1549  for( size_t i=0UL; i<n; ++i )
1550  if( !isDefault( matrix_(row()+i,column()+i) ) )
1551  ++nonzeros;
1552 
1553  return nonzeros;
1554 }
1556 //*************************************************************************************************
1557 
1558 
1559 //*************************************************************************************************
1565 template< typename MT // Type of the dense matrix
1566  , bool TF // Transpose flag
1567  , ptrdiff_t... CBAs > // Compile time band arguments
1569 {
1570  using blaze::clear;
1571 
1572  if( ( IsLower_v<MT> && column() > 0UL ) ||
1573  ( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> ) && row() == 0UL ) ||
1574  ( IsUpper_v<MT> && row() > 0UL ) ||
1575  ( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> ) && column() == 0UL ) )
1576  return;
1577 
1578  const size_t n( size() );
1579  for( size_t i=0UL; i<n; ++i )
1580  clear( matrix_(row()+i,column()+i) );
1581 }
1583 //*************************************************************************************************
1584 
1585 
1586 
1587 
1588 //=================================================================================================
1589 //
1590 // NUMERIC FUNCTIONS
1591 //
1592 //=================================================================================================
1593 
1594 //*************************************************************************************************
1607 template< typename MT // Type of the dense matrix
1608  , bool TF // Transpose flag
1609  , ptrdiff_t... CBAs > // Compile time band arguments
1610 template< typename Other > // Data type of the scalar value
1611 inline Band<MT,TF,true,false,CBAs...>&
1612  Band<MT,TF,true,false,CBAs...>::scale( const Other& scalar )
1613 {
1615 
1616  if( ( IsLower_v<MT> && column() > 0UL ) ||
1617  ( IsStrictlyLower_v<MT> && row() == 0UL ) ||
1618  ( IsUpper_v<MT> && row() > 0UL ) ||
1619  ( IsStrictlyUpper_v<MT> && column() == 0UL ) )
1620  return *this;
1621 
1622  const size_t n( size() );
1623  for( size_t i=0UL; i<n; ++i ) {
1624  matrix_(row()+i,column()+i) *= scalar;
1625  }
1626 
1627  return *this;
1628 }
1630 //*************************************************************************************************
1631 
1632 
1633 
1634 
1635 //=================================================================================================
1636 //
1637 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1638 //
1639 //=================================================================================================
1640 
1641 //*************************************************************************************************
1652 template< typename MT // Type of the dense matrix
1653  , bool TF // Transpose flag
1654  , ptrdiff_t... CBAs > // Compile time band arguments
1655 template< typename Other > // Data type of the foreign expression
1656 inline bool Band<MT,TF,true,false,CBAs...>::canAlias( const Other* alias ) const noexcept
1657 {
1658  return matrix_.isAliased( alias );
1659 }
1661 //*************************************************************************************************
1662 
1663 
1664 //*************************************************************************************************
1675 template< typename MT // Type of the dense matrix
1676  , bool TF // Transpose flag
1677  , ptrdiff_t... CBAs > // Compile time band arguments
1678 template< typename MT2 // Matrix type of the foreign dense band
1679  , ptrdiff_t... CBAs2 > // Compile time band arguments of the foreign dense band
1680 inline bool
1681  Band<MT,TF,true,false,CBAs...>::canAlias( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept
1682 {
1683  return matrix_.isAliased( &alias->matrix_ ) && ( band() == alias->band() );
1684 }
1686 //*************************************************************************************************
1687 
1688 
1689 //*************************************************************************************************
1700 template< typename MT // Type of the dense matrix
1701  , bool TF // Transpose flag
1702  , ptrdiff_t... CBAs > // Compile time band arguments
1703 template< typename Other > // Data type of the foreign expression
1704 inline bool Band<MT,TF,true,false,CBAs...>::isAliased( const Other* alias ) const noexcept
1705 {
1706  return matrix_.isAliased( alias );
1707 }
1709 //*************************************************************************************************
1710 
1711 
1712 //*************************************************************************************************
1723 template< typename MT // Type of the dense matrix
1724  , bool TF // Transpose flag
1725  , ptrdiff_t... CBAs > // Compile time band arguments
1726 template< typename MT2 // Matrix type of the foreign dense band
1727  , ptrdiff_t... CBAs2 > // Compile time band arguments of the foreign dense band
1728 inline bool
1729  Band<MT,TF,true,false,CBAs...>::isAliased( const Band<MT2,TF,true,false,CBAs2...>* alias ) const noexcept
1730 {
1731  return matrix_.isAliased( &alias->matrix_ ) && ( band() == alias->band() );
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 //*************************************************************************************************
1747 template< typename MT // Type of the dense matrix
1748  , bool TF // Transpose flag
1749  , ptrdiff_t... CBAs > // Compile time band arguments
1750 inline bool Band<MT,TF,true,false,CBAs...>::isAligned() const noexcept
1751 {
1752  return false;
1753 }
1755 //*************************************************************************************************
1756 
1757 
1758 //*************************************************************************************************
1769 template< typename MT // Type of the dense matrix
1770  , bool TF // Transpose flag
1771  , ptrdiff_t... CBAs > // Compile time band arguments
1772 inline bool Band<MT,TF,true,false,CBAs...>::canSMPAssign() const noexcept
1773 {
1774  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1775 }
1777 //*************************************************************************************************
1778 
1779 
1780 //*************************************************************************************************
1792 template< typename MT // Type of the dense matrix
1793  , bool TF // Transpose flag
1794  , ptrdiff_t... CBAs > // Compile time band arguments
1795 template< typename VT > // Type of the right-hand side dense vector
1796 inline void Band<MT,TF,true,false,CBAs...>::assign( const DenseVector<VT,TF>& rhs )
1797 {
1798  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1799 
1800  const size_t ipos( (~rhs).size() & size_t(-2) );
1801  for( size_t i=0UL; i<ipos; i+=2UL ) {
1802  matrix_(row()+i ,column()+i ) = (~rhs)[i ];
1803  matrix_(row()+i+1UL,column()+i+1UL) = (~rhs)[i+1UL];
1804  }
1805  if( ipos < (~rhs).size() ) {
1806  matrix_(row()+ipos,column()+ipos) = (~rhs)[ipos];
1807  }
1808 }
1810 //*************************************************************************************************
1811 
1812 
1813 //*************************************************************************************************
1825 template< typename MT // Type of the dense matrix
1826  , bool TF // Transpose flag
1827  , ptrdiff_t... CBAs > // Compile time band arguments
1828 template< typename VT > // Type of the right-hand side sparse vector
1829 inline void Band<MT,TF,true,false,CBAs...>::assign( const SparseVector<VT,TF>& rhs )
1830 {
1831  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1832 
1833  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1834  const size_t index( element->index() );
1835  matrix_(row()+index,column()+index) = element->value();
1836  }
1837 }
1839 //*************************************************************************************************
1840 
1841 
1842 //*************************************************************************************************
1854 template< typename MT // Type of the dense matrix
1855  , bool TF // Transpose flag
1856  , ptrdiff_t... CBAs > // Compile time band arguments
1857 template< typename VT > // Type of the right-hand side dense vector
1858 inline void Band<MT,TF,true,false,CBAs...>::addAssign( const DenseVector<VT,TF>& rhs )
1859 {
1860  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1861 
1862  const size_t ipos( (~rhs).size() & size_t(-2) );
1863  for( size_t i=0UL; i<ipos; i+=2UL ) {
1864  matrix_(row()+i ,column()+i ) += (~rhs)[i ];
1865  matrix_(row()+i+1UL,column()+i+1UL) += (~rhs)[i+1UL];
1866  }
1867  if( ipos < (~rhs).size() ) {
1868  matrix_(row()+ipos,column()+ipos) += (~rhs)[ipos];
1869  }
1870 }
1872 //*************************************************************************************************
1873 
1874 
1875 //*************************************************************************************************
1887 template< typename MT // Type of the dense matrix
1888  , bool TF // Transpose flag
1889  , ptrdiff_t... CBAs > // Compile time band arguments
1890 template< typename VT > // Type of the right-hand side sparse vector
1891 inline void Band<MT,TF,true,false,CBAs...>::addAssign( const SparseVector<VT,TF>& rhs )
1892 {
1893  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1894 
1895  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1896  const size_t index( element->index() );
1897  matrix_(row()+index,column()+index) += element->value();
1898  }
1899 }
1901 //*************************************************************************************************
1902 
1903 
1904 //*************************************************************************************************
1916 template< typename MT // Type of the dense matrix
1917  , bool TF // Transpose flag
1918  , ptrdiff_t... CBAs > // Compile time band arguments
1919 template< typename VT > // Type of the right-hand side dense vector
1920 inline void Band<MT,TF,true,false,CBAs...>::subAssign( const DenseVector<VT,TF>& rhs )
1921 {
1922  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1923 
1924  const size_t ipos( (~rhs).size() & size_t(-2) );
1925  for( size_t i=0UL; i<ipos; i+=2UL ) {
1926  matrix_(row()+i ,column()+i ) -= (~rhs)[i ];
1927  matrix_(row()+i+1UL,column()+i+1UL) -= (~rhs)[i+1UL];
1928  }
1929  if( ipos < (~rhs).size() ) {
1930  matrix_(row()+ipos,column()+ipos) -= (~rhs)[ipos];
1931  }
1932 }
1934 //*************************************************************************************************
1935 
1936 
1937 //*************************************************************************************************
1949 template< typename MT // Type of the dense matrix
1950  , bool TF // Transpose flag
1951  , ptrdiff_t... CBAs > // Compile time band arguments
1952 template< typename VT > // Type of the right-hand side sparse vector
1953 inline void Band<MT,TF,true,false,CBAs...>::subAssign( const SparseVector<VT,TF>& rhs )
1954 {
1955  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1956 
1957  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1958  const size_t index( element->index() );
1959  matrix_(row()+index,column()+index) -= element->value();
1960  }
1961 }
1963 //*************************************************************************************************
1964 
1965 
1966 //*************************************************************************************************
1978 template< typename MT // Type of the dense matrix
1979  , bool TF // Transpose flag
1980  , ptrdiff_t... CBAs > // Compile time band arguments
1981 template< typename VT > // Type of the right-hand side dense vector
1982 inline void Band<MT,TF,true,false,CBAs...>::multAssign( const DenseVector<VT,TF>& rhs )
1983 {
1984  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1985 
1986  const size_t ipos( (~rhs).size() & size_t(-2) );
1987  for( size_t i=0UL; i<ipos; i+=2UL ) {
1988  matrix_(row()+i ,column()+i ) *= (~rhs)[i ];
1989  matrix_(row()+i+1UL,column()+i+1UL) *= (~rhs)[i+1UL];
1990  }
1991  if( ipos < (~rhs).size() ) {
1992  matrix_(row()+ipos,column()+ipos) *= (~rhs)[ipos];
1993  }
1994 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2011 template< typename MT // Type of the dense matrix
2012  , bool TF // Transpose flag
2013  , ptrdiff_t... CBAs > // Compile time band arguments
2014 template< typename VT > // Type of the right-hand side sparse vector
2015 inline void Band<MT,TF,true,false,CBAs...>::multAssign( const SparseVector<VT,TF>& rhs )
2016 {
2017  using blaze::reset;
2018 
2019  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2020 
2021  size_t i( 0UL );
2022 
2023  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2024  const size_t index( element->index() );
2025  for( ; i<index; ++i )
2026  reset( matrix_(row()+i,column()+i) );
2027  matrix_(row()+index,column()+index) *= element->value();
2028  ++i;
2029  }
2030 
2031  for( ; i<size(); ++i ) {
2032  reset( matrix_(row()+i,column()+i) );
2033  }
2034 }
2036 //*************************************************************************************************
2037 
2038 
2039 //*************************************************************************************************
2051 template< typename MT // Type of the dense matrix
2052  , bool TF // Transpose flag
2053  , ptrdiff_t... CBAs > // Compile time band arguments
2054 template< typename VT > // Type of the right-hand side dense vector
2055 inline void Band<MT,TF,true,false,CBAs...>::divAssign( const DenseVector<VT,TF>& rhs )
2056 {
2057  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2058 
2059  const size_t ipos( (~rhs).size() & size_t(-2) );
2060  for( size_t i=0UL; i<ipos; i+=2UL ) {
2061  matrix_(row()+i ,column()+i ) /= (~rhs)[i ];
2062  matrix_(row()+i+1UL,column()+i+1UL) /= (~rhs)[i+1UL];
2063  }
2064  if( ipos < (~rhs).size() ) {
2065  matrix_(row()+ipos,column()+ipos) /= (~rhs)[ipos];
2066  }
2067 }
2069 //*************************************************************************************************
2070 
2071 
2072 
2073 
2074 //=================================================================================================
2075 //
2076 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRIX MULTIPLICATIONS
2077 //
2078 //=================================================================================================
2079 
2080 //*************************************************************************************************
2088 template< typename MT // Type of the dense matrix multiplication
2089  , bool TF // Transpose flag
2090  , ptrdiff_t... CBAs > // Compile time band arguments
2091 class Band<MT,TF,true,true,CBAs...>
2092  : public View< DenseVector< Band<MT,TF,true,true,CBAs...>, TF > >
2093  , private BandData<CBAs...>
2094  , private Computation
2095 {
2096  private:
2097  //**Type definitions****************************************************************************
2099  using DataType = BandData<CBAs...>;
2100 
2102  using LeftOperand = RemoveReference_t< LeftOperand_t<MT> >;
2103 
2105  using RightOperand = RemoveReference_t< RightOperand_t<MT> >;
2106  //**********************************************************************************************
2107 
2108  public:
2109  //**Type definitions****************************************************************************
2111  using This = Band<MT,TF,true,true,CBAs...>;
2112 
2114  using BaseType = DenseVector<This,TF>;
2115 
2117  using ViewedType = MT;
2118 
2120  using ResultType = BandTrait_t<ResultType_t<MT>,CBAs...>;
2121 
2122  using TransposeType = TransposeType_t<ResultType>;
2123  using ElementType = ElementType_t<ResultType>;
2124  using ReturnType = ReturnType_t<MT>;
2125 
2127  using CompositeType = If_t< RequiresEvaluation_v<LeftOperand> ||
2128  RequiresEvaluation_v<RightOperand>
2129  , const ResultType, const Band& >;
2130 
2132  using LT = If_t< IsSparseMatrix_v<LeftOperand> && IsColumnMajorMatrix_v<LeftOperand>
2133  , ResultType_t<LeftOperand>
2134  , CompositeType_t<LeftOperand> >;
2135 
2137  using RT = If_t< IsSparseMatrix_v<RightOperand> && IsRowMajorMatrix_v<RightOperand>
2138  , ResultType_t<RightOperand>
2139  , CompositeType_t<RightOperand> >;
2140  //**********************************************************************************************
2141 
2142  //**Compilation flags***************************************************************************
2144  static constexpr bool simdEnabled = false;
2145 
2147  static constexpr bool smpAssignable = false;
2148 
2150  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2151  //**********************************************************************************************
2152 
2153  //**Constructor*********************************************************************************
2160  template< typename... RBAs > // Runtime band arguments
2161  explicit inline Band( const MT& mmm, RBAs... args )
2162  : DataType( args... ) // Base class initialization
2163  , matrix_ ( mmm ) // The matrix multiplication containing the band
2164  {
2165  if( !Contains_v< TypeList<RBAs...>, Unchecked > ) {
2166  if( ( band() > 0L && column() >= mmm.columns() ) ||
2167  ( band() < 0L && row() >= mmm.rows() ) ) {
2168  BLAZE_THROW_INVALID_ARGUMENT( "Invalid band access index" );
2169  }
2170  }
2171  else {
2172  BLAZE_USER_ASSERT( band() <= 0L || column() < mmm.columns(), "Invalid band access index" );
2173  BLAZE_USER_ASSERT( band() >= 0L || row() < mmm.rows(), "Invalid band access index" );
2174  }
2175  }
2176  //**********************************************************************************************
2177 
2178  //**Subscript operator**************************************************************************
2184  inline ReturnType operator[]( size_t index ) const {
2185  BLAZE_INTERNAL_ASSERT( index < size(), "Invalid vector access index" );
2186  return matrix_(row()+index,column()+index);
2187  }
2188  //**********************************************************************************************
2189 
2190  //**At function*********************************************************************************
2197  inline ReturnType at( size_t index ) const {
2198  if( index >= size() ) {
2199  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
2200  }
2201  return (*this)[index];
2202  }
2203  //**********************************************************************************************
2204 
2205  //**Size function*******************************************************************************
2210  inline size_t size() const noexcept {
2211  return min( matrix_.rows() - row(), matrix_.columns() - column() );
2212  }
2213  //**********************************************************************************************
2214 
2215  //**********************************************************************************************
2216  using DataType::band;
2217  using DataType::row;
2218  using DataType::column;
2219  //**********************************************************************************************
2220 
2221  //**Operand access******************************************************************************
2226  inline const MT& operand() const noexcept {
2227  return matrix_;
2228  }
2229  //**********************************************************************************************
2230 
2231  //**********************************************************************************************
2237  template< typename T >
2238  inline bool canAlias( const T* alias ) const noexcept {
2239  return matrix_.isAliased( alias );
2240  }
2241  //**********************************************************************************************
2242 
2243  //**********************************************************************************************
2249  template< typename T >
2250  inline bool isAliased( const T* alias ) const noexcept {
2251  return matrix_.isAliased( alias );
2252  }
2253  //**********************************************************************************************
2254 
2255  //**********************************************************************************************
2260  inline constexpr bool isAligned() const noexcept {
2261  return false;
2262  }
2263  //**********************************************************************************************
2264 
2265  private:
2266  //**Member variables****************************************************************************
2267  MT matrix_;
2268  //**********************************************************************************************
2269 
2270  //**Assignment to dense vectors*****************************************************************
2282  template< typename VT > // Type of the target dense vector
2283  friend inline void assign( DenseVector<VT,TF>& lhs, const Band& rhs )
2284  {
2285  using blaze::row;
2286  using blaze::column;
2287 
2289 
2290  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2291 
2292  LT A( serial( rhs.operand().leftOperand() ) );
2293  RT B( serial( rhs.operand().rightOperand() ) );
2294 
2295  const size_t n( rhs.size() );
2296  for( size_t i=0UL; i<n; ++i ) {
2297  (~lhs)[i] = row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2298  }
2299  }
2301  //**********************************************************************************************
2302 
2303  //**Assignment to sparse vectors****************************************************************
2315  template< typename VT > // Type of the target sparse vector
2316  friend inline void assign( SparseVector<VT,TF>& lhs, const Band& rhs )
2317  {
2319 
2323 
2324  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2325 
2326  const ResultType tmp( serial( rhs ) );
2327  assign( ~lhs, tmp );
2328  }
2330  //**********************************************************************************************
2331 
2332  //**Addition assignment to dense vectors********************************************************
2344  template< typename VT > // Type of the target dense vector
2345  friend inline void addAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2346  {
2347  using blaze::row;
2348  using blaze::column;
2349 
2351 
2352  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2353 
2354  LT A( serial( rhs.operand().leftOperand() ) );
2355  RT B( serial( rhs.operand().rightOperand() ) );
2356 
2357  const size_t n( rhs.size() );
2358  for( size_t i=0UL; i<n; ++i ) {
2359  (~lhs)[i] += row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2360  }
2361  }
2363  //**********************************************************************************************
2364 
2365  //**Addition assignment to sparse vectors*******************************************************
2366  // No special implementation for the addition assignment to sparse vectors.
2367  //**********************************************************************************************
2368 
2369  //**Subtraction assignment to dense vectors*****************************************************
2381  template< typename VT > // Type of the target dense vector
2382  friend inline void subAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2383  {
2384  using blaze::row;
2385  using blaze::column;
2386 
2388 
2389  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2390 
2391  LT A( serial( rhs.operand().leftOperand() ) );
2392  RT B( serial( rhs.operand().rightOperand() ) );
2393 
2394  const size_t n( rhs.size() );
2395  for( size_t i=0UL; i<n; ++i ) {
2396  (~lhs)[i] -= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2397  }
2398  }
2400  //**********************************************************************************************
2401 
2402  //**Subtraction assignment to sparse vectors****************************************************
2403  // No special implementation for the subtraction assignment to sparse vectors.
2404  //**********************************************************************************************
2405 
2406  //**Multiplication assignment to dense vectors**************************************************
2419  template< typename VT > // Type of the target dense vector
2420  friend inline void multAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2421  {
2422  using blaze::row;
2423  using blaze::column;
2424 
2426 
2427  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2428 
2429  LT A( serial( rhs.operand().leftOperand() ) );
2430  RT B( serial( rhs.operand().rightOperand() ) );
2431 
2432  const size_t n( rhs.size() );
2433  for( size_t i=0UL; i<n; ++i ) {
2434  (~lhs)[i] *= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2435  }
2436  }
2438  //**********************************************************************************************
2439 
2440  //**Multiplication assignment to sparse vectors*************************************************
2441  // No special implementation for the multiplication assignment to sparse vectors.
2442  //**********************************************************************************************
2443 
2444  //**Division assignment to dense vectors********************************************************
2456  template< typename VT > // Type of the target dense vector
2457  friend inline void divAssign( DenseVector<VT,TF>& lhs, const Band& rhs )
2458  {
2459  using blaze::row;
2460  using blaze::column;
2461 
2463 
2464  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
2465 
2466  LT A( serial( rhs.operand().leftOperand() ) );
2467  RT B( serial( rhs.operand().rightOperand() ) );
2468 
2469  const size_t n( rhs.size() );
2470  for( size_t i=0UL; i<n; ++i ) {
2471  (~lhs)[i] /= row( A, rhs.row()+i, unchecked ) * column( B, rhs.column()+i, unchecked );
2472  }
2473  }
2475  //**********************************************************************************************
2476 
2477  //**Division assignment to sparse vectors*******************************************************
2478  // No special implementation for the division assignment to sparse vectors.
2479  //**********************************************************************************************
2480 
2481  //**Compile time checks*************************************************************************
2488  //**********************************************************************************************
2489 };
2490 //*************************************************************************************************
2491 
2492 } // namespace blaze
2493 
2494 #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
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
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:170
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
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
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
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:595
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.The IsUniUpper_v variable template provides...
Definition: IsUniUpper.h:173
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
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
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.
Header file for the reset shim.
#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.
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.The IsLower_v variable template provides a con...
Definition: IsLower.h:175
Header file for the extended initializer_list functionality.
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
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:173
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:253
Constraint on the data type.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.The IsStrictlyUpper_v variable templat...
Definition: IsStrictlyUpper.h:173
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.The IsExpression_v variable template prov...
Definition: IsExpression.h:130
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:9091
#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
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:1162
#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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
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:138
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.
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
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:615
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:137
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
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:558
Header file for the IsSparseVector type trait.
Header file for the IsConst type trait.
Header file for run time assertion macros.
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 IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.The IsUniLower_v variable template provides...
Definition: IsUniLower.h:173
#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,...
Definition: Reference.h:79
Header file for the isDefault shim.
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.The IsUpper_v variable template provides a con...
Definition: IsUpper.h:175
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
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
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.
#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
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
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
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:494
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
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,...
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.