Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ROW_DENSE_H_
36 #define _BLAZE_MATH_VIEWS_ROW_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <iterator>
45 #include <blaze/math/Aliases.h>
58 #include <blaze/math/Exception.h>
62 #include <blaze/math/shims/Clear.h>
64 #include <blaze/math/shims/Reset.h>
65 #include <blaze/math/SIMD.h>
85 #include <blaze/math/views/Check.h>
88 #include <blaze/system/CacheSize.h>
89 #include <blaze/system/Inline.h>
92 #include <blaze/util/Assert.h>
96 #include <blaze/util/DisableIf.h>
97 #include <blaze/util/EnableIf.h>
98 #include <blaze/util/mpl/If.h>
99 #include <blaze/util/TypeList.h>
100 #include <blaze/util/Types.h>
104 
105 
106 namespace blaze {
107 
108 //=================================================================================================
109 //
110 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR DENSE MATRICES
111 //
112 //=================================================================================================
113 
114 //*************************************************************************************************
122 template< typename MT // Type of the dense matrix
123  , bool SF // Symmetry flag
124  , size_t... CRAs > // Compile time row arguments
125 class Row<MT,true,true,SF,CRAs...>
126  : public View< DenseVector< Row<MT,true,true,SF,CRAs...>, true > >
127  , private RowData<CRAs...>
128 {
129  private:
130  //**Type definitions****************************************************************************
131  using DataType = RowData<CRAs...>;
132  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
133  //**********************************************************************************************
134 
135  public:
136  //**Type definitions****************************************************************************
138  using This = Row<MT,true,true,SF,CRAs...>;
139 
140  using BaseType = DenseVector<This,true>;
141  using ViewedType = MT;
142  using ResultType = RowTrait_t<MT,CRAs...>;
143  using TransposeType = TransposeType_t<ResultType>;
144  using ElementType = ElementType_t<MT>;
145  using SIMDType = SIMDTrait_t<ElementType>;
146  using ReturnType = ReturnType_t<MT>;
147  using CompositeType = const Row&;
148 
150  using ConstReference = ConstReference_t<MT>;
151 
153  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
154 
156  using ConstPointer = ConstPointer_t<MT>;
157 
159  using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
160 
162  using ConstIterator = ConstIterator_t<MT>;
163 
165  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
166  //**********************************************************************************************
167 
168  //**Compilation flags***************************************************************************
170  static constexpr bool simdEnabled = MT::simdEnabled;
171 
173  static constexpr bool smpAssignable = MT::smpAssignable;
174  //**********************************************************************************************
175 
176  //**Constructors********************************************************************************
179  template< typename... RRAs >
180  explicit inline Row( MT& matrix, RRAs... args );
181 
182  Row( const Row& ) = default;
184  //**********************************************************************************************
185 
186  //**Destructor**********************************************************************************
189  ~Row() = default;
191  //**********************************************************************************************
192 
193  //**Data access functions***********************************************************************
196  inline Reference operator[]( size_t index );
197  inline ConstReference operator[]( size_t index ) const;
198  inline Reference at( size_t index );
199  inline ConstReference at( size_t index ) const;
200  inline Pointer data () noexcept;
201  inline ConstPointer data () const noexcept;
202  inline Iterator begin ();
203  inline ConstIterator begin () const;
204  inline ConstIterator cbegin() const;
205  inline Iterator end ();
206  inline ConstIterator end () const;
207  inline ConstIterator cend () const;
209  //**********************************************************************************************
210 
211  //**Assignment operators************************************************************************
214  inline Row& operator=( const ElementType& rhs );
215  inline Row& operator=( initializer_list<ElementType> list );
216  inline Row& operator=( const Row& rhs );
217 
218  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
219  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
220  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
221  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
222  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
223  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
225  //**********************************************************************************************
226 
227  //**Utility functions***************************************************************************
230  using DataType::row;
231 
232  inline MT& operand() noexcept;
233  inline const MT& operand() const noexcept;
234 
235  inline size_t size() const noexcept;
236  inline size_t spacing() const noexcept;
237  inline size_t capacity() const noexcept;
238  inline size_t nonZeros() const;
239  inline void reset();
241  //**********************************************************************************************
242 
243  //**Numeric functions***************************************************************************
246  template< typename Other > inline Row& scale( const Other& scalar );
248  //**********************************************************************************************
249 
250  private:
251  //**********************************************************************************************
253  template< typename VT >
254  static constexpr bool VectorizedAssign_v =
255  ( useOptimizedKernels &&
256  simdEnabled && VT::simdEnabled &&
258  //**********************************************************************************************
259 
260  //**********************************************************************************************
262  template< typename VT >
263  static constexpr bool VectorizedAddAssign_v =
264  ( useOptimizedKernels &&
265  simdEnabled && VT::simdEnabled &&
268  //**********************************************************************************************
269 
270  //**********************************************************************************************
272  template< typename VT >
273  static constexpr bool VectorizedSubAssign_v =
274  ( useOptimizedKernels &&
275  simdEnabled && VT::simdEnabled &&
278  //**********************************************************************************************
279 
280  //**********************************************************************************************
282  template< typename VT >
283  static constexpr bool VectorizedMultAssign_v =
284  ( useOptimizedKernels &&
285  simdEnabled && VT::simdEnabled &&
288  //**********************************************************************************************
289 
290  //**********************************************************************************************
292  template< typename VT >
293  static constexpr bool VectorizedDivAssign_v =
294  ( useOptimizedKernels &&
295  simdEnabled && VT::simdEnabled &&
298  //**********************************************************************************************
299 
300  //**SIMD properties*****************************************************************************
302  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
303  //**********************************************************************************************
304 
305  public:
306  //**Expression template evaluation functions****************************************************
309  template< typename Other >
310  inline bool canAlias( const Other* alias ) const noexcept;
311 
312  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
313  inline bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
314 
315  template< typename Other >
316  inline bool isAliased( const Other* alias ) const noexcept;
317 
318  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
319  inline bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
320 
321  inline bool isAligned () const noexcept;
322  inline bool canSMPAssign() const noexcept;
323 
324  BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
325  BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
326  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
327 
328  BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
329  BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
330  BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
331  BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
332 
333  template< typename VT >
334  inline auto assign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT> >;
335 
336  template< typename VT >
337  inline auto assign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT> >;
338 
339  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
340 
341  template< typename VT >
342  inline auto addAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT> >;
343 
344  template< typename VT >
345  inline auto addAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT> >;
346 
347  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
348 
349  template< typename VT >
350  inline auto subAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT> >;
351 
352  template< typename VT >
353  inline auto subAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT> >;
354 
355  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
356 
357  template< typename VT >
358  inline auto multAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT> >;
359 
360  template< typename VT >
361  inline auto multAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT> >;
362 
363  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
364 
365  template< typename VT >
366  inline auto divAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT> >;
367 
368  template< typename VT >
369  inline auto divAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT> >;
371  //**********************************************************************************************
372 
373  private:
374  //**Member variables****************************************************************************
377  Operand matrix_;
378 
379  //**********************************************************************************************
380 
381  //**Friend declarations*************************************************************************
382  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
383  //**********************************************************************************************
384 
385  //**Compile time checks*************************************************************************
393  //**********************************************************************************************
394 };
396 //*************************************************************************************************
397 
398 
399 
400 
401 //=================================================================================================
402 //
403 // CONSTRUCTORS
404 //
405 //=================================================================================================
406 
407 //*************************************************************************************************
420 template< typename MT // Type of the dense matrix
421  , bool SF // Symmetry flag
422  , size_t... CRAs > // Compile time row arguments
423 template< typename... RRAs > // Runtime row arguments
424 inline Row<MT,true,true,SF,CRAs...>::Row( MT& matrix, RRAs... args )
425  : DataType( args... ) // Base class initialization
426  , matrix_ ( matrix ) // The matrix containing the row
427 {
428  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
429  if( matrix_.rows() <= row() ) {
430  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
431  }
432  }
433  else {
434  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
435  }
436 }
438 //*************************************************************************************************
439 
440 
441 
442 
443 //=================================================================================================
444 //
445 // DATA ACCESS FUNCTIONS
446 //
447 //=================================================================================================
448 
449 //*************************************************************************************************
459 template< typename MT // Type of the dense matrix
460  , bool SF // Symmetry flag
461  , size_t... CRAs > // Compile time row arguments
462 inline typename Row<MT,true,true,SF,CRAs...>::Reference
463  Row<MT,true,true,SF,CRAs...>::operator[]( size_t index )
464 {
465  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
466  return matrix_(row(),index);
467 }
469 //*************************************************************************************************
470 
471 
472 //*************************************************************************************************
482 template< typename MT // Type of the dense matrix
483  , bool SF // Symmetry flag
484  , size_t... CRAs > // Compile time row arguments
485 inline typename Row<MT,true,true,SF,CRAs...>::ConstReference
486  Row<MT,true,true,SF,CRAs...>::operator[]( size_t index ) const
487 {
488  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
489  return const_cast<const MT&>( matrix_ )(row(),index);
490 }
492 //*************************************************************************************************
493 
494 
495 //*************************************************************************************************
506 template< typename MT // Type of the dense matrix
507  , bool SF // Symmetry flag
508  , size_t... CRAs > // Compile time row arguments
509 inline typename Row<MT,true,true,SF,CRAs...>::Reference
510  Row<MT,true,true,SF,CRAs...>::at( size_t index )
511 {
512  if( index >= size() ) {
513  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
514  }
515  return (*this)[index];
516 }
518 //*************************************************************************************************
519 
520 
521 //*************************************************************************************************
532 template< typename MT // Type of the dense matrix
533  , bool SF // Symmetry flag
534  , size_t... CRAs > // Compile time row arguments
535 inline typename Row<MT,true,true,SF,CRAs...>::ConstReference
536  Row<MT,true,true,SF,CRAs...>::at( size_t index ) const
537 {
538  if( index >= size() ) {
539  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
540  }
541  return (*this)[index];
542 }
544 //*************************************************************************************************
545 
546 
547 //*************************************************************************************************
556 template< typename MT // Type of the dense matrix
557  , bool SF // Symmetry flag
558  , size_t... CRAs > // Compile time row arguments
559 inline typename Row<MT,true,true,SF,CRAs...>::Pointer
561 {
562  return matrix_.data( row() );
563 }
565 //*************************************************************************************************
566 
567 
568 //*************************************************************************************************
577 template< typename MT // Type of the dense matrix
578  , bool SF // Symmetry flag
579  , size_t... CRAs > // Compile time row arguments
580 inline typename Row<MT,true,true,SF,CRAs...>::ConstPointer
581  Row<MT,true,true,SF,CRAs...>::data() const noexcept
582 {
583  return matrix_.data( row() );
584 }
586 //*************************************************************************************************
587 
588 
589 //*************************************************************************************************
597 template< typename MT // Type of the dense matrix
598  , bool SF // Symmetry flag
599  , size_t... CRAs > // Compile time row arguments
600 inline typename Row<MT,true,true,SF,CRAs...>::Iterator
602 {
603  return matrix_.begin( row() );
604 }
606 //*************************************************************************************************
607 
608 
609 //*************************************************************************************************
617 template< typename MT // Type of the dense matrix
618  , bool SF // Symmetry flag
619  , size_t... CRAs > // Compile time row arguments
620 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
622 {
623  return matrix_.cbegin( row() );
624 }
626 //*************************************************************************************************
627 
628 
629 //*************************************************************************************************
637 template< typename MT // Type of the dense matrix
638  , bool SF // Symmetry flag
639  , size_t... CRAs > // Compile time row arguments
640 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
642 {
643  return matrix_.cbegin( row() );
644 }
646 //*************************************************************************************************
647 
648 
649 //*************************************************************************************************
657 template< typename MT // Type of the dense matrix
658  , bool SF // Symmetry flag
659  , size_t... CRAs > // Compile time row arguments
660 inline typename Row<MT,true,true,SF,CRAs...>::Iterator
662 {
663  return matrix_.end( row() );
664 }
666 //*************************************************************************************************
667 
668 
669 //*************************************************************************************************
677 template< typename MT // Type of the dense matrix
678  , bool SF // Symmetry flag
679  , size_t... CRAs > // Compile time row arguments
680 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
682 {
683  return matrix_.cend( row() );
684 }
686 //*************************************************************************************************
687 
688 
689 //*************************************************************************************************
697 template< typename MT // Type of the dense matrix
698  , bool SF // Symmetry flag
699  , size_t... CRAs > // Compile time row arguments
700 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
702 {
703  return matrix_.cend( row() );
704 }
706 //*************************************************************************************************
707 
708 
709 
710 
711 //=================================================================================================
712 //
713 // ASSIGNMENT OPERATORS
714 //
715 //=================================================================================================
716 
717 //*************************************************************************************************
728 template< typename MT // Type of the dense matrix
729  , bool SF // Symmetry flag
730  , size_t... CRAs > // Compile time row arguments
731 inline Row<MT,true,true,SF,CRAs...>&
732  Row<MT,true,true,SF,CRAs...>::operator=( const ElementType& rhs )
733 {
734  decltype(auto) left( derestrict( matrix_ ) );
735 
736  const size_t jbegin( ( IsUpper_v<MT> )
737  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
738  ?( row()+1UL )
739  :( row() ) )
740  :( 0UL ) );
741  const size_t jend ( ( IsLower_v<MT> )
742  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
743  ?( row() )
744  :( row()+1UL ) )
745  :( size() ) );
746 
747  for( size_t j=jbegin; j<jend; ++j ) {
748  if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, row(), j, rhs ) )
749  left(row(),j) = rhs;
750  }
751 
752  return *this;
753 }
755 //*************************************************************************************************
756 
757 
758 //*************************************************************************************************
773 template< typename MT // Type of the dense matrix
774  , bool SF // Symmetry flag
775  , size_t... CRAs > // Compile time row arguments
776 inline Row<MT,true,true,SF,CRAs...>&
777  Row<MT,true,true,SF,CRAs...>::operator=( initializer_list<ElementType> list )
778 {
779  if( list.size() > size() ) {
780  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
781  }
782 
783  if( IsRestricted_v<MT> ) {
784  const InitializerVector<ElementType,true> tmp( list, size() );
785  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
786  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
787  }
788  }
789 
790  decltype(auto) left( derestrict( *this ) );
791 
792  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
793 
794  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
795 
796  return *this;
797 }
799 //*************************************************************************************************
800 
801 
802 //*************************************************************************************************
816 template< typename MT // Type of the dense matrix
817  , bool SF // Symmetry flag
818  , size_t... CRAs > // Compile time row arguments
819 inline Row<MT,true,true,SF,CRAs...>&
820  Row<MT,true,true,SF,CRAs...>::operator=( const Row& rhs )
821 {
822  if( &rhs == this ) return *this;
823 
824  if( size() != rhs.size() ) {
825  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
826  }
827 
828  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
829  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
830  }
831 
832  decltype(auto) left( derestrict( *this ) );
833 
834  if( IsExpression_v<MT> && rhs.canAlias( &matrix_ ) ) {
835  const ResultType tmp( rhs );
836  smpAssign( left, tmp );
837  }
838  else {
839  smpAssign( left, rhs );
840  }
841 
842  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
843 
844  return *this;
845 }
847 //*************************************************************************************************
848 
849 
850 //*************************************************************************************************
864 template< typename MT // Type of the dense matrix
865  , bool SF // Symmetry flag
866  , size_t... CRAs > // Compile time row arguments
867 template< typename VT > // Type of the right-hand side vector
868 inline Row<MT,true,true,SF,CRAs...>&
869  Row<MT,true,true,SF,CRAs...>::operator=( const Vector<VT,true>& rhs )
870 {
871  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
873 
874  if( size() != (~rhs).size() ) {
875  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
876  }
877 
878  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
879  Right right( ~rhs );
880 
881  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
882  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
883  }
884 
885  decltype(auto) left( derestrict( *this ) );
886 
887  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
888  const ResultType_t<VT> tmp( right );
889  smpAssign( left, tmp );
890  }
891  else {
892  if( IsSparseVector_v<VT> )
893  reset();
894  smpAssign( left, right );
895  }
896 
897  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
898 
899  return *this;
900 }
902 //*************************************************************************************************
903 
904 
905 //*************************************************************************************************
919 template< typename MT // Type of the dense matrix
920  , bool SF // Symmetry flag
921  , size_t... CRAs > // Compile time row arguments
922 template< typename VT > // Type of the right-hand side vector
923 inline Row<MT,true,true,SF,CRAs...>&
924  Row<MT,true,true,SF,CRAs...>::operator+=( const Vector<VT,true>& rhs )
925 {
926  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
928 
929  if( size() != (~rhs).size() ) {
930  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
931  }
932 
933  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
934  Right right( ~rhs );
935 
936  if( !tryAddAssign( matrix_, right, row(), 0UL ) ) {
937  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
938  }
939 
940  decltype(auto) left( derestrict( *this ) );
941 
942  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
943  const ResultType_t<VT> tmp( right );
944  smpAddAssign( left, tmp );
945  }
946  else {
947  smpAddAssign( left, right );
948  }
949 
950  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
951 
952  return *this;
953 }
955 //*************************************************************************************************
956 
957 
958 //*************************************************************************************************
972 template< typename MT // Type of the dense matrix
973  , bool SF // Symmetry flag
974  , size_t... CRAs > // Compile time row arguments
975 template< typename VT > // Type of the right-hand side vector
976 inline Row<MT,true,true,SF,CRAs...>&
977  Row<MT,true,true,SF,CRAs...>::operator-=( const Vector<VT,true>& rhs )
978 {
979  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
981 
982  if( size() != (~rhs).size() ) {
983  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
984  }
985 
986  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
987  Right right( ~rhs );
988 
989  if( !trySubAssign( matrix_, right, row(), 0UL ) ) {
990  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
991  }
992 
993  decltype(auto) left( derestrict( *this ) );
994 
995  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
996  const ResultType_t<VT> tmp( right );
997  smpSubAssign( left, tmp );
998  }
999  else {
1000  smpSubAssign( left, right );
1001  }
1002 
1003  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1004 
1005  return *this;
1006 }
1008 //*************************************************************************************************
1009 
1010 
1011 //*************************************************************************************************
1024 template< typename MT // Type of the dense matrix
1025  , bool SF // Symmetry flag
1026  , size_t... CRAs > // Compile time row arguments
1027 template< typename VT > // Type of the right-hand side vector
1028 inline Row<MT,true,true,SF,CRAs...>&
1029  Row<MT,true,true,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1030 {
1031  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1033 
1034  if( size() != (~rhs).size() ) {
1035  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1036  }
1037 
1038  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1039  Right right( ~rhs );
1040 
1041  if( !tryMultAssign( matrix_, right, row(), 0UL ) ) {
1042  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1043  }
1044 
1045  decltype(auto) left( derestrict( *this ) );
1046 
1047  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1048  const ResultType_t<VT> tmp( right );
1049  smpMultAssign( left, tmp );
1050  }
1051  else {
1052  smpMultAssign( left, right );
1053  }
1054 
1055  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1056 
1057  return *this;
1058 }
1060 //*************************************************************************************************
1061 
1062 
1063 //*************************************************************************************************
1075 template< typename MT // Type of the dense matrix
1076  , bool SF // Symmetry flag
1077  , size_t... CRAs > // Compile time row arguments
1078 template< typename VT > // Type of the right-hand side dense vector
1079 inline Row<MT,true,true,SF,CRAs...>&
1080  Row<MT,true,true,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1081 {
1082  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1084 
1085  if( size() != (~rhs).size() ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1087  }
1088 
1089  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
1090  Right right( ~rhs );
1091 
1092  if( !tryDivAssign( matrix_, right, row(), 0UL ) ) {
1093  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1094  }
1095 
1096  decltype(auto) left( derestrict( *this ) );
1097 
1098  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1099  const ResultType_t<VT> tmp( right );
1100  smpDivAssign( left, tmp );
1101  }
1102  else {
1103  smpDivAssign( left, right );
1104  }
1105 
1106  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1107 
1108  return *this;
1109 }
1111 //*************************************************************************************************
1112 
1113 
1114 //*************************************************************************************************
1127 template< typename MT // Type of the dense matrix
1128  , bool SF // Symmetry flag
1129  , size_t... CRAs > // Compile time row arguments
1130 template< typename VT > // Type of the right-hand side vector
1131 inline Row<MT,true,true,SF,CRAs...>&
1132  Row<MT,true,true,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1133 {
1134  using blaze::assign;
1135 
1136  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1138 
1139  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1140 
1144 
1145  if( size() != 3UL || (~rhs).size() != 3UL ) {
1146  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1147  }
1148 
1149  const CrossType right( *this % (~rhs) );
1150 
1151  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
1152  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1153  }
1154 
1155  decltype(auto) left( derestrict( *this ) );
1156 
1157  assign( left, right );
1158 
1159  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1160 
1161  return *this;
1162 }
1164 //*************************************************************************************************
1165 
1166 
1167 
1168 
1169 //=================================================================================================
1170 //
1171 // UTILITY FUNCTIONS
1172 //
1173 //=================================================================================================
1174 
1175 //*************************************************************************************************
1181 template< typename MT // Type of the dense matrix
1182  , bool SF // Symmetry flag
1183  , size_t... CRAs > // Compile time row arguments
1184 inline MT& Row<MT,true,true,SF,CRAs...>::operand() noexcept
1185 {
1186  return matrix_;
1187 }
1189 //*************************************************************************************************
1190 
1191 
1192 //*************************************************************************************************
1198 template< typename MT // Type of the dense matrix
1199  , bool SF // Symmetry flag
1200  , size_t... CRAs > // Compile time row arguments
1201 inline const MT& Row<MT,true,true,SF,CRAs...>::operand() const noexcept
1202 {
1203  return matrix_;
1204 }
1206 //*************************************************************************************************
1207 
1208 
1209 //*************************************************************************************************
1215 template< typename MT // Type of the dense matrix
1216  , bool SF // Symmetry flag
1217  , size_t... CRAs > // Compile time row arguments
1218 inline size_t Row<MT,true,true,SF,CRAs...>::size() const noexcept
1219 {
1220  return matrix_.columns();
1221 }
1223 //*************************************************************************************************
1224 
1225 
1226 //*************************************************************************************************
1235 template< typename MT // Type of the dense matrix
1236  , bool SF // Symmetry flag
1237  , size_t... CRAs > // Compile time row arguments
1238 inline size_t Row<MT,true,true,SF,CRAs...>::spacing() const noexcept
1239 {
1240  return matrix_.spacing();
1241 }
1243 //*************************************************************************************************
1244 
1245 
1246 //*************************************************************************************************
1252 template< typename MT // Type of the dense matrix
1253  , bool SF // Symmetry flag
1254  , size_t... CRAs > // Compile time row arguments
1255 inline size_t Row<MT,true,true,SF,CRAs...>::capacity() const noexcept
1256 {
1257  return matrix_.capacity( row() );
1258 }
1260 //*************************************************************************************************
1261 
1262 
1263 //*************************************************************************************************
1272 template< typename MT // Type of the dense matrix
1273  , bool SF // Symmetry flag
1274  , size_t... CRAs > // Compile time row arguments
1275 inline size_t Row<MT,true,true,SF,CRAs...>::nonZeros() const
1276 {
1277  return matrix_.nonZeros( row() );
1278 }
1280 //*************************************************************************************************
1281 
1282 
1283 //*************************************************************************************************
1289 template< typename MT // Type of the dense matrix
1290  , bool SF // Symmetry flag
1291  , size_t... CRAs > // Compile time row arguments
1293 {
1294  matrix_.reset( row() );
1295 }
1297 //*************************************************************************************************
1298 
1299 
1300 
1301 
1302 //=================================================================================================
1303 //
1304 // NUMERIC FUNCTIONS
1305 //
1306 //=================================================================================================
1307 
1308 //*************************************************************************************************
1321 template< typename MT // Type of the dense matrix
1322  , bool SF // Symmetry flag
1323  , size_t... CRAs > // Compile time row arguments
1324 template< typename Other > // Data type of the scalar value
1325 inline Row<MT,true,true,SF,CRAs...>&
1326  Row<MT,true,true,SF,CRAs...>::scale( const Other& scalar )
1327 {
1329 
1330  const size_t jbegin( ( IsUpper_v<MT> )
1331  ?( ( IsStrictlyUpper_v<MT> )
1332  ?( row()+1UL )
1333  :( row() ) )
1334  :( 0UL ) );
1335  const size_t jend ( ( IsLower_v<MT> )
1336  ?( ( IsStrictlyLower_v<MT> )
1337  ?( row() )
1338  :( row()+1UL ) )
1339  :( size() ) );
1340 
1341  for( size_t j=jbegin; j<jend; ++j ) {
1342  matrix_(row(),j) *= scalar;
1343  }
1344 
1345  return *this;
1346 }
1348 //*************************************************************************************************
1349 
1350 
1351 
1352 
1353 //=================================================================================================
1354 //
1355 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1356 //
1357 //=================================================================================================
1358 
1359 //*************************************************************************************************
1370 template< typename MT // Type of the dense matrix
1371  , bool SF // Symmetry flag
1372  , size_t... CRAs > // Compile time row arguments
1373 template< typename Other > // Data type of the foreign expression
1374 inline bool Row<MT,true,true,SF,CRAs...>::canAlias( const Other* alias ) const noexcept
1375 {
1376  return matrix_.isAliased( alias );
1377 }
1379 //*************************************************************************************************
1380 
1381 
1382 //*************************************************************************************************
1393 template< typename MT // Type of the dense matrix
1394  , bool SF // Symmetry flag
1395  , size_t... CRAs > // Compile time row arguments
1396 template< typename MT2 // Data type of the foreign dense row
1397  , bool SO2 // Storage order of the foreign dense row
1398  , bool SF2 // Symmetry flag of the foreign dense row
1399  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
1400 inline bool
1401  Row<MT,true,true,SF,CRAs...>::canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
1402 {
1403  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
1404 }
1406 //*************************************************************************************************
1407 
1408 
1409 //*************************************************************************************************
1420 template< typename MT // Type of the dense matrix
1421  , bool SF // Symmetry flag
1422  , size_t... CRAs > // Compile time row arguments
1423 template< typename Other > // Data type of the foreign expression
1424 inline bool Row<MT,true,true,SF,CRAs...>::isAliased( const Other* alias ) const noexcept
1425 {
1426  return matrix_.isAliased( alias );
1427 }
1429 //*************************************************************************************************
1430 
1431 
1432 //*************************************************************************************************
1443 template< typename MT // Type of the dense matrix
1444  , bool SF // Symmetry flag
1445  , size_t... CRAs > // Compile time row arguments
1446 template< typename MT2 // Data type of the foreign dense row
1447  , bool SO2 // Storage order of the foreign dense row
1448  , bool SF2 // Symmetry flag of the foreign dense row
1449  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
1450 inline bool
1451  Row<MT,true,true,SF,CRAs...>::isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
1452 {
1453  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
1454 }
1456 //*************************************************************************************************
1457 
1458 
1459 //*************************************************************************************************
1469 template< typename MT // Type of the dense matrix
1470  , bool SF // Symmetry flag
1471  , size_t... CRAs > // Compile time row arguments
1472 inline bool Row<MT,true,true,SF,CRAs...>::isAligned() const noexcept
1473 {
1474  return matrix_.isAligned();
1475 }
1477 //*************************************************************************************************
1478 
1479 
1480 //*************************************************************************************************
1491 template< typename MT // Type of the dense matrix
1492  , bool SF // Symmetry flag
1493  , size_t... CRAs > // Compile time row arguments
1494 inline bool Row<MT,true,true,SF,CRAs...>::canSMPAssign() const noexcept
1495 {
1496  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1497 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1515 template< typename MT // Type of the dense matrix
1516  , bool SF // Symmetry flag
1517  , size_t... CRAs > // Compile time row arguments
1518 BLAZE_ALWAYS_INLINE typename Row<MT,true,true,SF,CRAs...>::SIMDType
1519  Row<MT,true,true,SF,CRAs...>::load( size_t index ) const noexcept
1520 {
1521  return matrix_.load( row(), index );
1522 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1540 template< typename MT // Type of the dense matrix
1541  , bool SF // Symmetry flag
1542  , size_t... CRAs > // Compile time row arguments
1543 BLAZE_ALWAYS_INLINE typename Row<MT,true,true,SF,CRAs...>::SIMDType
1544  Row<MT,true,true,SF,CRAs...>::loada( size_t index ) const noexcept
1545 {
1546  return matrix_.loada( row(), index );
1547 }
1549 //*************************************************************************************************
1550 
1551 
1552 //*************************************************************************************************
1565 template< typename MT // Type of the dense matrix
1566  , bool SF // Symmetry flag
1567  , size_t... CRAs > // Compile time row arguments
1568 BLAZE_ALWAYS_INLINE typename Row<MT,true,true,SF,CRAs...>::SIMDType
1569  Row<MT,true,true,SF,CRAs...>::loadu( size_t index ) const noexcept
1570 {
1571  return matrix_.loadu( row(), index );
1572 }
1574 //*************************************************************************************************
1575 
1576 
1577 //*************************************************************************************************
1591 template< typename MT // Type of the dense matrix
1592  , bool SF // Symmetry flag
1593  , size_t... CRAs > // Compile time row arguments
1595  Row<MT,true,true,SF,CRAs...>::store( size_t index, const SIMDType& value ) noexcept
1596 {
1597  matrix_.store( row(), index, value );
1598 }
1600 //*************************************************************************************************
1601 
1602 
1603 //*************************************************************************************************
1617 template< typename MT // Type of the dense matrix
1618  , bool SF // Symmetry flag
1619  , size_t... CRAs > // Compile time row arguments
1621  Row<MT,true,true,SF,CRAs...>::storea( size_t index, const SIMDType& value ) noexcept
1622 {
1623  matrix_.storea( row(), index, value );
1624 }
1626 //*************************************************************************************************
1627 
1628 
1629 //*************************************************************************************************
1643 template< typename MT // Type of the dense matrix
1644  , bool SF // Symmetry flag
1645  , size_t... CRAs > // Compile time row arguments
1647  Row<MT,true,true,SF,CRAs...>::storeu( size_t index, const SIMDType& value ) noexcept
1648 {
1649  matrix_.storeu( row(), index, value );
1650 }
1652 //*************************************************************************************************
1653 
1654 
1655 //*************************************************************************************************
1669 template< typename MT // Type of the dense matrix
1670  , bool SF // Symmetry flag
1671  , size_t... CRAs > // Compile time row arguments
1673  Row<MT,true,true,SF,CRAs...>::stream( size_t index, const SIMDType& value ) noexcept
1674 {
1675  matrix_.stream( row(), index, value );
1676 }
1678 //*************************************************************************************************
1679 
1680 
1681 //*************************************************************************************************
1693 template< typename MT // Type of the dense matrix
1694  , bool SF // Symmetry flag
1695  , size_t... CRAs > // Compile time row arguments
1696 template< typename VT > // Type of the right-hand side dense vector
1697 inline auto Row<MT,true,true,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1698  -> DisableIf_t< VectorizedAssign_v<VT> >
1699 {
1700  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1701 
1702  const size_t jpos( (~rhs).size() & size_t(-2) );
1703  for( size_t j=0UL; j<jpos; j+=2UL ) {
1704  matrix_(row(),j ) = (~rhs)[j ];
1705  matrix_(row(),j+1UL) = (~rhs)[j+1UL];
1706  }
1707  if( jpos < (~rhs).size() )
1708  matrix_(row(),jpos) = (~rhs)[jpos];
1709 }
1711 //*************************************************************************************************
1712 
1713 
1714 //*************************************************************************************************
1726 template< typename MT // Type of the dense matrix
1727  , bool SF // Symmetry flag
1728  , size_t... CRAs > // Compile time row arguments
1729 template< typename VT > // Type of the right-hand side dense vector
1730 inline auto Row<MT,true,true,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1731  -> EnableIf_t< VectorizedAssign_v<VT> >
1732 {
1734 
1735  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1736 
1737  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1738 
1739  const size_t columns( size() );
1740 
1741  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
1742  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
1743 
1744  size_t j( 0UL );
1745  Iterator left( begin() );
1746  ConstIterator_t<VT> right( (~rhs).begin() );
1747 
1748  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1749  {
1750  for( ; j<jpos; j+=SIMDSIZE ) {
1751  left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1752  }
1753  for( ; remainder && j<columns; ++j ) {
1754  *left = *right; ++left; ++right;
1755  }
1756  }
1757  else
1758  {
1759  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1760  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1761  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1762  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1763  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1764  }
1765  for( ; j<jpos; j+=SIMDSIZE ) {
1766  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1767  }
1768  for( ; remainder && j<columns; ++j ) {
1769  *left = *right; ++left; ++right;
1770  }
1771  }
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 VT > // Type of the right-hand side sparse vector
1793 inline void Row<MT,true,true,SF,CRAs...>::assign( const SparseVector<VT,true>& rhs )
1794 {
1795  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1796 
1797  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1798  matrix_(row(),element->index()) = element->value();
1799 }
1801 //*************************************************************************************************
1802 
1803 
1804 //*************************************************************************************************
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 VT > // Type of the right-hand side dense vector
1820 inline auto Row<MT,true,true,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1821  -> DisableIf_t< VectorizedAddAssign_v<VT> >
1822 {
1823  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1824 
1825  const size_t jpos( (~rhs).size() & size_t(-2) );
1826  for( size_t j=0UL; j<jpos; j+=2UL ) {
1827  matrix_(row(),j ) += (~rhs)[j ];
1828  matrix_(row(),j+1UL) += (~rhs)[j+1UL];
1829  }
1830  if( jpos < (~rhs).size() )
1831  matrix_(row(),jpos) += (~rhs)[jpos];
1832 }
1834 //*************************************************************************************************
1835 
1836 
1837 //*************************************************************************************************
1849 template< typename MT // Type of the dense matrix
1850  , bool SF // Symmetry flag
1851  , size_t... CRAs > // Compile time row arguments
1852 template< typename VT > // Type of the right-hand side dense vector
1853 inline auto Row<MT,true,true,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1854  -> EnableIf_t< VectorizedAddAssign_v<VT> >
1855 {
1857 
1858  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1859 
1860  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1861 
1862  const size_t columns( size() );
1863 
1864  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
1865  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
1866 
1867  size_t j( 0UL );
1868  Iterator left( begin() );
1869  ConstIterator_t<VT> right( (~rhs).begin() );
1870 
1871  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1872  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1873  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1874  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1875  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1876  }
1877  for( ; j<jpos; j+=SIMDSIZE ) {
1878  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1879  }
1880  for( ; remainder && j<columns; ++j ) {
1881  *left += *right; ++left; ++right;
1882  }
1883 }
1885 //*************************************************************************************************
1886 
1887 
1888 //*************************************************************************************************
1900 template< typename MT // Type of the dense matrix
1901  , bool SF // Symmetry flag
1902  , size_t... CRAs > // Compile time row arguments
1903 template< typename VT > // Type of the right-hand side sparse vector
1904 inline void Row<MT,true,true,SF,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
1905 {
1906  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1907 
1908  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1909  matrix_(row(),element->index()) += element->value();
1910 }
1912 //*************************************************************************************************
1913 
1914 
1915 //*************************************************************************************************
1927 template< typename MT // Type of the dense matrix
1928  , bool SF // Symmetry flag
1929  , size_t... CRAs > // Compile time row arguments
1930 template< typename VT > // Type of the right-hand side dense vector
1931 inline auto Row<MT,true,true,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
1932  -> DisableIf_t< VectorizedSubAssign_v<VT> >
1933 {
1934  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1935 
1936  const size_t jpos( (~rhs).size() & size_t(-2) );
1937  for( size_t j=0UL; j<jpos; j+=2UL ) {
1938  matrix_(row(),j ) -= (~rhs)[j ];
1939  matrix_(row(),j+1UL) -= (~rhs)[j+1UL];
1940  }
1941  if( jpos < (~rhs).size() )
1942  matrix_(row(),jpos) -= (~rhs)[jpos];
1943 }
1945 //*************************************************************************************************
1946 
1947 
1948 //*************************************************************************************************
1960 template< typename MT // Type of the dense matrix
1961  , bool SF // Symmetry flag
1962  , size_t... CRAs > // Compile time row arguments
1963 template< typename VT > // Type of the right-hand side dense vector
1964 inline auto Row<MT,true,true,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
1965  -> EnableIf_t< VectorizedSubAssign_v<VT> >
1966 {
1968 
1969  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1970 
1971  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1972 
1973  const size_t columns( size() );
1974 
1975  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
1976  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
1977 
1978  size_t j( 0UL );
1979  Iterator left( begin() );
1980  ConstIterator_t<VT> right( (~rhs).begin() );
1981 
1982  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1983  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1984  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1985  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1986  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1987  }
1988  for( ; j<jpos; j+=SIMDSIZE ) {
1989  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1990  }
1991  for( ; remainder && j<columns; ++j ) {
1992  *left -= *right; ++left; ++right;
1993  }
1994 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2011 template< typename MT // Type of the dense matrix
2012  , bool SF // Symmetry flag
2013  , size_t... CRAs > // Compile time row arguments
2014 template< typename VT > // Type of the right-hand side sparse vector
2015 inline void Row<MT,true,true,SF,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
2016 {
2017  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2018 
2019  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2020  matrix_(row(),element->index()) -= element->value();
2021 }
2023 //*************************************************************************************************
2024 
2025 
2026 //*************************************************************************************************
2038 template< typename MT // Type of the dense matrix
2039  , bool SF // Symmetry flag
2040  , size_t... CRAs > // Compile time row arguments
2041 template< typename VT > // Type of the right-hand side dense vector
2042 inline auto Row<MT,true,true,SF,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
2043  -> DisableIf_t< VectorizedMultAssign_v<VT> >
2044 {
2045  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2046 
2047  const size_t jpos( (~rhs).size() & size_t(-2) );
2048  for( size_t j=0UL; j<jpos; j+=2UL ) {
2049  matrix_(row(),j ) *= (~rhs)[j ];
2050  matrix_(row(),j+1UL) *= (~rhs)[j+1UL];
2051  }
2052  if( jpos < (~rhs).size() )
2053  matrix_(row(),jpos) *= (~rhs)[jpos];
2054 }
2056 //*************************************************************************************************
2057 
2058 
2059 //*************************************************************************************************
2071 template< typename MT // Type of the dense matrix
2072  , bool SF // Symmetry flag
2073  , size_t... CRAs > // Compile time row arguments
2074 template< typename VT > // Type of the right-hand side dense vector
2075 inline auto Row<MT,true,true,SF,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
2076  -> EnableIf_t< VectorizedMultAssign_v<VT> >
2077 {
2079 
2080  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2081 
2082  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
2083 
2084  const size_t columns( size() );
2085 
2086  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
2087  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2088 
2089  size_t j( 0UL );
2090  Iterator left( begin() );
2091  ConstIterator_t<VT> right( (~rhs).begin() );
2092 
2093  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2094  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2095  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2096  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2097  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2098  }
2099  for( ; j<jpos; j+=SIMDSIZE ) {
2100  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2101  }
2102  for( ; remainder && j<columns; ++j ) {
2103  *left *= *right; ++left; ++right;
2104  }
2105 }
2107 //*************************************************************************************************
2108 
2109 
2110 //*************************************************************************************************
2122 template< typename MT // Type of the dense matrix
2123  , bool SF // Symmetry flag
2124  , size_t... CRAs > // Compile time row arguments
2125 template< typename VT > // Type of the right-hand side sparse vector
2126 inline void Row<MT,true,true,SF,CRAs...>::multAssign( const SparseVector<VT,true>& rhs )
2127 {
2128  using blaze::reset;
2129 
2130  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2131 
2132  size_t j( 0UL );
2133 
2134  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2135  const size_t index( element->index() );
2136  for( ; j<index; ++j )
2137  reset( matrix_(row(),j) );
2138  matrix_(row(),j) *= element->value();
2139  ++j;
2140  }
2141 
2142  for( ; j<size(); ++j ) {
2143  reset( matrix_(row(),j) );
2144  }
2145 }
2147 //*************************************************************************************************
2148 
2149 
2150 //*************************************************************************************************
2162 template< typename MT // Type of the dense matrix
2163  , bool SF // Symmetry flag
2164  , size_t... CRAs > // Compile time row arguments
2165 template< typename VT > // Type of the right-hand side dense vector
2166 inline auto Row<MT,true,true,SF,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
2167  -> DisableIf_t< VectorizedDivAssign_v<VT> >
2168 {
2169  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2170 
2171  const size_t jpos( (~rhs).size() & size_t(-2) );
2172  for( size_t j=0UL; j<jpos; j+=2UL ) {
2173  matrix_(row(),j ) /= (~rhs)[j ];
2174  matrix_(row(),j+1UL) /= (~rhs)[j+1UL];
2175  }
2176  if( jpos < (~rhs).size() )
2177  matrix_(row(),jpos) /= (~rhs)[jpos];
2178 }
2180 //*************************************************************************************************
2181 
2182 
2183 //*************************************************************************************************
2195 template< typename MT // Type of the dense matrix
2196  , bool SF // Symmetry flag
2197  , size_t... CRAs > // Compile time row arguments
2198 template< typename VT > // Type of the right-hand side dense vector
2199 inline auto Row<MT,true,true,SF,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
2200  -> EnableIf_t< VectorizedDivAssign_v<VT> >
2201 {
2203 
2204  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2205 
2206  const size_t columns( size() );
2207 
2208  const size_t jpos( columns & size_t(-SIMDSIZE) );
2209  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2210 
2211  size_t j( 0UL );
2212  Iterator left( begin() );
2213  ConstIterator_t<VT> right( (~rhs).begin() );
2214 
2215  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2216  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2217  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2218  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2219  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2220  }
2221  for( ; j<jpos; j+=SIMDSIZE ) {
2222  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2223  }
2224  for( ; j<columns; ++j ) {
2225  *left /= *right; ++left; ++right;
2226  }
2227 }
2229 //*************************************************************************************************
2230 
2231 
2232 
2233 
2234 
2235 
2236 
2237 
2238 //=================================================================================================
2239 //
2240 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR MATRICES
2241 //
2242 //=================================================================================================
2243 
2244 //*************************************************************************************************
2252 template< typename MT // Type of the dense matrix
2253  , size_t... CRAs > // Compile time row arguments
2254 class Row<MT,false,true,false,CRAs...>
2255  : public View< DenseVector< Row<MT,false,true,false,CRAs...>, true > >
2256  , private RowData<CRAs...>
2257 {
2258  private:
2259  //**Type definitions****************************************************************************
2260  using DataType = RowData<CRAs...>;
2261  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2262  //**********************************************************************************************
2263 
2264  public:
2265  //**Type definitions****************************************************************************
2267  using This = Row<MT,false,true,false,CRAs...>;
2268 
2269  using BaseType = DenseVector<This,true>;
2270  using ViewedType = MT;
2271  using ResultType = RowTrait_t<MT,CRAs...>;
2272  using TransposeType = TransposeType_t<ResultType>;
2273  using ElementType = ElementType_t<MT>;
2274  using ReturnType = ElementType_t<MT>;
2275  using CompositeType = const Row&;
2276 
2278  using ConstReference = ConstReference_t<MT>;
2279 
2281  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2282 
2284  using ConstPointer = ConstPointer_t<MT>;
2285 
2287  using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
2288  //**********************************************************************************************
2289 
2290  //**RowIterator class definition****************************************************************
2293  template< typename MatrixType // Type of the dense matrix
2294  , typename IteratorType > // Type of the dense matrix iterator
2295  class RowIterator
2296  {
2297  public:
2298  //**Type definitions*************************************************************************
2300  using IteratorCategory = typename std::iterator_traits<IteratorType>::iterator_category;
2301 
2303  using ValueType = typename std::iterator_traits<IteratorType>::value_type;
2304 
2306  using PointerType = typename std::iterator_traits<IteratorType>::pointer;
2307 
2309  using ReferenceType = typename std::iterator_traits<IteratorType>::reference;
2310 
2312  using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
2313 
2314  // STL iterator requirements
2315  using iterator_category = IteratorCategory;
2316  using value_type = ValueType;
2317  using pointer = PointerType;
2318  using reference = ReferenceType;
2319  using difference_type = DifferenceType;
2320  //*******************************************************************************************
2321 
2322  //**Constructor******************************************************************************
2325  inline RowIterator() noexcept
2326  : matrix_( nullptr ) // The dense matrix containing the row
2327  , row_ ( 0UL ) // The current row index
2328  , column_( 0UL ) // The current column index
2329  , pos_ ( ) // Iterator to the current dense element
2330  {}
2331  //*******************************************************************************************
2332 
2333  //**Constructor******************************************************************************
2340  inline RowIterator( MatrixType& matrix, size_t row, size_t column ) noexcept
2341  : matrix_( &matrix ) // The dense matrix containing the row
2342  , row_ ( row ) // The current row index
2343  , column_( column ) // The current column index
2344  , pos_ ( ) // Iterator to the current dense element
2345  {
2346  if( column_ != matrix_->columns() )
2347  pos_ = matrix_->begin( column_ ) + row_;
2348  }
2349  //*******************************************************************************************
2350 
2351  //**Constructor******************************************************************************
2356  template< typename MatrixType2, typename IteratorType2 >
2357  inline RowIterator( const RowIterator<MatrixType2,IteratorType2>& it ) noexcept
2358  : matrix_( it.matrix_ ) // The dense matrix containing the row
2359  , row_ ( it.row_ ) // The current row index
2360  , column_( it.column_ ) // The current column index
2361  , pos_ ( it.pos_ ) // Iterator to the current dense element
2362  {}
2363  //*******************************************************************************************
2364 
2365  //**Addition assignment operator*************************************************************
2371  inline RowIterator& operator+=( size_t inc ) noexcept {
2372  using blaze::reset;
2373  column_ += inc;
2374  if( column_ != matrix_->columns() )
2375  pos_ = matrix_->begin( column_ ) + row_;
2376  else reset( pos_ );
2377  return *this;
2378  }
2379  //*******************************************************************************************
2380 
2381  //**Subtraction assignment operator**********************************************************
2387  inline RowIterator& operator-=( size_t dec ) noexcept {
2388  using blaze::reset;
2389  column_ -= dec;
2390  if( column_ != matrix_->columns() )
2391  pos_ = matrix_->begin( column_ ) + row_;
2392  else reset( pos_ );
2393  return *this;
2394  }
2395  //*******************************************************************************************
2396 
2397  //**Prefix increment operator****************************************************************
2402  inline RowIterator& operator++() noexcept {
2403  using blaze::reset;
2404  ++column_;
2405  if( column_ != matrix_->columns() )
2406  pos_ = matrix_->begin( column_ ) + row_;
2407  else reset( pos_ );
2408  return *this;
2409  }
2410  //*******************************************************************************************
2411 
2412  //**Postfix increment operator***************************************************************
2417  inline const RowIterator operator++( int ) noexcept {
2418  const RowIterator tmp( *this );
2419  ++(*this);
2420  return tmp;
2421  }
2422  //*******************************************************************************************
2423 
2424  //**Prefix decrement operator****************************************************************
2429  inline RowIterator& operator--() noexcept {
2430  using blaze::reset;
2431  --column_;
2432  if( column_ != matrix_->columns() )
2433  pos_ = matrix_->begin( column_ ) + row_;
2434  else reset( pos_ );
2435  return *this;
2436  }
2437  //*******************************************************************************************
2438 
2439  //**Postfix decrement operator***************************************************************
2444  inline const RowIterator operator--( int ) noexcept {
2445  const RowIterator tmp( *this );
2446  --(*this);
2447  return tmp;
2448  }
2449  //*******************************************************************************************
2450 
2451  //**Subscript operator***********************************************************************
2457  inline ReferenceType operator[]( size_t index ) const {
2458  BLAZE_USER_ASSERT( column_+index < matrix_->columns(), "Invalid access index detected" );
2459  const IteratorType pos( matrix_->begin( column_+index ) + row_ );
2460  return *pos;
2461  }
2462  //*******************************************************************************************
2463 
2464  //**Element access operator******************************************************************
2469  inline ReferenceType operator*() const {
2470  return *pos_;
2471  }
2472  //*******************************************************************************************
2473 
2474  //**Element access operator******************************************************************
2479  inline PointerType operator->() const {
2480  return pos_;
2481  }
2482  //*******************************************************************************************
2483 
2484  //**Equality operator************************************************************************
2490  template< typename MatrixType2, typename IteratorType2 >
2491  inline bool operator==( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2492  return column_ == rhs.column_;
2493  }
2494  //*******************************************************************************************
2495 
2496  //**Inequality operator**********************************************************************
2502  template< typename MatrixType2, typename IteratorType2 >
2503  inline bool operator!=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2504  return !( *this == rhs );
2505  }
2506  //*******************************************************************************************
2507 
2508  //**Less-than operator***********************************************************************
2514  template< typename MatrixType2, typename IteratorType2 >
2515  inline bool operator<( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2516  return column_ < rhs.column_;
2517  }
2518  //*******************************************************************************************
2519 
2520  //**Greater-than operator********************************************************************
2526  template< typename MatrixType2, typename IteratorType2 >
2527  inline bool operator>( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2528  return column_ > rhs.column_;
2529  }
2530  //*******************************************************************************************
2531 
2532  //**Less-or-equal-than operator**************************************************************
2538  template< typename MatrixType2, typename IteratorType2 >
2539  inline bool operator<=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2540  return column_ <= rhs.column_;
2541  }
2542  //*******************************************************************************************
2543 
2544  //**Greater-or-equal-than operator***********************************************************
2550  template< typename MatrixType2, typename IteratorType2 >
2551  inline bool operator>=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2552  return column_ >= rhs.column_;
2553  }
2554  //*******************************************************************************************
2555 
2556  //**Subtraction operator*********************************************************************
2562  inline DifferenceType operator-( const RowIterator& rhs ) const noexcept {
2563  return column_ - rhs.column_;
2564  }
2565  //*******************************************************************************************
2566 
2567  //**Addition operator************************************************************************
2574  friend inline const RowIterator operator+( const RowIterator& it, size_t inc ) noexcept {
2575  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2576  }
2577  //*******************************************************************************************
2578 
2579  //**Addition operator************************************************************************
2586  friend inline const RowIterator operator+( size_t inc, const RowIterator& it ) noexcept {
2587  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2588  }
2589  //*******************************************************************************************
2590 
2591  //**Subtraction operator*********************************************************************
2598  friend inline const RowIterator operator-( const RowIterator& it, size_t dec ) noexcept {
2599  return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2600  }
2601  //*******************************************************************************************
2602 
2603  private:
2604  //**Member variables*************************************************************************
2605  MatrixType* matrix_;
2606  size_t row_;
2607  size_t column_;
2608  IteratorType pos_;
2609  //*******************************************************************************************
2610 
2611  //**Friend declarations**********************************************************************
2612  template< typename MatrixType2, typename IteratorType2 > friend class RowIterator;
2613  //*******************************************************************************************
2614  };
2615  //**********************************************************************************************
2616 
2617  //**Type definitions****************************************************************************
2619  using ConstIterator = RowIterator< const MT, ConstIterator_t<MT> >;
2620 
2622  using Iterator = If_t< IsConst_v<MT>, ConstIterator, RowIterator< MT, Iterator_t<MT> > >;
2623  //**********************************************************************************************
2624 
2625  //**Compilation flags***************************************************************************
2627  static constexpr bool simdEnabled = false;
2628 
2630  static constexpr bool smpAssignable = MT::smpAssignable;
2631  //**********************************************************************************************
2632 
2633  //**Constructors********************************************************************************
2636  template< typename... RRAs >
2637  explicit inline Row( MT& matrix, RRAs... args );
2638 
2639  Row( const Row& ) = default;
2641  //**********************************************************************************************
2642 
2643  //**Destructor**********************************************************************************
2646  ~Row() = default;
2648  //**********************************************************************************************
2649 
2650  //**Data access functions***********************************************************************
2653  inline Reference operator[]( size_t index );
2654  inline ConstReference operator[]( size_t index ) const;
2655  inline Reference at( size_t index );
2656  inline ConstReference at( size_t index ) const;
2657  inline Pointer data () noexcept;
2658  inline ConstPointer data () const noexcept;
2659  inline Iterator begin ();
2660  inline ConstIterator begin () const;
2661  inline ConstIterator cbegin() const;
2662  inline Iterator end ();
2663  inline ConstIterator end () const;
2664  inline ConstIterator cend () const;
2666  //**********************************************************************************************
2667 
2668  //**Assignment operators************************************************************************
2671  inline Row& operator=( const ElementType& rhs );
2672  inline Row& operator=( initializer_list<ElementType> list );
2673  inline Row& operator=( const Row& rhs );
2674 
2675  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2676  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2677  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2678  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
2679  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2680  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
2682  //**********************************************************************************************
2683 
2684  //**Utility functions***************************************************************************
2687  using DataType::row;
2688 
2689  inline MT& operand() noexcept;
2690  inline const MT& operand() const noexcept;
2691 
2692  inline size_t size() const noexcept;
2693  inline size_t spacing() const noexcept;
2694  inline size_t capacity() const noexcept;
2695  inline size_t nonZeros() const;
2696  inline void reset();
2698  //**********************************************************************************************
2699 
2700  //**Numeric functions***************************************************************************
2703  template< typename Other > inline Row& scale( const Other& scalar );
2705  //**********************************************************************************************
2706 
2707  //**Expression template evaluation functions****************************************************
2710  template< typename Other >
2711  inline bool canAlias( const Other* alias ) const noexcept;
2712 
2713  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
2714  inline bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
2715 
2716  template< typename Other >
2717  inline bool isAliased( const Other* alias ) const noexcept;
2718 
2719  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
2720  inline bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
2721 
2722  inline bool isAligned () const noexcept;
2723  inline bool canSMPAssign() const noexcept;
2724 
2725  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2726  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2727  template< typename VT > inline void addAssign ( const DenseVector <VT,true>& rhs );
2728  template< typename VT > inline void addAssign ( const SparseVector<VT,true>& rhs );
2729  template< typename VT > inline void subAssign ( const DenseVector <VT,true>& rhs );
2730  template< typename VT > inline void subAssign ( const SparseVector<VT,true>& rhs );
2731  template< typename VT > inline void multAssign( const DenseVector <VT,true>& rhs );
2732  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
2733  template< typename VT > inline void divAssign ( const DenseVector <VT,true>& rhs );
2735  //**********************************************************************************************
2736 
2737  private:
2738  //**Member variables****************************************************************************
2741  Operand matrix_;
2742 
2743  //**********************************************************************************************
2744 
2745  //**Friend declarations*************************************************************************
2746  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
2747  //**********************************************************************************************
2748 
2749  //**Compile time checks*************************************************************************
2758  //**********************************************************************************************
2759 };
2761 //*************************************************************************************************
2762 
2763 
2764 
2765 
2766 //=================================================================================================
2767 //
2768 // CONSTRUCTORS
2769 //
2770 //=================================================================================================
2771 
2772 //*************************************************************************************************
2785 template< typename MT // Type of the dense matrix
2786  , size_t... CRAs > // Compile time row arguments
2787 template< typename... RRAs > // Runtime row arguments
2788 inline Row<MT,false,true,false,CRAs...>::Row( MT& matrix, RRAs... args )
2789  : DataType( args... ) // Base class initialization
2790  , matrix_ ( matrix ) // The matrix containing the row
2791 {
2792  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
2793  if( matrix_.rows() <= row() ) {
2794  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
2795  }
2796  }
2797  else {
2798  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
2799  }
2800 }
2802 //*************************************************************************************************
2803 
2804 
2805 
2806 
2807 //=================================================================================================
2808 //
2809 // DATA ACCESS FUNCTIONS
2810 //
2811 //=================================================================================================
2812 
2813 //*************************************************************************************************
2823 template< typename MT // Type of the dense matrix
2824  , size_t... CRAs > // Compile time row arguments
2825 inline typename Row<MT,false,true,false,CRAs...>::Reference
2826  Row<MT,false,true,false,CRAs...>::operator[]( size_t index )
2827 {
2828  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2829  return matrix_(row(),index);
2830 }
2832 //*************************************************************************************************
2833 
2834 
2835 //*************************************************************************************************
2845 template< typename MT // Type of the dense matrix
2846  , size_t... CRAs > // Compile time row arguments
2847 inline typename Row<MT,false,true,false,CRAs...>::ConstReference
2848  Row<MT,false,true,false,CRAs...>::operator[]( size_t index ) const
2849 {
2850  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2851  return const_cast<const MT&>( matrix_ )(row(),index);
2852 }
2854 //*************************************************************************************************
2855 
2856 
2857 //*************************************************************************************************
2868 template< typename MT // Type of the dense matrix
2869  , size_t... CRAs > // Compile time row arguments
2870 inline typename Row<MT,false,true,false,CRAs...>::Reference
2871  Row<MT,false,true,false,CRAs...>::at( size_t index )
2872 {
2873  if( index >= size() ) {
2874  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2875  }
2876  return (*this)[index];
2877 }
2879 //*************************************************************************************************
2880 
2881 
2882 //*************************************************************************************************
2893 template< typename MT // Type of the dense matrix
2894  , size_t... CRAs > // Compile time row arguments
2895 inline typename Row<MT,false,true,false,CRAs...>::ConstReference
2896  Row<MT,false,true,false,CRAs...>::at( size_t index ) const
2897 {
2898  if( index >= size() ) {
2899  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2900  }
2901  return (*this)[index];
2902 }
2904 //*************************************************************************************************
2905 
2906 
2907 //*************************************************************************************************
2916 template< typename MT // Type of the dense matrix
2917  , size_t... CRAs > // Compile time row arguments
2918 inline typename Row<MT,false,true,false,CRAs...>::Pointer
2920 {
2921  return matrix_.data() + row();
2922 }
2924 //*************************************************************************************************
2925 
2926 
2927 //*************************************************************************************************
2936 template< typename MT // Type of the dense matrix
2937  , size_t... CRAs > // Compile time row arguments
2938 inline typename Row<MT,false,true,false,CRAs...>::ConstPointer
2940 {
2941  return matrix_.data() + row();
2942 }
2944 //*************************************************************************************************
2945 
2946 
2947 //*************************************************************************************************
2955 template< typename MT // Type of the dense matrix
2956  , size_t... CRAs > // Compile time row arguments
2957 inline typename Row<MT,false,true,false,CRAs...>::Iterator
2959 {
2960  return Iterator( matrix_, row(), 0UL );
2961 }
2963 //*************************************************************************************************
2964 
2965 
2966 //*************************************************************************************************
2974 template< typename MT // Type of the dense matrix
2975  , size_t... CRAs > // Compile time row arguments
2976 inline typename Row<MT,false,true,false,CRAs...>::ConstIterator
2978 {
2979  return ConstIterator( matrix_, row(), 0UL );
2980 }
2982 //*************************************************************************************************
2983 
2984 
2985 //*************************************************************************************************
2993 template< typename MT // Type of the dense matrix
2994  , size_t... CRAs > // Compile time row arguments
2995 inline typename Row<MT,false,true,false,CRAs...>::ConstIterator
2997 {
2998  return ConstIterator( matrix_, row(), 0UL );
2999 }
3001 //*************************************************************************************************
3002 
3003 
3004 //*************************************************************************************************
3012 template< typename MT // Type of the dense matrix
3013  , size_t... CRAs > // Compile time row arguments
3014 inline typename Row<MT,false,true,false,CRAs...>::Iterator
3016 {
3017  return Iterator( matrix_, row(), size() );
3018 }
3020 //*************************************************************************************************
3021 
3022 
3023 //*************************************************************************************************
3031 template< typename MT // Type of the dense matrix
3032  , size_t... CRAs > // Compile time row arguments
3033 inline typename Row<MT,false,true,false,CRAs...>::ConstIterator
3035 {
3036  return ConstIterator( matrix_, row(), size() );
3037 }
3039 //*************************************************************************************************
3040 
3041 
3042 //*************************************************************************************************
3050 template< typename MT // Type of the dense matrix
3051  , size_t... CRAs > // Compile time row arguments
3052 inline typename Row<MT,false,true,false,CRAs...>::ConstIterator
3054 {
3055  return ConstIterator( matrix_, row(), size() );
3056 }
3058 //*************************************************************************************************
3059 
3060 
3061 
3062 
3063 //=================================================================================================
3064 //
3065 // ASSIGNMENT OPERATORS
3066 //
3067 //=================================================================================================
3068 
3069 //*************************************************************************************************
3080 template< typename MT // Type of the dense matrix
3081  , size_t... CRAs > // Compile time row arguments
3082 inline Row<MT,false,true,false,CRAs...>&
3083  Row<MT,false,true,false,CRAs...>::operator=( const ElementType& rhs )
3084 {
3085  decltype(auto) left( derestrict( matrix_ ) );
3086 
3087  const size_t jbegin( ( IsUpper_v<MT> )
3088  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3089  ?( row()+1UL )
3090  :( row() ) )
3091  :( 0UL ) );
3092  const size_t jend ( ( IsLower_v<MT> )
3093  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3094  ?( row() )
3095  :( row()+1UL ) )
3096  :( size() ) );
3097 
3098  for( size_t j=jbegin; j<jend; ++j ) {
3099  if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, row(), j, rhs ) )
3100  left(row(),j) = rhs;
3101  }
3102 
3103  return *this;
3104 }
3106 //*************************************************************************************************
3107 
3108 
3109 //*************************************************************************************************
3124 template< typename MT // Type of the dense matrix
3125  , size_t... CRAs > // Compile time row arguments
3126 inline Row<MT,false,true,false,CRAs...>&
3127  Row<MT,false,true,false,CRAs...>::operator=( initializer_list<ElementType> list )
3128 {
3129  if( list.size() > size() ) {
3130  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
3131  }
3132 
3133  if( IsRestricted_v<MT> ) {
3134  const InitializerVector<ElementType,true> tmp( list, size() );
3135  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3136  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3137  }
3138  }
3139 
3140  decltype(auto) left( derestrict( *this ) );
3141 
3142  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
3143 
3144  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3145 
3146  return *this;
3147 }
3149 //*************************************************************************************************
3150 
3151 
3152 //*************************************************************************************************
3166 template< typename MT // Type of the dense matrix
3167  , size_t... CRAs > // Compile time row arguments
3168 inline Row<MT,false,true,false,CRAs...>&
3169  Row<MT,false,true,false,CRAs...>::operator=( const Row& rhs )
3170 {
3171  if( &rhs == this ) return *this;
3172 
3173  if( size() != rhs.size() ) {
3174  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
3175  }
3176 
3177  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
3178  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3179  }
3180 
3181  decltype(auto) left( derestrict( *this ) );
3182 
3183  if( IsExpression_v<MT> && rhs.canAlias( &matrix_ ) ) {
3184  const ResultType tmp( rhs );
3185  smpAssign( left, tmp );
3186  }
3187  else {
3188  smpAssign( left, rhs );
3189  }
3190 
3191  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3192 
3193  return *this;
3194 }
3196 //*************************************************************************************************
3197 
3198 
3199 //*************************************************************************************************
3213 template< typename MT // Type of the dense matrix
3214  , size_t... CRAs > // Compile time row arguments
3215 template< typename VT > // Type of the right-hand side vector
3216 inline Row<MT,false,true,false,CRAs...>&
3217  Row<MT,false,true,false,CRAs...>::operator=( const Vector<VT,true>& rhs )
3218 {
3222 
3223  if( size() != (~rhs).size() ) {
3224  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3225  }
3226 
3227  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
3228  Right right( ~rhs );
3229 
3230  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
3231  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3232  }
3233 
3234  decltype(auto) left( derestrict( *this ) );
3235 
3236  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
3237  const ResultType tmp( right );
3238  smpAssign( left, tmp );
3239  }
3240  else {
3241  if( IsSparseVector_v<VT> )
3242  reset();
3243  smpAssign( left, right );
3244  }
3245 
3246  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3247 
3248  return *this;
3249 }
3251 //*************************************************************************************************
3252 
3253 
3254 //*************************************************************************************************
3268 template< typename MT // Type of the dense matrix
3269  , size_t... CRAs > // Compile time row arguments
3270 template< typename VT > // Type of the right-hand side vector
3271 inline Row<MT,false,true,false,CRAs...>&
3272  Row<MT,false,true,false,CRAs...>::operator+=( const Vector<VT,true>& rhs )
3273 {
3274  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3276 
3277  if( size() != (~rhs).size() ) {
3278  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3279  }
3280 
3281  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
3282  Right right( ~rhs );
3283 
3284  if( !tryAddAssign( matrix_, right, row(), 0UL ) ) {
3285  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3286  }
3287 
3288  decltype(auto) left( derestrict( *this ) );
3289 
3290  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
3291  const ResultType_t<VT> tmp( right );
3292  smpAddAssign( left, tmp );
3293  }
3294  else {
3295  smpAddAssign( left, right );
3296  }
3297 
3298  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3299 
3300  return *this;
3301 }
3303 //*************************************************************************************************
3304 
3305 
3306 //*************************************************************************************************
3320 template< typename MT // Type of the dense matrix
3321  , size_t... CRAs > // Compile time row arguments
3322 template< typename VT > // Type of the right-hand side vector
3323 inline Row<MT,false,true,false,CRAs...>&
3324  Row<MT,false,true,false,CRAs...>::operator-=( const Vector<VT,true>& rhs )
3325 {
3326  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3328 
3329  if( size() != (~rhs).size() ) {
3330  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3331  }
3332 
3333  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
3334  Right right( ~rhs );
3335 
3336  if( !trySubAssign( matrix_, right, row(), 0UL ) ) {
3337  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3338  }
3339 
3340  decltype(auto) left( derestrict( *this ) );
3341 
3342  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
3343  const ResultType_t<VT> tmp( right );
3344  smpSubAssign( left, tmp );
3345  }
3346  else {
3347  smpSubAssign( left, right );
3348  }
3349 
3350  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3351 
3352  return *this;
3353 }
3355 //*************************************************************************************************
3356 
3357 
3358 //*************************************************************************************************
3371 template< typename MT // Type of the dense matrix
3372  , size_t... CRAs > // Compile time row arguments
3373 template< typename VT > // Type of the right-hand side vector
3374 inline Row<MT,false,true,false,CRAs...>&
3375  Row<MT,false,true,false,CRAs...>::operator*=( const Vector<VT,true>& rhs )
3376 {
3377  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3379 
3380  if( size() != (~rhs).size() ) {
3381  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3382  }
3383 
3384  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
3385  Right right( ~rhs );
3386 
3387  if( !tryMultAssign( matrix_, right, row(), 0UL ) ) {
3388  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3389  }
3390 
3391  decltype(auto) left( derestrict( *this ) );
3392 
3393  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
3394  const ResultType_t<VT> tmp( right );
3395  smpMultAssign( left, tmp );
3396  }
3397  else {
3398  smpMultAssign( left, right );
3399  }
3400 
3401  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3402 
3403  return *this;
3404 }
3406 //*************************************************************************************************
3407 
3408 
3409 //*************************************************************************************************
3421 template< typename MT // Type of the dense matrix
3422  , size_t... CRAs > // Compile time row arguments
3423 template< typename VT > // Type of the right-hand side dense vector
3424 inline Row<MT,false,true,false,CRAs...>&
3425  Row<MT,false,true,false,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
3426 {
3427  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3429 
3430  if( size() != (~rhs).size() ) {
3431  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3432  }
3433 
3434  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
3435  Right right( ~rhs );
3436 
3437  if( !tryDivAssign( matrix_, right, row(), 0UL ) ) {
3438  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3439  }
3440 
3441  decltype(auto) left( derestrict( *this ) );
3442 
3443  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
3444  const ResultType_t<VT> tmp( right );
3445  smpDivAssign( left, tmp );
3446  }
3447  else {
3448  smpDivAssign( left, right );
3449  }
3450 
3451  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3452 
3453  return *this;
3454 }
3456 //*************************************************************************************************
3457 
3458 
3459 //*************************************************************************************************
3472 template< typename MT // Type of the dense matrix
3473  , size_t... CRAs > // Compile time row arguments
3474 template< typename VT > // Type of the right-hand side vector
3475 inline Row<MT,false,true,false,CRAs...>&
3476  Row<MT,false,true,false,CRAs...>::operator%=( const Vector<VT,true>& rhs )
3477 {
3478  using blaze::assign;
3479 
3480  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3482 
3483  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3484 
3488 
3489  if( size() != 3UL || (~rhs).size() != 3UL ) {
3490  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
3491  }
3492 
3493  const CrossType right( *this % (~rhs) );
3494 
3495  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
3496  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3497  }
3498 
3499  decltype(auto) left( derestrict( *this ) );
3500 
3501  assign( left, right );
3502 
3503  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3504 
3505  return *this;
3506 }
3508 //*************************************************************************************************
3509 
3510 
3511 
3512 
3513 //=================================================================================================
3514 //
3515 // UTILITY FUNCTIONS
3516 //
3517 //=================================================================================================
3518 
3519 //*************************************************************************************************
3525 template< typename MT // Type of the dense matrix
3526  , size_t... CRAs > // Compile time row arguments
3527 inline MT& Row<MT,false,true,false,CRAs...>::operand() noexcept
3528 {
3529  return matrix_;
3530 }
3532 //*************************************************************************************************
3533 
3534 
3535 //*************************************************************************************************
3541 template< typename MT // Type of the dense matrix
3542  , size_t... CRAs > // Compile time row arguments
3543 inline const MT& Row<MT,false,true,false,CRAs...>::operand() const noexcept
3544 {
3545  return matrix_;
3546 }
3548 //*************************************************************************************************
3549 
3550 
3551 //*************************************************************************************************
3557 template< typename MT // Type of the dense matrix
3558  , size_t... CRAs > // Compile time row arguments
3559 inline size_t Row<MT,false,true,false,CRAs...>::size() const noexcept
3560 {
3561  return matrix_.columns();
3562 }
3564 //*************************************************************************************************
3565 
3566 
3567 //*************************************************************************************************
3576 template< typename MT // Type of the dense matrix
3577  , size_t... CRAs > // Compile time row arguments
3578 inline size_t Row<MT,false,true,false,CRAs...>::spacing() const noexcept
3579 {
3580  return matrix_.spacing();
3581 }
3583 //*************************************************************************************************
3584 
3585 
3586 //*************************************************************************************************
3592 template< typename MT // Type of the dense matrix
3593  , size_t... CRAs > // Compile time row arguments
3594 inline size_t Row<MT,false,true,false,CRAs...>::capacity() const noexcept
3595 {
3596  return matrix_.columns();
3597 }
3599 //*************************************************************************************************
3600 
3601 
3602 //*************************************************************************************************
3611 template< typename MT // Type of the dense matrix
3612  , size_t... CRAs > // Compile time row arguments
3613 inline size_t Row<MT,false,true,false,CRAs...>::nonZeros() const
3614 {
3615  const size_t columns( size() );
3616  size_t nonzeros( 0UL );
3617 
3618  for( size_t j=0UL; j<columns; ++j )
3619  if( !isDefault( matrix_(row(),j) ) )
3620  ++nonzeros;
3621 
3622  return nonzeros;
3623 }
3625 //*************************************************************************************************
3626 
3627 
3628 //*************************************************************************************************
3634 template< typename MT // Type of the dense matrix
3635  , size_t... CRAs > // Compile time row arguments
3637 {
3638  using blaze::clear;
3639 
3640  const size_t jbegin( ( IsUpper_v<MT> )
3641  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3642  ?( row()+1UL )
3643  :( row() ) )
3644  :( 0UL ) );
3645  const size_t jend ( ( IsLower_v<MT> )
3646  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3647  ?( row() )
3648  :( row()+1UL ) )
3649  :( size() ) );
3650 
3651  for( size_t j=jbegin; j<jend; ++j )
3652  clear( matrix_(row(),j) );
3653 }
3655 //*************************************************************************************************
3656 
3657 
3658 
3659 
3660 //=================================================================================================
3661 //
3662 // NUMERIC FUNCTIONS
3663 //
3664 //=================================================================================================
3665 
3666 //*************************************************************************************************
3679 template< typename MT // Type of the dense matrix
3680  , size_t... CRAs > // Compile time row arguments
3681 template< typename Other > // Data type of the scalar value
3682 inline Row<MT,false,true,false,CRAs...>&
3683  Row<MT,false,true,false,CRAs...>::scale( const Other& scalar )
3684 {
3686 
3687  const size_t jbegin( ( IsUpper_v<MT> )
3688  ?( ( IsStrictlyUpper_v<MT> )
3689  ?( row()+1UL )
3690  :( row() ) )
3691  :( 0UL ) );
3692  const size_t jend ( ( IsLower_v<MT> )
3693  ?( ( IsStrictlyLower_v<MT> )
3694  ?( row() )
3695  :( row()+1UL ) )
3696  :( size() ) );
3697 
3698  for( size_t j=jbegin; j<jend; ++j ) {
3699  matrix_(row(),j) *= scalar;
3700  }
3701 
3702  return *this;
3703 }
3705 //*************************************************************************************************
3706 
3707 
3708 
3709 
3710 //=================================================================================================
3711 //
3712 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3713 //
3714 //=================================================================================================
3715 
3716 //*************************************************************************************************
3727 template< typename MT // Type of the dense matrix
3728  , size_t... CRAs > // Compile time row arguments
3729 template< typename Other > // Data type of the foreign expression
3730 inline bool Row<MT,false,true,false,CRAs...>::canAlias( const Other* alias ) const noexcept
3731 {
3732  return matrix_.isAliased( alias );
3733 }
3735 //*************************************************************************************************
3736 
3737 
3738 //*************************************************************************************************
3749 template< typename MT // Type of the dense matrix
3750  , size_t... CRAs > // Compile time row arguments
3751 template< typename MT2 // Data type of the foreign dense row
3752  , bool SO2 // Storage order of the foreign dense row
3753  , bool SF2 // Symmetry flag of the foreign dense row
3754  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
3755 inline bool
3756  Row<MT,false,true,false,CRAs...>::canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
3757 {
3758  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
3759 }
3761 //*************************************************************************************************
3762 
3763 
3764 //*************************************************************************************************
3775 template< typename MT // Type of the dense matrix
3776  , size_t... CRAs > // Compile time row arguments
3777 template< typename Other > // Data type of the foreign expression
3778 inline bool Row<MT,false,true,false,CRAs...>::isAliased( const Other* alias ) const noexcept
3779 {
3780  return matrix_.isAliased( alias );
3781 }
3783 //*************************************************************************************************
3784 
3785 
3786 //*************************************************************************************************
3797 template< typename MT // Type of the dense matrix
3798  , size_t... CRAs > // Compile time row arguments
3799 template< typename MT2 // Data type of the foreign dense row
3800  , bool SO2 // Storage order of the foreign dense row
3801  , bool SF2 // Symmetry flag of the foreign dense row
3802  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
3803 inline bool
3804  Row<MT,false,true,false,CRAs...>::isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
3805 {
3806  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
3807 }
3809 //*************************************************************************************************
3810 
3811 
3812 //*************************************************************************************************
3822 template< typename MT // Type of the dense matrix
3823  , size_t... CRAs > // Compile time row arguments
3824 inline bool Row<MT,false,true,false,CRAs...>::isAligned() const noexcept
3825 {
3826  return false;
3827 }
3829 //*************************************************************************************************
3830 
3831 
3832 //*************************************************************************************************
3843 template< typename MT // Type of the dense matrix
3844  , size_t... CRAs > // Compile time row arguments
3845 inline bool Row<MT,false,true,false,CRAs...>::canSMPAssign() const noexcept
3846 {
3847  return ( size() > SMP_DVECASSIGN_THRESHOLD );
3848 }
3850 //*************************************************************************************************
3851 
3852 
3853 //*************************************************************************************************
3865 template< typename MT // Type of the dense matrix
3866  , size_t... CRAs > // Compile time row arguments
3867 template< typename VT > // Type of the right-hand side dense vector
3868 inline void Row<MT,false,true,false,CRAs...>::assign( const DenseVector<VT,true>& rhs )
3869 {
3870  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3871 
3872  const size_t jpos( (~rhs).size() & size_t(-2) );
3873  for( size_t j=0UL; j<jpos; j+=2UL ) {
3874  matrix_(row(),j ) = (~rhs)[j ];
3875  matrix_(row(),j+1UL) = (~rhs)[j+1UL];
3876  }
3877  if( jpos < (~rhs).size() )
3878  matrix_(row(),jpos) = (~rhs)[jpos];
3879 }
3881 //*************************************************************************************************
3882 
3883 
3884 //*************************************************************************************************
3896 template< typename MT // Type of the dense matrix
3897  , size_t... CRAs > // Compile time row arguments
3898 template< typename VT > // Type of the right-hand side sparse vector
3899 inline void Row<MT,false,true,false,CRAs...>::assign( const SparseVector<VT,true>& rhs )
3900 {
3901  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3902 
3903  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3904  matrix_(row(),element->index()) = element->value();
3905 }
3907 //*************************************************************************************************
3908 
3909 
3910 //*************************************************************************************************
3922 template< typename MT // Type of the dense matrix
3923  , size_t... CRAs > // Compile time row arguments
3924 template< typename VT > // Type of the right-hand side dense vector
3925 inline void Row<MT,false,true,false,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
3926 {
3927  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3928 
3929  const size_t jpos( (~rhs).size() & size_t(-2) );
3930  for( size_t j=0UL; j<jpos; j+=2UL ) {
3931  matrix_(row(),j ) += (~rhs)[j ];
3932  matrix_(row(),j+1UL) += (~rhs)[j+1UL];
3933  }
3934  if( jpos < (~rhs).size() )
3935  matrix_(row(),jpos) += (~rhs)[jpos];
3936 }
3938 //*************************************************************************************************
3939 
3940 
3941 //*************************************************************************************************
3953 template< typename MT // Type of the dense matrix
3954  , size_t... CRAs > // Compile time row arguments
3955 template< typename VT > // Type of the right-hand side sparse vector
3956 inline void Row<MT,false,true,false,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
3957 {
3958  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3959 
3960  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3961  matrix_(row(),element->index()) += element->value();
3962 }
3964 //*************************************************************************************************
3965 
3966 
3967 //*************************************************************************************************
3979 template< typename MT // Type of the dense matrix
3980  , size_t... CRAs > // Compile time row arguments
3981 template< typename VT > // Type of the right-hand side dense vector
3982 inline void Row<MT,false,true,false,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
3983 {
3984  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3985 
3986  const size_t jpos( (~rhs).size() & size_t(-2) );
3987  for( size_t j=0UL; j<jpos; j+=2UL ) {
3988  matrix_(row(),j ) -= (~rhs)[j ];
3989  matrix_(row(),j+1UL) -= (~rhs)[j+1UL];
3990  }
3991  if( jpos < (~rhs).size() )
3992  matrix_(row(),jpos) -= (~rhs)[jpos];
3993 }
3995 //*************************************************************************************************
3996 
3997 
3998 //*************************************************************************************************
4010 template< typename MT // Type of the dense matrix
4011  , size_t... CRAs > // Compile time row arguments
4012 template< typename VT > // Type of the right-hand side sparse vector
4013 inline void Row<MT,false,true,false,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
4014 {
4015  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4016 
4017  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4018  matrix_(row(),element->index()) -= element->value();
4019 }
4021 //*************************************************************************************************
4022 
4023 
4024 //*************************************************************************************************
4036 template< typename MT // Type of the dense matrix
4037  , size_t... CRAs > // Compile time row arguments
4038 template< typename VT > // Type of the right-hand side dense vector
4039 inline void Row<MT,false,true,false,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
4040 {
4041  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4042 
4043  const size_t jpos( (~rhs).size() & size_t(-2) );
4044  for( size_t j=0UL; j<jpos; j+=2UL ) {
4045  matrix_(row(),j ) *= (~rhs)[j ];
4046  matrix_(row(),j+1UL) *= (~rhs)[j+1UL];
4047  }
4048  if( jpos < (~rhs).size() )
4049  matrix_(row(),jpos) *= (~rhs)[jpos];
4050 }
4052 //*************************************************************************************************
4053 
4054 
4055 //*************************************************************************************************
4067 template< typename MT // Type of the dense matrix
4068  , size_t... CRAs > // Compile time row arguments
4069 template< typename VT > // Type of the right-hand side sparse vector
4070 inline void Row<MT,false,true,false,CRAs...>::multAssign( const SparseVector<VT,true>& rhs )
4071 {
4072  using blaze::reset;
4073 
4074  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4075 
4076  size_t j( 0UL );
4077 
4078  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
4079  const size_t index( element->index() );
4080  for( ; j<index; ++j )
4081  reset( matrix_(row(),j) );
4082  matrix_(row(),j) *= element->value();
4083  ++j;
4084  }
4085 
4086  for( ; j<size(); ++j ) {
4087  reset( matrix_(row(),j) );
4088  }
4089 }
4091 //*************************************************************************************************
4092 
4093 
4094 //*************************************************************************************************
4106 template< typename MT // Type of the dense matrix
4107  , size_t... CRAs > // Compile time row arguments
4108 template< typename VT > // Type of the right-hand side dense vector
4109 inline void Row<MT,false,true,false,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
4110 {
4111  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4112 
4113  const size_t jpos( (~rhs).size() & size_t(-2) );
4114  for( size_t j=0UL; j<jpos; j+=2UL ) {
4115  matrix_(row(),j ) /= (~rhs)[j ];
4116  matrix_(row(),j+1UL) /= (~rhs)[j+1UL];
4117  }
4118  if( jpos < (~rhs).size() )
4119  matrix_(row(),jpos) /= (~rhs)[jpos];
4120 }
4122 //*************************************************************************************************
4123 
4124 
4125 
4126 
4127 
4128 
4129 
4130 
4131 //=================================================================================================
4132 //
4133 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR DENSE MATRICES
4134 //
4135 //=================================================================================================
4136 
4137 //*************************************************************************************************
4145 template< typename MT // Type of the dense matrix
4146  , size_t... CRAs > // Compile time row arguments
4147 class Row<MT,false,true,true,CRAs...>
4148  : public View< DenseVector< Row<MT,false,true,true,CRAs...>, true > >
4149  , private RowData<CRAs...>
4150 {
4151  private:
4152  //**Type definitions****************************************************************************
4153  using DataType = RowData<CRAs...>;
4154  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4155  //**********************************************************************************************
4156 
4157  public:
4158  //**Type definitions****************************************************************************
4160  using This = Row<MT,false,true,true,CRAs...>;
4161 
4162  using BaseType = DenseVector<This,true>;
4163  using ViewedType = MT;
4164  using ResultType = RowTrait_t<MT,CRAs...>;
4165  using TransposeType = TransposeType_t<ResultType>;
4166  using ElementType = ElementType_t<MT>;
4167  using SIMDType = SIMDTrait_t<ElementType>;
4168  using ReturnType = ElementType_t<MT>;
4169  using CompositeType = const Row&;
4170 
4172  using ConstReference = ConstReference_t<MT>;
4173 
4175  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4176 
4178  using ConstPointer = ConstPointer_t<MT>;
4179 
4181  using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
4182 
4184  using ConstIterator = ConstIterator_t<MT>;
4185 
4187  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4188  //**********************************************************************************************
4189 
4190  //**Compilation flags***************************************************************************
4192  static constexpr bool simdEnabled = MT::simdEnabled;
4193 
4195  static constexpr bool smpAssignable = MT::smpAssignable;
4196  //**********************************************************************************************
4197 
4198  //**Constructors********************************************************************************
4201  template< typename... RRAs >
4202  explicit inline Row( MT& matrix, RRAs... args );
4203 
4204  Row( const Row& ) = default;
4206  //**********************************************************************************************
4207 
4208  //**Destructor**********************************************************************************
4211  ~Row() = default;
4213  //**********************************************************************************************
4214 
4215  //**Data access functions***********************************************************************
4218  inline Reference operator[]( size_t index );
4219  inline ConstReference operator[]( size_t index ) const;
4220  inline Reference at( size_t index );
4221  inline ConstReference at( size_t index ) const;
4222  inline Pointer data () noexcept;
4223  inline ConstPointer data () const noexcept;
4224  inline Iterator begin ();
4225  inline ConstIterator begin () const;
4226  inline ConstIterator cbegin() const;
4227  inline Iterator end ();
4228  inline ConstIterator end () const;
4229  inline ConstIterator cend () const;
4231  //**********************************************************************************************
4232 
4233  //**Assignment operators************************************************************************
4236  inline Row& operator=( const ElementType& rhs );
4237  inline Row& operator=( initializer_list<ElementType> list );
4238  inline Row& operator=( const Row& rhs );
4239 
4240  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
4241  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
4242  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
4243  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
4244  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4245  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4247  //**********************************************************************************************
4248 
4249  //**Utility functions***************************************************************************
4252  using DataType::row;
4253 
4254  inline MT& operand() noexcept;
4255  inline const MT& operand() const noexcept;
4256 
4257  inline size_t size() const noexcept;
4258  inline size_t spacing() const noexcept;
4259  inline size_t capacity() const noexcept;
4260  inline size_t nonZeros() const;
4261  inline void reset();
4263  //**********************************************************************************************
4264 
4265  //**Numeric functions***************************************************************************
4268  template< typename Other > inline Row& scale( const Other& scalar );
4270  //**********************************************************************************************
4271 
4272  private:
4273  //**********************************************************************************************
4275  template< typename VT >
4276  static constexpr bool VectorizedAssign_v =
4277  ( useOptimizedKernels &&
4278  simdEnabled && VT::simdEnabled &&
4280  //**********************************************************************************************
4281 
4282  //**********************************************************************************************
4284  template< typename VT >
4285  static constexpr bool VectorizedAddAssign_v =
4286  ( useOptimizedKernels &&
4287  simdEnabled && VT::simdEnabled &&
4290  //**********************************************************************************************
4291 
4292  //**********************************************************************************************
4294  template< typename VT >
4295  static constexpr bool VectorizedSubAssign_v =
4296  ( useOptimizedKernels &&
4297  simdEnabled && VT::simdEnabled &&
4300  //**********************************************************************************************
4301 
4302  //**********************************************************************************************
4304  template< typename VT >
4305  static constexpr bool VectorizedMultAssign_v =
4306  ( useOptimizedKernels &&
4307  simdEnabled && VT::simdEnabled &&
4310  //**********************************************************************************************
4311 
4312  //**********************************************************************************************
4314  template< typename VT >
4315  static constexpr bool VectorizedDivAssign_v =
4316  ( useOptimizedKernels &&
4317  simdEnabled && VT::simdEnabled &&
4320  //**********************************************************************************************
4321 
4322  //**SIMD properties*****************************************************************************
4324  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
4325  //**********************************************************************************************
4326 
4327  public:
4328  //**Expression template evaluation functions****************************************************
4331  template< typename Other >
4332  inline bool canAlias( const Other* alias ) const noexcept;
4333 
4334  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
4335  inline bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
4336 
4337  template< typename Other >
4338  inline bool isAliased( const Other* alias ) const noexcept;
4339 
4340  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
4341  inline bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
4342 
4343  inline bool isAligned () const noexcept;
4344  inline bool canSMPAssign() const noexcept;
4345 
4346  BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
4347  BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
4348  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
4349 
4350  BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
4351  BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
4352  BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
4353  BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
4354 
4355  template< typename VT >
4356  inline auto assign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT> >;
4357 
4358  template< typename VT >
4359  inline auto assign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT> >;
4360 
4361  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
4362 
4363  template< typename VT >
4364  inline auto addAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT> >;
4365 
4366  template< typename VT >
4367  inline auto addAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT> >;
4368 
4369  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
4370 
4371  template< typename VT >
4372  inline auto subAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT> >;
4373 
4374  template< typename VT >
4375  inline auto subAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT> >;
4376 
4377  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
4378 
4379  template< typename VT >
4380  inline auto multAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT> >;
4381 
4382  template< typename VT >
4383  inline auto multAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT> >;
4384 
4385  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
4386 
4387  template< typename VT >
4388  inline auto divAssign( const DenseVector<VT,true>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT> >;
4389 
4390  template< typename VT >
4391  inline auto divAssign( const DenseVector<VT,true>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT> >;
4393  //**********************************************************************************************
4394 
4395  private:
4396  //**Member variables****************************************************************************
4399  Operand matrix_;
4400 
4401  //**********************************************************************************************
4402 
4403  //**Friend declarations*************************************************************************
4404  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
4405  //**********************************************************************************************
4406 
4407  //**Compile time checks*************************************************************************
4416  //**********************************************************************************************
4417 };
4419 //*************************************************************************************************
4420 
4421 
4422 
4423 
4424 //=================================================================================================
4425 //
4426 // CONSTRUCTORS
4427 //
4428 //=================================================================================================
4429 
4430 //*************************************************************************************************
4443 template< typename MT // Type of the dense matrix
4444  , size_t... CRAs > // Compile time row arguments
4445 template< typename... RRAs > // Runtime row arguments
4446 inline Row<MT,false,true,true,CRAs...>::Row( MT& matrix, RRAs... args )
4447  : DataType( args... ) // Base class initialization
4448  , matrix_ ( matrix ) // The matrix containing the row
4449 {
4450  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
4451  if( matrix_.rows() <= row() ) {
4452  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
4453  }
4454  }
4455  else {
4456  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
4457  }
4458 }
4460 //*************************************************************************************************
4461 
4462 
4463 
4464 
4465 //=================================================================================================
4466 //
4467 // DATA ACCESS FUNCTIONS
4468 //
4469 //=================================================================================================
4470 
4471 //*************************************************************************************************
4481 template< typename MT // Type of the dense matrix
4482  , size_t... CRAs > // Compile time row arguments
4483 inline typename Row<MT,false,true,true,CRAs...>::Reference
4484  Row<MT,false,true,true,CRAs...>::operator[]( size_t index )
4485 {
4486  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4487  return matrix_(index,row());
4488 }
4490 //*************************************************************************************************
4491 
4492 
4493 //*************************************************************************************************
4503 template< typename MT // Type of the dense matrix
4504  , size_t... CRAs > // Compile time row arguments
4505 inline typename Row<MT,false,true,true,CRAs...>::ConstReference
4506  Row<MT,false,true,true,CRAs...>::operator[]( size_t index ) const
4507 {
4508  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4509  return const_cast<const MT&>( matrix_ )(index,row());
4510 }
4512 //*************************************************************************************************
4513 
4514 
4515 //*************************************************************************************************
4526 template< typename MT // Type of the dense matrix
4527  , size_t... CRAs > // Compile time row arguments
4528 inline typename Row<MT,false,true,true,CRAs...>::Reference
4529  Row<MT,false,true,true,CRAs...>::at( size_t index )
4530 {
4531  if( index >= size() ) {
4532  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4533  }
4534  return (*this)[index];
4535 }
4537 //*************************************************************************************************
4538 
4539 
4540 //*************************************************************************************************
4551 template< typename MT // Type of the dense matrix
4552  , size_t... CRAs > // Compile time row arguments
4553 inline typename Row<MT,false,true,true,CRAs...>::ConstReference
4554  Row<MT,false,true,true,CRAs...>::at( size_t index ) const
4555 {
4556  if( index >= size() ) {
4557  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4558  }
4559  return (*this)[index];
4560 }
4562 //*************************************************************************************************
4563 
4564 
4565 //*************************************************************************************************
4574 template< typename MT // Type of the dense matrix
4575  , size_t... CRAs > // Compile time row arguments
4576 inline typename Row<MT,false,true,true,CRAs...>::Pointer
4578 {
4579  return matrix_.data( row() );
4580 }
4582 //*************************************************************************************************
4583 
4584 
4585 //*************************************************************************************************
4594 template< typename MT // Type of the dense matrix
4595  , size_t... CRAs > // Compile time row arguments
4596 inline typename Row<MT,false,true,true,CRAs...>::ConstPointer
4597  Row<MT,false,true,true,CRAs...>::data() const noexcept
4598 {
4599  return matrix_.data( row() );
4600 }
4602 //*************************************************************************************************
4603 
4604 
4605 //*************************************************************************************************
4613 template< typename MT // Type of the dense matrix
4614  , size_t... CRAs > // Compile time row arguments
4615 inline typename Row<MT,false,true,true,CRAs...>::Iterator
4617 {
4618  return matrix_.begin( row() );
4619 }
4621 //*************************************************************************************************
4622 
4623 
4624 //*************************************************************************************************
4632 template< typename MT // Type of the dense matrix
4633  , size_t... CRAs > // Compile time row arguments
4634 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4636 {
4637  return matrix_.cbegin( row() );
4638 }
4640 //*************************************************************************************************
4641 
4642 
4643 //*************************************************************************************************
4651 template< typename MT // Type of the dense matrix
4652  , size_t... CRAs > // Compile time row arguments
4653 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4655 {
4656  return matrix_.cbegin( row() );
4657 }
4659 //*************************************************************************************************
4660 
4661 
4662 //*************************************************************************************************
4670 template< typename MT // Type of the dense matrix
4671  , size_t... CRAs > // Compile time row arguments
4672 inline typename Row<MT,false,true,true,CRAs...>::Iterator
4674 {
4675  return matrix_.end( row() );
4676 }
4678 //*************************************************************************************************
4679 
4680 
4681 //*************************************************************************************************
4689 template< typename MT // Type of the dense matrix
4690  , size_t... CRAs > // Compile time row arguments
4691 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4693 {
4694  return matrix_.cend( row() );
4695 }
4697 //*************************************************************************************************
4698 
4699 
4700 //*************************************************************************************************
4708 template< typename MT // Type of the dense matrix
4709  , size_t... CRAs > // Compile time row arguments
4710 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4712 {
4713  return matrix_.cend( row() );
4714 }
4716 //*************************************************************************************************
4717 
4718 
4719 
4720 
4721 //=================================================================================================
4722 //
4723 // ASSIGNMENT OPERATORS
4724 //
4725 //=================================================================================================
4726 
4727 //*************************************************************************************************
4734 template< typename MT // Type of the dense matrix
4735  , size_t... CRAs > // Compile time row arguments
4736 inline Row<MT,false,true,true,CRAs...>&
4737  Row<MT,false,true,true,CRAs...>::operator=( const ElementType& rhs )
4738 {
4739  decltype(auto) left( derestrict( matrix_ ) );
4740 
4741  const size_t ibegin( ( IsLower_v<MT> )
4742  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
4743  ?( row()+1UL )
4744  :( row() ) )
4745  :( 0UL ) );
4746  const size_t iend ( ( IsUpper_v<MT> )
4747  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
4748  ?( row() )
4749  :( row()+1UL ) )
4750  :( size() ) );
4751 
4752  for( size_t i=ibegin; i<iend; ++i ) {
4753  if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, i, row(), rhs ) )
4754  left(i,row()) = rhs;
4755  }
4756 
4757  return *this;
4758 }
4760 //*************************************************************************************************
4761 
4762 
4763 //*************************************************************************************************
4778 template< typename MT // Type of the dense matrix
4779  , size_t... CRAs > // Compile time row arguments
4780 inline Row<MT,false,true,true,CRAs...>&
4781  Row<MT,false,true,true,CRAs...>::operator=( initializer_list<ElementType> list )
4782 {
4783  if( list.size() > size() ) {
4784  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
4785  }
4786 
4787  if( IsRestricted_v<MT> ) {
4788  const InitializerVector<ElementType,true> tmp( list, size() );
4789  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4790  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4791  }
4792  }
4793 
4794  decltype(auto) left( derestrict( *this ) );
4795 
4796  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
4797 
4798  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4799 
4800  return *this;
4801 }
4803 //*************************************************************************************************
4804 
4805 
4806 //*************************************************************************************************
4820 template< typename MT // Type of the dense matrix
4821  , size_t... CRAs > // Compile time row arguments
4822 inline Row<MT,false,true,true,CRAs...>&
4823  Row<MT,false,true,true,CRAs...>::operator=( const Row& rhs )
4824 {
4825  if( &rhs == this ) return *this;
4826 
4827  if( size() != rhs.size() ) {
4828  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
4829  }
4830 
4831  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
4832  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4833  }
4834 
4835  decltype(auto) left( derestrict( *this ) );
4836 
4837  if( IsExpression_v<MT> && rhs.canAlias( &matrix_ ) ) {
4838  const ResultType tmp( rhs );
4839  smpAssign( left, tmp );
4840  }
4841  else {
4842  smpAssign( left, rhs );
4843  }
4844 
4845  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4846 
4847  return *this;
4848 }
4850 //*************************************************************************************************
4851 
4852 
4853 //*************************************************************************************************
4867 template< typename MT // Type of the dense matrix
4868  , size_t... CRAs > // Compile time row arguments
4869 template< typename VT > // Type of the right-hand side vector
4870 inline Row<MT,false,true,true,CRAs...>&
4871  Row<MT,false,true,true,CRAs...>::operator=( const Vector<VT,true>& rhs )
4872 {
4873  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4875 
4876  if( size() != (~rhs).size() ) {
4877  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4878  }
4879 
4880  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4881  Right right( ~rhs );
4882 
4883  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4884  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4885  }
4886 
4887  decltype(auto) left( derestrict( *this ) );
4888 
4889  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4890  const ResultType_t<VT> tmp( right );
4891  smpAssign( left, tmp );
4892  }
4893  else {
4894  if( IsSparseVector_v<VT> )
4895  reset();
4896  smpAssign( left, right );
4897  }
4898 
4899  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4900 
4901  return *this;
4902 }
4904 //*************************************************************************************************
4905 
4906 
4907 //*************************************************************************************************
4921 template< typename MT // Type of the dense matrix
4922  , size_t... CRAs > // Compile time row arguments
4923 template< typename VT > // Type of the right-hand side vector
4924 inline Row<MT,false,true,true,CRAs...>&
4925  Row<MT,false,true,true,CRAs...>::operator+=( const Vector<VT,true>& rhs )
4926 {
4927  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4929 
4930  if( size() != (~rhs).size() ) {
4931  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4932  }
4933 
4934  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4935  Right right( ~rhs );
4936 
4937  if( !tryAddAssign( matrix_, right, row(), 0UL ) ) {
4938  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4939  }
4940 
4941  decltype(auto) left( derestrict( *this ) );
4942 
4943  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4944  const ResultType_t<VT> tmp( right );
4945  smpAddAssign( left, tmp );
4946  }
4947  else {
4948  smpAddAssign( left, right );
4949  }
4950 
4951  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4952 
4953  return *this;
4954 }
4956 //*************************************************************************************************
4957 
4958 
4959 //*************************************************************************************************
4973 template< typename MT // Type of the dense matrix
4974  , size_t... CRAs > // Compile time row arguments
4975 template< typename VT > // Type of the right-hand side vector
4976 inline Row<MT,false,true,true,CRAs...>&
4977  Row<MT,false,true,true,CRAs...>::operator-=( const Vector<VT,true>& rhs )
4978 {
4979  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4981 
4982  if( size() != (~rhs).size() ) {
4983  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4984  }
4985 
4986  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4987  Right right( ~rhs );
4988 
4989  if( !trySubAssign( matrix_, right, row(), 0UL ) ) {
4990  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4991  }
4992 
4993  decltype(auto) left( derestrict( *this ) );
4994 
4995  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4996  const ResultType_t<VT> tmp( right );
4997  smpSubAssign( left, tmp );
4998  }
4999  else {
5000  smpSubAssign( left, right );
5001  }
5002 
5003  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5004 
5005  return *this;
5006 }
5008 //*************************************************************************************************
5009 
5010 
5011 //*************************************************************************************************
5024 template< typename MT // Type of the dense matrix
5025  , size_t... CRAs > // Compile time row arguments
5026 template< typename VT > // Type of the right-hand side vector
5027 inline Row<MT,false,true,true,CRAs...>&
5028  Row<MT,false,true,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
5029 {
5030  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5032 
5033  if( size() != (~rhs).size() ) {
5034  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5035  }
5036 
5037  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
5038  Right right( ~rhs );
5039 
5040  if( !tryMultAssign( matrix_, right, row(), 0UL ) ) {
5041  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5042  }
5043 
5044  decltype(auto) left( derestrict( *this ) );
5045 
5046  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
5047  const ResultType_t<VT> tmp( right );
5048  smpMultAssign( left, tmp );
5049  }
5050  else {
5051  smpMultAssign( left, right );
5052  }
5053 
5054  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5055 
5056  return *this;
5057 }
5059 //*************************************************************************************************
5060 
5061 
5062 //*************************************************************************************************
5074 template< typename MT // Type of the dense matrix
5075  , size_t... CRAs > // Compile time row arguments
5076 template< typename VT > // Type of the right-hand side dense vector
5077 inline Row<MT,false,true,true,CRAs...>&
5078  Row<MT,false,true,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5079 {
5080  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5082 
5083  if( size() != (~rhs).size() ) {
5084  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5085  }
5086 
5087  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
5088  Right right( ~rhs );
5089 
5090  if( !tryDivAssign( matrix_, right, row(), 0UL ) ) {
5091  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5092  }
5093 
5094  decltype(auto) left( derestrict( *this ) );
5095 
5096  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
5097  const ResultType_t<VT> tmp( right );
5098  smpDivAssign( left, tmp );
5099  }
5100  else {
5101  smpDivAssign( left, right );
5102  }
5103 
5104  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5105 
5106  return *this;
5107 }
5109 //*************************************************************************************************
5110 
5111 
5112 //*************************************************************************************************
5125 template< typename MT // Type of the dense matrix
5126  , size_t... CRAs > // Compile time row arguments
5127 template< typename VT > // Type of the right-hand side vector
5128 inline Row<MT,false,true,true,CRAs...>&
5129  Row<MT,false,true,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5130 {
5131  using blaze::assign;
5132 
5133  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5135 
5136  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5137 
5141 
5142  if( size() != 3UL || (~rhs).size() != 3UL ) {
5143  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5144  }
5145 
5146  const CrossType right( *this % (~rhs) );
5147 
5148  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
5149  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5150  }
5151 
5152  decltype(auto) left( derestrict( *this ) );
5153 
5154  assign( left, right );
5155 
5156  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5157 
5158  return *this;
5159 }
5161 //*************************************************************************************************
5162 
5163 
5164 
5165 
5166 //=================================================================================================
5167 //
5168 // UTILITY FUNCTIONS
5169 //
5170 //=================================================================================================
5171 
5172 //*************************************************************************************************
5178 template< typename MT // Type of the dense matrix
5179  , size_t... CRAs > // Compile time row arguments
5180 inline MT& Row<MT,false,true,true,CRAs...>::operand() noexcept
5181 {
5182  return matrix_;
5183 }
5185 //*************************************************************************************************
5186 
5187 
5188 //*************************************************************************************************
5194 template< typename MT // Type of the dense matrix
5195  , size_t... CRAs > // Compile time row arguments
5196 inline const MT& Row<MT,false,true,true,CRAs...>::operand() const noexcept
5197 {
5198  return matrix_;
5199 }
5201 //*************************************************************************************************
5202 
5203 
5204 //*************************************************************************************************
5210 template< typename MT // Type of the dense matrix
5211  , size_t... CRAs > // Compile time row arguments
5212 inline size_t Row<MT,false,true,true,CRAs...>::size() const noexcept
5213 {
5214  return matrix_.columns();
5215 }
5217 //*************************************************************************************************
5218 
5219 
5220 //*************************************************************************************************
5229 template< typename MT // Type of the dense matrix
5230  , size_t... CRAs > // Compile time row arguments
5231 inline size_t Row<MT,false,true,true,CRAs...>::spacing() const noexcept
5232 {
5233  return matrix_.spacing();
5234 }
5236 //*************************************************************************************************
5237 
5238 
5239 //*************************************************************************************************
5245 template< typename MT // Type of the dense matrix
5246  , size_t... CRAs > // Compile time row arguments
5247 inline size_t Row<MT,false,true,true,CRAs...>::capacity() const noexcept
5248 {
5249  return matrix_.capacity( row() );
5250 }
5252 //*************************************************************************************************
5253 
5254 
5255 //*************************************************************************************************
5264 template< typename MT // Type of the dense matrix
5265  , size_t... CRAs > // Compile time row arguments
5266 inline size_t Row<MT,false,true,true,CRAs...>::nonZeros() const
5267 {
5268  return matrix_.nonZeros( row() );
5269 }
5271 //*************************************************************************************************
5272 
5273 
5274 //*************************************************************************************************
5280 template< typename MT // Type of the dense matrix
5281  , size_t... CRAs > // Compile time row arguments
5283 {
5284  matrix_.reset( row() );
5285 }
5287 //*************************************************************************************************
5288 
5289 
5290 
5291 
5292 //=================================================================================================
5293 //
5294 // NUMERIC FUNCTIONS
5295 //
5296 //=================================================================================================
5297 
5298 //*************************************************************************************************
5311 template< typename MT // Type of the dense matrix
5312  , size_t... CRAs > // Compile time row arguments
5313 template< typename Other > // Data type of the scalar value
5314 inline Row<MT,false,true,true,CRAs...>&
5315  Row<MT,false,true,true,CRAs...>::scale( const Other& scalar )
5316 {
5318 
5319  const size_t ibegin( ( IsLower_v<MT> )
5320  ?( ( IsStrictlyLower_v<MT> )
5321  ?( row()+1UL )
5322  :( row() ) )
5323  :( 0UL ) );
5324  const size_t iend ( ( IsUpper_v<MT> )
5325  ?( ( IsStrictlyUpper_v<MT> )
5326  ?( row() )
5327  :( row()+1UL ) )
5328  :( size() ) );
5329 
5330  for( size_t i=ibegin; i<iend; ++i ) {
5331  matrix_(i,row()) *= scalar;
5332  }
5333 
5334  return *this;
5335 }
5337 //*************************************************************************************************
5338 
5339 
5340 
5341 
5342 //=================================================================================================
5343 //
5344 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5345 //
5346 //=================================================================================================
5347 
5348 //*************************************************************************************************
5359 template< typename MT // Type of the dense matrix
5360  , size_t... CRAs > // Compile time row arguments
5361 template< typename Other > // Data type of the foreign expression
5362 inline bool Row<MT,false,true,true,CRAs...>::canAlias( const Other* alias ) const noexcept
5363 {
5364  return matrix_.isAliased( alias );
5365 }
5367 //*************************************************************************************************
5368 
5369 
5370 //*************************************************************************************************
5381 template< typename MT // Type of the dense matrix
5382  , size_t... CRAs > // Compile time row arguments
5383 template< typename MT2 // Data type of the foreign dense row
5384  , bool SO2 // Storage order of the foreign dense row
5385  , bool SF2 // Symmetry flag of the foreign dense row
5386  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
5387 inline bool
5388  Row<MT,false,true,true,CRAs...>::canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
5389 {
5390  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
5391 }
5393 //*************************************************************************************************
5394 
5395 
5396 //*************************************************************************************************
5407 template< typename MT // Type of the dense matrix
5408  , size_t... CRAs > // Compile time row arguments
5409 template< typename Other > // Data type of the foreign expression
5410 inline bool Row<MT,false,true,true,CRAs...>::isAliased( const Other* alias ) const noexcept
5411 {
5412  return matrix_.isAliased( alias );
5413 }
5415 //*************************************************************************************************
5416 
5417 
5418 //*************************************************************************************************
5429 template< typename MT // Type of the dense matrix
5430  , size_t... CRAs > // Compile time row arguments
5431 template< typename MT2 // Data type of the foreign dense row
5432  , bool SO2 // Storage order of the foreign dense row
5433  , bool SF2 // Symmetry flag of the foreign dense row
5434  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
5435 inline bool
5436  Row<MT,false,true,true,CRAs...>::isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
5437 {
5438  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
5439 }
5441 //*************************************************************************************************
5442 
5443 
5444 //*************************************************************************************************
5454 template< typename MT // Type of the dense matrix
5455  , size_t... CRAs > // Compile time row arguments
5456 inline bool Row<MT,false,true,true,CRAs...>::isAligned() const noexcept
5457 {
5458  return matrix_.isAligned();
5459 }
5461 //*************************************************************************************************
5462 
5463 
5464 //*************************************************************************************************
5475 template< typename MT // Type of the dense matrix
5476  , size_t... CRAs > // Compile time row arguments
5477 inline bool Row<MT,false,true,true,CRAs...>::canSMPAssign() const noexcept
5478 {
5479  return ( size() > SMP_DVECASSIGN_THRESHOLD );
5480 }
5482 //*************************************************************************************************
5483 
5484 
5485 //*************************************************************************************************
5498 template< typename MT // Type of the dense matrix
5499  , size_t... CRAs > // Compile time row arguments
5500 BLAZE_ALWAYS_INLINE typename Row<MT,false,true,true,CRAs...>::SIMDType
5501  Row<MT,false,true,true,CRAs...>::load( size_t index ) const noexcept
5502 {
5503  return matrix_.load( index, row() );
5504 }
5506 //*************************************************************************************************
5507 
5508 
5509 //*************************************************************************************************
5522 template< typename MT // Type of the dense matrix
5523  , size_t... CRAs > // Compile time row arguments
5524 BLAZE_ALWAYS_INLINE typename Row<MT,false,true,true,CRAs...>::SIMDType
5525  Row<MT,false,true,true,CRAs...>::loada( size_t index ) const noexcept
5526 {
5527  return matrix_.loada( index, row() );
5528 }
5530 //*************************************************************************************************
5531 
5532 
5533 //*************************************************************************************************
5546 template< typename MT // Type of the dense matrix
5547  , size_t... CRAs > // Compile time row arguments
5548 BLAZE_ALWAYS_INLINE typename Row<MT,false,true,true,CRAs...>::SIMDType
5549  Row<MT,false,true,true,CRAs...>::loadu( size_t index ) const noexcept
5550 {
5551  return matrix_.loadu( index, row() );
5552 }
5554 //*************************************************************************************************
5555 
5556 
5557 //*************************************************************************************************
5571 template< typename MT // Type of the dense matrix
5572  , size_t... CRAs > // Compile time row arguments
5574  Row<MT,false,true,true,CRAs...>::store( size_t index, const SIMDType& value ) noexcept
5575 {
5576  matrix_.store( index, row(), value );
5577 }
5579 //*************************************************************************************************
5580 
5581 
5582 //*************************************************************************************************
5596 template< typename MT // Type of the dense matrix
5597  , size_t... CRAs > // Compile time row arguments
5599  Row<MT,false,true,true,CRAs...>::storea( size_t index, const SIMDType& value ) noexcept
5600 {
5601  matrix_.storea( index, row(), value );
5602 }
5604 //*************************************************************************************************
5605 
5606 
5607 //*************************************************************************************************
5621 template< typename MT // Type of the dense matrix
5622  , size_t... CRAs > // Compile time row arguments
5624  Row<MT,false,true,true,CRAs...>::storeu( size_t index, const SIMDType& value ) noexcept
5625 {
5626  matrix_.storeu( index, row(), value );
5627 }
5629 //*************************************************************************************************
5630 
5631 
5632 //*************************************************************************************************
5646 template< typename MT // Type of the dense matrix
5647  , size_t... CRAs > // Compile time row arguments
5649  Row<MT,false,true,true,CRAs...>::stream( size_t index, const SIMDType& value ) noexcept
5650 {
5651  matrix_.stream( index, row(), value );
5652 }
5654 //*************************************************************************************************
5655 
5656 
5657 //*************************************************************************************************
5669 template< typename MT // Type of the dense matrix
5670  , size_t... CRAs > // Compile time row arguments
5671 template< typename VT > // Type of the right-hand side dense vector
5672 inline auto Row<MT,false,true,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5673  -> DisableIf_t< VectorizedAssign_v<VT> >
5674 {
5675  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5676 
5677  const size_t ipos( (~rhs).size() & size_t(-2) );
5678  for( size_t i=0UL; i<ipos; i+=2UL ) {
5679  matrix_(i ,row()) = (~rhs)[i ];
5680  matrix_(i+1UL,row()) = (~rhs)[i+1UL];
5681  }
5682  if( ipos < (~rhs).size() )
5683  matrix_(ipos,row()) = (~rhs)[ipos];
5684 }
5686 //*************************************************************************************************
5687 
5688 
5689 //*************************************************************************************************
5701 template< typename MT // Type of the dense matrix
5702  , size_t... CRAs > // Compile time row arguments
5703 template< typename VT > // Type of the right-hand side dense vector
5704 inline auto Row<MT,false,true,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5705  -> EnableIf_t< VectorizedAssign_v<VT> >
5706 {
5708 
5709  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5710 
5711  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5712 
5713  const size_t rows( size() );
5714 
5715  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
5716  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5717 
5718  size_t i( 0UL );
5719  Iterator left( begin() );
5720  ConstIterator_t<VT> right( (~rhs).begin() );
5721 
5722  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
5723  {
5724  for( ; i<ipos; i+=SIMDSIZE ) {
5725  left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5726  }
5727  for( ; remainder && i<rows; ++i ) {
5728  *left = *right; ++left; ++right;
5729  }
5730  }
5731  else
5732  {
5733  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5734  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5735  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5736  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5737  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5738  }
5739  for( ; i<ipos; i+=SIMDSIZE ) {
5740  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5741  }
5742  for( ; remainder && i<rows; ++i ) {
5743  *left = *right; ++left; ++right;
5744  }
5745  }
5746 }
5748 //*************************************************************************************************
5749 
5750 
5751 //*************************************************************************************************
5763 template< typename MT // Type of the dense matrix
5764  , size_t... CRAs > // Compile time row arguments
5765 template< typename VT > // Type of the right-hand side sparse vector
5766 inline void Row<MT,false,true,true,CRAs...>::assign( const SparseVector<VT,true>& rhs )
5767 {
5768  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5769 
5770  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5771  matrix_(element->index(),row()) = element->value();
5772 }
5774 //*************************************************************************************************
5775 
5776 
5777 //*************************************************************************************************
5789 template< typename MT // Type of the dense matrix
5790  , size_t... CRAs > // Compile time row arguments
5791 template< typename VT > // Type of the right-hand side dense vector
5792 inline auto Row<MT,false,true,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5793  -> DisableIf_t< VectorizedAddAssign_v<VT> >
5794 {
5795  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5796 
5797  const size_t ipos( (~rhs).size() & size_t(-2) );
5798  for( size_t i=0UL; i<ipos; i+=2UL ) {
5799  matrix_(i ,row()) += (~rhs)[i ];
5800  matrix_(i+1UL,row()) += (~rhs)[i+1UL];
5801  }
5802  if( ipos < (~rhs).size() )
5803  matrix_(ipos,row()) += (~rhs)[ipos];
5804 }
5806 //*************************************************************************************************
5807 
5808 
5809 //*************************************************************************************************
5821 template< typename MT // Type of the dense matrix
5822  , size_t... CRAs > // Compile time row arguments
5823 template< typename VT > // Type of the right-hand side dense vector
5824 inline auto Row<MT,false,true,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5825  -> EnableIf_t< VectorizedAddAssign_v<VT> >
5826 {
5828 
5829  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5830 
5831  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5832 
5833  const size_t rows( size() );
5834 
5835  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
5836  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5837 
5838  size_t i( 0UL );
5839  Iterator left( begin() );
5840  ConstIterator_t<VT> right( (~rhs).begin() );
5841 
5842  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5843  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5844  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5845  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5846  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5847  }
5848  for( ; i<ipos; i+=SIMDSIZE ) {
5849  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5850  }
5851  for( ; remainder && i<rows; ++i ) {
5852  *left += *right; ++left; ++right;
5853  }
5854 }
5856 //*************************************************************************************************
5857 
5858 
5859 //*************************************************************************************************
5871 template< typename MT // Type of the dense matrix
5872  , size_t... CRAs > // Compile time row arguments
5873 template< typename VT > // Type of the right-hand side sparse vector
5874 inline void Row<MT,false,true,true,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
5875 {
5876  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5877 
5878  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5879  matrix_(element->index(),row()) += element->value();
5880 }
5882 //*************************************************************************************************
5883 
5884 
5885 //*************************************************************************************************
5897 template< typename MT // Type of the dense matrix
5898  , size_t... CRAs > // Compile time row arguments
5899 template< typename VT > // Type of the right-hand side dense vector
5900 inline auto Row<MT,false,true,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5901  -> DisableIf_t< VectorizedSubAssign_v<VT> >
5902 {
5903  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5904 
5905  const size_t ipos( (~rhs).size() & size_t(-2) );
5906  for( size_t i=0UL; i<ipos; i+=2UL ) {
5907  matrix_(i ,row()) -= (~rhs)[i ];
5908  matrix_(i+1UL,row()) -= (~rhs)[i+1UL];
5909  }
5910  if( ipos < (~rhs).size() )
5911  matrix_(ipos,row()) -= (~rhs)[ipos];
5912 }
5914 //*************************************************************************************************
5915 
5916 
5917 //*************************************************************************************************
5929 template< typename MT // Type of the dense matrix
5930  , size_t... CRAs > // Compile time row arguments
5931 template< typename VT > // Type of the right-hand side dense vector
5932 inline auto Row<MT,false,true,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5933  -> EnableIf_t< VectorizedSubAssign_v<VT> >
5934 {
5936 
5937  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5938 
5939  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5940 
5941  const size_t rows( size() );
5942 
5943  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
5944  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5945 
5946  size_t i( 0UL );
5947  Iterator left( begin() );
5948  ConstIterator_t<VT> right( (~rhs).begin() );
5949 
5950  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5951  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5952  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5953  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5954  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5955  }
5956  for( ; i<ipos; i+=SIMDSIZE ) {
5957  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5958  }
5959  for( ; remainder && i<rows; ++i ) {
5960  *left -= *right; ++left; ++right;
5961  }
5962 }
5964 //*************************************************************************************************
5965 
5966 
5967 //*************************************************************************************************
5979 template< typename MT // Type of the dense matrix
5980  , size_t... CRAs > // Compile time row arguments
5981 template< typename VT > // Type of the right-hand side sparse vector
5982 inline void Row<MT,false,true,true,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
5983 {
5984  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5985 
5986  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5987  matrix_(element->index(),row()) -= element->value();
5988 }
5990 //*************************************************************************************************
5991 
5992 
5993 //*************************************************************************************************
6005 template< typename MT // Type of the dense matrix
6006  , size_t... CRAs > // Compile time row arguments
6007 template< typename VT > // Type of the right-hand side dense vector
6008 inline auto Row<MT,false,true,true,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
6009  -> DisableIf_t< VectorizedMultAssign_v<VT> >
6010 {
6011  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6012 
6013  const size_t ipos( (~rhs).size() & size_t(-2) );
6014  for( size_t i=0UL; i<ipos; i+=2UL ) {
6015  matrix_(i ,row()) *= (~rhs)[i ];
6016  matrix_(i+1UL,row()) *= (~rhs)[i+1UL];
6017  }
6018  if( ipos < (~rhs).size() )
6019  matrix_(ipos,row()) *= (~rhs)[ipos];
6020 }
6022 //*************************************************************************************************
6023 
6024 
6025 //*************************************************************************************************
6037 template< typename MT // Type of the dense matrix
6038  , size_t... CRAs > // Compile time row arguments
6039 template< typename VT > // Type of the right-hand side dense vector
6040 inline auto Row<MT,false,true,true,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
6041  -> EnableIf_t< VectorizedMultAssign_v<VT> >
6042 {
6044 
6045  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6046 
6047  constexpr bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
6048 
6049  const size_t rows( size() );
6050 
6051  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
6052  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
6053 
6054  size_t i( 0UL );
6055  Iterator left( begin() );
6056  ConstIterator_t<VT> right( (~rhs).begin() );
6057 
6058  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6059  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6060  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6061  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6062  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6063  }
6064  for( ; i<ipos; i+=SIMDSIZE ) {
6065  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6066  }
6067  for( ; remainder && i<rows; ++i ) {
6068  *left *= *right; ++left; ++right;
6069  }
6070 }
6072 //*************************************************************************************************
6073 
6074 
6075 //*************************************************************************************************
6087 template< typename MT // Type of the dense matrix
6088  , size_t... CRAs > // Compile time row arguments
6089 template< typename VT > // Type of the right-hand side sparse vector
6090 inline void Row<MT,false,true,true,CRAs...>::multAssign( const SparseVector<VT,true>& rhs )
6091 {
6092  using blaze::reset;
6093 
6094  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6095 
6096  size_t i( 0UL );
6097 
6098  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
6099  const size_t index( element->index() );
6100  for( ; i<index; ++i )
6101  reset( matrix_(i,row()) );
6102  matrix_(i,row()) *= element->value();
6103  ++i;
6104  }
6105 
6106  for( ; i<size(); ++i ) {
6107  reset( matrix_(i,row()) );
6108  }
6109 }
6111 //*************************************************************************************************
6112 
6113 
6114 //*************************************************************************************************
6126 template< typename MT // Type of the dense matrix
6127  , size_t... CRAs > // Compile time row arguments
6128 template< typename VT > // Type of the right-hand side dense vector
6129 inline auto Row<MT,false,true,true,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
6130  -> DisableIf_t< VectorizedDivAssign_v<VT> >
6131 {
6132  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6133 
6134  const size_t ipos( (~rhs).size() & size_t(-2) );
6135  for( size_t i=0UL; i<ipos; i+=2UL ) {
6136  matrix_(i ,row()) /= (~rhs)[i ];
6137  matrix_(i+1UL,row()) /= (~rhs)[i+1UL];
6138  }
6139  if( ipos < (~rhs).size() )
6140  matrix_(ipos,row()) /= (~rhs)[ipos];
6141 }
6143 //*************************************************************************************************
6144 
6145 
6146 //*************************************************************************************************
6158 template< typename MT // Type of the dense matrix
6159  , size_t... CRAs > // Compile time row arguments
6160 template< typename VT > // Type of the right-hand side dense vector
6161 inline auto Row<MT,false,true,true,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
6162  -> EnableIf_t< VectorizedDivAssign_v<VT> >
6163 {
6165 
6166  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6167 
6168  const size_t rows( size() );
6169 
6170  const size_t ipos( rows & size_t(-SIMDSIZE) );
6171  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
6172 
6173  size_t i( 0UL );
6174  Iterator left( begin() );
6175  ConstIterator_t<VT> right( (~rhs).begin() );
6176 
6177  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6178  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6179  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6180  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6181  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6182  }
6183  for( ; i<ipos; i+=SIMDSIZE ) {
6184  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6185  }
6186  for( ; i<rows; ++i ) {
6187  *left /= *right; ++left; ++right;
6188  }
6189 }
6191 //*************************************************************************************************
6192 
6193 } // namespace blaze
6194 
6195 #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:133
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the RowData class template.
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.The IsUniUpper_v variable template provides...
Definition: IsUniUpper.h:172
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the IsUniUpper type trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
Header file for the View base class.
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:188
Header file for the row trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#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 reset shim.
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.The IsUpper_v variable template provides a con...
Definition: IsUpper.h:174
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
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
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
STL namespace.
Header file for the IsUniLower type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the DisableIf class template.
Header file for the implementation of the Row base template.
Header file for the IsStrictlyUpper type trait.
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
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
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:189
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
#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.
constexpr bool HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.The HasSIMDDiv_v variable template provides...
Definition: HasSIMDDiv.h:172
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:446
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
Header file for all SIMD functionality.
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
Constraint on the data type.
Header file for the IsTriangular type trait.
#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
Constraint on the data type.
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:172
Header file for the exception macros of the math module.
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the IsPadded type trait.
Constraint on the data type.
Header file for the IsSIMDCombinable type trait.
Header file for the IsSparseVector 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.
constexpr bool IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.The IsUniLower_v variable template provides...
Definition: IsUniLower.h:172
Header file for the cross product trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.The IsStrictlyUpper_v variable templat...
Definition: IsStrictlyUpper.h:172
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.The IsLower_v variable template provides a con...
Definition: IsLower.h:174
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
typename RowTrait< MT, CRAs... >::Type RowTrait_t
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_t alias declaration provides a c...
Definition: RowTrait.h:170
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Constraint on the data type.
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.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
Header file for the RemoveReference type trait.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< 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:74
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.The IsExpression_v variable template prov...
Definition: IsExpression.h:131
Header file for the HasSIMDDiv type trait.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:188
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the clear shim.
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Constraint on the data type.