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/mpl/Not.h>
100 #include <blaze/util/mpl/Or.h>
101 #include <blaze/util/Template.h>
102 #include <blaze/util/TypeList.h>
103 #include <blaze/util/Types.h>
107 
108 
109 namespace blaze {
110 
111 //=================================================================================================
112 //
113 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR DENSE MATRICES
114 //
115 //=================================================================================================
116 
117 //*************************************************************************************************
125 template< typename MT // Type of the dense matrix
126  , bool SF // Symmetry flag
127  , size_t... CRAs > // Compile time row arguments
128 class Row<MT,true,true,SF,CRAs...>
129  : public View< DenseVector< Row<MT,true,true,SF,CRAs...>, true > >
130  , private RowData<CRAs...>
131 {
132  private:
133  //**Type definitions****************************************************************************
134  using DataType = RowData<CRAs...>;
135  using Operand = If_< IsExpression<MT>, MT, MT& >;
136  //**********************************************************************************************
137 
138  public:
139  //**Type definitions****************************************************************************
141  using This = Row<MT,true,true,SF,CRAs...>;
142 
143  using BaseType = DenseVector<This,true>;
144  using ViewedType = MT;
145  using ResultType = RowTrait_<MT,CRAs...>;
146  using TransposeType = TransposeType_<ResultType>;
147  using ElementType = ElementType_<MT>;
148  using SIMDType = SIMDTrait_<ElementType>;
149  using ReturnType = ReturnType_<MT>;
150  using CompositeType = const Row&;
151 
153  using ConstReference = ConstReference_<MT>;
154 
156  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
157 
159  using ConstPointer = ConstPointer_<MT>;
160 
162  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
163 
165  using ConstIterator = ConstIterator_<MT>;
166 
168  using Iterator = If_< IsConst<MT>, ConstIterator, Iterator_<MT> >;
169  //**********************************************************************************************
170 
171  //**Compilation flags***************************************************************************
173  enum : bool { simdEnabled = MT::simdEnabled };
174 
176  enum : bool { smpAssignable = MT::smpAssignable };
177  //**********************************************************************************************
178 
179  //**Constructors********************************************************************************
182  template< typename... RRAs >
183  explicit inline Row( MT& matrix, RRAs... args );
184  // No explicitly declared copy constructor.
186  //**********************************************************************************************
187 
188  //**Destructor**********************************************************************************
189  // No explicitly declared destructor.
190  //**********************************************************************************************
191 
192  //**Data access functions***********************************************************************
195  inline Reference operator[]( size_t index );
196  inline ConstReference operator[]( size_t index ) const;
197  inline Reference at( size_t index );
198  inline ConstReference at( size_t index ) const;
199  inline Pointer data () noexcept;
200  inline ConstPointer data () const noexcept;
201  inline Iterator begin ();
202  inline ConstIterator begin () const;
203  inline ConstIterator cbegin() const;
204  inline Iterator end ();
205  inline ConstIterator end () const;
206  inline ConstIterator cend () const;
208  //**********************************************************************************************
209 
210  //**Assignment operators************************************************************************
213  inline Row& operator=( const ElementType& rhs );
214  inline Row& operator=( initializer_list<ElementType> list );
215  inline Row& operator=( const Row& rhs );
216 
217  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
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 DenseVector<VT,true>& rhs );
222  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
224  //**********************************************************************************************
225 
226  //**Utility functions***************************************************************************
229  using DataType::row;
230 
231  inline MT& operand() noexcept;
232  inline const MT& operand() const noexcept;
233 
234  inline size_t size() const noexcept;
235  inline size_t spacing() const noexcept;
236  inline size_t capacity() const noexcept;
237  inline size_t nonZeros() const;
238  inline void reset();
240  //**********************************************************************************************
241 
242  //**Numeric functions***************************************************************************
245  template< typename Other > inline Row& scale( const Other& scalar );
247  //**********************************************************************************************
248 
249  private:
250  //**********************************************************************************************
252  template< typename VT >
253  struct VectorizedAssign {
254  enum : bool { value = useOptimizedKernels &&
255  simdEnabled && VT::simdEnabled &&
256  IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
257  };
258  //**********************************************************************************************
259 
260  //**********************************************************************************************
262  template< typename VT >
263  struct VectorizedAddAssign {
264  enum : bool { value = useOptimizedKernels &&
265  simdEnabled && VT::simdEnabled &&
266  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
267  HasSIMDAdd< ElementType, ElementType_<VT> >::value };
268  };
269  //**********************************************************************************************
270 
271  //**********************************************************************************************
273  template< typename VT >
274  struct VectorizedSubAssign {
275  enum : bool { value = useOptimizedKernels &&
276  simdEnabled && VT::simdEnabled &&
277  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
278  HasSIMDSub< ElementType, ElementType_<VT> >::value };
279  };
280  //**********************************************************************************************
281 
282  //**********************************************************************************************
284  template< typename VT >
285  struct VectorizedMultAssign {
286  enum : bool { value = useOptimizedKernels &&
287  simdEnabled && VT::simdEnabled &&
288  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
289  HasSIMDMult< ElementType, ElementType_<VT> >::value };
290  };
291  //**********************************************************************************************
292 
293  //**********************************************************************************************
295  template< typename VT >
296  struct VectorizedDivAssign {
297  enum : bool { value = useOptimizedKernels &&
298  simdEnabled && VT::simdEnabled &&
299  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
300  HasSIMDDiv< ElementType, ElementType_<VT> >::value };
301  };
302  //**********************************************************************************************
303 
304  //**SIMD properties*****************************************************************************
306  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
307  //**********************************************************************************************
308 
309  public:
310  //**Expression template evaluation functions****************************************************
313  template< typename Other >
314  inline bool canAlias( const Other* alias ) const noexcept;
315 
316  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
317  inline bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
318 
319  template< typename Other >
320  inline bool isAliased( const Other* alias ) const noexcept;
321 
322  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
323  inline bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
324 
325  inline bool isAligned () const noexcept;
326  inline bool canSMPAssign() const noexcept;
327 
328  BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
329  BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
330  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
331 
332  BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
333  BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
334  BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
335  BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
336 
337  template< typename VT >
338  inline DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
339 
340  template< typename VT >
341  inline EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
342 
343  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
344 
345  template< typename VT >
346  inline DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
347 
348  template< typename VT >
349  inline EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
350 
351  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
352 
353  template< typename VT >
354  inline DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
355 
356  template< typename VT >
357  inline EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
358 
359  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
360 
361  template< typename VT >
362  inline DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
363 
364  template< typename VT >
365  inline EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
366 
367  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
368 
369  template< typename VT >
370  inline DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
371 
372  template< typename VT >
373  inline EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
375  //**********************************************************************************************
376 
377  private:
378  //**Member variables****************************************************************************
381  Operand matrix_;
382 
383  //**********************************************************************************************
384 
385  //**Friend declarations*************************************************************************
386  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
387  //**********************************************************************************************
388 
389  //**Compile time checks*************************************************************************
397  //**********************************************************************************************
398 };
400 //*************************************************************************************************
401 
402 
403 
404 
405 //=================================================================================================
406 //
407 // CONSTRUCTORS
408 //
409 //=================================================================================================
410 
411 //*************************************************************************************************
424 template< typename MT // Type of the dense matrix
425  , bool SF // Symmetry flag
426  , size_t... CRAs > // Compile time row arguments
427 template< typename... RRAs > // Runtime row arguments
428 inline Row<MT,true,true,SF,CRAs...>::Row( MT& matrix, RRAs... args )
429  : DataType( args... ) // Base class initialization
430  , matrix_ ( matrix ) // The matrix containing the row
431 {
432  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
433  if( matrix_.rows() <= row() ) {
434  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
435  }
436  }
437  else {
438  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
439  }
440 }
442 //*************************************************************************************************
443 
444 
445 
446 
447 //=================================================================================================
448 //
449 // DATA ACCESS FUNCTIONS
450 //
451 //=================================================================================================
452 
453 //*************************************************************************************************
463 template< typename MT // Type of the dense matrix
464  , bool SF // Symmetry flag
465  , size_t... CRAs > // Compile time row arguments
466 inline typename Row<MT,true,true,SF,CRAs...>::Reference
467  Row<MT,true,true,SF,CRAs...>::operator[]( size_t index )
468 {
469  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
470  return matrix_(row(),index);
471 }
473 //*************************************************************************************************
474 
475 
476 //*************************************************************************************************
486 template< typename MT // Type of the dense matrix
487  , bool SF // Symmetry flag
488  , size_t... CRAs > // Compile time row arguments
489 inline typename Row<MT,true,true,SF,CRAs...>::ConstReference
490  Row<MT,true,true,SF,CRAs...>::operator[]( size_t index ) const
491 {
492  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
493  return const_cast<const MT&>( matrix_ )(row(),index);
494 }
496 //*************************************************************************************************
497 
498 
499 //*************************************************************************************************
510 template< typename MT // Type of the dense matrix
511  , bool SF // Symmetry flag
512  , size_t... CRAs > // Compile time row arguments
513 inline typename Row<MT,true,true,SF,CRAs...>::Reference
514  Row<MT,true,true,SF,CRAs...>::at( size_t index )
515 {
516  if( index >= size() ) {
517  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
518  }
519  return (*this)[index];
520 }
522 //*************************************************************************************************
523 
524 
525 //*************************************************************************************************
536 template< typename MT // Type of the dense matrix
537  , bool SF // Symmetry flag
538  , size_t... CRAs > // Compile time row arguments
539 inline typename Row<MT,true,true,SF,CRAs...>::ConstReference
540  Row<MT,true,true,SF,CRAs...>::at( size_t index ) const
541 {
542  if( index >= size() ) {
543  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
544  }
545  return (*this)[index];
546 }
548 //*************************************************************************************************
549 
550 
551 //*************************************************************************************************
560 template< typename MT // Type of the dense matrix
561  , bool SF // Symmetry flag
562  , size_t... CRAs > // Compile time row arguments
563 inline typename Row<MT,true,true,SF,CRAs...>::Pointer
565 {
566  return matrix_.data( row() );
567 }
569 //*************************************************************************************************
570 
571 
572 //*************************************************************************************************
581 template< typename MT // Type of the dense matrix
582  , bool SF // Symmetry flag
583  , size_t... CRAs > // Compile time row arguments
584 inline typename Row<MT,true,true,SF,CRAs...>::ConstPointer
585  Row<MT,true,true,SF,CRAs...>::data() const noexcept
586 {
587  return matrix_.data( row() );
588 }
590 //*************************************************************************************************
591 
592 
593 //*************************************************************************************************
601 template< typename MT // Type of the dense matrix
602  , bool SF // Symmetry flag
603  , size_t... CRAs > // Compile time row arguments
604 inline typename Row<MT,true,true,SF,CRAs...>::Iterator
606 {
607  return matrix_.begin( row() );
608 }
610 //*************************************************************************************************
611 
612 
613 //*************************************************************************************************
621 template< typename MT // Type of the dense matrix
622  , bool SF // Symmetry flag
623  , size_t... CRAs > // Compile time row arguments
624 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
626 {
627  return matrix_.cbegin( row() );
628 }
630 //*************************************************************************************************
631 
632 
633 //*************************************************************************************************
641 template< typename MT // Type of the dense matrix
642  , bool SF // Symmetry flag
643  , size_t... CRAs > // Compile time row arguments
644 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
646 {
647  return matrix_.cbegin( row() );
648 }
650 //*************************************************************************************************
651 
652 
653 //*************************************************************************************************
661 template< typename MT // Type of the dense matrix
662  , bool SF // Symmetry flag
663  , size_t... CRAs > // Compile time row arguments
664 inline typename Row<MT,true,true,SF,CRAs...>::Iterator
666 {
667  return matrix_.end( row() );
668 }
670 //*************************************************************************************************
671 
672 
673 //*************************************************************************************************
681 template< typename MT // Type of the dense matrix
682  , bool SF // Symmetry flag
683  , size_t... CRAs > // Compile time row arguments
684 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
686 {
687  return matrix_.cend( row() );
688 }
690 //*************************************************************************************************
691 
692 
693 //*************************************************************************************************
701 template< typename MT // Type of the dense matrix
702  , bool SF // Symmetry flag
703  , size_t... CRAs > // Compile time row arguments
704 inline typename Row<MT,true,true,SF,CRAs...>::ConstIterator
706 {
707  return matrix_.cend( row() );
708 }
710 //*************************************************************************************************
711 
712 
713 
714 
715 //=================================================================================================
716 //
717 // ASSIGNMENT OPERATORS
718 //
719 //=================================================================================================
720 
721 //*************************************************************************************************
732 template< typename MT // Type of the dense matrix
733  , bool SF // Symmetry flag
734  , size_t... CRAs > // Compile time row arguments
735 inline Row<MT,true,true,SF,CRAs...>&
736  Row<MT,true,true,SF,CRAs...>::operator=( const ElementType& rhs )
737 {
738  decltype(auto) left( derestrict( matrix_ ) );
739 
740  const size_t jbegin( ( IsUpper<MT>::value )
741  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
742  ?( row()+1UL )
743  :( row() ) )
744  :( 0UL ) );
745  const size_t jend ( ( IsLower<MT>::value )
746  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
747  ?( row() )
748  :( row()+1UL ) )
749  :( size() ) );
750 
751  for( size_t j=jbegin; j<jend; ++j ) {
752  if( !IsRestricted<MT>::value || IsTriangular<MT>::value || trySet( matrix_, row(), j, rhs ) )
753  left(row(),j) = rhs;
754  }
755 
756  return *this;
757 }
759 //*************************************************************************************************
760 
761 
762 //*************************************************************************************************
777 template< typename MT // Type of the dense matrix
778  , bool SF // Symmetry flag
779  , size_t... CRAs > // Compile time row arguments
780 inline Row<MT,true,true,SF,CRAs...>&
781  Row<MT,true,true,SF,CRAs...>::operator=( initializer_list<ElementType> list )
782 {
783  if( list.size() > size() ) {
784  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
785  }
786 
787  if( IsRestricted<MT>::value ) {
788  const InitializerVector<ElementType,true> tmp( list, size() );
789  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
790  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
791  }
792  }
793 
794  decltype(auto) left( derestrict( *this ) );
795 
796  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
797 
798  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
799 
800  return *this;
801 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
820 template< typename MT // Type of the dense matrix
821  , bool SF // Symmetry flag
822  , size_t... CRAs > // Compile time row arguments
823 inline Row<MT,true,true,SF,CRAs...>&
824  Row<MT,true,true,SF,CRAs...>::operator=( const Row& rhs )
825 {
826  if( &rhs == this ) return *this;
827 
828  if( size() != rhs.size() ) {
829  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
830  }
831 
832  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
833  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
834  }
835 
836  decltype(auto) left( derestrict( *this ) );
837 
838  if( IsExpression<MT>::value && rhs.canAlias( &matrix_ ) ) {
839  const ResultType tmp( rhs );
840  smpAssign( left, tmp );
841  }
842  else {
843  smpAssign( left, rhs );
844  }
845 
846  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
847 
848  return *this;
849 }
851 //*************************************************************************************************
852 
853 
854 //*************************************************************************************************
868 template< typename MT // Type of the dense matrix
869  , bool SF // Symmetry flag
870  , size_t... CRAs > // Compile time row arguments
871 template< typename VT > // Type of the right-hand side vector
872 inline Row<MT,true,true,SF,CRAs...>&
873  Row<MT,true,true,SF,CRAs...>::operator=( const Vector<VT,true>& rhs )
874 {
875  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
877 
878  if( size() != (~rhs).size() ) {
879  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
880  }
881 
882  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
883  Right right( ~rhs );
884 
885  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
886  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
887  }
888 
889  decltype(auto) left( derestrict( *this ) );
890 
891  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
892  const ResultType_<VT> tmp( right );
893  smpAssign( left, tmp );
894  }
895  else {
896  if( IsSparseVector<VT>::value )
897  reset();
898  smpAssign( left, right );
899  }
900 
901  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
902 
903  return *this;
904 }
906 //*************************************************************************************************
907 
908 
909 //*************************************************************************************************
923 template< typename MT // Type of the dense matrix
924  , bool SF // Symmetry flag
925  , size_t... CRAs > // Compile time row arguments
926 template< typename VT > // Type of the right-hand side vector
927 inline Row<MT,true,true,SF,CRAs...>&
928  Row<MT,true,true,SF,CRAs...>::operator+=( const Vector<VT,true>& rhs )
929 {
930  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
932 
933  if( size() != (~rhs).size() ) {
934  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
935  }
936 
937  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
938  Right right( ~rhs );
939 
940  if( !tryAddAssign( matrix_, right, row(), 0UL ) ) {
941  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
942  }
943 
944  decltype(auto) left( derestrict( *this ) );
945 
946  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
947  const ResultType_<VT> tmp( right );
948  smpAddAssign( left, tmp );
949  }
950  else {
951  smpAddAssign( left, right );
952  }
953 
954  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
955 
956  return *this;
957 }
959 //*************************************************************************************************
960 
961 
962 //*************************************************************************************************
976 template< typename MT // Type of the dense matrix
977  , bool SF // Symmetry flag
978  , size_t... CRAs > // Compile time row arguments
979 template< typename VT > // Type of the right-hand side vector
980 inline Row<MT,true,true,SF,CRAs...>&
981  Row<MT,true,true,SF,CRAs...>::operator-=( const Vector<VT,true>& rhs )
982 {
983  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
985 
986  if( size() != (~rhs).size() ) {
987  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
988  }
989 
990  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
991  Right right( ~rhs );
992 
993  if( !trySubAssign( matrix_, right, row(), 0UL ) ) {
994  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
995  }
996 
997  decltype(auto) left( derestrict( *this ) );
998 
999  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1000  const ResultType_<VT> tmp( right );
1001  smpSubAssign( left, tmp );
1002  }
1003  else {
1004  smpSubAssign( left, right );
1005  }
1006 
1007  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1008 
1009  return *this;
1010 }
1012 //*************************************************************************************************
1013 
1014 
1015 //*************************************************************************************************
1028 template< typename MT // Type of the dense matrix
1029  , bool SF // Symmetry flag
1030  , size_t... CRAs > // Compile time row arguments
1031 template< typename VT > // Type of the right-hand side vector
1032 inline Row<MT,true,true,SF,CRAs...>&
1033  Row<MT,true,true,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1034 {
1035  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1037 
1038  if( size() != (~rhs).size() ) {
1039  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1040  }
1041 
1042  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1043  Right right( ~rhs );
1044 
1045  if( !tryMultAssign( matrix_, right, row(), 0UL ) ) {
1046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1047  }
1048 
1049  decltype(auto) left( derestrict( *this ) );
1050 
1051  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1052  const ResultType_<VT> tmp( right );
1053  smpMultAssign( left, tmp );
1054  }
1055  else {
1056  smpMultAssign( left, right );
1057  }
1058 
1059  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1060 
1061  return *this;
1062 }
1064 //*************************************************************************************************
1065 
1066 
1067 //*************************************************************************************************
1079 template< typename MT // Type of the dense matrix
1080  , bool SF // Symmetry flag
1081  , size_t... CRAs > // Compile time row arguments
1082 template< typename VT > // Type of the right-hand side dense vector
1083 inline Row<MT,true,true,SF,CRAs...>&
1084  Row<MT,true,true,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1085 {
1086  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1088 
1089  if( size() != (~rhs).size() ) {
1090  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1091  }
1092 
1093  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
1094  Right right( ~rhs );
1095 
1096  if( !tryDivAssign( matrix_, right, row(), 0UL ) ) {
1097  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1098  }
1099 
1100  decltype(auto) left( derestrict( *this ) );
1101 
1102  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1103  const ResultType_<VT> tmp( right );
1104  smpDivAssign( left, tmp );
1105  }
1106  else {
1107  smpDivAssign( left, right );
1108  }
1109 
1110  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1111 
1112  return *this;
1113 }
1115 //*************************************************************************************************
1116 
1117 
1118 //*************************************************************************************************
1131 template< typename MT // Type of the dense matrix
1132  , bool SF // Symmetry flag
1133  , size_t... CRAs > // Compile time row arguments
1134 template< typename VT > // Type of the right-hand side vector
1135 inline Row<MT,true,true,SF,CRAs...>&
1136  Row<MT,true,true,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1137 {
1138  using blaze::assign;
1139 
1140  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1142 
1143  using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1144 
1148 
1149  if( size() != 3UL || (~rhs).size() != 3UL ) {
1150  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1151  }
1152 
1153  const CrossType right( *this % (~rhs) );
1154 
1155  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
1156  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1157  }
1158 
1159  decltype(auto) left( derestrict( *this ) );
1160 
1161  assign( left, right );
1162 
1163  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1164 
1165  return *this;
1166 }
1168 //*************************************************************************************************
1169 
1170 
1171 
1172 
1173 //=================================================================================================
1174 //
1175 // UTILITY FUNCTIONS
1176 //
1177 //=================================================================================================
1178 
1179 //*************************************************************************************************
1185 template< typename MT // Type of the dense matrix
1186  , bool SF // Symmetry flag
1187  , size_t... CRAs > // Compile time row arguments
1188 inline MT& Row<MT,true,true,SF,CRAs...>::operand() noexcept
1189 {
1190  return matrix_;
1191 }
1193 //*************************************************************************************************
1194 
1195 
1196 //*************************************************************************************************
1202 template< typename MT // Type of the dense matrix
1203  , bool SF // Symmetry flag
1204  , size_t... CRAs > // Compile time row arguments
1205 inline const MT& Row<MT,true,true,SF,CRAs...>::operand() const noexcept
1206 {
1207  return matrix_;
1208 }
1210 //*************************************************************************************************
1211 
1212 
1213 //*************************************************************************************************
1219 template< typename MT // Type of the dense matrix
1220  , bool SF // Symmetry flag
1221  , size_t... CRAs > // Compile time row arguments
1222 inline size_t Row<MT,true,true,SF,CRAs...>::size() const noexcept
1223 {
1224  return matrix_.columns();
1225 }
1227 //*************************************************************************************************
1228 
1229 
1230 //*************************************************************************************************
1239 template< typename MT // Type of the dense matrix
1240  , bool SF // Symmetry flag
1241  , size_t... CRAs > // Compile time row arguments
1242 inline size_t Row<MT,true,true,SF,CRAs...>::spacing() const noexcept
1243 {
1244  return matrix_.spacing();
1245 }
1247 //*************************************************************************************************
1248 
1249 
1250 //*************************************************************************************************
1256 template< typename MT // Type of the dense matrix
1257  , bool SF // Symmetry flag
1258  , size_t... CRAs > // Compile time row arguments
1259 inline size_t Row<MT,true,true,SF,CRAs...>::capacity() const noexcept
1260 {
1261  return matrix_.capacity( row() );
1262 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1276 template< typename MT // Type of the dense matrix
1277  , bool SF // Symmetry flag
1278  , size_t... CRAs > // Compile time row arguments
1279 inline size_t Row<MT,true,true,SF,CRAs...>::nonZeros() const
1280 {
1281  return matrix_.nonZeros( row() );
1282 }
1284 //*************************************************************************************************
1285 
1286 
1287 //*************************************************************************************************
1293 template< typename MT // Type of the dense matrix
1294  , bool SF // Symmetry flag
1295  , size_t... CRAs > // Compile time row arguments
1297 {
1298  matrix_.reset( row() );
1299 }
1301 //*************************************************************************************************
1302 
1303 
1304 
1305 
1306 //=================================================================================================
1307 //
1308 // NUMERIC FUNCTIONS
1309 //
1310 //=================================================================================================
1311 
1312 //*************************************************************************************************
1325 template< typename MT // Type of the dense matrix
1326  , bool SF // Symmetry flag
1327  , size_t... CRAs > // Compile time row arguments
1328 template< typename Other > // Data type of the scalar value
1329 inline Row<MT,true,true,SF,CRAs...>&
1330  Row<MT,true,true,SF,CRAs...>::scale( const Other& scalar )
1331 {
1333 
1334  const size_t jbegin( ( IsUpper<MT>::value )
1335  ?( ( IsStrictlyUpper<MT>::value )
1336  ?( row()+1UL )
1337  :( row() ) )
1338  :( 0UL ) );
1339  const size_t jend ( ( IsLower<MT>::value )
1340  ?( ( IsStrictlyLower<MT>::value )
1341  ?( row() )
1342  :( row()+1UL ) )
1343  :( size() ) );
1344 
1345  for( size_t j=jbegin; j<jend; ++j ) {
1346  matrix_(row(),j) *= scalar;
1347  }
1348 
1349  return *this;
1350 }
1352 //*************************************************************************************************
1353 
1354 
1355 
1356 
1357 //=================================================================================================
1358 //
1359 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1360 //
1361 //=================================================================================================
1362 
1363 //*************************************************************************************************
1374 template< typename MT // Type of the dense matrix
1375  , bool SF // Symmetry flag
1376  , size_t... CRAs > // Compile time row arguments
1377 template< typename Other > // Data type of the foreign expression
1378 inline bool Row<MT,true,true,SF,CRAs...>::canAlias( const Other* alias ) const noexcept
1379 {
1380  return matrix_.isAliased( alias );
1381 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1397 template< typename MT // Type of the dense matrix
1398  , bool SF // Symmetry flag
1399  , size_t... CRAs > // Compile time row arguments
1400 template< typename MT2 // Data type of the foreign dense row
1401  , bool SO2 // Storage order of the foreign dense row
1402  , bool SF2 // Symmetry flag of the foreign dense row
1403  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
1404 inline bool
1405  Row<MT,true,true,SF,CRAs...>::canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
1406 {
1407  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1424 template< typename MT // Type of the dense matrix
1425  , bool SF // Symmetry flag
1426  , size_t... CRAs > // Compile time row arguments
1427 template< typename Other > // Data type of the foreign expression
1428 inline bool Row<MT,true,true,SF,CRAs...>::isAliased( const Other* alias ) const noexcept
1429 {
1430  return matrix_.isAliased( alias );
1431 }
1433 //*************************************************************************************************
1434 
1435 
1436 //*************************************************************************************************
1447 template< typename MT // Type of the dense matrix
1448  , bool SF // Symmetry flag
1449  , size_t... CRAs > // Compile time row arguments
1450 template< typename MT2 // Data type of the foreign dense row
1451  , bool SO2 // Storage order of the foreign dense row
1452  , bool SF2 // Symmetry flag of the foreign dense row
1453  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
1454 inline bool
1455  Row<MT,true,true,SF,CRAs...>::isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
1456 {
1457  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
1458 }
1460 //*************************************************************************************************
1461 
1462 
1463 //*************************************************************************************************
1473 template< typename MT // Type of the dense matrix
1474  , bool SF // Symmetry flag
1475  , size_t... CRAs > // Compile time row arguments
1476 inline bool Row<MT,true,true,SF,CRAs...>::isAligned() const noexcept
1477 {
1478  return matrix_.isAligned();
1479 }
1481 //*************************************************************************************************
1482 
1483 
1484 //*************************************************************************************************
1495 template< typename MT // Type of the dense matrix
1496  , bool SF // Symmetry flag
1497  , size_t... CRAs > // Compile time row arguments
1498 inline bool Row<MT,true,true,SF,CRAs...>::canSMPAssign() const noexcept
1499 {
1500  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1501 }
1503 //*************************************************************************************************
1504 
1505 
1506 //*************************************************************************************************
1519 template< typename MT // Type of the dense matrix
1520  , bool SF // Symmetry flag
1521  , size_t... CRAs > // Compile time row arguments
1522 BLAZE_ALWAYS_INLINE typename Row<MT,true,true,SF,CRAs...>::SIMDType
1523  Row<MT,true,true,SF,CRAs...>::load( size_t index ) const noexcept
1524 {
1525  return matrix_.load( row(), index );
1526 }
1528 //*************************************************************************************************
1529 
1530 
1531 //*************************************************************************************************
1544 template< typename MT // Type of the dense matrix
1545  , bool SF // Symmetry flag
1546  , size_t... CRAs > // Compile time row arguments
1547 BLAZE_ALWAYS_INLINE typename Row<MT,true,true,SF,CRAs...>::SIMDType
1548  Row<MT,true,true,SF,CRAs...>::loada( size_t index ) const noexcept
1549 {
1550  return matrix_.loada( row(), index );
1551 }
1553 //*************************************************************************************************
1554 
1555 
1556 //*************************************************************************************************
1569 template< typename MT // Type of the dense matrix
1570  , bool SF // Symmetry flag
1571  , size_t... CRAs > // Compile time row arguments
1572 BLAZE_ALWAYS_INLINE typename Row<MT,true,true,SF,CRAs...>::SIMDType
1573  Row<MT,true,true,SF,CRAs...>::loadu( size_t index ) const noexcept
1574 {
1575  return matrix_.loadu( row(), index );
1576 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1595 template< typename MT // Type of the dense matrix
1596  , bool SF // Symmetry flag
1597  , size_t... CRAs > // Compile time row arguments
1599  Row<MT,true,true,SF,CRAs...>::store( size_t index, const SIMDType& value ) noexcept
1600 {
1601  matrix_.store( row(), index, value );
1602 }
1604 //*************************************************************************************************
1605 
1606 
1607 //*************************************************************************************************
1621 template< typename MT // Type of the dense matrix
1622  , bool SF // Symmetry flag
1623  , size_t... CRAs > // Compile time row arguments
1625  Row<MT,true,true,SF,CRAs...>::storea( size_t index, const SIMDType& value ) noexcept
1626 {
1627  matrix_.storea( row(), index, value );
1628 }
1630 //*************************************************************************************************
1631 
1632 
1633 //*************************************************************************************************
1647 template< typename MT // Type of the dense matrix
1648  , bool SF // Symmetry flag
1649  , size_t... CRAs > // Compile time row arguments
1651  Row<MT,true,true,SF,CRAs...>::storeu( size_t index, const SIMDType& value ) noexcept
1652 {
1653  matrix_.storeu( row(), index, value );
1654 }
1656 //*************************************************************************************************
1657 
1658 
1659 //*************************************************************************************************
1673 template< typename MT // Type of the dense matrix
1674  , bool SF // Symmetry flag
1675  , size_t... CRAs > // Compile time row arguments
1677  Row<MT,true,true,SF,CRAs...>::stream( size_t index, const SIMDType& value ) noexcept
1678 {
1679  matrix_.stream( row(), index, value );
1680 }
1682 //*************************************************************************************************
1683 
1684 
1685 //*************************************************************************************************
1697 template< typename MT // Type of the dense matrix
1698  , bool SF // Symmetry flag
1699  , size_t... CRAs > // Compile time row arguments
1700 template< typename VT > // Type of the right-hand side dense vector
1701 inline DisableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1702  Row<MT,true,true,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1703 {
1704  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1705 
1706  const size_t jpos( (~rhs).size() & size_t(-2) );
1707  for( size_t j=0UL; j<jpos; j+=2UL ) {
1708  matrix_(row(),j ) = (~rhs)[j ];
1709  matrix_(row(),j+1UL) = (~rhs)[j+1UL];
1710  }
1711  if( jpos < (~rhs).size() )
1712  matrix_(row(),jpos) = (~rhs)[jpos];
1713 }
1715 //*************************************************************************************************
1716 
1717 
1718 //*************************************************************************************************
1730 template< typename MT // Type of the dense matrix
1731  , bool SF // Symmetry flag
1732  , size_t... CRAs > // Compile time row arguments
1733 template< typename VT > // Type of the right-hand side dense vector
1734 inline EnableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1735  Row<MT,true,true,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1736 {
1738 
1739  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1740 
1741  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1742 
1743  const size_t columns( size() );
1744 
1745  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
1746  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
1747 
1748  size_t j( 0UL );
1749  Iterator left( begin() );
1750  ConstIterator_<VT> right( (~rhs).begin() );
1751 
1752  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1753  {
1754  for( ; j<jpos; j+=SIMDSIZE ) {
1755  left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1756  }
1757  for( ; remainder && j<columns; ++j ) {
1758  *left = *right; ++left; ++right;
1759  }
1760  }
1761  else
1762  {
1763  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1764  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1765  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1766  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1767  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1768  }
1769  for( ; j<jpos; j+=SIMDSIZE ) {
1770  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1771  }
1772  for( ; remainder && j<columns; ++j ) {
1773  *left = *right; ++left; ++right;
1774  }
1775  }
1776 }
1778 //*************************************************************************************************
1779 
1780 
1781 //*************************************************************************************************
1793 template< typename MT // Type of the dense matrix
1794  , bool SF // Symmetry flag
1795  , size_t... CRAs > // Compile time row arguments
1796 template< typename VT > // Type of the right-hand side sparse vector
1797 inline void Row<MT,true,true,SF,CRAs...>::assign( const SparseVector<VT,true>& rhs )
1798 {
1799  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1800 
1801  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1802  matrix_(row(),element->index()) = element->value();
1803 }
1805 //*************************************************************************************************
1806 
1807 
1808 //*************************************************************************************************
1820 template< typename MT // Type of the dense matrix
1821  , bool SF // Symmetry flag
1822  , size_t... CRAs > // Compile time row arguments
1823 template< typename VT > // Type of the right-hand side dense vector
1824 inline DisableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1825  Row<MT,true,true,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1826 {
1827  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1828 
1829  const size_t jpos( (~rhs).size() & size_t(-2) );
1830  for( size_t j=0UL; j<jpos; j+=2UL ) {
1831  matrix_(row(),j ) += (~rhs)[j ];
1832  matrix_(row(),j+1UL) += (~rhs)[j+1UL];
1833  }
1834  if( jpos < (~rhs).size() )
1835  matrix_(row(),jpos) += (~rhs)[jpos];
1836 }
1838 //*************************************************************************************************
1839 
1840 
1841 //*************************************************************************************************
1853 template< typename MT // Type of the dense matrix
1854  , bool SF // Symmetry flag
1855  , size_t... CRAs > // Compile time row arguments
1856 template< typename VT > // Type of the right-hand side dense vector
1857 inline EnableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1858  Row<MT,true,true,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1859 {
1861 
1862  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1863 
1864  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1865 
1866  const size_t columns( size() );
1867 
1868  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
1869  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
1870 
1871  size_t j( 0UL );
1872  Iterator left( begin() );
1873  ConstIterator_<VT> right( (~rhs).begin() );
1874 
1875  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1876  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1877  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1878  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1879  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1880  }
1881  for( ; j<jpos; j+=SIMDSIZE ) {
1882  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1883  }
1884  for( ; remainder && j<columns; ++j ) {
1885  *left += *right; ++left; ++right;
1886  }
1887 }
1889 //*************************************************************************************************
1890 
1891 
1892 //*************************************************************************************************
1904 template< typename MT // Type of the dense matrix
1905  , bool SF // Symmetry flag
1906  , size_t... CRAs > // Compile time row arguments
1907 template< typename VT > // Type of the right-hand side sparse vector
1908 inline void Row<MT,true,true,SF,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
1909 {
1910  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1911 
1912  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1913  matrix_(row(),element->index()) += element->value();
1914 }
1916 //*************************************************************************************************
1917 
1918 
1919 //*************************************************************************************************
1931 template< typename MT // Type of the dense matrix
1932  , bool SF // Symmetry flag
1933  , size_t... CRAs > // Compile time row arguments
1934 template< typename VT > // Type of the right-hand side dense vector
1935 inline DisableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1936  Row<MT,true,true,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
1937 {
1938  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1939 
1940  const size_t jpos( (~rhs).size() & size_t(-2) );
1941  for( size_t j=0UL; j<jpos; j+=2UL ) {
1942  matrix_(row(),j ) -= (~rhs)[j ];
1943  matrix_(row(),j+1UL) -= (~rhs)[j+1UL];
1944  }
1945  if( jpos < (~rhs).size() )
1946  matrix_(row(),jpos) -= (~rhs)[jpos];
1947 }
1949 //*************************************************************************************************
1950 
1951 
1952 //*************************************************************************************************
1964 template< typename MT // Type of the dense matrix
1965  , bool SF // Symmetry flag
1966  , size_t... CRAs > // Compile time row arguments
1967 template< typename VT > // Type of the right-hand side dense vector
1968 inline EnableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1969  Row<MT,true,true,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
1970 {
1972 
1973  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1974 
1975  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1976 
1977  const size_t columns( size() );
1978 
1979  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
1980  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
1981 
1982  size_t j( 0UL );
1983  Iterator left( begin() );
1984  ConstIterator_<VT> right( (~rhs).begin() );
1985 
1986  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1987  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1988  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1989  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1990  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1991  }
1992  for( ; j<jpos; j+=SIMDSIZE ) {
1993  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1994  }
1995  for( ; remainder && j<columns; ++j ) {
1996  *left -= *right; ++left; ++right;
1997  }
1998 }
2000 //*************************************************************************************************
2001 
2002 
2003 //*************************************************************************************************
2015 template< typename MT // Type of the dense matrix
2016  , bool SF // Symmetry flag
2017  , size_t... CRAs > // Compile time row arguments
2018 template< typename VT > // Type of the right-hand side sparse vector
2019 inline void Row<MT,true,true,SF,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
2020 {
2021  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2022 
2023  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2024  matrix_(row(),element->index()) -= element->value();
2025 }
2027 //*************************************************************************************************
2028 
2029 
2030 //*************************************************************************************************
2042 template< typename MT // Type of the dense matrix
2043  , bool SF // Symmetry flag
2044  , size_t... CRAs > // Compile time row arguments
2045 template< typename VT > // Type of the right-hand side dense vector
2046 inline DisableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2047  Row<MT,true,true,SF,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
2048 {
2049  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2050 
2051  const size_t jpos( (~rhs).size() & size_t(-2) );
2052  for( size_t j=0UL; j<jpos; j+=2UL ) {
2053  matrix_(row(),j ) *= (~rhs)[j ];
2054  matrix_(row(),j+1UL) *= (~rhs)[j+1UL];
2055  }
2056  if( jpos < (~rhs).size() )
2057  matrix_(row(),jpos) *= (~rhs)[jpos];
2058 }
2060 //*************************************************************************************************
2061 
2062 
2063 //*************************************************************************************************
2075 template< typename MT // Type of the dense matrix
2076  , bool SF // Symmetry flag
2077  , size_t... CRAs > // Compile time row arguments
2078 template< typename VT > // Type of the right-hand side dense vector
2079 inline EnableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2080  Row<MT,true,true,SF,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
2081 {
2083 
2084  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2085 
2086  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
2087 
2088  const size_t columns( size() );
2089 
2090  const size_t jpos( ( remainder )?( columns & size_t(-SIMDSIZE) ):( columns ) );
2091  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2092 
2093  size_t j( 0UL );
2094  Iterator left( begin() );
2095  ConstIterator_<VT> right( (~rhs).begin() );
2096 
2097  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2098  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2099  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2100  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2101  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2102  }
2103  for( ; j<jpos; j+=SIMDSIZE ) {
2104  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2105  }
2106  for( ; remainder && j<columns; ++j ) {
2107  *left *= *right; ++left; ++right;
2108  }
2109 }
2111 //*************************************************************************************************
2112 
2113 
2114 //*************************************************************************************************
2126 template< typename MT // Type of the dense matrix
2127  , bool SF // Symmetry flag
2128  , size_t... CRAs > // Compile time row arguments
2129 template< typename VT > // Type of the right-hand side sparse vector
2130 inline void Row<MT,true,true,SF,CRAs...>::multAssign( const SparseVector<VT,true>& rhs )
2131 {
2132  using blaze::reset;
2133 
2134  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2135 
2136  size_t j( 0UL );
2137 
2138  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2139  const size_t index( element->index() );
2140  for( ; j<index; ++j )
2141  reset( matrix_(row(),j) );
2142  matrix_(row(),j) *= element->value();
2143  ++j;
2144  }
2145 
2146  for( ; j<size(); ++j ) {
2147  reset( matrix_(row(),j) );
2148  }
2149 }
2151 //*************************************************************************************************
2152 
2153 
2154 //*************************************************************************************************
2166 template< typename MT // Type of the dense matrix
2167  , bool SF // Symmetry flag
2168  , size_t... CRAs > // Compile time row arguments
2169 template< typename VT > // Type of the right-hand side dense vector
2170 inline DisableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2171  Row<MT,true,true,SF,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
2172 {
2173  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2174 
2175  const size_t jpos( (~rhs).size() & size_t(-2) );
2176  for( size_t j=0UL; j<jpos; j+=2UL ) {
2177  matrix_(row(),j ) /= (~rhs)[j ];
2178  matrix_(row(),j+1UL) /= (~rhs)[j+1UL];
2179  }
2180  if( jpos < (~rhs).size() )
2181  matrix_(row(),jpos) /= (~rhs)[jpos];
2182 }
2184 //*************************************************************************************************
2185 
2186 
2187 //*************************************************************************************************
2199 template< typename MT // Type of the dense matrix
2200  , bool SF // Symmetry flag
2201  , size_t... CRAs > // Compile time row arguments
2202 template< typename VT > // Type of the right-hand side dense vector
2203 inline EnableIf_< typename Row<MT,true,true,SF,CRAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2204  Row<MT,true,true,SF,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
2205 {
2207 
2208  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2209 
2210  const size_t columns( size() );
2211 
2212  const size_t jpos( columns & size_t(-SIMDSIZE) );
2213  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2214 
2215  size_t j( 0UL );
2216  Iterator left( begin() );
2217  ConstIterator_<VT> right( (~rhs).begin() );
2218 
2219  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2220  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2221  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2222  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2223  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2224  }
2225  for( ; j<jpos; j+=SIMDSIZE ) {
2226  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2227  }
2228  for( ; j<columns; ++j ) {
2229  *left /= *right; ++left; ++right;
2230  }
2231 }
2233 //*************************************************************************************************
2234 
2235 
2236 
2237 
2238 
2239 
2240 
2241 
2242 //=================================================================================================
2243 //
2244 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR MATRICES
2245 //
2246 //=================================================================================================
2247 
2248 //*************************************************************************************************
2256 template< typename MT // Type of the dense matrix
2257  , size_t... CRAs > // Compile time row arguments
2258 class Row<MT,false,true,false,CRAs...>
2259  : public View< DenseVector< Row<MT,false,true,false,CRAs...>, true > >
2260  , private RowData<CRAs...>
2261 {
2262  private:
2263  //**Type definitions****************************************************************************
2264  using DataType = RowData<CRAs...>;
2265  using Operand = If_< IsExpression<MT>, MT, MT& >;
2266  //**********************************************************************************************
2267 
2268  public:
2269  //**Type definitions****************************************************************************
2271  using This = Row<MT,false,true,false,CRAs...>;
2272 
2273  using BaseType = DenseVector<This,true>;
2274  using ViewedType = MT;
2275  using ResultType = RowTrait_<MT,CRAs...>;
2276  using TransposeType = TransposeType_<ResultType>;
2277  using ElementType = ElementType_<MT>;
2278  using ReturnType = ElementType_<MT>;
2279  using CompositeType = const Row&;
2280 
2282  using ConstReference = ConstReference_<MT>;
2283 
2285  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
2286 
2288  using ConstPointer = ConstPointer_<MT>;
2289 
2291  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
2292  //**********************************************************************************************
2293 
2294  //**RowIterator class definition****************************************************************
2297  template< typename MatrixType // Type of the dense matrix
2298  , typename IteratorType > // Type of the dense matrix iterator
2299  class RowIterator
2300  {
2301  public:
2302  //**Type definitions*************************************************************************
2304  using IteratorCategory = typename std::iterator_traits<IteratorType>::iterator_category;
2305 
2307  using ValueType = typename std::iterator_traits<IteratorType>::value_type;
2308 
2310  using PointerType = typename std::iterator_traits<IteratorType>::pointer;
2311 
2313  using ReferenceType = typename std::iterator_traits<IteratorType>::reference;
2314 
2316  using DifferenceType = typename std::iterator_traits<IteratorType>::difference_type;
2317 
2318  // STL iterator requirements
2319  using iterator_category = IteratorCategory;
2320  using value_type = ValueType;
2321  using pointer = PointerType;
2322  using reference = ReferenceType;
2323  using difference_type = DifferenceType;
2324  //*******************************************************************************************
2325 
2326  //**Constructor******************************************************************************
2329  inline RowIterator() noexcept
2330  : matrix_( nullptr ) // The dense matrix containing the row
2331  , row_ ( 0UL ) // The current row index
2332  , column_( 0UL ) // The current column index
2333  , pos_ ( ) // Iterator to the current dense element
2334  {}
2335  //*******************************************************************************************
2336 
2337  //**Constructor******************************************************************************
2344  inline RowIterator( MatrixType& matrix, size_t row, size_t column ) noexcept
2345  : matrix_( &matrix ) // The dense matrix containing the row
2346  , row_ ( row ) // The current row index
2347  , column_( column ) // The current column index
2348  , pos_ ( ) // Iterator to the current dense element
2349  {
2350  if( column_ != matrix_->columns() )
2351  pos_ = matrix_->begin( column_ ) + row_;
2352  }
2353  //*******************************************************************************************
2354 
2355  //**Constructor******************************************************************************
2360  template< typename MatrixType2, typename IteratorType2 >
2361  inline RowIterator( const RowIterator<MatrixType2,IteratorType2>& it ) noexcept
2362  : matrix_( it.matrix_ ) // The dense matrix containing the row
2363  , row_ ( it.row_ ) // The current row index
2364  , column_( it.column_ ) // The current column index
2365  , pos_ ( it.pos_ ) // Iterator to the current dense element
2366  {}
2367  //*******************************************************************************************
2368 
2369  //**Addition assignment operator*************************************************************
2375  inline RowIterator& operator+=( size_t inc ) noexcept {
2376  using blaze::reset;
2377  column_ += inc;
2378  if( column_ != matrix_->columns() )
2379  pos_ = matrix_->begin( column_ ) + row_;
2380  else reset( pos_ );
2381  return *this;
2382  }
2383  //*******************************************************************************************
2384 
2385  //**Subtraction assignment operator**********************************************************
2391  inline RowIterator& operator-=( size_t dec ) noexcept {
2392  using blaze::reset;
2393  column_ -= dec;
2394  if( column_ != matrix_->columns() )
2395  pos_ = matrix_->begin( column_ ) + row_;
2396  else reset( pos_ );
2397  return *this;
2398  }
2399  //*******************************************************************************************
2400 
2401  //**Prefix increment operator****************************************************************
2406  inline RowIterator& operator++() noexcept {
2407  using blaze::reset;
2408  ++column_;
2409  if( column_ != matrix_->columns() )
2410  pos_ = matrix_->begin( column_ ) + row_;
2411  else reset( pos_ );
2412  return *this;
2413  }
2414  //*******************************************************************************************
2415 
2416  //**Postfix increment operator***************************************************************
2421  inline const RowIterator operator++( int ) noexcept {
2422  const RowIterator tmp( *this );
2423  ++(*this);
2424  return tmp;
2425  }
2426  //*******************************************************************************************
2427 
2428  //**Prefix decrement operator****************************************************************
2433  inline RowIterator& operator--() noexcept {
2434  using blaze::reset;
2435  --column_;
2436  if( column_ != matrix_->columns() )
2437  pos_ = matrix_->begin( column_ ) + row_;
2438  else reset( pos_ );
2439  return *this;
2440  }
2441  //*******************************************************************************************
2442 
2443  //**Postfix decrement operator***************************************************************
2448  inline const RowIterator operator--( int ) noexcept {
2449  const RowIterator tmp( *this );
2450  --(*this);
2451  return tmp;
2452  }
2453  //*******************************************************************************************
2454 
2455  //**Subscript operator***********************************************************************
2461  inline ReferenceType operator[]( size_t index ) const {
2462  BLAZE_USER_ASSERT( column_+index < matrix_->columns(), "Invalid access index detected" );
2463  const IteratorType pos( matrix_->begin( column_+index ) + row_ );
2464  return *pos;
2465  }
2466  //*******************************************************************************************
2467 
2468  //**Element access operator******************************************************************
2473  inline ReferenceType operator*() const {
2474  return *pos_;
2475  }
2476  //*******************************************************************************************
2477 
2478  //**Element access operator******************************************************************
2483  inline PointerType operator->() const {
2484  return pos_;
2485  }
2486  //*******************************************************************************************
2487 
2488  //**Equality operator************************************************************************
2494  template< typename MatrixType2, typename IteratorType2 >
2495  inline bool operator==( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2496  return column_ == rhs.column_;
2497  }
2498  //*******************************************************************************************
2499 
2500  //**Inequality operator**********************************************************************
2506  template< typename MatrixType2, typename IteratorType2 >
2507  inline bool operator!=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2508  return !( *this == rhs );
2509  }
2510  //*******************************************************************************************
2511 
2512  //**Less-than operator***********************************************************************
2518  template< typename MatrixType2, typename IteratorType2 >
2519  inline bool operator<( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2520  return column_ < rhs.column_;
2521  }
2522  //*******************************************************************************************
2523 
2524  //**Greater-than operator********************************************************************
2530  template< typename MatrixType2, typename IteratorType2 >
2531  inline bool operator>( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2532  return column_ > rhs.column_;
2533  }
2534  //*******************************************************************************************
2535 
2536  //**Less-or-equal-than operator**************************************************************
2542  template< typename MatrixType2, typename IteratorType2 >
2543  inline bool operator<=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2544  return column_ <= rhs.column_;
2545  }
2546  //*******************************************************************************************
2547 
2548  //**Greater-or-equal-than operator***********************************************************
2554  template< typename MatrixType2, typename IteratorType2 >
2555  inline bool operator>=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2556  return column_ >= rhs.column_;
2557  }
2558  //*******************************************************************************************
2559 
2560  //**Subtraction operator*********************************************************************
2566  inline DifferenceType operator-( const RowIterator& rhs ) const noexcept {
2567  return column_ - rhs.column_;
2568  }
2569  //*******************************************************************************************
2570 
2571  //**Addition operator************************************************************************
2578  friend inline const RowIterator operator+( const RowIterator& it, size_t inc ) noexcept {
2579  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2580  }
2581  //*******************************************************************************************
2582 
2583  //**Addition operator************************************************************************
2590  friend inline const RowIterator operator+( size_t inc, const RowIterator& it ) noexcept {
2591  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2592  }
2593  //*******************************************************************************************
2594 
2595  //**Subtraction operator*********************************************************************
2602  friend inline const RowIterator operator-( const RowIterator& it, size_t dec ) noexcept {
2603  return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2604  }
2605  //*******************************************************************************************
2606 
2607  private:
2608  //**Member variables*************************************************************************
2609  MatrixType* matrix_;
2610  size_t row_;
2611  size_t column_;
2612  IteratorType pos_;
2613  //*******************************************************************************************
2614 
2615  //**Friend declarations**********************************************************************
2616  template< typename MatrixType2, typename IteratorType2 > friend class RowIterator;
2617  //*******************************************************************************************
2618  };
2619  //**********************************************************************************************
2620 
2621  //**Type definitions****************************************************************************
2623  using ConstIterator = RowIterator< const MT, ConstIterator_<MT> >;
2624 
2626  using Iterator = If_< IsConst<MT>, ConstIterator, RowIterator< MT, Iterator_<MT> > >;
2627  //**********************************************************************************************
2628 
2629  //**Compilation flags***************************************************************************
2631  enum : bool { simdEnabled = false };
2632 
2634  enum : bool { smpAssignable = MT::smpAssignable };
2635  //**********************************************************************************************
2636 
2637  //**Constructors********************************************************************************
2640  template< typename... RRAs >
2641  explicit inline Row( MT& matrix, RRAs... args );
2642  // No explicitly declared copy constructor.
2644  //**********************************************************************************************
2645 
2646  //**Destructor**********************************************************************************
2647  // No explicitly declared destructor.
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< TypeList<RRAs...>, Unchecked >::value ) {
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<MT>::value )
3088  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3089  ?( row()+1UL )
3090  :( row() ) )
3091  :( 0UL ) );
3092  const size_t jend ( ( IsLower<MT>::value )
3093  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3094  ?( row() )
3095  :( row()+1UL ) )
3096  :( size() ) );
3097 
3098  for( size_t j=jbegin; j<jend; ++j ) {
3099  if( !IsRestricted<MT>::value || IsTriangular<MT>::value || 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<MT>::value ) {
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<MT>::value && 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_< IsRestricted<MT>, CompositeType_<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<Right>::value && right.canAlias( &matrix_ ) ) {
3237  const ResultType tmp( right );
3238  smpAssign( left, tmp );
3239  }
3240  else {
3241  if( IsSparseVector<VT>::value )
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_<VT> );
3276 
3277  if( size() != (~rhs).size() ) {
3278  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3279  }
3280 
3281  using Right = If_< IsRestricted<MT>, CompositeType_<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<Right>::value && right.canAlias( &matrix_ ) ) {
3291  const ResultType_<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_<VT> );
3328 
3329  if( size() != (~rhs).size() ) {
3330  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3331  }
3332 
3333  using Right = If_< IsRestricted<MT>, CompositeType_<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<Right>::value && right.canAlias( &matrix_ ) ) {
3343  const ResultType_<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_<VT> );
3379 
3380  if( size() != (~rhs).size() ) {
3381  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3382  }
3383 
3384  using Right = If_< IsRestricted<MT>, CompositeType_<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<Right>::value && right.canAlias( &matrix_ ) ) {
3394  const ResultType_<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_<VT> );
3429 
3430  if( size() != (~rhs).size() ) {
3431  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3432  }
3433 
3434  using Right = If_< IsRestricted<MT>, CompositeType_<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<Right>::value && right.canAlias( &matrix_ ) ) {
3444  const ResultType_<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_<VT> );
3482 
3483  using CrossType = CrossTrait_< ResultType, ResultType_<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<MT>::value )
3641  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3642  ?( row()+1UL )
3643  :( row() ) )
3644  :( 0UL ) );
3645  const size_t jend ( ( IsLower<MT>::value )
3646  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
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<MT>::value )
3688  ?( ( IsStrictlyUpper<MT>::value )
3689  ?( row()+1UL )
3690  :( row() ) )
3691  :( 0UL ) );
3692  const size_t jend ( ( IsLower<MT>::value )
3693  ?( ( IsStrictlyLower<MT>::value )
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_<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_<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_<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_<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_< IsExpression<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_<MT,CRAs...>;
4165  using TransposeType = TransposeType_<ResultType>;
4166  using ElementType = ElementType_<MT>;
4167  using SIMDType = SIMDTrait_<ElementType>;
4168  using ReturnType = ElementType_<MT>;
4169  using CompositeType = const Row&;
4170 
4172  using ConstReference = ConstReference_<MT>;
4173 
4175  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
4176 
4178  using ConstPointer = ConstPointer_<MT>;
4179 
4181  using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, Pointer_<MT> >;
4182 
4184  using ConstIterator = ConstIterator_<MT>;
4185 
4187  using Iterator = If_< IsConst<MT>, ConstIterator, Iterator_<MT> >;
4188  //**********************************************************************************************
4189 
4190  //**Compilation flags***************************************************************************
4192  enum : bool { simdEnabled = MT::simdEnabled };
4193 
4195  enum : bool { smpAssignable = MT::smpAssignable };
4196  //**********************************************************************************************
4197 
4198  //**Constructors********************************************************************************
4201  template< typename... RRAs >
4202  explicit inline Row( MT& matrix, RRAs... args );
4203  // No explicitly declared copy constructor.
4205  //**********************************************************************************************
4206 
4207  //**Destructor**********************************************************************************
4208  // No explicitly declared destructor.
4209  //**********************************************************************************************
4210 
4211  //**Data access functions***********************************************************************
4214  inline Reference operator[]( size_t index );
4215  inline ConstReference operator[]( size_t index ) const;
4216  inline Reference at( size_t index );
4217  inline ConstReference at( size_t index ) const;
4218  inline Pointer data () noexcept;
4219  inline ConstPointer data () const noexcept;
4220  inline Iterator begin ();
4221  inline ConstIterator begin () const;
4222  inline ConstIterator cbegin() const;
4223  inline Iterator end ();
4224  inline ConstIterator end () const;
4225  inline ConstIterator cend () const;
4227  //**********************************************************************************************
4228 
4229  //**Assignment operators************************************************************************
4232  inline Row& operator=( const ElementType& rhs );
4233  inline Row& operator=( initializer_list<ElementType> list );
4234  inline Row& operator=( const Row& rhs );
4235 
4236  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
4237  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
4238  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
4239  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
4240  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4241  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4243  //**********************************************************************************************
4244 
4245  //**Utility functions***************************************************************************
4248  using DataType::row;
4249 
4250  inline MT& operand() noexcept;
4251  inline const MT& operand() const noexcept;
4252 
4253  inline size_t size() const noexcept;
4254  inline size_t spacing() const noexcept;
4255  inline size_t capacity() const noexcept;
4256  inline size_t nonZeros() const;
4257  inline void reset();
4259  //**********************************************************************************************
4260 
4261  //**Numeric functions***************************************************************************
4264  template< typename Other > inline Row& scale( const Other& scalar );
4266  //**********************************************************************************************
4267 
4268  private:
4269  //**********************************************************************************************
4271  template< typename VT >
4272  struct VectorizedAssign {
4273  enum : bool { value = useOptimizedKernels &&
4274  simdEnabled && VT::simdEnabled &&
4275  IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
4276  };
4277  //**********************************************************************************************
4278 
4279  //**********************************************************************************************
4281  template< typename VT >
4282  struct VectorizedAddAssign {
4283  enum : bool { value = useOptimizedKernels &&
4284  simdEnabled && VT::simdEnabled &&
4285  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4286  HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4287  };
4288  //**********************************************************************************************
4289 
4290  //**********************************************************************************************
4292  template< typename VT >
4293  struct VectorizedSubAssign {
4294  enum : bool { value = useOptimizedKernels &&
4295  simdEnabled && VT::simdEnabled &&
4296  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4297  HasSIMDSub< ElementType, ElementType_<VT> >::value };
4298  };
4299  //**********************************************************************************************
4300 
4301  //**********************************************************************************************
4303  template< typename VT >
4304  struct VectorizedMultAssign {
4305  enum : bool { value = useOptimizedKernels &&
4306  simdEnabled && VT::simdEnabled &&
4307  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4308  HasSIMDMult< ElementType, ElementType_<VT> >::value };
4309  };
4310  //**********************************************************************************************
4311 
4312  //**********************************************************************************************
4314  template< typename VT >
4315  struct VectorizedDivAssign {
4316  enum : bool { value = useOptimizedKernels &&
4317  simdEnabled && VT::simdEnabled &&
4318  IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4319  HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4320  };
4321  //**********************************************************************************************
4322 
4323  //**SIMD properties*****************************************************************************
4325  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
4326  //**********************************************************************************************
4327 
4328  public:
4329  //**Expression template evaluation functions****************************************************
4332  template< typename Other >
4333  inline bool canAlias( const Other* alias ) const noexcept;
4334 
4335  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
4336  inline bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
4337 
4338  template< typename Other >
4339  inline bool isAliased( const Other* alias ) const noexcept;
4340 
4341  template< typename MT2, bool SO2, bool SF2, size_t... CRAs2 >
4342  inline bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
4343 
4344  inline bool isAligned () const noexcept;
4345  inline bool canSMPAssign() const noexcept;
4346 
4347  BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
4348  BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
4349  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
4350 
4351  BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
4352  BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
4353  BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
4354  BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
4355 
4356  template< typename VT >
4357  inline DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4358 
4359  template< typename VT >
4360  inline EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4361 
4362  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
4363 
4364  template< typename VT >
4365  inline DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4366 
4367  template< typename VT >
4368  inline EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4369 
4370  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
4371 
4372  template< typename VT >
4373  inline DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4374 
4375  template< typename VT >
4376  inline EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4377 
4378  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
4379 
4380  template< typename VT >
4381  inline DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4382 
4383  template< typename VT >
4384  inline EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4385 
4386  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
4387 
4388  template< typename VT >
4389  inline DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4390 
4391  template< typename VT >
4392  inline EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4394  //**********************************************************************************************
4395 
4396  private:
4397  //**Member variables****************************************************************************
4400  Operand matrix_;
4401 
4402  //**********************************************************************************************
4403 
4404  //**Friend declarations*************************************************************************
4405  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
4406  //**********************************************************************************************
4407 
4408  //**Compile time checks*************************************************************************
4417  //**********************************************************************************************
4418 };
4420 //*************************************************************************************************
4421 
4422 
4423 
4424 
4425 //=================================================================================================
4426 //
4427 // CONSTRUCTORS
4428 //
4429 //=================================================================================================
4430 
4431 //*************************************************************************************************
4444 template< typename MT // Type of the dense matrix
4445  , size_t... CRAs > // Compile time row arguments
4446 template< typename... RRAs > // Runtime row arguments
4447 inline Row<MT,false,true,true,CRAs...>::Row( MT& matrix, RRAs... args )
4448  : DataType( args... ) // Base class initialization
4449  , matrix_ ( matrix ) // The matrix containing the row
4450 {
4451  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
4452  if( matrix_.rows() <= row() ) {
4453  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
4454  }
4455  }
4456  else {
4457  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
4458  }
4459 }
4461 //*************************************************************************************************
4462 
4463 
4464 
4465 
4466 //=================================================================================================
4467 //
4468 // DATA ACCESS FUNCTIONS
4469 //
4470 //=================================================================================================
4471 
4472 //*************************************************************************************************
4482 template< typename MT // Type of the dense matrix
4483  , size_t... CRAs > // Compile time row arguments
4484 inline typename Row<MT,false,true,true,CRAs...>::Reference
4485  Row<MT,false,true,true,CRAs...>::operator[]( size_t index )
4486 {
4487  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4488  return matrix_(index,row());
4489 }
4491 //*************************************************************************************************
4492 
4493 
4494 //*************************************************************************************************
4504 template< typename MT // Type of the dense matrix
4505  , size_t... CRAs > // Compile time row arguments
4506 inline typename Row<MT,false,true,true,CRAs...>::ConstReference
4507  Row<MT,false,true,true,CRAs...>::operator[]( size_t index ) const
4508 {
4509  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4510  return const_cast<const MT&>( matrix_ )(index,row());
4511 }
4513 //*************************************************************************************************
4514 
4515 
4516 //*************************************************************************************************
4527 template< typename MT // Type of the dense matrix
4528  , size_t... CRAs > // Compile time row arguments
4529 inline typename Row<MT,false,true,true,CRAs...>::Reference
4530  Row<MT,false,true,true,CRAs...>::at( size_t index )
4531 {
4532  if( index >= size() ) {
4533  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4534  }
4535  return (*this)[index];
4536 }
4538 //*************************************************************************************************
4539 
4540 
4541 //*************************************************************************************************
4552 template< typename MT // Type of the dense matrix
4553  , size_t... CRAs > // Compile time row arguments
4554 inline typename Row<MT,false,true,true,CRAs...>::ConstReference
4555  Row<MT,false,true,true,CRAs...>::at( size_t index ) const
4556 {
4557  if( index >= size() ) {
4558  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4559  }
4560  return (*this)[index];
4561 }
4563 //*************************************************************************************************
4564 
4565 
4566 //*************************************************************************************************
4575 template< typename MT // Type of the dense matrix
4576  , size_t... CRAs > // Compile time row arguments
4577 inline typename Row<MT,false,true,true,CRAs...>::Pointer
4579 {
4580  return matrix_.data( row() );
4581 }
4583 //*************************************************************************************************
4584 
4585 
4586 //*************************************************************************************************
4595 template< typename MT // Type of the dense matrix
4596  , size_t... CRAs > // Compile time row arguments
4597 inline typename Row<MT,false,true,true,CRAs...>::ConstPointer
4598  Row<MT,false,true,true,CRAs...>::data() const noexcept
4599 {
4600  return matrix_.data( row() );
4601 }
4603 //*************************************************************************************************
4604 
4605 
4606 //*************************************************************************************************
4614 template< typename MT // Type of the dense matrix
4615  , size_t... CRAs > // Compile time row arguments
4616 inline typename Row<MT,false,true,true,CRAs...>::Iterator
4618 {
4619  return matrix_.begin( row() );
4620 }
4622 //*************************************************************************************************
4623 
4624 
4625 //*************************************************************************************************
4633 template< typename MT // Type of the dense matrix
4634  , size_t... CRAs > // Compile time row arguments
4635 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4637 {
4638  return matrix_.cbegin( row() );
4639 }
4641 //*************************************************************************************************
4642 
4643 
4644 //*************************************************************************************************
4652 template< typename MT // Type of the dense matrix
4653  , size_t... CRAs > // Compile time row arguments
4654 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4656 {
4657  return matrix_.cbegin( row() );
4658 }
4660 //*************************************************************************************************
4661 
4662 
4663 //*************************************************************************************************
4671 template< typename MT // Type of the dense matrix
4672  , size_t... CRAs > // Compile time row arguments
4673 inline typename Row<MT,false,true,true,CRAs...>::Iterator
4675 {
4676  return matrix_.end( row() );
4677 }
4679 //*************************************************************************************************
4680 
4681 
4682 //*************************************************************************************************
4690 template< typename MT // Type of the dense matrix
4691  , size_t... CRAs > // Compile time row arguments
4692 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4694 {
4695  return matrix_.cend( row() );
4696 }
4698 //*************************************************************************************************
4699 
4700 
4701 //*************************************************************************************************
4709 template< typename MT // Type of the dense matrix
4710  , size_t... CRAs > // Compile time row arguments
4711 inline typename Row<MT,false,true,true,CRAs...>::ConstIterator
4713 {
4714  return matrix_.cend( row() );
4715 }
4717 //*************************************************************************************************
4718 
4719 
4720 
4721 
4722 //=================================================================================================
4723 //
4724 // ASSIGNMENT OPERATORS
4725 //
4726 //=================================================================================================
4727 
4728 //*************************************************************************************************
4735 template< typename MT // Type of the dense matrix
4736  , size_t... CRAs > // Compile time row arguments
4737 inline Row<MT,false,true,true,CRAs...>&
4738  Row<MT,false,true,true,CRAs...>::operator=( const ElementType& rhs )
4739 {
4740  decltype(auto) left( derestrict( matrix_ ) );
4741 
4742  const size_t ibegin( ( IsLower<MT>::value )
4743  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4744  ?( row()+1UL )
4745  :( row() ) )
4746  :( 0UL ) );
4747  const size_t iend ( ( IsUpper<MT>::value )
4748  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4749  ?( row() )
4750  :( row()+1UL ) )
4751  :( size() ) );
4752 
4753  for( size_t i=ibegin; i<iend; ++i ) {
4754  if( !IsRestricted<MT>::value || IsTriangular<MT>::value || trySet( matrix_, i, row(), rhs ) )
4755  left(i,row()) = rhs;
4756  }
4757 
4758  return *this;
4759 }
4761 //*************************************************************************************************
4762 
4763 
4764 //*************************************************************************************************
4779 template< typename MT // Type of the dense matrix
4780  , size_t... CRAs > // Compile time row arguments
4781 inline Row<MT,false,true,true,CRAs...>&
4782  Row<MT,false,true,true,CRAs...>::operator=( initializer_list<ElementType> list )
4783 {
4784  if( list.size() > size() ) {
4785  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
4786  }
4787 
4788  if( IsRestricted<MT>::value ) {
4789  const InitializerVector<ElementType,true> tmp( list, size() );
4790  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4791  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4792  }
4793  }
4794 
4795  decltype(auto) left( derestrict( *this ) );
4796 
4797  std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
4798 
4799  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4800 
4801  return *this;
4802 }
4804 //*************************************************************************************************
4805 
4806 
4807 //*************************************************************************************************
4821 template< typename MT // Type of the dense matrix
4822  , size_t... CRAs > // Compile time row arguments
4823 inline Row<MT,false,true,true,CRAs...>&
4824  Row<MT,false,true,true,CRAs...>::operator=( const Row& rhs )
4825 {
4826  if( &rhs == this ) return *this;
4827 
4828  if( size() != rhs.size() ) {
4829  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
4830  }
4831 
4832  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
4833  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4834  }
4835 
4836  decltype(auto) left( derestrict( *this ) );
4837 
4838  if( IsExpression<MT>::value && rhs.canAlias( &matrix_ ) ) {
4839  const ResultType tmp( rhs );
4840  smpAssign( left, tmp );
4841  }
4842  else {
4843  smpAssign( left, rhs );
4844  }
4845 
4846  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4847 
4848  return *this;
4849 }
4851 //*************************************************************************************************
4852 
4853 
4854 //*************************************************************************************************
4868 template< typename MT // Type of the dense matrix
4869  , size_t... CRAs > // Compile time row arguments
4870 template< typename VT > // Type of the right-hand side vector
4871 inline Row<MT,false,true,true,CRAs...>&
4872  Row<MT,false,true,true,CRAs...>::operator=( const Vector<VT,true>& rhs )
4873 {
4874  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4876 
4877  if( size() != (~rhs).size() ) {
4878  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4879  }
4880 
4881  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
4882  Right right( ~rhs );
4883 
4884  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4885  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4886  }
4887 
4888  decltype(auto) left( derestrict( *this ) );
4889 
4890  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4891  const ResultType_<VT> tmp( right );
4892  smpAssign( left, tmp );
4893  }
4894  else {
4895  if( IsSparseVector<VT>::value )
4896  reset();
4897  smpAssign( left, right );
4898  }
4899 
4900  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4901 
4902  return *this;
4903 }
4905 //*************************************************************************************************
4906 
4907 
4908 //*************************************************************************************************
4922 template< typename MT // Type of the dense matrix
4923  , size_t... CRAs > // Compile time row arguments
4924 template< typename VT > // Type of the right-hand side vector
4925 inline Row<MT,false,true,true,CRAs...>&
4926  Row<MT,false,true,true,CRAs...>::operator+=( const Vector<VT,true>& rhs )
4927 {
4928  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4930 
4931  if( size() != (~rhs).size() ) {
4932  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4933  }
4934 
4935  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
4936  Right right( ~rhs );
4937 
4938  if( !tryAddAssign( matrix_, right, row(), 0UL ) ) {
4939  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4940  }
4941 
4942  decltype(auto) left( derestrict( *this ) );
4943 
4944  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4945  const ResultType_<VT> tmp( right );
4946  smpAddAssign( left, tmp );
4947  }
4948  else {
4949  smpAddAssign( left, right );
4950  }
4951 
4952  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4953 
4954  return *this;
4955 }
4957 //*************************************************************************************************
4958 
4959 
4960 //*************************************************************************************************
4974 template< typename MT // Type of the dense matrix
4975  , size_t... CRAs > // Compile time row arguments
4976 template< typename VT > // Type of the right-hand side vector
4977 inline Row<MT,false,true,true,CRAs...>&
4978  Row<MT,false,true,true,CRAs...>::operator-=( const Vector<VT,true>& rhs )
4979 {
4980  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4982 
4983  if( size() != (~rhs).size() ) {
4984  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4985  }
4986 
4987  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
4988  Right right( ~rhs );
4989 
4990  if( !trySubAssign( matrix_, right, row(), 0UL ) ) {
4991  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4992  }
4993 
4994  decltype(auto) left( derestrict( *this ) );
4995 
4996  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4997  const ResultType_<VT> tmp( right );
4998  smpSubAssign( left, tmp );
4999  }
5000  else {
5001  smpSubAssign( left, right );
5002  }
5003 
5004  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5005 
5006  return *this;
5007 }
5009 //*************************************************************************************************
5010 
5011 
5012 //*************************************************************************************************
5025 template< typename MT // Type of the dense matrix
5026  , size_t... CRAs > // Compile time row arguments
5027 template< typename VT > // Type of the right-hand side vector
5028 inline Row<MT,false,true,true,CRAs...>&
5029  Row<MT,false,true,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
5030 {
5031  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
5033 
5034  if( size() != (~rhs).size() ) {
5035  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5036  }
5037 
5038  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
5039  Right right( ~rhs );
5040 
5041  if( !tryMultAssign( matrix_, right, row(), 0UL ) ) {
5042  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5043  }
5044 
5045  decltype(auto) left( derestrict( *this ) );
5046 
5047  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
5048  const ResultType_<VT> tmp( right );
5049  smpMultAssign( left, tmp );
5050  }
5051  else {
5052  smpMultAssign( left, right );
5053  }
5054 
5055  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5056 
5057  return *this;
5058 }
5060 //*************************************************************************************************
5061 
5062 
5063 //*************************************************************************************************
5075 template< typename MT // Type of the dense matrix
5076  , size_t... CRAs > // Compile time row arguments
5077 template< typename VT > // Type of the right-hand side dense vector
5078 inline Row<MT,false,true,true,CRAs...>&
5079  Row<MT,false,true,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5080 {
5081  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
5083 
5084  if( size() != (~rhs).size() ) {
5085  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5086  }
5087 
5088  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
5089  Right right( ~rhs );
5090 
5091  if( !tryDivAssign( matrix_, right, row(), 0UL ) ) {
5092  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5093  }
5094 
5095  decltype(auto) left( derestrict( *this ) );
5096 
5097  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
5098  const ResultType_<VT> tmp( right );
5099  smpDivAssign( left, tmp );
5100  }
5101  else {
5102  smpDivAssign( left, right );
5103  }
5104 
5105  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5106 
5107  return *this;
5108 }
5110 //*************************************************************************************************
5111 
5112 
5113 //*************************************************************************************************
5126 template< typename MT // Type of the dense matrix
5127  , size_t... CRAs > // Compile time row arguments
5128 template< typename VT > // Type of the right-hand side vector
5129 inline Row<MT,false,true,true,CRAs...>&
5130  Row<MT,false,true,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5131 {
5132  using blaze::assign;
5133 
5134  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
5136 
5137  using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5138 
5142 
5143  if( size() != 3UL || (~rhs).size() != 3UL ) {
5144  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5145  }
5146 
5147  const CrossType right( *this % (~rhs) );
5148 
5149  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
5150  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5151  }
5152 
5153  decltype(auto) left( derestrict( *this ) );
5154 
5155  assign( left, right );
5156 
5157  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5158 
5159  return *this;
5160 }
5162 //*************************************************************************************************
5163 
5164 
5165 
5166 
5167 //=================================================================================================
5168 //
5169 // UTILITY FUNCTIONS
5170 //
5171 //=================================================================================================
5172 
5173 //*************************************************************************************************
5179 template< typename MT // Type of the dense matrix
5180  , size_t... CRAs > // Compile time row arguments
5181 inline MT& Row<MT,false,true,true,CRAs...>::operand() noexcept
5182 {
5183  return matrix_;
5184 }
5186 //*************************************************************************************************
5187 
5188 
5189 //*************************************************************************************************
5195 template< typename MT // Type of the dense matrix
5196  , size_t... CRAs > // Compile time row arguments
5197 inline const MT& Row<MT,false,true,true,CRAs...>::operand() const noexcept
5198 {
5199  return matrix_;
5200 }
5202 //*************************************************************************************************
5203 
5204 
5205 //*************************************************************************************************
5211 template< typename MT // Type of the dense matrix
5212  , size_t... CRAs > // Compile time row arguments
5213 inline size_t Row<MT,false,true,true,CRAs...>::size() const noexcept
5214 {
5215  return matrix_.columns();
5216 }
5218 //*************************************************************************************************
5219 
5220 
5221 //*************************************************************************************************
5230 template< typename MT // Type of the dense matrix
5231  , size_t... CRAs > // Compile time row arguments
5232 inline size_t Row<MT,false,true,true,CRAs...>::spacing() const noexcept
5233 {
5234  return matrix_.spacing();
5235 }
5237 //*************************************************************************************************
5238 
5239 
5240 //*************************************************************************************************
5246 template< typename MT // Type of the dense matrix
5247  , size_t... CRAs > // Compile time row arguments
5248 inline size_t Row<MT,false,true,true,CRAs...>::capacity() const noexcept
5249 {
5250  return matrix_.capacity( row() );
5251 }
5253 //*************************************************************************************************
5254 
5255 
5256 //*************************************************************************************************
5265 template< typename MT // Type of the dense matrix
5266  , size_t... CRAs > // Compile time row arguments
5267 inline size_t Row<MT,false,true,true,CRAs...>::nonZeros() const
5268 {
5269  return matrix_.nonZeros( row() );
5270 }
5272 //*************************************************************************************************
5273 
5274 
5275 //*************************************************************************************************
5281 template< typename MT // Type of the dense matrix
5282  , size_t... CRAs > // Compile time row arguments
5284 {
5285  matrix_.reset( row() );
5286 }
5288 //*************************************************************************************************
5289 
5290 
5291 
5292 
5293 //=================================================================================================
5294 //
5295 // NUMERIC FUNCTIONS
5296 //
5297 //=================================================================================================
5298 
5299 //*************************************************************************************************
5312 template< typename MT // Type of the dense matrix
5313  , size_t... CRAs > // Compile time row arguments
5314 template< typename Other > // Data type of the scalar value
5315 inline Row<MT,false,true,true,CRAs...>&
5316  Row<MT,false,true,true,CRAs...>::scale( const Other& scalar )
5317 {
5319 
5320  const size_t ibegin( ( IsLower<MT>::value )
5321  ?( ( IsStrictlyLower<MT>::value )
5322  ?( row()+1UL )
5323  :( row() ) )
5324  :( 0UL ) );
5325  const size_t iend ( ( IsUpper<MT>::value )
5326  ?( ( IsStrictlyUpper<MT>::value )
5327  ?( row() )
5328  :( row()+1UL ) )
5329  :( size() ) );
5330 
5331  for( size_t i=ibegin; i<iend; ++i ) {
5332  matrix_(i,row()) *= scalar;
5333  }
5334 
5335  return *this;
5336 }
5338 //*************************************************************************************************
5339 
5340 
5341 
5342 
5343 //=================================================================================================
5344 //
5345 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5346 //
5347 //=================================================================================================
5348 
5349 //*************************************************************************************************
5360 template< typename MT // Type of the dense matrix
5361  , size_t... CRAs > // Compile time row arguments
5362 template< typename Other > // Data type of the foreign expression
5363 inline bool Row<MT,false,true,true,CRAs...>::canAlias( const Other* alias ) const noexcept
5364 {
5365  return matrix_.isAliased( alias );
5366 }
5368 //*************************************************************************************************
5369 
5370 
5371 //*************************************************************************************************
5382 template< typename MT // Type of the dense matrix
5383  , size_t... CRAs > // Compile time row arguments
5384 template< typename MT2 // Data type of the foreign dense row
5385  , bool SO2 // Storage order of the foreign dense row
5386  , bool SF2 // Symmetry flag of the foreign dense row
5387  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
5388 inline bool
5389  Row<MT,false,true,true,CRAs...>::canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
5390 {
5391  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
5392 }
5394 //*************************************************************************************************
5395 
5396 
5397 //*************************************************************************************************
5408 template< typename MT // Type of the dense matrix
5409  , size_t... CRAs > // Compile time row arguments
5410 template< typename Other > // Data type of the foreign expression
5411 inline bool Row<MT,false,true,true,CRAs...>::isAliased( const Other* alias ) const noexcept
5412 {
5413  return matrix_.isAliased( alias );
5414 }
5416 //*************************************************************************************************
5417 
5418 
5419 //*************************************************************************************************
5430 template< typename MT // Type of the dense matrix
5431  , size_t... CRAs > // Compile time row arguments
5432 template< typename MT2 // Data type of the foreign dense row
5433  , bool SO2 // Storage order of the foreign dense row
5434  , bool SF2 // Symmetry flag of the foreign dense row
5435  , size_t... CRAs2 > // Compile time row arguments of the foreign dense row
5436 inline bool
5437  Row<MT,false,true,true,CRAs...>::isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept
5438 {
5439  return matrix_.isAliased( &alias->matrix_ ) && ( row() == alias->row() );
5440 }
5442 //*************************************************************************************************
5443 
5444 
5445 //*************************************************************************************************
5455 template< typename MT // Type of the dense matrix
5456  , size_t... CRAs > // Compile time row arguments
5457 inline bool Row<MT,false,true,true,CRAs...>::isAligned() const noexcept
5458 {
5459  return matrix_.isAligned();
5460 }
5462 //*************************************************************************************************
5463 
5464 
5465 //*************************************************************************************************
5476 template< typename MT // Type of the dense matrix
5477  , size_t... CRAs > // Compile time row arguments
5478 inline bool Row<MT,false,true,true,CRAs...>::canSMPAssign() const noexcept
5479 {
5480  return ( size() > SMP_DVECASSIGN_THRESHOLD );
5481 }
5483 //*************************************************************************************************
5484 
5485 
5486 //*************************************************************************************************
5499 template< typename MT // Type of the dense matrix
5500  , size_t... CRAs > // Compile time row arguments
5501 BLAZE_ALWAYS_INLINE typename Row<MT,false,true,true,CRAs...>::SIMDType
5502  Row<MT,false,true,true,CRAs...>::load( size_t index ) const noexcept
5503 {
5504  return matrix_.load( index, row() );
5505 }
5507 //*************************************************************************************************
5508 
5509 
5510 //*************************************************************************************************
5523 template< typename MT // Type of the dense matrix
5524  , size_t... CRAs > // Compile time row arguments
5525 BLAZE_ALWAYS_INLINE typename Row<MT,false,true,true,CRAs...>::SIMDType
5526  Row<MT,false,true,true,CRAs...>::loada( size_t index ) const noexcept
5527 {
5528  return matrix_.loada( index, row() );
5529 }
5531 //*************************************************************************************************
5532 
5533 
5534 //*************************************************************************************************
5547 template< typename MT // Type of the dense matrix
5548  , size_t... CRAs > // Compile time row arguments
5549 BLAZE_ALWAYS_INLINE typename Row<MT,false,true,true,CRAs...>::SIMDType
5550  Row<MT,false,true,true,CRAs...>::loadu( size_t index ) const noexcept
5551 {
5552  return matrix_.loadu( index, row() );
5553 }
5555 //*************************************************************************************************
5556 
5557 
5558 //*************************************************************************************************
5572 template< typename MT // Type of the dense matrix
5573  , size_t... CRAs > // Compile time row arguments
5575  Row<MT,false,true,true,CRAs...>::store( size_t index, const SIMDType& value ) noexcept
5576 {
5577  matrix_.store( index, row(), value );
5578 }
5580 //*************************************************************************************************
5581 
5582 
5583 //*************************************************************************************************
5597 template< typename MT // Type of the dense matrix
5598  , size_t... CRAs > // Compile time row arguments
5600  Row<MT,false,true,true,CRAs...>::storea( size_t index, const SIMDType& value ) noexcept
5601 {
5602  matrix_.storea( index, row(), value );
5603 }
5605 //*************************************************************************************************
5606 
5607 
5608 //*************************************************************************************************
5622 template< typename MT // Type of the dense matrix
5623  , size_t... CRAs > // Compile time row arguments
5625  Row<MT,false,true,true,CRAs...>::storeu( size_t index, const SIMDType& value ) noexcept
5626 {
5627  matrix_.storeu( index, row(), value );
5628 }
5630 //*************************************************************************************************
5631 
5632 
5633 //*************************************************************************************************
5647 template< typename MT // Type of the dense matrix
5648  , size_t... CRAs > // Compile time row arguments
5650  Row<MT,false,true,true,CRAs...>::stream( size_t index, const SIMDType& value ) noexcept
5651 {
5652  matrix_.stream( index, row(), value );
5653 }
5655 //*************************************************************************************************
5656 
5657 
5658 //*************************************************************************************************
5670 template< typename MT // Type of the dense matrix
5671  , size_t... CRAs > // Compile time row arguments
5672 template< typename VT > // Type of the right-hand side dense vector
5673 inline DisableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5674  Row<MT,false,true,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5675 {
5676  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5677 
5678  const size_t ipos( (~rhs).size() & size_t(-2) );
5679  for( size_t i=0UL; i<ipos; i+=2UL ) {
5680  matrix_(i ,row()) = (~rhs)[i ];
5681  matrix_(i+1UL,row()) = (~rhs)[i+1UL];
5682  }
5683  if( ipos < (~rhs).size() )
5684  matrix_(ipos,row()) = (~rhs)[ipos];
5685 }
5687 //*************************************************************************************************
5688 
5689 
5690 //*************************************************************************************************
5702 template< typename MT // Type of the dense matrix
5703  , size_t... CRAs > // Compile time row arguments
5704 template< typename VT > // Type of the right-hand side dense vector
5705 inline EnableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5706  Row<MT,false,true,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5707 {
5709 
5710  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5711 
5712  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5713 
5714  const size_t rows( size() );
5715 
5716  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
5717  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5718 
5719  size_t i( 0UL );
5720  Iterator left( begin() );
5721  ConstIterator_<VT> right( (~rhs).begin() );
5722 
5723  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
5724  {
5725  for( ; i<ipos; i+=SIMDSIZE ) {
5726  left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5727  }
5728  for( ; remainder && i<rows; ++i ) {
5729  *left = *right; ++left; ++right;
5730  }
5731  }
5732  else
5733  {
5734  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5739  }
5740  for( ; i<ipos; i+=SIMDSIZE ) {
5741  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5742  }
5743  for( ; remainder && i<rows; ++i ) {
5744  *left = *right; ++left; ++right;
5745  }
5746  }
5747 }
5749 //*************************************************************************************************
5750 
5751 
5752 //*************************************************************************************************
5764 template< typename MT // Type of the dense matrix
5765  , size_t... CRAs > // Compile time row arguments
5766 template< typename VT > // Type of the right-hand side sparse vector
5767 inline void Row<MT,false,true,true,CRAs...>::assign( const SparseVector<VT,true>& rhs )
5768 {
5769  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5770 
5771  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5772  matrix_(element->index(),row()) = element->value();
5773 }
5775 //*************************************************************************************************
5776 
5777 
5778 //*************************************************************************************************
5790 template< typename MT // Type of the dense matrix
5791  , size_t... CRAs > // Compile time row arguments
5792 template< typename VT > // Type of the right-hand side dense vector
5793 inline DisableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5794  Row<MT,false,true,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5795 {
5796  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5797 
5798  const size_t ipos( (~rhs).size() & size_t(-2) );
5799  for( size_t i=0UL; i<ipos; i+=2UL ) {
5800  matrix_(i ,row()) += (~rhs)[i ];
5801  matrix_(i+1UL,row()) += (~rhs)[i+1UL];
5802  }
5803  if( ipos < (~rhs).size() )
5804  matrix_(ipos,row()) += (~rhs)[ipos];
5805 }
5807 //*************************************************************************************************
5808 
5809 
5810 //*************************************************************************************************
5822 template< typename MT // Type of the dense matrix
5823  , size_t... CRAs > // Compile time row arguments
5824 template< typename VT > // Type of the right-hand side dense vector
5825 inline EnableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5826  Row<MT,false,true,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5827 {
5829 
5830  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5831 
5832  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5833 
5834  const size_t rows( size() );
5835 
5836  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
5837  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5838 
5839  size_t i( 0UL );
5840  Iterator left( begin() );
5841  ConstIterator_<VT> right( (~rhs).begin() );
5842 
5843  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5848  }
5849  for( ; i<ipos; i+=SIMDSIZE ) {
5850  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5851  }
5852  for( ; remainder && i<rows; ++i ) {
5853  *left += *right; ++left; ++right;
5854  }
5855 }
5857 //*************************************************************************************************
5858 
5859 
5860 //*************************************************************************************************
5872 template< typename MT // Type of the dense matrix
5873  , size_t... CRAs > // Compile time row arguments
5874 template< typename VT > // Type of the right-hand side sparse vector
5875 inline void Row<MT,false,true,true,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
5876 {
5877  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5878 
5879  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5880  matrix_(element->index(),row()) += element->value();
5881 }
5883 //*************************************************************************************************
5884 
5885 
5886 //*************************************************************************************************
5898 template< typename MT // Type of the dense matrix
5899  , size_t... CRAs > // Compile time row arguments
5900 template< typename VT > // Type of the right-hand side dense vector
5901 inline DisableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5902  Row<MT,false,true,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5903 {
5904  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5905 
5906  const size_t ipos( (~rhs).size() & size_t(-2) );
5907  for( size_t i=0UL; i<ipos; i+=2UL ) {
5908  matrix_(i ,row()) -= (~rhs)[i ];
5909  matrix_(i+1UL,row()) -= (~rhs)[i+1UL];
5910  }
5911  if( ipos < (~rhs).size() )
5912  matrix_(ipos,row()) -= (~rhs)[ipos];
5913 }
5915 //*************************************************************************************************
5916 
5917 
5918 //*************************************************************************************************
5930 template< typename MT // Type of the dense matrix
5931  , size_t... CRAs > // Compile time row arguments
5932 template< typename VT > // Type of the right-hand side dense vector
5933 inline EnableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5934  Row<MT,false,true,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5935 {
5937 
5938  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5939 
5940  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5941 
5942  const size_t rows( size() );
5943 
5944  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
5945  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5946 
5947  size_t i( 0UL );
5948  Iterator left( begin() );
5949  ConstIterator_<VT> right( (~rhs).begin() );
5950 
5951  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5956  }
5957  for( ; i<ipos; i+=SIMDSIZE ) {
5958  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5959  }
5960  for( ; remainder && i<rows; ++i ) {
5961  *left -= *right; ++left; ++right;
5962  }
5963 }
5965 //*************************************************************************************************
5966 
5967 
5968 //*************************************************************************************************
5980 template< typename MT // Type of the dense matrix
5981  , size_t... CRAs > // Compile time row arguments
5982 template< typename VT > // Type of the right-hand side sparse vector
5983 inline void Row<MT,false,true,true,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
5984 {
5985  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5986 
5987  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5988  matrix_(element->index(),row()) -= element->value();
5989 }
5991 //*************************************************************************************************
5992 
5993 
5994 //*************************************************************************************************
6006 template< typename MT // Type of the dense matrix
6007  , size_t... CRAs > // Compile time row arguments
6008 template< typename VT > // Type of the right-hand side dense vector
6009 inline DisableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
6010  Row<MT,false,true,true,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
6011 {
6012  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6013 
6014  const size_t ipos( (~rhs).size() & size_t(-2) );
6015  for( size_t i=0UL; i<ipos; i+=2UL ) {
6016  matrix_(i ,row()) *= (~rhs)[i ];
6017  matrix_(i+1UL,row()) *= (~rhs)[i+1UL];
6018  }
6019  if( ipos < (~rhs).size() )
6020  matrix_(ipos,row()) *= (~rhs)[ipos];
6021 }
6023 //*************************************************************************************************
6024 
6025 
6026 //*************************************************************************************************
6038 template< typename MT // Type of the dense matrix
6039  , size_t... CRAs > // Compile time row arguments
6040 template< typename VT > // Type of the right-hand side dense vector
6041 inline EnableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
6042  Row<MT,false,true,true,CRAs...>::multAssign( const DenseVector<VT,true>& rhs )
6043 {
6045 
6046  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6047 
6048  constexpr bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
6049 
6050  const size_t rows( size() );
6051 
6052  const size_t ipos( ( remainder )?( rows & size_t(-SIMDSIZE) ):( rows ) );
6053  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
6054 
6055  size_t i( 0UL );
6056  Iterator left( begin() );
6057  ConstIterator_<VT> right( (~rhs).begin() );
6058 
6059  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6064  }
6065  for( ; i<ipos; i+=SIMDSIZE ) {
6066  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6067  }
6068  for( ; remainder && i<rows; ++i ) {
6069  *left *= *right; ++left; ++right;
6070  }
6071 }
6073 //*************************************************************************************************
6074 
6075 
6076 //*************************************************************************************************
6088 template< typename MT // Type of the dense matrix
6089  , size_t... CRAs > // Compile time row arguments
6090 template< typename VT > // Type of the right-hand side sparse vector
6091 inline void Row<MT,false,true,true,CRAs...>::multAssign( const SparseVector<VT,true>& rhs )
6092 {
6093  using blaze::reset;
6094 
6095  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6096 
6097  size_t i( 0UL );
6098 
6099  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
6100  const size_t index( element->index() );
6101  for( ; i<index; ++i )
6102  reset( matrix_(i,row()) );
6103  matrix_(i,row()) *= element->value();
6104  ++i;
6105  }
6106 
6107  for( ; i<size(); ++i ) {
6108  reset( matrix_(i,row()) );
6109  }
6110 }
6112 //*************************************************************************************************
6113 
6114 
6115 //*************************************************************************************************
6127 template< typename MT // Type of the dense matrix
6128  , size_t... CRAs > // Compile time row arguments
6129 template< typename VT > // Type of the right-hand side dense vector
6130 inline DisableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6131  Row<MT,false,true,true,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
6132 {
6133  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6134 
6135  const size_t ipos( (~rhs).size() & size_t(-2) );
6136  for( size_t i=0UL; i<ipos; i+=2UL ) {
6137  matrix_(i ,row()) /= (~rhs)[i ];
6138  matrix_(i+1UL,row()) /= (~rhs)[i+1UL];
6139  }
6140  if( ipos < (~rhs).size() )
6141  matrix_(ipos,row()) /= (~rhs)[ipos];
6142 }
6144 //*************************************************************************************************
6145 
6146 
6147 //*************************************************************************************************
6159 template< typename MT // Type of the dense matrix
6160  , size_t... CRAs > // Compile time row arguments
6161 template< typename VT > // Type of the right-hand side dense vector
6162 inline EnableIf_< typename Row<MT,false,true,true,CRAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6163  Row<MT,false,true,true,CRAs...>::divAssign( const DenseVector<VT,true>& rhs )
6164 {
6166 
6167  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
6168 
6169  const size_t rows( size() );
6170 
6171  const size_t ipos( rows & size_t(-SIMDSIZE) );
6172  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
6173 
6174  size_t i( 0UL );
6175  Iterator left( begin() );
6176  ConstIterator_<VT> right( (~rhs).begin() );
6177 
6178  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6183  }
6184  for( ; i<ipos; i+=SIMDSIZE ) {
6185  left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6186  }
6187  for( ; i<rows; ++i ) {
6188  *left /= *right; ++left; ++right;
6189  }
6190 }
6192 //*************************************************************************************************
6193 
6194 } // namespace blaze
6195 
6196 #endif
Constraint on the data type.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the RowData class template.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the IsUniUpper type trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
Header file for the View base class.
Header file for the row trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:701
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
Header file for the 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:3083
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
STL namespace.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
Header file for the IsUniLower type trait.
typename RowTrait< MT, CRAs... >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:145
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the implementation of the Row base template.
Header file for the IsStrictlyUpper type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
Header file for the Or class template.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
Header file for the Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for all SIMD functionality.
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraint on the data type.
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.
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the IsPadded type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
Header file for the IsSIMDCombinable type trait.
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.
Header file for the cross product trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
Header file for the reset shim.
Header file for the cache size of the target architecture.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
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.
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
Header file for the HasSIMDDiv type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
#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:628
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsRestricted type trait.
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
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Constraint on the data type.