Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ROWS_DENSE_H_
36 #define _BLAZE_MATH_VIEWS_ROWS_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <blaze/math/Aliases.h>
57 #include <blaze/math/Exception.h>
61 #include <blaze/math/shims/Reset.h>
62 #include <blaze/math/SIMD.h>
83 #include <blaze/math/views/Check.h>
86 #include <blaze/system/Blocking.h>
87 #include <blaze/system/CacheSize.h>
88 #include <blaze/system/Inline.h>
91 #include <blaze/util/Assert.h>
96 #include <blaze/util/DisableIf.h>
97 #include <blaze/util/EnableIf.h>
98 #include <blaze/util/mpl/And.h>
99 #include <blaze/util/mpl/If.h>
100 #include <blaze/util/mpl/Not.h>
101 #include <blaze/util/mpl/Or.h>
102 #include <blaze/util/Template.h>
103 #include <blaze/util/TypeList.h>
104 #include <blaze/util/Types.h>
107 #include <blaze/util/Unused.h>
108 
109 
110 namespace blaze {
111 
112 //=================================================================================================
113 //
114 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR DENSE MATRICES
115 //
116 //=================================================================================================
117 
118 //*************************************************************************************************
126 template< typename MT // Type of the dense matrix
127  , bool SF // Symmetry flag
128  , size_t... CRAs > // Compile time row arguments
129 class Rows<MT,true,true,SF,CRAs...>
130  : public View< DenseMatrix< Rows<MT,true,true,SF,CRAs...>, false > >
131  , private RowsData<CRAs...>
132 {
133  private:
134  //**Type definitions****************************************************************************
135  using DataType = RowsData<CRAs...>;
136  using Operand = If_< IsExpression<MT>, MT, MT& >;
137  //**********************************************************************************************
138 
139  public:
140  //**Type definitions****************************************************************************
142  using This = Rows<MT,true,true,SF,CRAs...>;
143 
144  using BaseType = DenseMatrix<This,false>;
145  using ViewedType = MT;
146  using ResultType = RowsTrait_<MT,CRAs...>;
147  using OppositeType = OppositeType_<ResultType>;
148  using TransposeType = TransposeType_<ResultType>;
149  using ElementType = ElementType_<MT>;
150  using SIMDType = SIMDTrait_<ElementType>;
151  using ReturnType = ReturnType_<MT>;
152  using CompositeType = const Rows&;
153 
155  using ConstReference = ConstReference_<MT>;
156 
158  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
159 
161  using ConstPointer = ConstPointer_<MT>;
162 
164  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
165 
167  using ConstIterator = ConstIterator_<MT>;
168 
170  using Iterator = If_< IsConst<MT>, ConstIterator, Iterator_<MT> >;
171  //**********************************************************************************************
172 
173  //**Compilation flags***************************************************************************
175  enum : bool { simdEnabled = MT::simdEnabled };
176 
178  enum : bool { smpAssignable = MT::smpAssignable };
179  //**********************************************************************************************
180 
181  //**Constructors********************************************************************************
184  template< typename... RRAs >
185  explicit inline Rows( MT& matrix, RRAs... args );
186 
187  inline Rows( const Rows& ) = default;
188  inline Rows( Rows&& ) = default;
190  //**********************************************************************************************
191 
192  //**Destructor**********************************************************************************
193  // No explicitly declared destructor.
194  //**********************************************************************************************
195 
196  //**Data access functions***********************************************************************
199  inline Reference operator()( size_t i, size_t j );
200  inline ConstReference operator()( size_t i, size_t j ) const;
201  inline Reference at( size_t i, size_t j );
202  inline ConstReference at( size_t i, size_t j ) const;
203  inline Pointer data () noexcept;
204  inline ConstPointer data () const noexcept;
205  inline Pointer data ( size_t i ) noexcept;
206  inline ConstPointer data ( size_t i ) const noexcept;
207  inline Iterator begin ( size_t i );
208  inline ConstIterator begin ( size_t i ) const;
209  inline ConstIterator cbegin( size_t i ) const;
210  inline Iterator end ( size_t i );
211  inline ConstIterator end ( size_t i ) const;
212  inline ConstIterator cend ( size_t i ) const;
214  //**********************************************************************************************
215 
216  //**Assignment operators************************************************************************
219  inline Rows& operator=( const ElementType& rhs );
220  inline Rows& operator=( initializer_list< initializer_list<ElementType> > list );
221  inline Rows& operator=( const Rows& rhs );
222 
223  template< typename MT2, bool SO2 >
224  inline Rows& operator=( const Matrix<MT2,SO2>& rhs );
225 
226  template< typename MT2, bool SO2 >
227  inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
228  operator+=( const Matrix<MT2,SO2>& rhs );
229 
230  template< typename MT2, bool SO2 >
231  inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
232  operator+=( const Matrix<MT2,SO2>& rhs );
233 
234  template< typename MT2, bool SO2 >
235  inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
236  operator-=( const Matrix<MT2,SO2>& rhs );
237 
238  template< typename MT2, bool SO2 >
239  inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
240  operator-=( const Matrix<MT2,SO2>& rhs );
241 
242  template< typename MT2, bool SO2 >
243  inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
244  operator%=( const Matrix<MT2,SO2>& rhs );
245 
246  template< typename MT2, bool SO2 >
247  inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
248  operator%=( const Matrix<MT2,SO2>& rhs );
250  //**********************************************************************************************
251 
252  //**Utility functions***************************************************************************
255  using DataType::idx;
256  using DataType::idces;
257  using DataType::rows;
258 
259  inline MT& operand() noexcept;
260  inline const MT& operand() const noexcept;
261 
262  inline size_t columns() const noexcept;
263  inline size_t spacing() const noexcept;
264  inline size_t capacity() const noexcept;
265  inline size_t capacity( size_t i ) const noexcept;
266  inline size_t nonZeros() const;
267  inline size_t nonZeros( size_t i ) const;
268  inline void reset();
269  inline void reset( size_t i );
271  //**********************************************************************************************
272 
273  //**Numeric functions***************************************************************************
276  inline Rows& transpose();
277  inline Rows& ctranspose();
278 
279  template< typename Other > inline Rows& scale( const Other& scalar );
281  //**********************************************************************************************
282 
283  private:
284  //**********************************************************************************************
286  template< typename MT2 >
287  struct VectorizedAssign {
288  enum : bool { value = useOptimizedKernels &&
289  simdEnabled && MT2::simdEnabled &&
290  IsSIMDCombinable< ElementType, ElementType_<MT2> >::value };
291  };
292  //**********************************************************************************************
293 
294  //**********************************************************************************************
296  template< typename MT2 >
297  struct VectorizedAddAssign {
298  enum : bool { value = useOptimizedKernels &&
299  simdEnabled && MT2::simdEnabled &&
300  IsSIMDCombinable< ElementType, ElementType_<MT2> >::value &&
301  HasSIMDAdd< ElementType, ElementType_<MT2> >::value &&
302  !IsDiagonal<MT2>::value };
303  };
304  //**********************************************************************************************
305 
306  //**********************************************************************************************
308  template< typename MT2 >
309  struct VectorizedSubAssign {
310  enum : bool { value = useOptimizedKernels &&
311  simdEnabled && MT2::simdEnabled &&
312  IsSIMDCombinable< ElementType, ElementType_<MT2> >::value &&
313  HasSIMDSub< ElementType, ElementType_<MT2> >::value &&
314  !IsDiagonal<MT2>::value };
315  };
316  //**********************************************************************************************
317 
318  //**********************************************************************************************
320  template< typename MT2 >
321  struct VectorizedSchurAssign {
322  enum : bool { value = useOptimizedKernels &&
323  simdEnabled && MT2::simdEnabled &&
324  IsSIMDCombinable< ElementType, ElementType_<MT2> >::value &&
325  HasSIMDMult< ElementType, ElementType_<MT2> >::value };
326  };
327  //**********************************************************************************************
328 
329  //**SIMD properties*****************************************************************************
331  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
332  //**********************************************************************************************
333 
334  public:
335  //**Expression template evaluation functions****************************************************
338  template< typename Other >
339  inline bool canAlias( const Other* alias ) const noexcept;
340 
341  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
342  inline bool canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
343 
344  template< typename Other >
345  inline bool isAliased( const Other* alias ) const noexcept;
346 
347  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
348  inline bool isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
349 
350  inline bool isAligned () const noexcept;
351  inline bool canSMPAssign() const noexcept;
352 
353  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
354  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
355  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
356 
357  BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
358  BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
359  BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
360  BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
361 
362  template< typename MT2 >
363  inline DisableIf_< VectorizedAssign<MT2> > assign( const DenseMatrix<MT2,false>& rhs );
364 
365  template< typename MT2 >
366  inline EnableIf_< VectorizedAssign<MT2> > assign( const DenseMatrix<MT2,false>& rhs );
367 
368  template< typename MT2 > inline void assign( const DenseMatrix<MT2,true>& rhs );
369 
370  template< typename MT2 > inline void assign( const SparseMatrix<MT2,false>& rhs );
371  template< typename MT2 > inline void assign( const SparseMatrix<MT2,true>& rhs );
372 
373  template< typename MT2 >
374  inline DisableIf_< VectorizedAddAssign<MT2> > addAssign( const DenseMatrix<MT2,false>& rhs );
375 
376  template< typename MT2 >
377  inline EnableIf_< VectorizedAddAssign<MT2> > addAssign( const DenseMatrix<MT2,false>& rhs );
378 
379  template< typename MT2 > inline void addAssign( const DenseMatrix<MT2,true>& rhs );
380  template< typename MT2 > inline void addAssign( const SparseMatrix<MT2,false>& rhs );
381  template< typename MT2 > inline void addAssign( const SparseMatrix<MT2,true>& rhs );
382 
383  template< typename MT2 >
384  inline DisableIf_< VectorizedSubAssign<MT2> > subAssign( const DenseMatrix<MT2,false>& rhs );
385 
386  template< typename MT2 >
387  inline EnableIf_< VectorizedSubAssign<MT2> > subAssign( const DenseMatrix<MT2,false>& rhs );
388 
389  template< typename MT2 > inline void subAssign( const DenseMatrix<MT2,true>& rhs );
390  template< typename MT2 > inline void subAssign( const SparseMatrix<MT2,false>& rhs );
391  template< typename MT2 > inline void subAssign( const SparseMatrix<MT2,true>& rhs );
392 
393  template< typename MT2 >
394  inline DisableIf_< VectorizedSchurAssign<MT2> > schurAssign( const DenseMatrix<MT2,false>& rhs );
395 
396  template< typename MT2 >
397  inline EnableIf_< VectorizedSchurAssign<MT2> > schurAssign( const DenseMatrix<MT2,false>& rhs );
398 
399  template< typename MT2 > inline void schurAssign( const DenseMatrix<MT2,true>& rhs );
400  template< typename MT2 > inline void schurAssign( const SparseMatrix<MT2,false>& rhs );
401  template< typename MT2 > inline void schurAssign( const SparseMatrix<MT2,true>& rhs );
403  //**********************************************************************************************
404 
405  private:
406  //**Member variables****************************************************************************
409  Operand matrix_;
410 
411  //**********************************************************************************************
412 
413  //**Friend declarations*************************************************************************
414  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Rows;
415  //**********************************************************************************************
416 
417  //**Compile time checks*************************************************************************
426  //**********************************************************************************************
427 };
429 //*************************************************************************************************
430 
431 
432 
433 
434 //=================================================================================================
435 //
436 // CONSTRUCTORS
437 //
438 //=================================================================================================
439 
440 //*************************************************************************************************
453 template< typename MT // Type of the dense matrix
454  , bool SF // Symmetry flag
455  , size_t... CRAs > // Compile time row arguments
456 template< typename... RRAs > // Runtime row arguments
457 inline Rows<MT,true,true,SF,CRAs...>::Rows( MT& matrix, RRAs... args )
458  : DataType( args... ) // Base class initialization
459  , matrix_ ( matrix ) // The matrix containing the rows
460 {
461  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
462  for( size_t i=0UL; i<rows(); ++i ) {
463  if( matrix_.rows() <= idx(i) ) {
464  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
465  }
466  }
467  }
468 }
470 //*************************************************************************************************
471 
472 
473 
474 
475 //=================================================================================================
476 //
477 // DATA ACCESS FUNCTIONS
478 //
479 //=================================================================================================
480 
481 //*************************************************************************************************
492 template< typename MT // Type of the dense matrix
493  , bool SF // Symmetry flag
494  , size_t... CRAs > // Compile time row arguments
495 inline typename Rows<MT,true,true,SF,CRAs...>::Reference
496  Rows<MT,true,true,SF,CRAs...>::operator()( size_t i, size_t j )
497 {
498  BLAZE_USER_ASSERT( i < rows() , "Invalid row access index" );
499  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
500 
501  return matrix_(idx(i),j);
502 }
504 //*************************************************************************************************
505 
506 
507 //*************************************************************************************************
518 template< typename MT // Type of the dense matrix
519  , bool SF // Symmetry flag
520  , size_t... CRAs > // Compile time row arguments
521 inline typename Rows<MT,true,true,SF,CRAs...>::ConstReference
522  Rows<MT,true,true,SF,CRAs...>::operator()( size_t i, size_t j ) const
523 {
524  BLAZE_USER_ASSERT( i < rows() , "Invalid row access index" );
525  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
526 
527  return const_cast<const MT&>( matrix_ )(idx(i),j);
528 }
530 //*************************************************************************************************
531 
532 
533 //*************************************************************************************************
545 template< typename MT // Type of the dense matrix
546  , bool SF // Symmetry flag
547  , size_t... CRAs > // Compile time row arguments
548 inline typename Rows<MT,true,true,SF,CRAs...>::Reference
549  Rows<MT,true,true,SF,CRAs...>::at( size_t i, size_t j )
550 {
551  if( i >= rows() ) {
552  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
553  }
554  if( j >= columns() ) {
555  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
556  }
557  return (*this)(i,j);
558 }
560 //*************************************************************************************************
561 
562 
563 //*************************************************************************************************
575 template< typename MT // Type of the dense matrix
576  , bool SF // Symmetry flag
577  , size_t... CRAs > // Compile time row arguments
578 inline typename Rows<MT,true,true,SF,CRAs...>::ConstReference
579  Rows<MT,true,true,SF,CRAs...>::at( size_t i, size_t j ) const
580 {
581  if( i >= rows() ) {
582  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
583  }
584  if( j >= columns() ) {
585  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
586  }
587  return (*this)(i,j);
588 }
590 //*************************************************************************************************
591 
592 
593 //*************************************************************************************************
603 template< typename MT // Type of the dense matrix
604  , bool SF // Symmetry flag
605  , size_t... CRAs > // Compile time row arguments
606 inline typename Rows<MT,true,true,SF,CRAs...>::Pointer
608 {
609  return matrix_.data( idx(0UL) );
610 }
612 //*************************************************************************************************
613 
614 
615 //*************************************************************************************************
625 template< typename MT // Type of the dense matrix
626  , bool SF // Symmetry flag
627  , size_t... CRAs > // Compile time row arguments
628 inline typename Rows<MT,true,true,SF,CRAs...>::ConstPointer
629  Rows<MT,true,true,SF,CRAs...>::data() const noexcept
630 {
631  return matrix_.data( idx(0UL) );
632 }
634 //*************************************************************************************************
635 
636 
637 //*************************************************************************************************
646 template< typename MT // Type of the dense matrix
647  , bool SF // Symmetry flag
648  , size_t... CRAs > // Compile time row arguments
649 inline typename Rows<MT,true,true,SF,CRAs...>::Pointer
650  Rows<MT,true,true,SF,CRAs...>::data( size_t i ) noexcept
651 {
652  return matrix_.data( idx(i) );
653 }
655 //*************************************************************************************************
656 
657 
658 //*************************************************************************************************
667 template< typename MT // Type of the dense matrix
668  , bool SF // Symmetry flag
669  , size_t... CRAs > // Compile time row arguments
670 inline typename Rows<MT,true,true,SF,CRAs...>::ConstPointer
671  Rows<MT,true,true,SF,CRAs...>::data( size_t i ) const noexcept
672 {
673  return matrix_.data( idx(i) );
674 }
676 //*************************************************************************************************
677 
678 
679 //*************************************************************************************************
688 template< typename MT // Type of the dense matrix
689  , bool SF // Symmetry flag
690  , size_t... CRAs > // Compile time row arguments
691 inline typename Rows<MT,true,true,SF,CRAs...>::Iterator
693 {
694  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
695  return matrix_.begin( idx(i) );
696 }
698 //*************************************************************************************************
699 
700 
701 //*************************************************************************************************
710 template< typename MT // Type of the dense matrix
711  , bool SF // Symmetry flag
712  , size_t... CRAs > // Compile time row arguments
713 inline typename Rows<MT,true,true,SF,CRAs...>::ConstIterator
714  Rows<MT,true,true,SF,CRAs...>::begin( size_t i ) const
715 {
716  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
717  return matrix_.cbegin( idx(i) );
718 }
720 //*************************************************************************************************
721 
722 
723 //*************************************************************************************************
732 template< typename MT // Type of the dense matrix
733  , bool SF // Symmetry flag
734  , size_t... CRAs > // Compile time row arguments
735 inline typename Rows<MT,true,true,SF,CRAs...>::ConstIterator
736  Rows<MT,true,true,SF,CRAs...>::cbegin( size_t i ) const
737 {
738  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
739  return matrix_.cbegin( idx(i) );
740 }
742 //*************************************************************************************************
743 
744 
745 //*************************************************************************************************
754 template< typename MT // Type of the dense matrix
755  , bool SF // Symmetry flag
756  , size_t... CRAs > // Compile time row arguments
757 inline typename Rows<MT,true,true,SF,CRAs...>::Iterator
759 {
760  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
761  return matrix_.end( idx(i) );
762 }
764 //*************************************************************************************************
765 
766 
767 //*************************************************************************************************
776 template< typename MT // Type of the dense matrix
777  , bool SF // Symmetry flag
778  , size_t... CRAs > // Compile time row arguments
779 inline typename Rows<MT,true,true,SF,CRAs...>::ConstIterator
780  Rows<MT,true,true,SF,CRAs...>::end( size_t i ) const
781 {
782  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
783  return matrix_.cend( idx(i) );
784 }
786 //*************************************************************************************************
787 
788 
789 //*************************************************************************************************
798 template< typename MT // Type of the dense matrix
799  , bool SF // Symmetry flag
800  , size_t... CRAs > // Compile time row arguments
801 inline typename Rows<MT,true,true,SF,CRAs...>::ConstIterator
802  Rows<MT,true,true,SF,CRAs...>::cend( size_t i ) const
803 {
804  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
805  return matrix_.cend( idx(i) );
806 }
808 //*************************************************************************************************
809 
810 
811 
812 
813 //=================================================================================================
814 //
815 // ASSIGNMENT OPERATORS
816 //
817 //=================================================================================================
818 
819 //*************************************************************************************************
830 template< typename MT // Type of the dense matrix
831  , bool SF // Symmetry flag
832  , size_t... CRAs > // Compile time row arguments
833 inline Rows<MT,true,true,SF,CRAs...>&
834  Rows<MT,true,true,SF,CRAs...>::operator=( const ElementType& rhs )
835 {
836  for( size_t i=0UL; i<rows(); ++i ) {
837  row( matrix_, idx(i), unchecked ) = rhs;
838  }
839 
840  return *this;
841 }
843 //*************************************************************************************************
844 
845 
846 //*************************************************************************************************
862 template< typename MT // Type of the dense matrix
863  , bool SF // Symmetry flag
864  , size_t... CRAs > // Compile time row arguments
865 inline Rows<MT,true,true,SF,CRAs...>&
866  Rows<MT,true,true,SF,CRAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
867 {
870 
871  if( list.size() != rows() ) {
872  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row selection" );
873  }
874 
875  if( IsRestricted<MT>::value ) {
876  size_t i( 0UL );
877  for( const auto& rowList : list ) {
878  const InitializerVector<ElementType> tmp( rowList, columns() );
879  if( !tryAssign( row( matrix_, idx(i), unchecked ), tmp, 0UL ) ){
880  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
881  }
882  ++i;
883  }
884  }
885 
886  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
887  size_t i( 0UL );
888 
889  for( const auto& rowList : list ) {
890  std::fill( std::copy( rowList.begin(), rowList.end(), left.begin(i) ), left.end(i), ElementType() );
891  ++i;
892  }
893 
894  return *this;
895 }
897 //*************************************************************************************************
898 
899 
900 //*************************************************************************************************
915 template< typename MT // Type of the dense matrix
916  , bool SF // Symmetry flag
917  , size_t... CRAs > // Compile time row arguments
918 inline Rows<MT,true,true,SF,CRAs...>&
919  Rows<MT,true,true,SF,CRAs...>::operator=( const Rows& rhs )
920 {
923 
926 
927  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && idces() == rhs.idces() ) )
928  return *this;
929 
930  if( rows() != rhs.rows() || columns() != rhs.columns() ) {
931  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
932  }
933 
934  if( IsRestricted<MT>::value ) {
935  for( size_t i=0UL; i<rows(); ++i ) {
936  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( rhs, i, unchecked ), 0UL ) ) {
937  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
938  }
939  }
940  }
941 
942  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
943 
944  if( rhs.canAlias( &matrix_ ) ) {
945  const ResultType tmp( rhs );
946  smpAssign( left, tmp );
947  }
948  else {
949  smpAssign( left, rhs );
950  }
951 
952  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
953 
954  return *this;
955 }
957 //*************************************************************************************************
958 
959 
960 //*************************************************************************************************
975 template< typename MT // Type of the dense matrix
976  , bool SF // Symmetry flag
977  , size_t... CRAs > // Compile time row arguments
978 template< typename MT2 // Type of the right-hand side matrix
979  , bool SO2 > // Storage order of the right-hand side matrix
980 inline Rows<MT,true,true,SF,CRAs...>&
981  Rows<MT,true,true,SF,CRAs...>::operator=( const Matrix<MT2,SO2>& rhs )
982 {
985 
987 
988  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
989  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
990  }
991 
992  using Right = If_< IsRestricted<MT>, CompositeType_<MT2>, const MT2& >;
993  Right right( ~rhs );
994 
995  if( IsRestricted<MT>::value ) {
996  for( size_t i=0UL; i<rows(); ++i ) {
997  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( right, i, unchecked ), 0UL ) ) {
998  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
999  }
1000  }
1001  }
1002 
1003  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1004 
1005  if( IsSparseMatrix<MT2>::value ) {
1006  reset();
1007  }
1008 
1009  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1010  const ResultType_<MT2> tmp( right );
1011  smpAssign( left, tmp );
1012  }
1013  else {
1014  smpAssign( left, right );
1015  }
1016 
1017  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1018 
1019  return *this;
1020 }
1022 //*************************************************************************************************
1023 
1024 
1025 //*************************************************************************************************
1039 template< typename MT // Type of the dense matrix
1040  , bool SF // Symmetry flag
1041  , size_t... CRAs > // Compile time row arguments
1042 template< typename MT2 // Type of the right-hand side matrix
1043  , bool SO2 > // Storage order of the right-hand side matrix
1044 inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,true,true,SF,CRAs...>& >
1045  Rows<MT,true,true,SF,CRAs...>::operator+=( const Matrix<MT2,SO2>& rhs )
1046 {
1049 
1053 
1054  using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
1055 
1058 
1059  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
1060  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1061  }
1062 
1063  if( IsRestricted<MT>::value ) {
1064  for( size_t i=0UL; i<rows(); ++i ) {
1065  if( !tryAddAssign( row( matrix_, idx(i), unchecked ), row( ~rhs, i, unchecked ), 0UL ) ) {
1066  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1067  }
1068  }
1069  }
1070 
1071  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1072 
1073  if( (~rhs).canAlias( &matrix_ ) ) {
1074  const AddType tmp( *this + (~rhs) );
1075  smpAssign( left, tmp );
1076  }
1077  else {
1078  smpAddAssign( left, ~rhs );
1079  }
1080 
1081  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1082 
1083  return *this;
1084 }
1086 //*************************************************************************************************
1087 
1088 
1089 //*************************************************************************************************
1103 template< typename MT // Type of the dense matrix
1104  , bool SF // Symmetry flag
1105  , size_t... CRAs > // Compile time row arguments
1106 template< typename MT2 // Type of the right-hand side matrix
1107  , bool SO2 > // Storage order of the right-hand side matrix
1108 inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,true,true,SF,CRAs...>& >
1109  Rows<MT,true,true,SF,CRAs...>::operator+=( const Matrix<MT2,SO2>& rhs )
1110 {
1113 
1117 
1118  using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
1119 
1122 
1123  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
1124  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1125  }
1126 
1127  const AddType tmp( *this + (~rhs) );
1128 
1129  if( IsRestricted<MT>::value ) {
1130  for( size_t i=0UL; i<rows(); ++i ) {
1131  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( tmp, i, unchecked ), 0UL ) ) {
1132  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1133  }
1134  }
1135  }
1136 
1137  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1138 
1139  smpAssign( left, tmp );
1140 
1141  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1142 
1143  return *this;
1144 }
1146 //*************************************************************************************************
1147 
1148 
1149 //*************************************************************************************************
1163 template< typename MT // Type of the dense matrix
1164  , bool SF // Symmetry flag
1165  , size_t... CRAs > // Compile time row arguments
1166 template< typename MT2 // Type of the right-hand side matrix
1167  , bool SO2 > // Storage order of the right-hand side matrix
1168 inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,true,true,SF,CRAs...>& >
1169  Rows<MT,true,true,SF,CRAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
1170 {
1173 
1177 
1178  using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
1179 
1182 
1183  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
1184  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1185  }
1186 
1187  if( IsRestricted<MT>::value ) {
1188  for( size_t i=0UL; i<rows(); ++i ) {
1189  if( !trySubAssign( row( matrix_, idx(i), unchecked ), row( ~rhs, i, unchecked ), 0UL ) ) {
1190  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1191  }
1192  }
1193  }
1194 
1195  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1196 
1197  if( (~rhs).canAlias( &matrix_ ) ) {
1198  const SubType tmp( *this - (~rhs ) );
1199  smpAssign( left, tmp );
1200  }
1201  else {
1202  smpSubAssign( left, ~rhs );
1203  }
1204 
1205  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1206 
1207  return *this;
1208 }
1210 //*************************************************************************************************
1211 
1212 
1213 //*************************************************************************************************
1227 template< typename MT // Type of the dense matrix
1228  , bool SF // Symmetry flag
1229  , size_t... CRAs > // Compile time row arguments
1230 template< typename MT2 // Type of the right-hand side matrix
1231  , bool SO2 > // Storage order of the right-hand side matrix
1232 inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,true,true,SF,CRAs...>& >
1233  Rows<MT,true,true,SF,CRAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
1234 {
1237 
1241 
1242  using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
1243 
1246 
1247  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
1248  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1249  }
1250 
1251  const SubType tmp( *this - (~rhs) );
1252 
1253  if( IsRestricted<MT>::value ) {
1254  for( size_t i=0UL; i<rows(); ++i ) {
1255  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( tmp, i, unchecked ), 0UL ) ) {
1256  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1257  }
1258  }
1259  }
1260 
1261  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1262 
1263  smpAssign( left, tmp );
1264 
1265  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1266 
1267  return *this;
1268 }
1270 //*************************************************************************************************
1271 
1272 
1273 //*************************************************************************************************
1287 template< typename MT // Type of the dense matrix
1288  , bool SF // Symmetry flag
1289  , size_t... CRAs > // Compile time row arguments
1290 template< typename MT2 // Type of the right-hand side matrix
1291  , bool SO2 > // Storage order of the right-hand side matrix
1292 inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,true,true,SF,CRAs...>& >
1293  Rows<MT,true,true,SF,CRAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
1294 {
1297 
1301 
1302  using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
1303 
1305 
1306  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
1307  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1308  }
1309 
1310  if( IsRestricted<MT>::value ) {
1311  for( size_t i=0UL; i<rows(); ++i ) {
1312  if( !tryMultAssign( row( matrix_, idx(i), unchecked ), row( ~rhs, i, unchecked ), 0UL ) ) {
1313  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1314  }
1315  }
1316  }
1317 
1318  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1319 
1320  if( (~rhs).canAlias( &matrix_ ) ) {
1321  const SchurType tmp( *this % (~rhs) );
1322  if( IsSparseMatrix<SchurType>::value )
1323  reset();
1324  smpAssign( left, tmp );
1325  }
1326  else {
1327  smpSchurAssign( left, ~rhs );
1328  }
1329 
1330  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1331 
1332  return *this;
1333 }
1335 //*************************************************************************************************
1336 
1337 
1338 //*************************************************************************************************
1352 template< typename MT // Type of the dense matrix
1353  , bool SF // Symmetry flag
1354  , size_t... CRAs > // Compile time row arguments
1355 template< typename MT2 // Type of the right-hand side matrix
1356  , bool SO2 > // Storage order of the right-hand side matrix
1357 inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,true,true,SF,CRAs...>& >
1358  Rows<MT,true,true,SF,CRAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
1359 {
1362 
1366 
1367  using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
1368 
1370 
1371  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
1372  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1373  }
1374 
1375  const SchurType tmp( *this % (~rhs) );
1376 
1377  if( IsRestricted<MT>::value ) {
1378  for( size_t i=0UL; i<rows(); ++i ) {
1379  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( tmp, i, unchecked ), 0UL ) ) {
1380  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1381  }
1382  }
1383  }
1384 
1385  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1386 
1387  if( IsSparseMatrix<SchurType>::value ) {
1388  reset();
1389  }
1390 
1391  smpAssign( left, tmp );
1392 
1393  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1394 
1395  return *this;
1396 }
1398 //*************************************************************************************************
1399 
1400 
1401 
1402 
1403 //=================================================================================================
1404 //
1405 // UTILITY FUNCTIONS
1406 //
1407 //=================================================================================================
1408 
1409 //*************************************************************************************************
1415 template< typename MT // Type of the dense matrix
1416  , bool SF // Symmetry flag
1417  , size_t... CRAs > // Compile time row arguments
1418 inline MT& Rows<MT,true,true,SF,CRAs...>::operand() noexcept
1419 {
1420  return matrix_;
1421 }
1423 //*************************************************************************************************
1424 
1425 
1426 //*************************************************************************************************
1432 template< typename MT // Type of the dense matrix
1433  , bool SF // Symmetry flag
1434  , size_t... CRAs > // Compile time row arguments
1435 inline const MT& Rows<MT,true,true,SF,CRAs...>::operand() const noexcept
1436 {
1437  return matrix_;
1438 }
1440 //*************************************************************************************************
1441 
1442 
1443 //*************************************************************************************************
1449 template< typename MT // Type of the dense matrix
1450  , bool SF // Symmetry flag
1451  , size_t... CRAs > // Compile time row arguments
1452 inline size_t Rows<MT,true,true,SF,CRAs...>::columns() const noexcept
1453 {
1454  return matrix_.columns();
1455 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1469 template< typename MT // Type of the dense matrix
1470  , bool SF // Symmetry flag
1471  , size_t... CRAs > // Compile time row arguments
1472 inline size_t Rows<MT,true,true,SF,CRAs...>::spacing() const noexcept
1473 {
1474  return matrix_.spacing();
1475 }
1477 //*************************************************************************************************
1478 
1479 
1480 //*************************************************************************************************
1486 template< typename MT // Type of the dense matrix
1487  , bool SF // Symmetry flag
1488  , size_t... CRAs > // Compile time row arguments
1489 inline size_t Rows<MT,true,true,SF,CRAs...>::capacity() const noexcept
1490 {
1491  return rows() * columns();
1492 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1506 template< typename MT // Type of the dense matrix
1507  , bool SF // Symmetry flag
1508  , size_t... CRAs > // Compile time row arguments
1509 inline size_t Rows<MT,true,true,SF,CRAs...>::capacity( size_t i ) const noexcept
1510 {
1511  UNUSED_PARAMETER( i );
1512 
1513  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1514 
1515  return columns();
1516 }
1518 //*************************************************************************************************
1519 
1520 
1521 //*************************************************************************************************
1527 template< typename MT // Type of the dense matrix
1528  , bool SF // Symmetry flag
1529  , size_t... CRAs > // Compile time row arguments
1530 inline size_t Rows<MT,true,true,SF,CRAs...>::nonZeros() const
1531 {
1532  size_t nonzeros( 0UL );
1533 
1534  for( size_t i=0UL; i<rows(); ++i ) {
1535  nonzeros += matrix_.nonZeros( idx(i) );
1536  }
1537 
1538  return nonzeros;
1539 }
1541 //*************************************************************************************************
1542 
1543 
1544 //*************************************************************************************************
1553 template< typename MT // Type of the dense matrix
1554  , bool SF // Symmetry flag
1555  , size_t... CRAs > // Compile time row arguments
1556 inline size_t Rows<MT,true,true,SF,CRAs...>::nonZeros( size_t i ) const
1557 {
1558  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1559 
1560  return matrix_.nonZeros( idx(i) );
1561 }
1563 //*************************************************************************************************
1564 
1565 
1566 //*************************************************************************************************
1572 template< typename MT // Type of the dense matrix
1573  , bool SF // Symmetry flag
1574  , size_t... CRAs > // Compile time row arguments
1576 {
1577  for( size_t i=0UL; i<rows(); ++i ) {
1578  matrix_.reset( idx(i) );
1579  }
1580 }
1582 //*************************************************************************************************
1583 
1584 
1585 //*************************************************************************************************
1594 template< typename MT // Type of the dense matrix
1595  , bool SF // Symmetry flag
1596  , size_t... CRAs > // Compile time row arguments
1597 inline void Rows<MT,true,true,SF,CRAs...>::reset( size_t i )
1598 {
1599  matrix_.reset( idx(i) );
1600 }
1602 //*************************************************************************************************
1603 
1604 
1605 
1606 
1607 //=================================================================================================
1608 //
1609 // NUMERIC FUNCTIONS
1610 //
1611 //=================================================================================================
1612 
1613 //*************************************************************************************************
1626 template< typename MT // Type of the dense matrix
1627  , bool SF // Symmetry flag
1628  , size_t... CRAs > // Compile time row arguments
1629 inline Rows<MT,true,true,SF,CRAs...>&
1631 {
1634 
1635  if( rows() != columns() ) {
1636  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose of a non-quadratic matrix" );
1637  }
1638 
1639  const ResultType tmp( trans( *this ) );
1640 
1641  if( IsRestricted<MT>::value ) {
1642  for( size_t i=0UL; i<rows(); ++i ) {
1643  if( !tryAssign( matrix_, row( tmp, i ), idx(i), 0UL ) ) {
1644  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose operation" );
1645  }
1646  }
1647  }
1648 
1649  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1650 
1651  smpAssign( left, tmp );
1652 
1653  return *this;
1654 }
1656 //*************************************************************************************************
1657 
1658 
1659 //*************************************************************************************************
1672 template< typename MT // Type of the dense matrix
1673  , bool SF // Symmetry flag
1674  , size_t... CRAs > // Compile time row arguments
1675 inline Rows<MT,true,true,SF,CRAs...>&
1677 {
1680 
1681  if( rows() != columns() ) {
1682  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose of a non-quadratic matrix" );
1683  }
1684 
1685  const ResultType tmp( ctrans( *this ) );
1686 
1687  if( IsRestricted<MT>::value ) {
1688  for( size_t i=0UL; i<rows(); ++i ) {
1689  if( !tryAssign( matrix_, row( tmp, i ), idx(i), 0UL ) ) {
1690  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose operation" );
1691  }
1692  }
1693  }
1694 
1695  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
1696 
1697  smpAssign( left, tmp );
1698 
1699  return *this;
1700 }
1702 //*************************************************************************************************
1703 
1704 
1705 //*************************************************************************************************
1718 template< typename MT // Type of the dense matrix
1719  , bool SF // Symmetry flag
1720  , size_t... CRAs > // Compile time row arguments
1721 template< typename Other > // Data type of the scalar value
1722 inline Rows<MT,true,true,SF,CRAs...>&
1723  Rows<MT,true,true,SF,CRAs...>::scale( const Other& scalar )
1724 {
1728 
1729  for( size_t i=0UL; i<rows(); ++i )
1730  {
1731  const size_t index ( idx(i) );
1732  const size_t jbegin( IsUpper<MT>::value ? ( IsStrictlyUpper<MT>::value ? index+1UL : index ) : 0UL );
1733  const size_t jend ( IsLower<MT>::value ? ( IsStrictlyLower<MT>::value ? index : index+1UL ) : columns() );
1734 
1735  for( size_t j=jbegin; j<jend; ++j ) {
1736  matrix_(index,j) *= scalar;
1737  }
1738  }
1739 
1740  return *this;
1741 }
1743 //*************************************************************************************************
1744 
1745 
1746 
1747 
1748 //=================================================================================================
1749 //
1750 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1751 //
1752 //=================================================================================================
1753 
1754 //*************************************************************************************************
1765 template< typename MT // Type of the dense matrix
1766  , bool SF // Symmetry flag
1767  , size_t... CRAs > // Compile time row arguments
1768 template< typename Other > // Data type of the foreign expression
1769 inline bool Rows<MT,true,true,SF,CRAs...>::canAlias( const Other* alias ) const noexcept
1770 {
1771  return matrix_.isAliased( alias );
1772 }
1774 //*************************************************************************************************
1775 
1776 
1777 //*************************************************************************************************
1789 template< typename MT // Type of the dense matrix
1790  , bool SF // Symmetry flag
1791  , size_t... CRAs > // Compile time row arguments
1792 template< typename MT2 // Data type of the foreign dense row selection
1793  , bool SO2 // Storage order of the foreign dense row selection
1794  , bool SF2 // Symmetry flag of the foreign dense row selection
1795  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row selection
1796 inline bool
1797  Rows<MT,true,true,SF,CRAs...>::canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
1798 {
1799  return matrix_.isAliased( &alias->matrix_ );
1800 }
1802 //*************************************************************************************************
1803 
1804 
1805 //*************************************************************************************************
1816 template< typename MT // Type of the dense matrix
1817  , bool SF // Symmetry flag
1818  , size_t... CRAs > // Compile time row arguments
1819 template< typename Other > // Data type of the foreign expression
1820 inline bool Rows<MT,true,true,SF,CRAs...>::isAliased( const Other* alias ) const noexcept
1821 {
1822  return matrix_.isAliased( alias );
1823 }
1825 //*************************************************************************************************
1826 
1827 
1828 //*************************************************************************************************
1840 template< typename MT // Type of the dense matrix
1841  , bool SF // Symmetry flag
1842  , size_t... CRAs > // Compile time row arguments
1843 template< typename MT2 // Data type of the foreign dense row selection
1844  , bool SO2 // Storage order of the foreign dense row selection
1845  , bool SF2 // Symmetry flag of the foreign dense row selection
1846  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row selection
1847 inline bool
1848  Rows<MT,true,true,SF,CRAs...>::isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
1849 {
1850  return matrix_.isAliased( &alias->matrix_ );
1851 }
1853 //*************************************************************************************************
1854 
1855 
1856 //*************************************************************************************************
1866 template< typename MT // Type of the dense matrix
1867  , bool SF // Symmetry flag
1868  , size_t... CRAs > // Compile time row arguments
1869 inline bool Rows<MT,true,true,SF,CRAs...>::isAligned() const noexcept
1870 {
1871  return matrix_.isAligned();
1872 }
1874 //*************************************************************************************************
1875 
1876 
1877 //*************************************************************************************************
1888 template< typename MT // Type of the dense matrix
1889  , bool SF // Symmetry flag
1890  , size_t... CRAs > // Compile time row arguments
1891 inline bool Rows<MT,true,true,SF,CRAs...>::canSMPAssign() const noexcept
1892 {
1893  return ( rows() * columns() > SMP_DMATASSIGN_THRESHOLD );
1894 }
1896 //*************************************************************************************************
1897 
1898 
1899 //*************************************************************************************************
1914 template< typename MT // Type of the dense matrix
1915  , bool SF // Symmetry flag
1916  , size_t... CRAs > // Compile time row arguments
1917 BLAZE_ALWAYS_INLINE typename Rows<MT,true,true,SF,CRAs...>::SIMDType
1918  Rows<MT,true,true,SF,CRAs...>::load( size_t i, size_t j ) const noexcept
1919 {
1920  return matrix_.load( idx(i), j );
1921 }
1923 //*************************************************************************************************
1924 
1925 
1926 //*************************************************************************************************
1941 template< typename MT // Type of the dense matrix
1942  , bool SF // Symmetry flag
1943  , size_t... CRAs > // Compile time row arguments
1944 BLAZE_ALWAYS_INLINE typename Rows<MT,true,true,SF,CRAs...>::SIMDType
1945  Rows<MT,true,true,SF,CRAs...>::loada( size_t i, size_t j ) const noexcept
1946 {
1947  return matrix_.loada( idx(i), j );
1948 }
1950 //*************************************************************************************************
1951 
1952 
1953 //*************************************************************************************************
1968 template< typename MT // Type of the dense matrix
1969  , bool SF // Symmetry flag
1970  , size_t... CRAs > // Compile time row arguments
1971 BLAZE_ALWAYS_INLINE typename Rows<MT,true,true,SF,CRAs...>::SIMDType
1972  Rows<MT,true,true,SF,CRAs...>::loadu( size_t i, size_t j ) const noexcept
1973 {
1974  return matrix_.loadu( idx(i), j );
1975 }
1977 //*************************************************************************************************
1978 
1979 
1980 //*************************************************************************************************
1996 template< typename MT // Type of the dense matrix
1997  , bool SF // Symmetry flag
1998  , size_t... CRAs > // Compile time row arguments
2000  Rows<MT,true,true,SF,CRAs...>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2001 {
2002  matrix_.store( idx(i), j, value );
2003 }
2005 //*************************************************************************************************
2006 
2007 
2008 //*************************************************************************************************
2024 template< typename MT // Type of the dense matrix
2025  , bool SF // Symmetry flag
2026  , size_t... CRAs > // Compile time row arguments
2028  Rows<MT,true,true,SF,CRAs...>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2029 {
2030  matrix_.storea( idx(i), j, value );
2031 }
2033 //*************************************************************************************************
2034 
2035 
2036 //*************************************************************************************************
2052 template< typename MT // Type of the dense matrix
2053  , bool SF // Symmetry flag
2054  , size_t... CRAs > // Compile time row arguments
2056  Rows<MT,true,true,SF,CRAs...>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2057 {
2058  matrix_.storeu( idx(i), j, value );
2059 }
2061 //*************************************************************************************************
2062 
2063 
2064 //*************************************************************************************************
2080 template< typename MT // Type of the dense matrix
2081  , bool SF // Symmetry flag
2082  , size_t... CRAs > // Compile time row arguments
2084  Rows<MT,true,true,SF,CRAs...>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2085 {
2086  matrix_.stream( idx(i), j, value );
2087 }
2089 //*************************************************************************************************
2090 
2091 
2092 //*************************************************************************************************
2104 template< typename MT // Type of the dense matrix
2105  , bool SF // Symmetry flag
2106  , size_t... CRAs > // Compile time row arguments
2107 template< typename MT2 > // Type of the right-hand side dense matrix
2108 inline DisableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAssign<MT2> >
2109  Rows<MT,true,true,SF,CRAs...>::assign( const DenseMatrix<MT2,false>& rhs )
2110 {
2113 
2114  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2115  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2116 
2117  const size_t jpos( columns() & size_t(-2) );
2118  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
2119 
2120  for( size_t i=0UL; i<rows(); ++i ) {
2121  const size_t index( idx(i) );
2122  for( size_t j=0UL; j<jpos; j+=2UL ) {
2123  matrix_(index,j ) = (~rhs)(i,j );
2124  matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
2125  }
2126  if( jpos < columns() ) {
2127  matrix_(index,jpos) = (~rhs)(i,jpos);
2128  }
2129  }
2130 }
2132 //*************************************************************************************************
2133 
2134 
2135 //*************************************************************************************************
2147 template< typename MT // Type of the dense matrix
2148  , bool SF // Symmetry flag
2149  , size_t... CRAs > // Compile time row arguments
2150 template< typename MT2 > // Type of the right-hand side dense matrix
2151 inline EnableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAssign<MT2> >
2152  Rows<MT,true,true,SF,CRAs...>::assign( const DenseMatrix<MT2,false>& rhs )
2153 {
2156 
2158 
2159  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2160  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2161 
2162  const size_t jpos( columns() & size_t(-SIMDSIZE) );
2163  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2164 
2165  if( useStreaming &&
2166  rows()*columns() > ( cacheSize / ( sizeof(ElementType) * 3UL ) ) &&
2167  !(~rhs).isAliased( &matrix_ ) )
2168  {
2169  for( size_t i=0UL; i<rows(); ++i )
2170  {
2171  size_t j( 0UL );
2172  Iterator left( begin(i) );
2173  ConstIterator_<MT2> right( (~rhs).begin(i) );
2174 
2175  for( ; j<jpos; j+=SIMDSIZE ) {
2176  left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2177  }
2178  for( ; j<columns(); ++j ) {
2179  *left = *right;
2180  }
2181  }
2182  }
2183  else
2184  {
2185  for( size_t i=0UL; i<rows(); ++i )
2186  {
2187  size_t j( 0UL );
2188  Iterator left( begin(i) );
2189  ConstIterator_<MT2> right( (~rhs).begin(i) );
2190 
2191  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2192  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2193  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2194  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2195  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2196  }
2197  for( ; j<jpos; j+=SIMDSIZE ) {
2198  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2199  }
2200  for( ; j<columns(); ++j ) {
2201  *left = *right; ++left; ++right;
2202  }
2203  }
2204  }
2205 }
2207 //*************************************************************************************************
2208 
2209 
2210 //*************************************************************************************************
2222 template< typename MT // Type of the dense matrix
2223  , bool SF // Symmetry flag
2224  , size_t... CRAs > // Compile time row arguments
2225 template< typename MT2 > // Type of the right-hand side dense matrix
2226 inline void Rows<MT,true,true,SF,CRAs...>::assign( const DenseMatrix<MT2,true>& rhs )
2227 {
2230 
2232 
2233  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2234  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2235 
2236  constexpr size_t block( BLOCK_SIZE );
2237 
2238  if( rows() < block && columns() < block )
2239  {
2240  const size_t jpos( (~rhs).columns() & size_t(-2) );
2241  for( size_t i=0UL; i<rows(); ++i ) {
2242  const size_t index( idx(i) );
2243  for( size_t j=0UL; j<jpos; j+=2UL ) {
2244  matrix_(index,j ) = (~rhs)(i,j );
2245  matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
2246  }
2247  if( jpos < (~rhs).columns() ) {
2248  matrix_(index,jpos) = (~rhs)(i,jpos);
2249  }
2250  }
2251  }
2252  else
2253  {
2254  for( size_t ii=0UL; ii<rows(); ii+=block ) {
2255  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
2256  for( size_t jj=0UL; jj<columns(); jj+=block ) {
2257  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
2258  for( size_t i=ii; i<iend; ++i ) {
2259  const size_t index( idx(i) );
2260  for( size_t j=jj; j<jend; ++j ) {
2261  matrix_(index,j) = (~rhs)(i,j);
2262  }
2263  }
2264  }
2265  }
2266  }
2267 }
2269 //*************************************************************************************************
2270 
2271 
2272 //*************************************************************************************************
2284 template< typename MT // Type of the dense matrix
2285  , bool SF // Symmetry flag
2286  , size_t... CRAs > // Compile time row arguments
2287 template< typename MT2 > // Type of the right-hand side sparse matrix
2288 inline void Rows<MT,true,true,SF,CRAs...>::assign( const SparseMatrix<MT2,false>& rhs )
2289 {
2292 
2293  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2294  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2295 
2296  for( size_t i=0UL; i<rows(); ++i ) {
2297  const size_t index( idx(i) );
2298  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2299  matrix_(index,element->index()) = element->value();
2300  }
2301 }
2303 //*************************************************************************************************
2304 
2305 
2306 //*************************************************************************************************
2318 template< typename MT // Type of the dense matrix
2319  , bool SF // Symmetry flag
2320  , size_t... CRAs > // Compile time row arguments
2321 template< typename MT2 > // Type of the right-hand side sparse matrix
2322 inline void Rows<MT,true,true,SF,CRAs...>::assign( const SparseMatrix<MT2,true>& rhs )
2323 {
2326 
2328 
2329  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2330  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2331 
2332  for( size_t j=0UL; j<columns(); ++j ) {
2333  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2334  matrix_(idx(element->index()),j) = element->value();
2335  }
2336 }
2338 //*************************************************************************************************
2339 
2340 
2341 //*************************************************************************************************
2353 template< typename MT // Type of the dense matrix
2354  , bool SF // Symmetry flag
2355  , size_t... CRAs > // Compile time row arguments
2356 template< typename MT2 > // Type of the right-hand side dense matrix
2357 inline DisableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >
2358  Rows<MT,true,true,SF,CRAs...>::addAssign( const DenseMatrix<MT2,false>& rhs )
2359 {
2362 
2363  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2364  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2365 
2366  const size_t jpos( columns() & size_t(-2) );
2367  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
2368 
2369  for( size_t i=0UL; i<rows(); ++i )
2370  {
2371  const size_t index( idx(i) );
2372  if( IsDiagonal<MT2>::value ) {
2373  matrix_(index,i) += (~rhs)(i,i);
2374  }
2375  else {
2376  for( size_t j=0UL; j<jpos; j+=2UL ) {
2377  matrix_(index,j ) += (~rhs)(i,j );
2378  matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
2379  }
2380  if( jpos < columns() ) {
2381  matrix_(index,jpos) += (~rhs)(i,jpos);
2382  }
2383  }
2384  }
2385 }
2387 //*************************************************************************************************
2388 
2389 
2390 //*************************************************************************************************
2402 template< typename MT // Type of the dense matrix
2403  , bool SF // Symmetry flag
2404  , size_t... CRAs > // Compile time row arguments
2405 template< typename MT2 > // Type of the right-hand side dense matrix
2406 inline EnableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >
2407  Rows<MT,true,true,SF,CRAs...>::addAssign( const DenseMatrix<MT2,false>& rhs )
2408 {
2411 
2413 
2414  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2415  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2416 
2417  for( size_t i=0UL; i<rows(); ++i )
2418  {
2419  const size_t jbegin( ( IsUpper<MT2>::value )
2420  ?( ( IsStrictlyUpper<MT2>::value ? i+1UL : i ) & size_t(-SIMDSIZE) )
2421  :( 0UL ) );
2422  const size_t jend ( ( IsLower<MT2>::value )
2423  ?( IsStrictlyLower<MT2>::value ? i : i+1UL )
2424  :( columns() ) );
2425  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2426 
2427  const size_t jpos( jend & size_t(-SIMDSIZE) );
2428  BLAZE_INTERNAL_ASSERT( ( jend - ( jend % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2429 
2430  size_t j( jbegin );
2431  Iterator left( begin(i) + jbegin );
2432  ConstIterator_<MT2> right( (~rhs).begin(i) + jbegin );
2433 
2434  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2435  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2436  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2437  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2438  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2439  }
2440  for( ; j<jpos; j+=SIMDSIZE ) {
2441  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2442  }
2443  for( ; j<jend; ++j ) {
2444  *left += *right; ++left; ++right;
2445  }
2446  }
2447 }
2449 //*************************************************************************************************
2450 
2451 
2452 //*************************************************************************************************
2464 template< typename MT // Type of the dense matrix
2465  , bool SF // Symmetry flag
2466  , size_t... CRAs > // Compile time row arguments
2467 template< typename MT2 > // Type of the right-hand side dense matrix
2468 inline void Rows<MT,true,true,SF,CRAs...>::addAssign( const DenseMatrix<MT2,true>& rhs )
2469 {
2472 
2474 
2475  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2476  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2477 
2478  constexpr size_t block( BLOCK_SIZE );
2479 
2480  if( rows() < block && columns() < block )
2481  {
2482  const size_t jpos( (~rhs).columns() & size_t(-2) );
2483  for( size_t i=0UL; i<rows(); ++i ) {
2484  const size_t index( idx(i) );
2485  for( size_t j=0UL; j<jpos; j+=2UL ) {
2486  matrix_(index,j ) += (~rhs)(i,j );
2487  matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
2488  }
2489  if( jpos < (~rhs).columns() ) {
2490  matrix_(index,jpos) += (~rhs)(i,jpos);
2491  }
2492  }
2493  }
2494  else
2495  {
2496  for( size_t ii=0UL; ii<rows(); ii+=block ) {
2497  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
2498  for( size_t jj=0UL; jj<columns(); jj+=block ) {
2499  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
2500  for( size_t i=ii; i<iend; ++i ) {
2501  const size_t index( idx(i) );
2502  for( size_t j=jj; j<jend; ++j ) {
2503  matrix_(index,j) += (~rhs)(i,j);
2504  }
2505  }
2506  }
2507  }
2508  }
2509 }
2511 //*************************************************************************************************
2512 
2513 
2514 //*************************************************************************************************
2526 template< typename MT // Type of the dense matrix
2527  , bool SF // Symmetry flag
2528  , size_t... CRAs > // Compile time row arguments
2529 template< typename MT2 > // Type of the right-hand side sparse matrix
2530 inline void Rows<MT,true,true,SF,CRAs...>::addAssign( const SparseMatrix<MT2,false>& rhs )
2531 {
2534 
2535  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2536  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2537 
2538  for( size_t i=0UL; i<rows(); ++i ) {
2539  const size_t index( idx(i) );
2540  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2541  matrix_(index,element->index()) += element->value();
2542  }
2543 }
2545 //*************************************************************************************************
2546 
2547 
2548 //*************************************************************************************************
2560 template< typename MT // Type of the dense matrix
2561  , bool SF // Symmetry flag
2562  , size_t... CRAs > // Compile time row arguments
2563 template< typename MT2 > // Type of the right-hand side sparse matrix
2564 inline void Rows<MT,true,true,SF,CRAs...>::addAssign( const SparseMatrix<MT2,true>& rhs )
2565 {
2568 
2570 
2571  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2572  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2573 
2574  for( size_t j=0UL; j<columns(); ++j ) {
2575  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2576  matrix_(idx(element->index()),j) += element->value();
2577  }
2578 }
2580 //*************************************************************************************************
2581 
2582 
2583 //*************************************************************************************************
2595 template< typename MT // Type of the dense matrix
2596  , bool SF // Symmetry flag
2597  , size_t... CRAs > // Compile time row arguments
2598 template< typename MT2 > // Type of the right-hand side dense matrix
2599 inline DisableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >
2600  Rows<MT,true,true,SF,CRAs...>::subAssign( const DenseMatrix<MT2,false>& rhs )
2601 {
2604 
2605  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2606  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2607 
2608  const size_t jpos( columns() & size_t(-2) );
2609  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
2610 
2611  for( size_t i=0UL; i<rows(); ++i )
2612  {
2613  const size_t index( idx(i) );
2614 
2615  if( IsDiagonal<MT2>::value ) {
2616  matrix_(index,i) -= (~rhs)(i,i);
2617  }
2618  else {
2619  for( size_t j=0UL; j<jpos; j+=2UL ) {
2620  matrix_(index,j ) -= (~rhs)(i,j );
2621  matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
2622  }
2623  if( jpos < columns() ) {
2624  matrix_(index,jpos) -= (~rhs)(i,jpos);
2625  }
2626  }
2627  }
2628 }
2630 //*************************************************************************************************
2631 
2632 
2633 //*************************************************************************************************
2645 template< typename MT // Type of the dense matrix
2646  , bool SF // Symmetry flag
2647  , size_t... CRAs > // Compile time row arguments
2648 template< typename MT2 > // Type of the right-hand side dense matrix
2649 inline EnableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >
2650  Rows<MT,true,true,SF,CRAs...>::subAssign( const DenseMatrix<MT2,false>& rhs )
2651 {
2654 
2656 
2657  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2658  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2659 
2660  for( size_t i=0UL; i<rows(); ++i )
2661  {
2662  const size_t jbegin( ( IsUpper<MT2>::value )
2663  ?( ( IsStrictlyUpper<MT2>::value ? i+1UL : i ) & size_t(-SIMDSIZE) )
2664  :( 0UL ) );
2665  const size_t jend ( ( IsLower<MT2>::value )
2666  ?( IsStrictlyLower<MT2>::value ? i : i+1UL )
2667  :( columns() ) );
2668  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2669 
2670  const size_t jpos( jend & size_t(-SIMDSIZE) );
2671  BLAZE_INTERNAL_ASSERT( ( jend - ( jend % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2672 
2673  size_t j( jbegin );
2674  Iterator left( begin(i) + jbegin );
2675  ConstIterator_<MT2> right( (~rhs).begin(i) + jbegin );
2676 
2677  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2678  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2679  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2680  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2681  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2682  }
2683  for( ; j<jpos; j+=SIMDSIZE ) {
2684  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2685  }
2686  for( ; j<jend; ++j ) {
2687  *left -= *right; ++left; ++right;
2688  }
2689  }
2690 }
2692 //*************************************************************************************************
2693 
2694 
2695 //*************************************************************************************************
2707 template< typename MT // Type of the dense matrix
2708  , bool SF // Symmetry flag
2709  , size_t... CRAs > // Compile time row arguments
2710 template< typename MT2 > // Type of the right-hand side dense matrix
2711 inline void Rows<MT,true,true,SF,CRAs...>::subAssign( const DenseMatrix<MT2,true>& rhs )
2712 {
2715 
2717 
2718  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2719  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2720 
2721  constexpr size_t block( BLOCK_SIZE );
2722 
2723  if( rows() < block && columns() < block )
2724  {
2725  const size_t jpos( (~rhs).columns() & size_t(-2) );
2726  for( size_t i=0UL; i<rows(); ++i ) {
2727  const size_t index( idx(i) );
2728  for( size_t j=0UL; j<jpos; j+=2UL ) {
2729  matrix_(index,j ) -= (~rhs)(i,j );
2730  matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
2731  }
2732  if( jpos < (~rhs).columns() ) {
2733  matrix_(index,jpos) -= (~rhs)(i,jpos);
2734  }
2735  }
2736  }
2737  else
2738  {
2739  for( size_t ii=0UL; ii<rows(); ii+=block ) {
2740  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
2741  for( size_t jj=0UL; jj<columns(); jj+=block ) {
2742  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
2743  for( size_t i=ii; i<iend; ++i ) {
2744  const size_t index( idx(i) );
2745  for( size_t j=jj; j<jend; ++j ) {
2746  matrix_(index,j) -= (~rhs)(i,j);
2747  }
2748  }
2749  }
2750  }
2751  }
2752 }
2754 //*************************************************************************************************
2755 
2756 
2757 //*************************************************************************************************
2769 template< typename MT // Type of the dense matrix
2770  , bool SF // Symmetry flag
2771  , size_t... CRAs > // Compile time row arguments
2772 template< typename MT2 > // Type of the right-hand side sparse matrix
2773 inline void Rows<MT,true,true,SF,CRAs...>::subAssign( const SparseMatrix<MT2,false>& rhs )
2774 {
2777 
2778  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2779  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2780 
2781  for( size_t i=0UL; i<rows(); ++i ) {
2782  const size_t index( idx(i) );
2783  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2784  matrix_(index,element->index()) -= element->value();
2785  }
2786 }
2788 //*************************************************************************************************
2789 
2790 
2791 //*************************************************************************************************
2803 template< typename MT // Type of the dense matrix
2804  , bool SF // Symmetry flag
2805  , size_t... CRAs > // Compile time row arguments
2806 template< typename MT2 > // Type of the right-hand side sparse matrix
2807 inline void Rows<MT,true,true,SF,CRAs...>::subAssign( const SparseMatrix<MT2,true>& rhs )
2808 {
2811 
2813 
2814  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2815  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2816 
2817  for( size_t j=0UL; j<columns(); ++j ) {
2818  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2819  matrix_(idx(element->index()),j) -= element->value();
2820  }
2821 }
2823 //*************************************************************************************************
2824 
2825 
2826 //*************************************************************************************************
2838 template< typename MT // Type of the dense matrix
2839  , bool SF // Symmetry flag
2840  , size_t... CRAs > // Compile time row arguments
2841 template< typename MT2 > // Type of the right-hand side dense matrix
2842 inline DisableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedSchurAssign<MT2> >
2843  Rows<MT,true,true,SF,CRAs...>::schurAssign( const DenseMatrix<MT2,false>& rhs )
2844 {
2847 
2848  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2849  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2850 
2851  const size_t jpos( columns() & size_t(-2) );
2852  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
2853 
2854  for( size_t i=0UL; i<rows(); ++i ) {
2855  const size_t index( idx(i) );
2856  for( size_t j=0UL; j<jpos; j+=2UL ) {
2857  matrix_(index,j ) *= (~rhs)(i,j );
2858  matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
2859  }
2860  if( jpos < columns() ) {
2861  matrix_(index,jpos) *= (~rhs)(i,jpos);
2862  }
2863  }
2864 }
2866 //*************************************************************************************************
2867 
2868 
2869 //*************************************************************************************************
2881 template< typename MT // Type of the dense matrix
2882  , bool SF // Symmetry flag
2883  , size_t... CRAs > // Compile time row arguments
2884 template< typename MT2 > // Type of the right-hand side dense matrix
2885 inline EnableIf_< typename Rows<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedSchurAssign<MT2> >
2886  Rows<MT,true,true,SF,CRAs...>::schurAssign( const DenseMatrix<MT2,false>& rhs )
2887 {
2890 
2892 
2893  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2894  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2895 
2896  for( size_t i=0UL; i<rows(); ++i )
2897  {
2898  const size_t jpos( columns() & size_t(-SIMDSIZE) );
2899  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2900 
2901  size_t j( 0UL );
2902  Iterator left( begin(i) );
2903  ConstIterator_<MT2> right( (~rhs).begin(i) );
2904 
2905  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2906  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2907  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2908  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2909  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2910  }
2911  for( ; j<jpos; j+=SIMDSIZE ) {
2912  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2913  }
2914  for( ; j<columns(); ++j ) {
2915  *left *= *right; ++left; ++right;
2916  }
2917  }
2918 }
2920 //*************************************************************************************************
2921 
2922 
2923 //*************************************************************************************************
2935 template< typename MT // Type of the dense matrix
2936  , bool SF // Symmetry flag
2937  , size_t... CRAs > // Compile time row arguments
2938 template< typename MT2 > // Type of the right-hand side dense matrix
2939 inline void Rows<MT,true,true,SF,CRAs...>::schurAssign( const DenseMatrix<MT2,true>& rhs )
2940 {
2943 
2945 
2946  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2947  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2948 
2949  constexpr size_t block( BLOCK_SIZE );
2950 
2951  if( rows() < block && columns() < block )
2952  {
2953  const size_t jpos( (~rhs).columns() & size_t(-2) );
2954  for( size_t i=0UL; i<rows(); ++i ) {
2955  const size_t index( idx(i) );
2956  for( size_t j=0UL; j<jpos; j+=2UL ) {
2957  matrix_(index,j ) *= (~rhs)(i,j );
2958  matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
2959  }
2960  if( jpos < (~rhs).columns() ) {
2961  matrix_(index,jpos) *= (~rhs)(i,jpos);
2962  }
2963  }
2964  }
2965  else
2966  {
2967  for( size_t ii=0UL; ii<rows(); ii+=block ) {
2968  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
2969  for( size_t jj=0UL; jj<columns(); jj+=block ) {
2970  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
2971  for( size_t i=ii; i<iend; ++i ) {
2972  const size_t index( idx(i) );
2973  for( size_t j=jj; j<jend; ++j ) {
2974  matrix_(index,j) *= (~rhs)(i,j);
2975  }
2976  }
2977  }
2978  }
2979  }
2980 }
2982 //*************************************************************************************************
2983 
2984 
2985 //*************************************************************************************************
2997 template< typename MT // Type of the dense matrix
2998  , bool SF // Symmetry flag
2999  , size_t... CRAs > // Compile time row arguments
3000 template< typename MT2 > // Type of the right-hand side sparse matrix
3001 inline void Rows<MT,true,true,SF,CRAs...>::schurAssign( const SparseMatrix<MT2,false>& rhs )
3002 {
3005 
3006  using blaze::reset;
3007 
3008  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
3009  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
3010 
3011  for( size_t i=0UL; i<rows(); ++i )
3012  {
3013  const size_t index( idx(i) );
3014  size_t j( 0UL );
3015 
3016  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
3017  for( ; j<element->index(); ++j )
3018  reset( matrix_(index,j) );
3019  matrix_(index,j) *= element->value();
3020  ++j;
3021  }
3022 
3023  for( ; j<columns(); ++j ) {
3024  reset( matrix_(index,j) );
3025  }
3026  }
3027 }
3029 //*************************************************************************************************
3030 
3031 
3032 //*************************************************************************************************
3044 template< typename MT // Type of the dense matrix
3045  , bool SF // Symmetry flag
3046  , size_t... CRAs > // Compile time row arguments
3047 template< typename MT2 > // Type of the right-hand side sparse matrix
3048 inline void Rows<MT,true,true,SF,CRAs...>::schurAssign( const SparseMatrix<MT2,true>& rhs )
3049 {
3052 
3053  using blaze::reset;
3054 
3056 
3057  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
3058  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
3059 
3060  for( size_t j=0UL; j<columns(); ++j )
3061  {
3062  size_t i( 0UL );
3063 
3064  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
3065  for( ; i<element->index(); ++i )
3066  reset( matrix_(idx(i),j) );
3067  matrix_(idx(i),j) *= element->value();
3068  ++i;
3069  }
3070 
3071  for( ; i<rows(); ++i ) {
3072  reset( matrix_(idx(i),j) );
3073  }
3074  }
3075 }
3077 //*************************************************************************************************
3078 
3079 
3080 
3081 
3082 
3083 
3084 
3085 
3086 //=================================================================================================
3087 //
3088 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR DENSE MATRICES
3089 //
3090 //=================================================================================================
3091 
3092 //*************************************************************************************************
3100 template< typename MT // Type of the dense matrix
3101  , size_t... CRAs > // Compile time row arguments
3102 class Rows<MT,false,true,false,CRAs...>
3103  : public View< DenseMatrix< Rows<MT,false,true,false,CRAs...>, false > >
3104  , private RowsData<CRAs...>
3105 {
3106  private:
3107  //**Type definitions****************************************************************************
3108  using DataType = RowsData<CRAs...>;
3109  using Operand = If_< IsExpression<MT>, MT, MT& >;
3110  //**********************************************************************************************
3111 
3112  public:
3113  //**Type definitions****************************************************************************
3115  using This = Rows<MT,false,true,false,CRAs...>;
3116 
3117  using BaseType = DenseMatrix<This,false>;
3118  using ViewedType = MT;
3119  using ResultType = RowsTrait_<MT,CRAs...>;
3120  using OppositeType = OppositeType_<ResultType>;
3121  using TransposeType = TransposeType_<ResultType>;
3122  using ElementType = ElementType_<MT>;
3123  using ReturnType = ReturnType_<MT>;
3124  using CompositeType = const Rows&;
3125 
3127  using ConstReference = ConstReference_<MT>;
3128 
3130  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
3131 
3133  using ConstPointer = ConstPointer_<MT>;
3134 
3136  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
3137  //**********************************************************************************************
3138 
3139  //**RowsIterator class definition***************************************************************
3142  template< typename MatrixType // Type of the dense matrix
3143  , typename IteratorType > // Type of the dense matrix iterator
3144  class RowsIterator
3145  {
3146  public:
3147  //**Type definitions*************************************************************************
3149  using IteratorCategory = typename std::iterator_traits<IteratorType>::iterator_category;
3150 
3152  using ValueType = typename std::iterator_traits<IteratorType>::value_type;
3153 
3155  using PointerType = typename std::iterator_traits<IteratorType>::pointer;
3156 
3158  using ReferenceType = typename std::iterator_traits<IteratorType>::reference;
3159 
3161  using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
3162 
3163  // STL iterator requirements
3164  using iterator_category = IteratorCategory;
3165  using value_type = ValueType;
3166  using pointer = PointerType;
3167  using reference = ReferenceType;
3168  using difference_type = DifferenceType;
3169  //*******************************************************************************************
3170 
3171  //**Constructor******************************************************************************
3174  inline RowsIterator() noexcept
3175  : matrix_( nullptr ) // The dense matrix containing the row
3176  , row_ ( 0UL ) // The current row index
3177  , column_( 0UL ) // The current column index
3178  , pos_ ( ) // Iterator to the current dense element
3179  {}
3180  //*******************************************************************************************
3181 
3182  //**Constructor******************************************************************************
3189  inline RowsIterator( MatrixType& matrix, size_t row, size_t column ) noexcept
3190  : matrix_( &matrix ) // The dense matrix containing the selected row
3191  , row_ ( row ) // The current row index
3192  , column_( column ) // The current column index
3193  , pos_ ( ) // Iterator to the current dense element
3194  {
3195  if( column_ != matrix_->columns() )
3196  pos_ = matrix_->begin( column_ ) + row_;
3197  }
3198  //*******************************************************************************************
3199 
3200  //**Constructor******************************************************************************
3205  template< typename MatrixType2, typename IteratorType2 >
3206  inline RowsIterator( const RowsIterator<MatrixType2,IteratorType2>& it ) noexcept
3207  : matrix_( it.matrix_ ) // The dense matrix containing the seleted row
3208  , row_ ( it.row_ ) // The current row index
3209  , column_( it.column_ ) // The current column index
3210  , pos_ ( it.pos_ ) // Iterator to the current dense element
3211  {}
3212  //*******************************************************************************************
3213 
3214  //**Addition assignment operator*************************************************************
3220  inline RowsIterator& operator+=( size_t inc ) noexcept {
3221  using blaze::reset;
3222  column_ += inc;
3223  if( column_ != matrix_->columns() )
3224  pos_ = matrix_->begin( column_ ) + row_;
3225  else reset( pos_ );
3226  return *this;
3227  }
3228  //*******************************************************************************************
3229 
3230  //**Subtraction assignment operator**********************************************************
3236  inline RowsIterator& operator-=( size_t dec ) noexcept {
3237  using blaze::reset;
3238  column_ -= dec;
3239  if( column_ != matrix_->columns() )
3240  pos_ = matrix_->begin( column_ ) + row_;
3241  else reset( pos_ );
3242  return *this;
3243  }
3244  //*******************************************************************************************
3245 
3246  //**Prefix increment operator****************************************************************
3251  inline RowsIterator& operator++() noexcept {
3252  using blaze::reset;
3253  ++column_;
3254  if( column_ != matrix_->columns() )
3255  pos_ = matrix_->begin( column_ ) + row_;
3256  else reset( pos_ );
3257  return *this;
3258  }
3259  //*******************************************************************************************
3260 
3261  //**Postfix increment operator***************************************************************
3266  inline const RowsIterator operator++( int ) noexcept {
3267  const RowsIterator tmp( *this );
3268  ++(*this);
3269  return tmp;
3270  }
3271  //*******************************************************************************************
3272 
3273  //**Prefix decrement operator****************************************************************
3278  inline RowsIterator& operator--() noexcept {
3279  using blaze::reset;
3280  --column_;
3281  if( column_ != matrix_->columns() )
3282  pos_ = matrix_->begin( column_ ) + row_;
3283  else reset( pos_ );
3284  return *this;
3285  }
3286  //*******************************************************************************************
3287 
3288  //**Postfix decrement operator***************************************************************
3293  inline const RowsIterator operator--( int ) noexcept {
3294  const RowsIterator tmp( *this );
3295  --(*this);
3296  return tmp;
3297  }
3298  //*******************************************************************************************
3299 
3300  //**Subscript operator***********************************************************************
3306  inline ReferenceType operator[]( size_t index ) const {
3307  BLAZE_USER_ASSERT( column_+index < matrix_->columns(), "Invalid access index detected" );
3308  const IteratorType pos( matrix_->begin( column_+index ) + row_ );
3309  return *pos;
3310  }
3311  //*******************************************************************************************
3312 
3313  //**Element access operator******************************************************************
3318  inline ReferenceType operator*() const {
3319  return *pos_;
3320  }
3321  //*******************************************************************************************
3322 
3323  //**Element access operator******************************************************************
3328  inline PointerType operator->() const {
3329  return pos_;
3330  }
3331  //*******************************************************************************************
3332 
3333  //**Equality operator************************************************************************
3339  template< typename MatrixType2, typename IteratorType2 >
3340  inline bool operator==( const RowsIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
3341  return column_ == rhs.column_;
3342  }
3343  //*******************************************************************************************
3344 
3345  //**Inequality operator**********************************************************************
3351  template< typename MatrixType2, typename IteratorType2 >
3352  inline bool operator!=( const RowsIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
3353  return !( *this == rhs );
3354  }
3355  //*******************************************************************************************
3356 
3357  //**Less-than operator***********************************************************************
3363  template< typename MatrixType2, typename IteratorType2 >
3364  inline bool operator<( const RowsIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
3365  return column_ < rhs.column_;
3366  }
3367  //*******************************************************************************************
3368 
3369  //**Greater-than operator********************************************************************
3375  template< typename MatrixType2, typename IteratorType2 >
3376  inline bool operator>( const RowsIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
3377  return column_ > rhs.column_;
3378  }
3379  //*******************************************************************************************
3380 
3381  //**Less-or-equal-than operator**************************************************************
3387  template< typename MatrixType2, typename IteratorType2 >
3388  inline bool operator<=( const RowsIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
3389  return column_ <= rhs.column_;
3390  }
3391  //*******************************************************************************************
3392 
3393  //**Greater-or-equal-than operator***********************************************************
3399  template< typename MatrixType2, typename IteratorType2 >
3400  inline bool operator>=( const RowsIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
3401  return column_ >= rhs.column_;
3402  }
3403  //*******************************************************************************************
3404 
3405  //**Subtraction operator*********************************************************************
3411  inline DifferenceType operator-( const RowsIterator& rhs ) const noexcept {
3412  return column_ - rhs.column_;
3413  }
3414  //*******************************************************************************************
3415 
3416  //**Addition operator************************************************************************
3423  friend inline const RowsIterator operator+( const RowsIterator& it, size_t inc ) noexcept {
3424  return RowsIterator( *it.matrix_, it.row_, it.column_+inc );
3425  }
3426  //*******************************************************************************************
3427 
3428  //**Addition operator************************************************************************
3435  friend inline const RowsIterator operator+( size_t inc, const RowsIterator& it ) noexcept {
3436  return RowsIterator( *it.matrix_, it.row_, it.column_+inc );
3437  }
3438  //*******************************************************************************************
3439 
3440  //**Subtraction operator*********************************************************************
3447  friend inline const RowsIterator operator-( const RowsIterator& it, size_t dec ) noexcept {
3448  return RowsIterator( *it.matrix_, it.row_, it.column_-dec );
3449  }
3450  //*******************************************************************************************
3451 
3452  private:
3453  //**Member variables*************************************************************************
3454  MatrixType* matrix_;
3455  size_t row_;
3456  size_t column_;
3457  IteratorType pos_;
3458  //*******************************************************************************************
3459 
3460  //**Friend declarations**********************************************************************
3461  template< typename MatrixType2, typename IteratorType2 > friend class RowsIterator;
3462  //*******************************************************************************************
3463  };
3464  //**********************************************************************************************
3465 
3466  //**Type definitions****************************************************************************
3468  using ConstIterator = RowsIterator< const MT, ConstIterator_<MT> >;
3469 
3471  using Iterator = If_< IsConst<MT>, ConstIterator, RowsIterator< MT, Iterator_<MT> > >;
3472  //**********************************************************************************************
3473 
3474  //**Compilation flags***************************************************************************
3476  enum : bool { simdEnabled = false };
3477 
3479  enum : bool { smpAssignable = MT::smpAssignable };
3480  //**********************************************************************************************
3481 
3482  //**Constructors********************************************************************************
3485  template< typename... RRAs >
3486  explicit inline Rows( MT& matrix, RRAs... args );
3487 
3488  inline Rows( const Rows& ) = default;
3489  inline Rows( Rows&& ) = default;
3491  //**********************************************************************************************
3492 
3493  //**Destructor**********************************************************************************
3494  // No explicitly declared destructor.
3495  //**********************************************************************************************
3496 
3497  //**Data access functions***********************************************************************
3500  inline Reference operator()( size_t i, size_t j );
3501  inline ConstReference operator()( size_t i, size_t j ) const;
3502  inline Reference at( size_t i, size_t j );
3503  inline ConstReference at( size_t i, size_t j ) const;
3504  inline Pointer data () noexcept;
3505  inline ConstPointer data () const noexcept;
3506  inline Pointer data ( size_t i ) noexcept;
3507  inline ConstPointer data ( size_t i ) const noexcept;
3508  inline Iterator begin ( size_t i );
3509  inline ConstIterator begin ( size_t i ) const;
3510  inline ConstIterator cbegin( size_t i ) const;
3511  inline Iterator end ( size_t i );
3512  inline ConstIterator end ( size_t i ) const;
3513  inline ConstIterator cend ( size_t i ) const;
3515  //**********************************************************************************************
3516 
3517  //**Assignment operators************************************************************************
3520  inline Rows& operator=( const ElementType& rhs );
3521  inline Rows& operator=( initializer_list< initializer_list<ElementType> > list );
3522  inline Rows& operator=( const Rows& rhs );
3523 
3524  template< typename MT2, bool SO2 >
3525  inline Rows& operator=( const Matrix<MT2,SO2>& rhs );
3526 
3527  template< typename MT2, bool SO2 >
3528  inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
3529  operator+=( const Matrix<MT2,SO2>& rhs );
3530 
3531  template< typename MT2, bool SO2 >
3532  inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
3533  operator+=( const Matrix<MT2,SO2>& rhs );
3534 
3535  template< typename MT2, bool SO2 >
3536  inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
3537  operator-=( const Matrix<MT2,SO2>& rhs );
3538 
3539  template< typename MT2, bool SO2 >
3540  inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
3541  operator-=( const Matrix<MT2,SO2>& rhs );
3542 
3543  template< typename MT2, bool SO2 >
3544  inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
3545  operator%=( const Matrix<MT2,SO2>& rhs );
3546 
3547  template< typename MT2, bool SO2 >
3548  inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows& >
3549  operator%=( const Matrix<MT2,SO2>& rhs );
3551  //**********************************************************************************************
3552 
3553  //**Utility functions***************************************************************************
3556  using DataType::idx;
3557  using DataType::idces;
3558  using DataType::rows;
3559 
3560  inline MT& operand() noexcept;
3561  inline const MT& operand() const noexcept;
3562 
3563  inline size_t columns() const noexcept;
3564  inline size_t spacing() const noexcept;
3565  inline size_t capacity() const noexcept;
3566  inline size_t capacity( size_t i ) const noexcept;
3567  inline size_t nonZeros() const;
3568  inline size_t nonZeros( size_t i ) const;
3569  inline void reset();
3570  inline void reset( size_t i );
3572  //**********************************************************************************************
3573 
3574  //**Numeric functions***************************************************************************
3577  inline Rows& transpose();
3578  inline Rows& ctranspose();
3579 
3580  template< typename Other > inline Rows& scale( const Other& scalar );
3582  //**********************************************************************************************
3583 
3584  //**Expression template evaluation functions****************************************************
3587  template< typename Other >
3588  inline bool canAlias( const Other* alias ) const noexcept;
3589 
3590  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
3591  inline bool canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
3592 
3593  template< typename Other >
3594  inline bool isAliased( const Other* alias ) const noexcept;
3595 
3596  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
3597  inline bool isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
3598 
3599  inline bool isAligned () const noexcept;
3600  inline bool canSMPAssign() const noexcept;
3601 
3602  template< typename MT2 > inline void assign( const DenseMatrix<MT2,false>& rhs );
3603  template< typename MT2 > inline void assign( const DenseMatrix<MT2,true>& rhs );
3604  template< typename MT2 > inline void assign( const SparseMatrix<MT2,false>& rhs );
3605  template< typename MT2 > inline void assign( const SparseMatrix<MT2,true>& rhs );
3606 
3607  template< typename MT2 > inline void addAssign( const DenseMatrix<MT2,false>& rhs );
3608  template< typename MT2 > inline void addAssign( const DenseMatrix<MT2,true>& rhs );
3609  template< typename MT2 > inline void addAssign( const SparseMatrix<MT2,false>& rhs );
3610  template< typename MT2 > inline void addAssign( const SparseMatrix<MT2,true>& rhs );
3611 
3612  template< typename MT2 > inline void subAssign( const DenseMatrix<MT2,false>& rhs );
3613  template< typename MT2 > inline void subAssign( const DenseMatrix<MT2,true>& rhs );
3614  template< typename MT2 > inline void subAssign( const SparseMatrix<MT2,false>& rhs );
3615  template< typename MT2 > inline void subAssign( const SparseMatrix<MT2,true>& rhs );
3616 
3617  template< typename MT2 > inline void schurAssign( const DenseMatrix<MT2,false>& rhs );
3618  template< typename MT2 > inline void schurAssign( const DenseMatrix<MT2,true>& rhs );
3619  template< typename MT2 > inline void schurAssign( const SparseMatrix<MT2,false>& rhs );
3620  template< typename MT2 > inline void schurAssign( const SparseMatrix<MT2,true>& rhs );
3622  //**********************************************************************************************
3623 
3624  private:
3625  //**Member variables****************************************************************************
3628  Operand matrix_;
3629 
3630  //**********************************************************************************************
3631 
3632  //**Friend declarations*************************************************************************
3633  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Rows;
3634  //**********************************************************************************************
3635 
3636  //**Compile time checks*************************************************************************
3646  //**********************************************************************************************
3647 };
3649 //*************************************************************************************************
3650 
3651 
3652 
3653 
3654 //=================================================================================================
3655 //
3656 // CONSTRUCTORS
3657 //
3658 //=================================================================================================
3659 
3660 //*************************************************************************************************
3673 template< typename MT // Type of the dense matrix
3674  , size_t... CRAs > // Compile time row arguments
3675 template< typename... RRAs > // Runtime row arguments
3676 inline Rows<MT,false,true,false,CRAs...>::Rows( MT& matrix, RRAs... args )
3677  : DataType( args... ) // Base class initialization
3678  , matrix_ ( matrix ) // The matrix containing the rows
3679 {
3680  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
3681  for( size_t i=0UL; i<rows(); ++i ) {
3682  if( matrix_.rows() <= idx(i) ) {
3683  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
3684  }
3685  }
3686  }
3687 }
3689 //*************************************************************************************************
3690 
3691 
3692 
3693 
3694 //=================================================================================================
3695 //
3696 // DATA ACCESS FUNCTIONS
3697 //
3698 //=================================================================================================
3699 
3700 //*************************************************************************************************
3711 template< typename MT // Type of the dense matrix
3712  , size_t... CRAs > // Compile time row arguments
3713 inline typename Rows<MT,false,true,false,CRAs...>::Reference
3714  Rows<MT,false,true,false,CRAs...>::operator()( size_t i, size_t j )
3715 {
3716  BLAZE_USER_ASSERT( i < rows() , "Invalid row access index" );
3717  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
3718 
3719  return matrix_(idx(i),j);
3720 }
3722 //*************************************************************************************************
3723 
3724 
3725 //*************************************************************************************************
3736 template< typename MT // Type of the dense matrix
3737  , size_t... CRAs > // Compile time row arguments
3738 inline typename Rows<MT,false,true,false,CRAs...>::ConstReference
3739  Rows<MT,false,true,false,CRAs...>::operator()( size_t i, size_t j ) const
3740 {
3741  BLAZE_USER_ASSERT( i < rows() , "Invalid row access index" );
3742  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
3743 
3744  return const_cast<const MT&>( matrix_ )(idx(i),j);
3745 }
3747 //*************************************************************************************************
3748 
3749 
3750 //*************************************************************************************************
3762 template< typename MT // Type of the dense matrix
3763  , size_t... CRAs > // Compile time row arguments
3764 inline typename Rows<MT,false,true,false,CRAs...>::Reference
3765  Rows<MT,false,true,false,CRAs...>::at( size_t i, size_t j )
3766 {
3767  if( i >= rows() ) {
3768  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
3769  }
3770  if( j >= columns() ) {
3771  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
3772  }
3773  return (*this)(i,j);
3774 }
3776 //*************************************************************************************************
3777 
3778 
3779 //*************************************************************************************************
3791 template< typename MT // Type of the dense matrix
3792  , size_t... CRAs > // Compile time row arguments
3793 inline typename Rows<MT,false,true,false,CRAs...>::ConstReference
3794  Rows<MT,false,true,false,CRAs...>::at( size_t i, size_t j ) const
3795 {
3796  if( i >= rows() ) {
3797  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
3798  }
3799  if( j >= columns() ) {
3800  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
3801  }
3802  return (*this)(i,j);
3803 }
3805 //*************************************************************************************************
3806 
3807 
3808 //*************************************************************************************************
3818 template< typename MT // Type of the dense matrix
3819  , size_t... CRAs > // Compile time row arguments
3820 inline typename Rows<MT,false,true,false,CRAs...>::Pointer
3822 {
3823  return matrix_.data() + idx(0UL);
3824 }
3826 //*************************************************************************************************
3827 
3828 
3829 //*************************************************************************************************
3839 template< typename MT // Type of the dense matrix
3840  , size_t... CRAs > // Compile time row arguments
3841 inline typename Rows<MT,false,true,false,CRAs...>::ConstPointer
3843 {
3844  return matrix_.data() + idx(0UL);
3845 }
3847 //*************************************************************************************************
3848 
3849 
3850 //*************************************************************************************************
3859 template< typename MT // Type of the dense matrix
3860  , size_t... CRAs > // Compile time row arguments
3861 inline typename Rows<MT,false,true,false,CRAs...>::Pointer
3862  Rows<MT,false,true,false,CRAs...>::data( size_t i ) noexcept
3863 {
3864  return matrix_.data() + idx(i);
3865 }
3867 //*************************************************************************************************
3868 
3869 
3870 //*************************************************************************************************
3879 template< typename MT // Type of the dense matrix
3880  , size_t... CRAs > // Compile time row arguments
3881 inline typename Rows<MT,false,true,false,CRAs...>::ConstPointer
3882  Rows<MT,false,true,false,CRAs...>::data( size_t i ) const noexcept
3883 {
3884  return matrix_.data() + idx(i);
3885 }
3887 //*************************************************************************************************
3888 
3889 
3890 //*************************************************************************************************
3899 template< typename MT // Type of the dense matrix
3900  , size_t... CRAs > // Compile time row arguments
3901 inline typename Rows<MT,false,true,false,CRAs...>::Iterator
3903 {
3904  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
3905  return Iterator( matrix_, idx(i), 0UL );
3906 }
3908 //*************************************************************************************************
3909 
3910 
3911 //*************************************************************************************************
3920 template< typename MT // Type of the dense matrix
3921  , size_t... CRAs > // Compile time row arguments
3922 inline typename Rows<MT,false,true,false,CRAs...>::ConstIterator
3924 {
3925  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
3926  return ConstIterator( matrix_, idx(i), 0UL );
3927 }
3929 //*************************************************************************************************
3930 
3931 
3932 //*************************************************************************************************
3941 template< typename MT // Type of the dense matrix
3942  , size_t... CRAs > // Compile time row arguments
3943 inline typename Rows<MT,false,true,false,CRAs...>::ConstIterator
3945 {
3946  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
3947  return ConstIterator( matrix_, idx(i), 0UL );
3948 }
3950 //*************************************************************************************************
3951 
3952 
3953 //*************************************************************************************************
3962 template< typename MT // Type of the dense matrix
3963  , size_t... CRAs > // Compile time row arguments
3964 inline typename Rows<MT,false,true,false,CRAs...>::Iterator
3966 {
3967  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
3968  return Iterator( matrix_, idx(i), columns() );
3969 }
3971 //*************************************************************************************************
3972 
3973 
3974 //*************************************************************************************************
3983 template< typename MT // Type of the dense matrix
3984  , size_t... CRAs > // Compile time row arguments
3985 inline typename Rows<MT,false,true,false,CRAs...>::ConstIterator
3986  Rows<MT,false,true,false,CRAs...>::end( size_t i ) const
3987 {
3988  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
3989  return ConstIterator( matrix_, idx(i), columns() );
3990 }
3992 //*************************************************************************************************
3993 
3994 
3995 //*************************************************************************************************
4004 template< typename MT // Type of the dense matrix
4005  , size_t... CRAs > // Compile time row arguments
4006 inline typename Rows<MT,false,true,false,CRAs...>::ConstIterator
4007  Rows<MT,false,true,false,CRAs...>::cend( size_t i ) const
4008 {
4009  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
4010  return ConstIterator( matrix_, idx(i), columns() );
4011 }
4013 //*************************************************************************************************
4014 
4015 
4016 
4017 
4018 //=================================================================================================
4019 //
4020 // ASSIGNMENT OPERATORS
4021 //
4022 //=================================================================================================
4023 
4024 //*************************************************************************************************
4035 template< typename MT // Type of the dense matrix
4036  , size_t... CRAs > // Compile time row arguments
4037 inline Rows<MT,false,true,false,CRAs...>&
4038  Rows<MT,false,true,false,CRAs...>::operator=( const ElementType& rhs )
4039 {
4040  for( size_t i=0UL; i<rows(); ++i ) {
4041  row( matrix_, idx(i), unchecked ) = rhs;
4042  }
4043 
4044  return *this;
4045 }
4047 //*************************************************************************************************
4048 
4049 
4050 //*************************************************************************************************
4066 template< typename MT // Type of the dense matrix
4067  , size_t... CRAs > // Compile time row arguments
4068 inline Rows<MT,false,true,false,CRAs...>&
4069  Rows<MT,false,true,false,CRAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
4070 {
4073 
4074  if( list.size() != rows() ) {
4075  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row selection" );
4076  }
4077 
4078  if( IsRestricted<MT>::value ) {
4079  size_t i( 0UL );
4080  for( const auto& rowList : list ) {
4081  const InitializerVector<ElementType> tmp( rowList, columns() );
4082  if( !tryAssign( row( matrix_, idx(i), unchecked ), tmp, 0UL ) ){
4083  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4084  }
4085  ++i;
4086  }
4087  }
4088 
4089  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4090  size_t i( 0UL );
4091 
4092  for( const auto& rowList : list ) {
4093  std::fill( std::copy( rowList.begin(), rowList.end(), left.begin(i) ), left.end(i), ElementType() );
4094  ++i;
4095  }
4096 
4097  return *this;
4098 }
4100 //*************************************************************************************************
4101 
4102 
4103 //*************************************************************************************************
4118 template< typename MT // Type of the dense matrix
4119  , size_t... CRAs > // Compile time row arguments
4120 inline Rows<MT,false,true,false,CRAs...>&
4121  Rows<MT,false,true,false,CRAs...>::operator=( const Rows& rhs )
4122 {
4125 
4128 
4129  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && idces() == rhs.idces() ) )
4130  return *this;
4131 
4132  if( rows() != rhs.rows() || columns() != rhs.columns() ) {
4133  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4134  }
4135 
4136  if( IsRestricted<MT>::value ) {
4137  for( size_t i=0UL; i<rows(); ++i ) {
4138  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( rhs, i, unchecked ), 0UL ) ) {
4139  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4140  }
4141  }
4142  }
4143 
4144  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4145 
4146  if( rhs.canAlias( &matrix_ ) ) {
4147  const ResultType tmp( rhs );
4148  smpAssign( left, tmp );
4149  }
4150  else {
4151  smpAssign( left, rhs );
4152  }
4153 
4154  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4155 
4156  return *this;
4157 }
4159 //*************************************************************************************************
4160 
4161 
4162 //*************************************************************************************************
4177 template< typename MT // Type of the dense matrix
4178  , size_t... CRAs > // Compile time row arguments
4179 template< typename MT2 // Type of the right-hand side matrix
4180  , bool SO2 > // Storage order of the right-hand side matrix
4181 inline Rows<MT,false,true,false,CRAs...>&
4182  Rows<MT,false,true,false,CRAs...>::operator=( const Matrix<MT2,SO2>& rhs )
4183 {
4186 
4188 
4189  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4190  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4191  }
4192 
4193  using Right = If_< IsRestricted<MT>, CompositeType_<MT2>, const MT2& >;
4194  Right right( ~rhs );
4195 
4196  if( IsRestricted<MT>::value ) {
4197  for( size_t i=0UL; i<rows(); ++i ) {
4198  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( right, i, unchecked ), 0UL ) ) {
4199  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4200  }
4201  }
4202  }
4203 
4204  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4205 
4206  if( IsSparseMatrix<MT2>::value ) {
4207  reset();
4208  }
4209 
4210  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4211  const ResultType_<MT2> tmp( right );
4212  smpAssign( left, tmp );
4213  }
4214  else {
4215  smpAssign( left, right );
4216  }
4217 
4218  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4219 
4220  return *this;
4221 }
4223 //*************************************************************************************************
4224 
4225 
4226 //*************************************************************************************************
4240 template< typename MT // Type of the dense matrix
4241  , size_t... CRAs > // Compile time row arguments
4242 template< typename MT2 // Type of the right-hand side matrix
4243  , bool SO2 > // Storage order of the right-hand side matrix
4244 inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,false,true,false,CRAs...>& >
4245  Rows<MT,false,true,false,CRAs...>::operator+=( const Matrix<MT2,SO2>& rhs )
4246 {
4249 
4253 
4254  using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
4255 
4258 
4259  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4260  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4261  }
4262 
4263  if( IsRestricted<MT>::value ) {
4264  for( size_t i=0UL; i<rows(); ++i ) {
4265  if( !tryAddAssign( row( matrix_, idx(i), unchecked ), row( ~rhs, i, unchecked ), 0UL ) ) {
4266  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4267  }
4268  }
4269  }
4270 
4271  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4272 
4273  if( (~rhs).canAlias( &matrix_ ) ) {
4274  const AddType tmp( *this + (~rhs) );
4275  smpAssign( left, tmp );
4276  }
4277  else {
4278  smpAddAssign( left, ~rhs );
4279  }
4280 
4281  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4282 
4283  return *this;
4284 }
4286 //*************************************************************************************************
4287 
4288 
4289 //*************************************************************************************************
4303 template< typename MT // Type of the dense matrix
4304  , size_t... CRAs > // Compile time row arguments
4305 template< typename MT2 // Type of the right-hand side matrix
4306  , bool SO2 > // Storage order of the right-hand side matrix
4307 inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,false,true,false,CRAs...>& >
4308  Rows<MT,false,true,false,CRAs...>::operator+=( const Matrix<MT2,SO2>& rhs )
4309 {
4312 
4316 
4317  using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
4318 
4321 
4322  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4323  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4324  }
4325 
4326  const AddType tmp( *this + (~rhs) );
4327 
4328  if( IsRestricted<MT>::value ) {
4329  for( size_t i=0UL; i<rows(); ++i ) {
4330  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( tmp, i, unchecked ), 0UL ) ) {
4331  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4332  }
4333  }
4334  }
4335 
4336  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4337 
4338  smpAssign( left, tmp );
4339 
4340  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4341 
4342  return *this;
4343 }
4345 //*************************************************************************************************
4346 
4347 
4348 //*************************************************************************************************
4362 template< typename MT // Type of the dense matrix
4363  , size_t... CRAs > // Compile time row arguments
4364 template< typename MT2 // Type of the right-hand side matrix
4365  , bool SO2 > // Storage order of the right-hand side matrix
4366 inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,false,true,false,CRAs...>& >
4367  Rows<MT,false,true,false,CRAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
4368 {
4371 
4375 
4376  using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
4377 
4380 
4381  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4382  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4383  }
4384 
4385  if( IsRestricted<MT>::value ) {
4386  for( size_t i=0UL; i<rows(); ++i ) {
4387  if( !trySubAssign( row( matrix_, idx(i), unchecked ), row( ~rhs, i, unchecked ), 0UL ) ) {
4388  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4389  }
4390  }
4391  }
4392 
4393  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4394 
4395  if( (~rhs).canAlias( &matrix_ ) ) {
4396  const SubType tmp( *this - (~rhs ) );
4397  smpAssign( left, tmp );
4398  }
4399  else {
4400  smpSubAssign( left, ~rhs );
4401  }
4402 
4403  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4404 
4405  return *this;
4406 }
4408 //*************************************************************************************************
4409 
4410 
4411 //*************************************************************************************************
4425 template< typename MT // Type of the dense matrix
4426  , size_t... CRAs > // Compile time row arguments
4427 template< typename MT2 // Type of the right-hand side matrix
4428  , bool SO2 > // Storage order of the right-hand side matrix
4429 inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,false,true,false,CRAs...>& >
4430  Rows<MT,false,true,false,CRAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
4431 {
4434 
4438 
4439  using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
4440 
4443 
4444  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4445  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4446  }
4447 
4448  const SubType tmp( *this - (~rhs) );
4449 
4450  if( IsRestricted<MT>::value ) {
4451  for( size_t i=0UL; i<rows(); ++i ) {
4452  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( tmp, i, unchecked ), 0UL ) ) {
4453  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4454  }
4455  }
4456  }
4457 
4458  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4459 
4460  smpAssign( left, tmp );
4461 
4462  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4463 
4464  return *this;
4465 }
4467 //*************************************************************************************************
4468 
4469 
4470 //*************************************************************************************************
4484 template< typename MT // Type of the dense matrix
4485  , size_t... CRAs > // Compile time row arguments
4486 template< typename MT2 // Type of the right-hand side matrix
4487  , bool SO2 > // Storage order of the right-hand side matrix
4488 inline DisableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,false,true,false,CRAs...>& >
4489  Rows<MT,false,true,false,CRAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
4490 {
4493 
4497 
4498  using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
4499 
4501 
4502  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4503  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4504  }
4505 
4506  if( IsRestricted<MT>::value ) {
4507  for( size_t i=0UL; i<rows(); ++i ) {
4508  if( !tryMultAssign( row( matrix_, idx(i), unchecked ), row( ~rhs, i, unchecked ), 0UL ) ) {
4509  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4510  }
4511  }
4512  }
4513 
4514  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4515 
4516  if( (~rhs).canAlias( &matrix_ ) ) {
4517  const SchurType tmp( *this % (~rhs) );
4518  if( IsSparseMatrix<SchurType>::value )
4519  reset();
4520  smpAssign( left, tmp );
4521  }
4522  else {
4523  smpSchurAssign( left, ~rhs );
4524  }
4525 
4526  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4527 
4528  return *this;
4529 }
4531 //*************************************************************************************************
4532 
4533 
4534 //*************************************************************************************************
4548 template< typename MT // Type of the dense matrix
4549  , size_t... CRAs > // Compile time row arguments
4550 template< typename MT2 // Type of the right-hand side matrix
4551  , bool SO2 > // Storage order of the right-hand side matrix
4552 inline EnableIf_< And< IsRestricted<MT>, RequiresEvaluation<MT2> >, Rows<MT,false,true,false,CRAs...>& >
4553  Rows<MT,false,true,false,CRAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
4554 {
4557 
4561 
4562  using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
4563 
4565 
4566  if( rows() != (~rhs).rows() || columns() != (~rhs).columns() ) {
4567  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4568  }
4569 
4570  const SchurType tmp( *this % (~rhs) );
4571 
4572  if( IsRestricted<MT>::value ) {
4573  for( size_t i=0UL; i<rows(); ++i ) {
4574  if( !tryAssign( row( matrix_, idx(i), unchecked ), row( tmp, i, unchecked ), 0UL ) ) {
4575  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4576  }
4577  }
4578  }
4579 
4580  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4581 
4582  if( IsSparseMatrix<SchurType>::value ) {
4583  reset();
4584  }
4585 
4586  smpAssign( left, tmp );
4587 
4588  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4589 
4590  return *this;
4591 }
4593 //*************************************************************************************************
4594 
4595 
4596 
4597 
4598 //=================================================================================================
4599 //
4600 // UTILITY FUNCTIONS
4601 //
4602 //=================================================================================================
4603 
4604 //*************************************************************************************************
4610 template< typename MT // Type of the dense matrix
4611  , size_t... CRAs > // Compile time row arguments
4612 inline MT& Rows<MT,false,true,false,CRAs...>::operand() noexcept
4613 {
4614  return matrix_;
4615 }
4617 //*************************************************************************************************
4618 
4619 
4620 //*************************************************************************************************
4626 template< typename MT // Type of the dense matrix
4627  , size_t... CRAs > // Compile time row arguments
4628 inline const MT& Rows<MT,false,true,false,CRAs...>::operand() const noexcept
4629 {
4630  return matrix_;
4631 }
4633 //*************************************************************************************************
4634 
4635 
4636 //*************************************************************************************************
4642 template< typename MT // Type of the dense matrix
4643  , size_t... CRAs > // Compile time row arguments
4644 inline size_t Rows<MT,false,true,false,CRAs...>::columns() const noexcept
4645 {
4646  return matrix_.columns();
4647 }
4649 //*************************************************************************************************
4650 
4651 
4652 //*************************************************************************************************
4661 template< typename MT // Type of the dense matrix
4662  , size_t... CRAs > // Compile time row arguments
4663 inline size_t Rows<MT,false,true,false,CRAs...>::spacing() const noexcept
4664 {
4665  return matrix_.spacing();
4666 }
4668 //*************************************************************************************************
4669 
4670 
4671 //*************************************************************************************************
4677 template< typename MT // Type of the dense matrix
4678  , size_t... CRAs > // Compile time row arguments
4679 inline size_t Rows<MT,false,true,false,CRAs...>::capacity() const noexcept
4680 {
4681  return rows() * columns();
4682 }
4684 //*************************************************************************************************
4685 
4686 
4687 //*************************************************************************************************
4696 template< typename MT // Type of the dense matrix
4697  , size_t... CRAs > // Compile time row arguments
4698 inline size_t Rows<MT,false,true,false,CRAs...>::capacity( size_t i ) const noexcept
4699 {
4700  UNUSED_PARAMETER( i );
4701 
4702  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
4703 
4704  return columns();
4705 }
4707 //*************************************************************************************************
4708 
4709 
4710 //*************************************************************************************************
4716 template< typename MT // Type of the dense matrix
4717  , size_t... CRAs > // Compile time row arguments
4718 inline size_t Rows<MT,false,true,false,CRAs...>::nonZeros() const
4719 {
4720  size_t nonzeros( 0UL );
4721 
4722  for( size_t i=0UL; i<rows(); ++i ) {
4723  nonzeros += nonZeros( i );
4724  }
4725 
4726  return nonzeros;
4727 }
4729 //*************************************************************************************************
4730 
4731 
4732 //*************************************************************************************************
4741 template< typename MT // Type of the dense matrix
4742  , size_t... CRAs > // Compile time row arguments
4743 inline size_t Rows<MT,false,true,false,CRAs...>::nonZeros( size_t i ) const
4744 {
4745  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
4746 
4747  size_t nonzeros( 0UL );
4748 
4749  const size_t index( idx(i) );
4750  for( size_t j=0UL; j<columns(); ++j ) {
4751  if( !isDefault( matrix_( index, j ) ) )
4752  ++nonzeros;
4753  }
4754 
4755  return nonzeros;
4756 }
4758 //*************************************************************************************************
4759 
4760 
4761 //*************************************************************************************************
4767 template< typename MT // Type of the dense matrix
4768  , size_t... CRAs > // Compile time row arguments
4770 {
4771  for( size_t i=0UL; i<rows(); ++i ) {
4772  reset( i );
4773  }
4774 }
4776 //*************************************************************************************************
4777 
4778 
4779 //*************************************************************************************************
4788 template< typename MT // Type of the dense matrix
4789  , size_t... CRAs > // Compile time row arguments
4790 inline void Rows<MT,false,true,false,CRAs...>::reset( size_t i )
4791 {
4792  using blaze::reset;
4793 
4794  const size_t index( idx(i) );
4795  for( size_t j=0UL; j<columns(); ++j ) {
4796  reset( matrix_( index, j ) );
4797  }
4798 }
4800 //*************************************************************************************************
4801 
4802 
4803 
4804 
4805 //=================================================================================================
4806 //
4807 // NUMERIC FUNCTIONS
4808 //
4809 //=================================================================================================
4810 
4811 //*************************************************************************************************
4824 template< typename MT // Type of the dense matrix
4825  , size_t... CRAs > // Compile time row arguments
4826 inline Rows<MT,false,true,false,CRAs...>&
4828 {
4831 
4832  if( rows() != columns() ) {
4833  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose of a non-quadratic matrix" );
4834  }
4835 
4836  const ResultType tmp( trans( *this ) );
4837 
4838  if( IsRestricted<MT>::value ) {
4839  for( size_t i=0UL; i<rows(); ++i ) {
4840  if( !tryAssign( matrix_, row( tmp, i ), idx(i), 0UL ) ) {
4841  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose operation" );
4842  }
4843  }
4844  }
4845 
4846  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4847 
4848  smpAssign( left, tmp );
4849 
4850  return *this;
4851 }
4853 //*************************************************************************************************
4854 
4855 
4856 //*************************************************************************************************
4869 template< typename MT // Type of the dense matrix
4870  , size_t... CRAs > // Compile time row arguments
4871 inline Rows<MT,false,true,false,CRAs...>&
4873 {
4876 
4877  if( rows() != columns() ) {
4878  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose of a non-quadratic matrix" );
4879  }
4880 
4881  const ResultType tmp( ctrans( *this ) );
4882 
4883  if( IsRestricted<MT>::value ) {
4884  for( size_t i=0UL; i<rows(); ++i ) {
4885  if( !tryAssign( matrix_, row( tmp, i ), idx(i), 0UL ) ) {
4886  BLAZE_THROW_LOGIC_ERROR( "Invalid transpose operation" );
4887  }
4888  }
4889  }
4890 
4891  BLAZE_DECLTYPE_AUTO( left, derestrict( *this ) );
4892 
4893  smpAssign( left, tmp );
4894 
4895  return *this;
4896 }
4898 //*************************************************************************************************
4899 
4900 
4901 //*************************************************************************************************
4914 template< typename MT // Type of the dense matrix
4915  , size_t... CRAs > // Compile time row arguments
4916 template< typename Other > // Data type of the scalar value
4917 inline Rows<MT,false,true,false,CRAs...>&
4918  Rows<MT,false,true,false,CRAs...>::scale( const Other& scalar )
4919 {
4923 
4924  for( size_t i=0UL; i<rows(); ++i )
4925  {
4926  const size_t index ( idx(i) );
4927  const size_t jbegin( IsUpper<MT>::value ? ( IsStrictlyUpper<MT>::value ? index+1UL : index ) : 0UL );
4928  const size_t jend ( IsLower<MT>::value ? ( IsStrictlyLower<MT>::value ? index : index+1UL ) : columns() );
4929 
4930  for( size_t j=jbegin; j<jend; ++j ) {
4931  matrix_(index,j) *= scalar;
4932  }
4933  }
4934 
4935  return *this;
4936 }
4938 //*************************************************************************************************
4939 
4940 
4941 
4942 
4943 //=================================================================================================
4944 //
4945 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
4946 //
4947 //=================================================================================================
4948 
4949 //*************************************************************************************************
4960 template< typename MT // Type of the dense matrix
4961  , size_t... CRAs > // Compile time row arguments
4962 template< typename Other > // Data type of the foreign expression
4963 inline bool Rows<MT,false,true,false,CRAs...>::canAlias( const Other* alias ) const noexcept
4964 {
4965  return matrix_.isAliased( alias );
4966 }
4968 //*************************************************************************************************
4969 
4970 
4971 //*************************************************************************************************
4983 template< typename MT // Type of the dense matrix
4984  , size_t... CRAs > // Compile time row arguments
4985 template< typename MT2 // Data type of the foreign dense row selection
4986  , bool SO2 // Storage order of the foreign dense row selection
4987  , bool SF2 // Symmetry flag of the foreign dense row selection
4988  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row selection
4989 inline bool
4990  Rows<MT,false,true,false,CRAs...>::canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
4991 {
4992  return matrix_.isAliased( &alias->matrix_ );
4993 }
4995 //*************************************************************************************************
4996 
4997 
4998 //*************************************************************************************************
5009 template< typename MT // Type of the dense matrix
5010  , size_t... CRAs > // Compile time row arguments
5011 template< typename Other > // Data type of the foreign expression
5012 inline bool Rows<MT,false,true,false,CRAs...>::isAliased( const Other* alias ) const noexcept
5013 {
5014  return matrix_.isAliased( alias );
5015 }
5017 //*************************************************************************************************
5018 
5019 
5020 //*************************************************************************************************
5032 template< typename MT // Type of the dense matrix
5033  , size_t... CRAs > // Compile time row arguments
5034 template< typename MT2 // Data type of the foreign dense row selection
5035  , bool SO2 // Storage order of the foreign dense row selection
5036  , bool SF2 // Symmetry flag of the foreign dense row selection
5037  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row selection
5038 inline bool
5039  Rows<MT,false,true,false,CRAs...>::isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
5040 {
5041  return matrix_.isAliased( &alias->matrix_ );
5042 }
5044 //*************************************************************************************************
5045 
5046 
5047 //*************************************************************************************************
5057 template< typename MT // Type of the dense matrix
5058  , size_t... CRAs > // Compile time row arguments
5059 inline bool Rows<MT,false,true,false,CRAs...>::isAligned() const noexcept
5060 {
5061  return false;
5062 }
5064 //*************************************************************************************************
5065 
5066 
5067 //*************************************************************************************************
5078 template< typename MT // Type of the dense matrix
5079  , size_t... CRAs > // Compile time row arguments
5080 inline bool Rows<MT,false,true,false,CRAs...>::canSMPAssign() const noexcept
5081 {
5082  return ( rows() * columns() > SMP_DMATASSIGN_THRESHOLD );
5083 }
5085 //*************************************************************************************************
5086 
5087 
5088 //*************************************************************************************************
5100 template< typename MT // Type of the dense matrix
5101  , size_t... CRAs > // Compile time row arguments
5102 template< typename MT2 > // Type of the right-hand side dense matrix
5103 inline void Rows<MT,false,true,false,CRAs...>::assign( const DenseMatrix<MT2,false>& rhs )
5104 {
5107 
5108  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5109  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5110 
5111  const size_t jpos( columns() & size_t(-2) );
5112  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
5113 
5114  for( size_t i=0UL; i<rows(); ++i ) {
5115  const size_t index( idx(i) );
5116  for( size_t j=0UL; j<jpos; j+=2UL ) {
5117  matrix_(index,j ) = (~rhs)(i,j );
5118  matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
5119  }
5120  if( jpos < columns() ) {
5121  matrix_(index,jpos) = (~rhs)(i,jpos);
5122  }
5123  }
5124 }
5126 //*************************************************************************************************
5127 
5128 
5129 //*************************************************************************************************
5141 template< typename MT // Type of the dense matrix
5142  , size_t... CRAs > // Compile time row arguments
5143 template< typename MT2 > // Type of the right-hand side dense matrix
5144 inline void Rows<MT,false,true,false,CRAs...>::assign( const DenseMatrix<MT2,true>& rhs )
5145 {
5148 
5150 
5151  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5152  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5153 
5154  constexpr size_t block( BLOCK_SIZE );
5155 
5156  if( rows() < block && columns() < block )
5157  {
5158  const size_t jpos( (~rhs).columns() & size_t(-2) );
5159  for( size_t i=0UL; i<rows(); ++i ) {
5160  const size_t index( idx(i) );
5161  for( size_t j=0UL; j<jpos; j+=2UL ) {
5162  matrix_(index,j ) = (~rhs)(i,j );
5163  matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
5164  }
5165  if( jpos < (~rhs).columns() )
5166  matrix_(index,jpos) = (~rhs)(i,jpos);
5167  }
5168  }
5169  else
5170  {
5171  for( size_t ii=0UL; ii<rows(); ii+=block ) {
5172  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
5173  for( size_t jj=0UL; jj<columns(); jj+=block ) {
5174  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
5175  for( size_t i=ii; i<iend; ++i ) {
5176  const size_t index( idx(i) );
5177  for( size_t j=jj; j<jend; ++j ) {
5178  matrix_(index,j) = (~rhs)(i,j);
5179  }
5180  }
5181  }
5182  }
5183  }
5184 }
5186 //*************************************************************************************************
5187 
5188 
5189 //*************************************************************************************************
5201 template< typename MT // Type of the dense matrix
5202  , size_t... CRAs > // Compile time row arguments
5203 template< typename MT2 > // Type of the right-hand side sparse matrix
5204 inline void Rows<MT,false,true,false,CRAs...>::assign( const SparseMatrix<MT2,false>& rhs )
5205 {
5208 
5209  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5210  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5211 
5212  for( size_t i=0UL; i<rows(); ++i ) {
5213  const size_t index( idx(i) );
5214  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5215  matrix_(index,element->index()) = element->value();
5216  }
5217 }
5219 //*************************************************************************************************
5220 
5221 
5222 //*************************************************************************************************
5234 template< typename MT // Type of the dense matrix
5235  , size_t... CRAs > // Compile time row arguments
5236 template< typename MT2 > // Type of the right-hand side sparse matrix
5237 inline void Rows<MT,false,true,false,CRAs...>::assign( const SparseMatrix<MT2,true>& rhs )
5238 {
5241 
5243 
5244  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5245  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5246 
5247  for( size_t j=0UL; j<columns(); ++j ) {
5248  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5249  matrix_(idx(element->index()),j) = element->value();
5250  }
5251 }
5253 //*************************************************************************************************
5254 
5255 
5256 //*************************************************************************************************
5268 template< typename MT // Type of the dense matrix
5269  , size_t... CRAs > // Compile time row arguments
5270 template< typename MT2 > // Type of the right-hand side dense matrix
5271 inline void Rows<MT,false,true,false,CRAs...>::addAssign( const DenseMatrix<MT2,false>& rhs )
5272 {
5275 
5276  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5277  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5278 
5279  const size_t jpos( columns() & size_t(-2) );
5280  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
5281 
5282  for( size_t i=0UL; i<rows(); ++i )
5283  {
5284  const size_t index( idx(i) );
5285  if( IsDiagonal<MT2>::value ) {
5286  matrix_(index,i) += (~rhs)(i,i);
5287  }
5288  else {
5289  for( size_t j=0UL; j<jpos; j+=2UL ) {
5290  matrix_(index,j ) += (~rhs)(i,j );
5291  matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
5292  }
5293  if( jpos < columns() ) {
5294  matrix_(index,jpos) += (~rhs)(i,jpos);
5295  }
5296  }
5297  }
5298 }
5300 //*************************************************************************************************
5301 
5302 
5303 //*************************************************************************************************
5315 template< typename MT // Type of the dense matrix
5316  , size_t... CRAs > // Compile time row arguments
5317 template< typename MT2 > // Type of the right-hand side dense matrix
5318 inline void Rows<MT,false,true,false,CRAs...>::addAssign( const DenseMatrix<MT2,true>& rhs )
5319 {
5322 
5324 
5325  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5326  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5327 
5328  constexpr size_t block( BLOCK_SIZE );
5329 
5330  if( rows() < block && columns() < block )
5331  {
5332  const size_t jpos( (~rhs).columns() & size_t(-2) );
5333  for( size_t i=0UL; i<rows(); ++i ) {
5334  const size_t index( idx(i) );
5335  for( size_t j=0UL; j<jpos; j+=2UL ) {
5336  matrix_(index,j ) += (~rhs)(i,j );
5337  matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
5338  }
5339  if( jpos < (~rhs).columns() )
5340  matrix_(index,jpos) += (~rhs)(i,jpos);
5341  }
5342  }
5343  else
5344  {
5345  for( size_t ii=0UL; ii<rows(); ii+=block ) {
5346  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
5347  for( size_t jj=0UL; jj<columns(); jj+=block ) {
5348  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
5349  for( size_t i=ii; i<iend; ++i ) {
5350  const size_t index( idx(i) );
5351  for( size_t j=jj; j<jend; ++j ) {
5352  matrix_(index,j) += (~rhs)(i,j);
5353  }
5354  }
5355  }
5356  }
5357  }
5358 }
5360 //*************************************************************************************************
5361 
5362 
5363 //*************************************************************************************************
5375 template< typename MT // Type of the dense matrix
5376  , size_t... CRAs > // Compile time row arguments
5377 template< typename MT2 > // Type of the right-hand side sparse matrix
5378 inline void Rows<MT,false,true,false,CRAs...>::addAssign( const SparseMatrix<MT2,false>& rhs )
5379 {
5382 
5383  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5384  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5385 
5386  for( size_t i=0UL; i<rows(); ++i ) {
5387  const size_t index( idx(i) );
5388  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5389  matrix_(index,element->index()) += element->value();
5390  }
5391 }
5393 //*************************************************************************************************
5394 
5395 
5396 //*************************************************************************************************
5408 template< typename MT // Type of the dense matrix
5409  , size_t... CRAs > // Compile time row arguments
5410 template< typename MT2 > // Type of the right-hand side sparse matrix
5411 inline void Rows<MT,false,true,false,CRAs...>::addAssign( const SparseMatrix<MT2,true>& rhs )
5412 {
5415 
5417 
5418  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5419  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5420 
5421  for( size_t j=0UL; j<columns(); ++j ) {
5422  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5423  matrix_(idx(element->index()),j) += element->value();
5424  }
5425 }
5427 //*************************************************************************************************
5428 
5429 
5430 //*************************************************************************************************
5442 template< typename MT // Type of the dense matrix
5443  , size_t... CRAs > // Compile time row arguments
5444 template< typename MT2 > // Type of the right-hand side dense matrix
5445 inline void Rows<MT,false,true,false,CRAs...>::subAssign( const DenseMatrix<MT2,false>& rhs )
5446 {
5449 
5450  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5451  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5452 
5453  const size_t jpos( columns() & size_t(-2) );
5454  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
5455 
5456  for( size_t i=0UL; i<rows(); ++i )
5457  {
5458  const size_t index( idx(i) );
5459 
5460  if( IsDiagonal<MT2>::value ) {
5461  matrix_(index,i) -= (~rhs)(i,i);
5462  }
5463  else {
5464  for( size_t j=0UL; j<jpos; j+=2UL ) {
5465  matrix_(index,j ) -= (~rhs)(i,j );
5466  matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
5467  }
5468  if( jpos < columns() ) {
5469  matrix_(index,jpos) -= (~rhs)(i,jpos);
5470  }
5471  }
5472  }
5473 }
5475 //*************************************************************************************************
5476 
5477 
5478 //*************************************************************************************************
5490 template< typename MT // Type of the dense matrix
5491  , size_t... CRAs > // Compile time row arguments
5492 template< typename MT2 > // Type of the right-hand side dense matrix
5493 inline void Rows<MT,false,true,false,CRAs...>::subAssign( const DenseMatrix<MT2,true>& rhs )
5494 {
5497 
5499 
5500  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5501  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5502 
5503  constexpr size_t block( BLOCK_SIZE );
5504 
5505  if( rows() < block && columns() < block )
5506  {
5507  const size_t jpos( (~rhs).columns() & size_t(-2) );
5508  for( size_t i=0UL; i<rows(); ++i ) {
5509  const size_t index( idx(i) );
5510  for( size_t j=0UL; j<jpos; j+=2UL ) {
5511  matrix_(index,j ) -= (~rhs)(i,j );
5512  matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
5513  }
5514  if( jpos < (~rhs).columns() )
5515  matrix_(index,jpos) -= (~rhs)(i,jpos);
5516  }
5517  }
5518  else
5519  {
5520  for( size_t ii=0UL; ii<rows(); ii+=block ) {
5521  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
5522  for( size_t jj=0UL; jj<columns(); jj+=block ) {
5523  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
5524  for( size_t i=ii; i<iend; ++i ) {
5525  const size_t index( idx(i) );
5526  for( size_t j=jj; j<jend; ++j ) {
5527  matrix_(index,j) -= (~rhs)(i,j);
5528  }
5529  }
5530  }
5531  }
5532  }
5533 }
5535 //*************************************************************************************************
5536 
5537 
5538 //*************************************************************************************************
5550 template< typename MT // Type of the dense matrix
5551  , size_t... CRAs > // Compile time row arguments
5552 template< typename MT2 > // Type of the right-hand side sparse matrix
5553 inline void Rows<MT,false,true,false,CRAs...>::subAssign( const SparseMatrix<MT2,false>& rhs )
5554 {
5557 
5558  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5559  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5560 
5561  for( size_t i=0UL; i<rows(); ++i ) {
5562  const size_t index( idx(i) );
5563  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5564  matrix_(index,element->index()) -= element->value();
5565  }
5566 }
5568 //*************************************************************************************************
5569 
5570 
5571 //*************************************************************************************************
5583 template< typename MT // Type of the dense matrix
5584  , size_t... CRAs > // Compile time row arguments
5585 template< typename MT2 > // Type of the right-hand side sparse matrix
5586 inline void Rows<MT,false,true,false,CRAs...>::subAssign( const SparseMatrix<MT2,true>& rhs )
5587 {
5590 
5592 
5593  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5594  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5595 
5596  for( size_t j=0UL; j<columns(); ++j ) {
5597  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5598  matrix_(idx(element->index()),j) -= element->value();
5599  }
5600 }
5602 //*************************************************************************************************
5603 
5604 
5605 //*************************************************************************************************
5617 template< typename MT // Type of the dense matrix
5618  , size_t... CRAs > // Compile time row arguments
5619 template< typename MT2 > // Type of the right-hand side dense matrix
5620 inline void Rows<MT,false,true,false,CRAs...>::schurAssign( const DenseMatrix<MT2,false>& rhs )
5621 {
5624 
5625  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5626  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5627 
5628  const size_t jpos( columns() & size_t(-2) );
5629  BLAZE_INTERNAL_ASSERT( ( columns() - ( columns() % 2UL ) ) == jpos, "Invalid end calculation" );
5630 
5631  for( size_t i=0UL; i<rows(); ++i ) {
5632  const size_t index( idx(i) );
5633  for( size_t j=0UL; j<jpos; j+=2UL ) {
5634  matrix_(index,j ) *= (~rhs)(i,j );
5635  matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
5636  }
5637  if( jpos < columns() ) {
5638  matrix_(index,jpos) *= (~rhs)(i,jpos);
5639  }
5640  }
5641 }
5643 //*************************************************************************************************
5644 
5645 
5646 //*************************************************************************************************
5658 template< typename MT // Type of the dense matrix
5659  , size_t... CRAs > // Compile time row arguments
5660 template< typename MT2 > // Type of the right-hand side dense matrix
5661 inline void Rows<MT,false,true,false,CRAs...>::schurAssign( const DenseMatrix<MT2,true>& rhs )
5662 {
5665 
5667 
5668  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5669  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5670 
5671  constexpr size_t block( BLOCK_SIZE );
5672 
5673  if( rows() < block && columns() < block )
5674  {
5675  const size_t jpos( (~rhs).columns() & size_t(-2) );
5676  for( size_t i=0UL; i<rows(); ++i ) {
5677  const size_t index( idx(i) );
5678  for( size_t j=0UL; j<jpos; j+=2UL ) {
5679  matrix_(index,j ) *= (~rhs)(i,j );
5680  matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
5681  }
5682  if( jpos < (~rhs).columns() )
5683  matrix_(index,jpos) *= (~rhs)(i,jpos);
5684  }
5685  }
5686  else
5687  {
5688  for( size_t ii=0UL; ii<rows(); ii+=block ) {
5689  const size_t iend( ( rows()<(ii+block) )?( rows() ):( ii+block ) );
5690  for( size_t jj=0UL; jj<columns(); jj+=block ) {
5691  const size_t jend( ( columns()<(jj+block) )?( columns() ):( jj+block ) );
5692  for( size_t i=ii; i<iend; ++i ) {
5693  const size_t index( idx(i) );
5694  for( size_t j=jj; j<jend; ++j ) {
5695  matrix_(index,j) *= (~rhs)(i,j);
5696  }
5697  }
5698  }
5699  }
5700  }
5701 }
5703 //*************************************************************************************************
5704 
5705 
5706 //*************************************************************************************************
5718 template< typename MT // Type of the dense matrix
5719  , size_t... CRAs > // Compile time row arguments
5720 template< typename MT2 > // Type of the right-hand side sparse matrix
5721 inline void Rows<MT,false,true,false,CRAs...>::schurAssign( const SparseMatrix<MT2,false>& rhs )
5722 {
5723  using blaze::reset;
5724 
5727 
5728  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5729  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5730 
5731  for( size_t i=0UL; i<rows(); ++i )
5732  {
5733  const size_t index( idx(i) );
5734  size_t j( 0UL );
5735 
5736  for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
5737  for( ; j<element->index(); ++j )
5738  reset( matrix_(index,j) );
5739  matrix_(index,j) *= element->value();
5740  ++j;
5741  }
5742 
5743  for( ; j<columns(); ++j ) {
5744  reset( matrix_(index,j) );
5745  }
5746  }
5747 }
5749 //*************************************************************************************************
5750 
5751 
5752 //*************************************************************************************************
5764 template< typename MT // Type of the dense matrix
5765  , size_t... CRAs > // Compile time row arguments
5766 template< typename MT2 > // Type of the right-hand side sparse matrix
5767 inline void Rows<MT,false,true,false,CRAs...>::schurAssign( const SparseMatrix<MT2,true>& rhs )
5768 {
5769  using blaze::reset;
5770 
5773 
5775 
5776  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
5777  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
5778 
5779  for( size_t j=0UL; j<columns(); ++j )
5780  {
5781  size_t i( 0UL );
5782 
5783  for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
5784  for( ; i<element->index(); ++i )
5785  reset( matrix_(idx(i),j) );
5786  matrix_(idx(i),j) *= element->value();
5787  ++i;
5788  }
5789 
5790  for( ; i<rows(); ++i ) {
5791  reset( matrix_(idx(i),j) );
5792  }
5793  }
5794 }
5796 //*************************************************************************************************
5797 
5798 
5799 
5800 
5801 
5802 
5803 
5804 
5805 //=================================================================================================
5806 //
5807 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR DENSE MATRICES
5808 //
5809 //=================================================================================================
5810 
5811 //*************************************************************************************************
5819 template< typename MT // Type of the dense matrix
5820  , size_t... CRAs > // Compile time row arguments
5821 class Rows<MT,false,true,true,CRAs...>
5822  : public View< DenseMatrix< Rows<MT,false,true,true,CRAs...>, false > >
5823  , private RowsData<CRAs...>
5824 {
5825  private:
5826  //**Type definitions****************************************************************************
5827  using DataType = RowsData<CRAs...>;
5828  using Operand = If_< IsExpression<MT>, MT, MT& >;
5829  //**********************************************************************************************
5830 
5831  public:
5832  //**Type definitions****************************************************************************
5834  using This = Rows<MT,false,true,true,CRAs...>;
5835 
5836  using BaseType = DenseMatrix<This,false>;
5837  using ViewedType = MT;
5838  using ResultType = RowsTrait_<MT,CRAs...>;
5839  using OppositeType = OppositeType_<ResultType>;
5840  using TransposeType = TransposeType_<ResultType>;
5841  using ElementType = ElementType_<MT>;
5842  using SIMDType = SIMDTrait_<ElementType>;
5843  using ReturnType = ReturnType_<MT>;
5844  using CompositeType = const Rows&;
5845 
5847  using ConstReference = ConstReference_<MT>;
5848 
5850  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
5851 
5853  using ConstPointer = ConstPointer_<MT>;
5854 
5856  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
5857 
5859  using ConstIterator = ConstIterator_<MT>;
5860 
5862  using Iterator = If_< IsConst<MT>, ConstIterator, Iterator_<MT> >;
5863  //**********************************************************************************************
5864 
5865  //**Compilation flags***************************************************************************
5867  enum : bool { simdEnabled = MT::simdEnabled };
5868 
5870  enum : bool { smpAssignable = MT::smpAssignable };
5871  //**********************************************************************************************
5872 
5873  //**Constructors********************************************************************************
5876  template< typename... RRAs >
5877  explicit inline Rows( MT& matrix, RRAs... args );
5878 
5879  inline Rows( const Rows& ) = default;
5880  inline Rows( Rows&& ) = default;
5882  //**********************************************************************************************
5883 
5884  //**Destructor**********************************************************************************
5885  // No explicitly declared destructor.
5886  //**********************************************************************************************
5887 
5888  //**Data access functions***********************************************************************
5891  inline Reference operator()( size_t i, size_t j );
5892  inline ConstReference operator()( size_t i, size_t j ) const;
5893  inline Reference at( size_t i, size_t j );
5894  inline ConstReference at( size_t i, size_t j ) const;
5895  inline Pointer data () noexcept;
5896  inline ConstPointer data () const noexcept;
5897  inline Pointer data ( size_t i ) noexcept;
5898  inline ConstPointer data ( size_t i ) const noexcept;
5899  inline Iterator begin ( size_t i );
5900  inline ConstIterator begin ( size_t i ) const;
5901  inline ConstIterator cbegin( size_t i ) const;
5902  inline Iterator end ( size_t i );
5903  inline ConstIterator end ( size_t i ) const;
5904  inline ConstIterator cend ( size_t i ) const;
5906  //**********************************************************************************************
5907 
5908  //**Assignment operators************************************************************************
5911  inline Rows& operator=( const ElementType& rhs );
5912 
5913  Rows& operator=( const Rows& ) = delete;
5915  //**********************************************************************************************
5916 
5917  //**Utility functions***************************************************************************
5920  using DataType::idx;
5921  using DataType::idces;
5922  using DataType::rows;
5923 
5924  inline MT& operand() noexcept;
5925  inline const MT& operand() const noexcept;
5926 
5927  inline size_t columns() const noexcept;
5928  inline size_t spacing() const noexcept;
5929  inline size_t capacity() const noexcept;
5930  inline size_t capacity( size_t i ) const noexcept;
5931  inline size_t nonZeros() const;
5932  inline size_t nonZeros( size_t i ) const;
5933  inline void reset();
5934  inline void reset( size_t i );
5936  //**********************************************************************************************
5937 
5938  //**Expression template evaluation functions****************************************************
5941  template< typename Other >
5942  inline bool canAlias( const Other* alias ) const noexcept;
5943 
5944  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
5945  inline bool canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
5946 
5947  template< typename Other >
5948  inline bool isAliased( const Other* alias ) const noexcept;
5949 
5950  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
5951  inline bool isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
5952 
5953  inline bool isAligned () const noexcept;
5954  inline bool canSMPAssign() const noexcept;
5955 
5956  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
5957  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
5958  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
5960  //**********************************************************************************************
5961 
5962  private:
5963  //**Member variables****************************************************************************
5966  Operand matrix_;
5967 
5968  //**********************************************************************************************
5969 
5970  //**Friend declarations*************************************************************************
5971  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Rows;
5972  //**********************************************************************************************
5973 
5974  //**Compile time checks*************************************************************************
5984  //**********************************************************************************************
5985 };
5987 //*************************************************************************************************
5988 
5989 
5990 
5991 
5992 //=================================================================================================
5993 //
5994 // CONSTRUCTORS
5995 //
5996 //=================================================================================================
5997 
5998 //*************************************************************************************************
6011 template< typename MT // Type of the dense matrix
6012  , size_t... CRAs > // Compile time row arguments
6013 template< typename... RRAs > // Runtime row arguments
6014 inline Rows<MT,false,true,true,CRAs...>::Rows( MT& matrix, RRAs... args )
6015  : DataType( args... ) // Base class initialization
6016  , matrix_ ( matrix ) // The matrix containing the rows
6017 {
6018  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
6019  for( size_t i=0UL; i<rows(); ++i ) {
6020  if( matrix_.rows() <= idx(i) ) {
6021  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
6022  }
6023  }
6024  }
6025 }
6027 //*************************************************************************************************
6028 
6029 
6030 
6031 
6032 //=================================================================================================
6033 //
6034 // DATA ACCESS FUNCTIONS
6035 //
6036 //=================================================================================================
6037 
6038 //*************************************************************************************************
6049 template< typename MT // Type of the dense matrix
6050  , size_t... CRAs > // Compile time row arguments
6051 inline typename Rows<MT,false,true,true,CRAs...>::Reference
6052  Rows<MT,false,true,true,CRAs...>::operator()( size_t i, size_t j )
6053 {
6054  BLAZE_USER_ASSERT( i < rows() , "Invalid row access index" );
6055  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
6056 
6057  return matrix_(j,idx(i));
6058 }
6060 //*************************************************************************************************
6061 
6062 
6063 //*************************************************************************************************
6074 template< typename MT // Type of the dense matrix
6075  , size_t... CRAs > // Compile time row arguments
6076 inline typename Rows<MT,false,true,true,CRAs...>::ConstReference
6077  Rows<MT,false,true,true,CRAs...>::operator()( size_t i, size_t j ) const
6078 {
6079  BLAZE_USER_ASSERT( i < rows() , "Invalid row access index" );
6080  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
6081 
6082  return const_cast<const MT&>( matrix_ )(j,idx(i));
6083 }
6085 //*************************************************************************************************
6086 
6087 
6088 //*************************************************************************************************
6100 template< typename MT // Type of the dense matrix
6101  , size_t... CRAs > // Compile time row arguments
6102 inline typename Rows<MT,false,true,true,CRAs...>::Reference
6103  Rows<MT,false,true,true,CRAs...>::at( size_t i, size_t j )
6104 {
6105  if( i >= rows() ) {
6106  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
6107  }
6108  if( j >= columns() ) {
6109  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
6110  }
6111  return (*this)(i,j);
6112 }
6114 //*************************************************************************************************
6115 
6116 
6117 //*************************************************************************************************
6129 template< typename MT // Type of the dense matrix
6130  , size_t... CRAs > // Compile time row arguments
6131 inline typename Rows<MT,false,true,true,CRAs...>::ConstReference
6132  Rows<MT,false,true,true,CRAs...>::at( size_t i, size_t j ) const
6133 {
6134  if( i >= rows() ) {
6135  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
6136  }
6137  if( j >= columns() ) {
6138  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
6139  }
6140  return (*this)(i,j);
6141 }
6143 //*************************************************************************************************
6144 
6145 
6146 //*************************************************************************************************
6156 template< typename MT // Type of the dense matrix
6157  , size_t... CRAs > // Compile time row arguments
6158 inline typename Rows<MT,false,true,true,CRAs...>::Pointer
6160 {
6161  return matrix_.data( idx(0UL) );
6162 }
6164 //*************************************************************************************************
6165 
6166 
6167 //*************************************************************************************************
6177 template< typename MT // Type of the dense matrix
6178  , size_t... CRAs > // Compile time row arguments
6179 inline typename Rows<MT,false,true,true,CRAs...>::ConstPointer
6181 {
6182  return matrix_.data( idx(0UL) );
6183 }
6185 //*************************************************************************************************
6186 
6187 
6188 //*************************************************************************************************
6197 template< typename MT // Type of the dense matrix
6198  , size_t... CRAs > // Compile time row arguments
6199 inline typename Rows<MT,false,true,true,CRAs...>::Pointer
6200  Rows<MT,false,true,true,CRAs...>::data( size_t i ) noexcept
6201 {
6202  return matrix_.data( idx(i) );
6203 }
6205 //*************************************************************************************************
6206 
6207 
6208 //*************************************************************************************************
6217 template< typename MT // Type of the dense matrix
6218  , size_t... CRAs > // Compile time row arguments
6219 inline typename Rows<MT,false,true,true,CRAs...>::ConstPointer
6220  Rows<MT,false,true,true,CRAs...>::data( size_t i ) const noexcept
6221 {
6222  return matrix_.data( idx(i) );
6223 }
6225 //*************************************************************************************************
6226 
6227 
6228 //*************************************************************************************************
6237 template< typename MT // Type of the dense matrix
6238  , size_t... CRAs > // Compile time row arguments
6239 inline typename Rows<MT,false,true,true,CRAs...>::Iterator
6241 {
6242  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6243  return matrix_.begin( idx(i) );
6244 }
6246 //*************************************************************************************************
6247 
6248 
6249 //*************************************************************************************************
6258 template< typename MT // Type of the dense matrix
6259  , size_t... CRAs > // Compile time row arguments
6260 inline typename Rows<MT,false,true,true,CRAs...>::ConstIterator
6261  Rows<MT,false,true,true,CRAs...>::begin( size_t i ) const
6262 {
6263  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6264  return matrix_.cbegin( idx(i) );
6265 }
6267 //*************************************************************************************************
6268 
6269 
6270 //*************************************************************************************************
6279 template< typename MT // Type of the dense matrix
6280  , size_t... CRAs > // Compile time row arguments
6281 inline typename Rows<MT,false,true,true,CRAs...>::ConstIterator
6283 {
6284  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6285  return matrix_.cbegin( idx(i) );
6286 }
6288 //*************************************************************************************************
6289 
6290 
6291 //*************************************************************************************************
6300 template< typename MT // Type of the dense matrix
6301  , size_t... CRAs > // Compile time row arguments
6302 inline typename Rows<MT,false,true,true,CRAs...>::Iterator
6304 {
6305  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6306  return matrix_.end( idx(i) );
6307 }
6309 //*************************************************************************************************
6310 
6311 
6312 //*************************************************************************************************
6321 template< typename MT // Type of the dense matrix
6322  , size_t... CRAs > // Compile time row arguments
6323 inline typename Rows<MT,false,true,true,CRAs...>::ConstIterator
6324  Rows<MT,false,true,true,CRAs...>::end( size_t i ) const
6325 {
6326  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6327  return matrix_.cend( idx(i) );
6328 }
6330 //*************************************************************************************************
6331 
6332 
6333 //*************************************************************************************************
6342 template< typename MT // Type of the dense matrix
6343  , size_t... CRAs > // Compile time row arguments
6344 inline typename Rows<MT,false,true,true,CRAs...>::ConstIterator
6345  Rows<MT,false,true,true,CRAs...>::cend( size_t i ) const
6346 {
6347  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6348  return matrix_.cend( idx(i) );
6349 }
6351 //*************************************************************************************************
6352 
6353 
6354 
6355 
6356 //=================================================================================================
6357 //
6358 // ASSIGNMENT OPERATORS
6359 //
6360 //=================================================================================================
6361 
6362 //*************************************************************************************************
6373 template< typename MT // Type of the dense matrix
6374  , size_t... CRAs > // Compile time row arguments
6375 inline Rows<MT,false,true,true,CRAs...>&
6376  Rows<MT,false,true,true,CRAs...>::operator=( const ElementType& rhs )
6377 {
6378  for( size_t i=0UL; i<rows(); ++i ) {
6379  column( matrix_, idx(i), unchecked ) = rhs;
6380  }
6381 
6382  return *this;
6383 }
6385 //*************************************************************************************************
6386 
6387 
6388 
6389 
6390 //=================================================================================================
6391 //
6392 // UTILITY FUNCTIONS
6393 //
6394 //=================================================================================================
6395 
6396 //*************************************************************************************************
6402 template< typename MT // Type of the dense matrix
6403  , size_t... CRAs > // Compile time row arguments
6404 inline MT& Rows<MT,false,true,true,CRAs...>::operand() noexcept
6405 {
6406  return matrix_;
6407 }
6409 //*************************************************************************************************
6410 
6411 
6412 //*************************************************************************************************
6418 template< typename MT // Type of the dense matrix
6419  , size_t... CRAs > // Compile time row arguments
6420 inline const MT& Rows<MT,false,true,true,CRAs...>::operand() const noexcept
6421 {
6422  return matrix_;
6423 }
6425 //*************************************************************************************************
6426 
6427 
6428 //*************************************************************************************************
6434 template< typename MT // Type of the dense matrix
6435  , size_t... CRAs > // Compile time row arguments
6436 inline size_t Rows<MT,false,true,true,CRAs...>::columns() const noexcept
6437 {
6438  return matrix_.columns();
6439 }
6441 //*************************************************************************************************
6442 
6443 
6444 //*************************************************************************************************
6453 template< typename MT // Type of the dense matrix
6454  , size_t... CRAs > // Compile time row arguments
6455 inline size_t Rows<MT,false,true,true,CRAs...>::spacing() const noexcept
6456 {
6457  return matrix_.spacing();
6458 }
6460 //*************************************************************************************************
6461 
6462 
6463 //*************************************************************************************************
6469 template< typename MT // Type of the dense matrix
6470  , size_t... CRAs > // Compile time row arguments
6471 inline size_t Rows<MT,false,true,true,CRAs...>::capacity() const noexcept
6472 {
6473  return rows() * columns();
6474 }
6476 //*************************************************************************************************
6477 
6478 
6479 //*************************************************************************************************
6488 template< typename MT // Type of the dense matrix
6489  , size_t... CRAs > // Compile time row arguments
6490 inline size_t Rows<MT,false,true,true,CRAs...>::capacity( size_t i ) const noexcept
6491 {
6492  UNUSED_PARAMETER( i );
6493 
6494  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6495 
6496  return columns();
6497 }
6499 //*************************************************************************************************
6500 
6501 
6502 //*************************************************************************************************
6508 template< typename MT // Type of the dense matrix
6509  , size_t... CRAs > // Compile time row arguments
6510 inline size_t Rows<MT,false,true,true,CRAs...>::nonZeros() const
6511 {
6512  size_t nonzeros( 0UL );
6513 
6514  for( size_t i=0UL; i<rows(); ++i ) {
6515  nonzeros += matrix_.nonZeros( idx(i) );
6516  }
6517 
6518  return nonzeros;
6519 }
6521 //*************************************************************************************************
6522 
6523 
6524 //*************************************************************************************************
6533 template< typename MT // Type of the dense matrix
6534  , size_t... CRAs > // Compile time row arguments
6535 inline size_t Rows<MT,false,true,true,CRAs...>::nonZeros( size_t i ) const
6536 {
6537  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
6538 
6539  return matrix_.nonZeros( idx(i) );
6540 }
6542 //*************************************************************************************************
6543 
6544 
6545 //*************************************************************************************************
6551 template< typename MT // Type of the dense matrix
6552  , size_t... CRAs > // Compile time row arguments
6554 {
6555  for( size_t i=0UL; i<rows(); ++i ) {
6556  matrix_.reset( idx(i) );
6557  }
6558 }
6560 //*************************************************************************************************
6561 
6562 
6563 //*************************************************************************************************
6572 template< typename MT // Type of the dense matrix
6573  , size_t... CRAs > // Compile time row arguments
6574 inline void Rows<MT,false,true,true,CRAs...>::reset( size_t i )
6575 {
6576  matrix_.reset( idx(i) );
6577 }
6579 //*************************************************************************************************
6580 
6581 
6582 
6583 
6584 //=================================================================================================
6585 //
6586 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
6587 //
6588 //=================================================================================================
6589 
6590 //*************************************************************************************************
6601 template< typename MT // Type of the dense matrix
6602  , size_t... CRAs > // Compile time row arguments
6603 template< typename Other > // Data type of the foreign expression
6604 inline bool Rows<MT,false,true,true,CRAs...>::canAlias( const Other* alias ) const noexcept
6605 {
6606  return matrix_.isAliased( alias );
6607 }
6609 //*************************************************************************************************
6610 
6611 
6612 //*************************************************************************************************
6624 template< typename MT // Type of the dense matrix
6625  , size_t... CRAs > // Compile time row arguments
6626 template< typename MT2 // Data type of the foreign dense row selection
6627  , bool SO2 // Storage order of the foreign dense row selection
6628  , bool SF2 // Symmetry flag of the foreign dense row selection
6629  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row selection
6630 inline bool
6631  Rows<MT,false,true,true,CRAs...>::canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
6632 {
6633  return matrix_.isAliased( &alias->matrix_ );
6634 }
6636 //*************************************************************************************************
6637 
6638 
6639 //*************************************************************************************************
6650 template< typename MT // Type of the dense matrix
6651  , size_t... CRAs > // Compile time row arguments
6652 template< typename Other > // Data type of the foreign expression
6653 inline bool Rows<MT,false,true,true,CRAs...>::isAliased( const Other* alias ) const noexcept
6654 {
6655  return matrix_.isAliased( alias );
6656 }
6658 //*************************************************************************************************
6659 
6660 
6661 //*************************************************************************************************
6673 template< typename MT // Type of the dense matrix
6674  , size_t... CRAs > // Compile time row arguments
6675 template< typename MT2 // Data type of the foreign dense row selection
6676  , bool SO2 // Storage order of the foreign dense row selection
6677  , bool SF2 // Symmetry flag of the foreign dense row selection
6678  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row selection
6679 inline bool
6680  Rows<MT,false,true,true,CRAs...>::isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
6681 {
6682  return matrix_.isAliased( &alias->matrix_ );
6683 }
6685 //*************************************************************************************************
6686 
6687 
6688 //*************************************************************************************************
6698 template< typename MT // Type of the dense matrix
6699  , size_t... CRAs > // Compile time row arguments
6700 inline bool Rows<MT,false,true,true,CRAs...>::isAligned() const noexcept
6701 {
6702  return matrix_.isAligned();
6703 }
6705 //*************************************************************************************************
6706 
6707 
6708 //*************************************************************************************************
6719 template< typename MT // Type of the dense matrix
6720  , size_t... CRAs > // Compile time row arguments
6721 inline bool Rows<MT,false,true,true,CRAs...>::canSMPAssign() const noexcept
6722 {
6723  return ( rows() * columns() > SMP_DMATASSIGN_THRESHOLD );
6724 }
6726 //*************************************************************************************************
6727 
6728 
6729 //*************************************************************************************************
6744 template< typename MT // Type of the dense matrix
6745  , size_t... CRAs > // Compile time row arguments
6746 BLAZE_ALWAYS_INLINE typename Rows<MT,false,true,true,CRAs...>::SIMDType
6747  Rows<MT,false,true,true,CRAs...>::load( size_t i, size_t j ) const noexcept
6748 {
6749  return matrix_.load( j, idx(i) );
6750 }
6752 //*************************************************************************************************
6753 
6754 
6755 //*************************************************************************************************
6770 template< typename MT // Type of the dense matrix
6771  , size_t... CRAs > // Compile time row arguments
6772 BLAZE_ALWAYS_INLINE typename Rows<MT,false,true,true,CRAs...>::SIMDType
6773  Rows<MT,false,true,true,CRAs...>::loada( size_t i, size_t j ) const noexcept
6774 {
6775  return matrix_.loada( j, idx(i) );
6776 }
6778 //*************************************************************************************************
6779 
6780 
6781 //*************************************************************************************************
6796 template< typename MT // Type of the dense matrix
6797  , size_t... CRAs > // Compile time row arguments
6798 BLAZE_ALWAYS_INLINE typename Rows<MT,false,true,true,CRAs...>::SIMDType
6799  Rows<MT,false,true,true,CRAs...>::loadu( size_t i, size_t j ) const noexcept
6800 {
6801  return matrix_.loadu( j, idx(i) );
6802 }
6804 //*************************************************************************************************
6805 
6806 } // namespace blaze
6807 
6808 #endif
Constraint on the data type.
#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.
Header file for kernel specific block sizes.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
Header file for the Schur product trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ROWS_TYPE(T)
Constraint on the data type.In case the given data type T is a row selection type (i...
Definition: Rows.h:81
#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 UNUSED_PARAMETER function template.
EnableIf_< IsDenseMatrix< MT1 > > smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:196
Header file for the subtraction 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 View base class.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
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.
Header file for the IsDiagonal 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
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
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
Header file for the And class template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:827
#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
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
Header file for the decltype(auto) workaround.
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
Constraints on the storage order of matrix types.
#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.
System settings for performance optimizations.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
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
Constraint on the data type.
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 DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
Header file for nested template disabiguation.
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
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
Header file for the HasSIMDAdd type trait.
Header file for the DenseMatrix base class.
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 all SIMD functionality.
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
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:61
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.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
typename RowsTrait< MT, CRAs... >::Type RowsTrait_
Auxiliary alias declaration for the RowsTrait type trait.The RowsTrait_ alias declaration provides a ...
Definition: RowsTrait.h:145
Constraint on the data type.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
Header file for the IsSIMDCombinable type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the HasSIMDMult 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 addition 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
Header file for the reset shim.
Header file for the cache size of the target architecture.
#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
Constraint on the data type.
Constraint on the data type.
Header file for the HasSIMDSub type trait.
Constraints on the storage order of matrix types.
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.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Header file for the rows trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
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
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
Constraint on the data type.
Header file for the implementation of the RowsData class template.
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)
Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Bla...
Definition: Exception.h:187
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.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the implementation of the Rows base template.
Header file for the IsHermitian type trait.
Header file for the IsRestricted type trait.
System settings for the inline keywords.
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.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:801