Blaze  3.6
Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ROW_SPARSE_H_
36 #define _BLAZE_MATH_VIEWS_ROW_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
58 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Reset.h>
80 #include <blaze/math/views/Check.h>
85 #include <blaze/util/Assert.h>
88 #include <blaze/util/DisableIf.h>
89 #include <blaze/util/MaybeUnused.h>
90 #include <blaze/util/mpl/If.h>
91 #include <blaze/util/TypeList.h>
92 #include <blaze/util/Types.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR SPARSE MATRICES
103 //
104 //=================================================================================================
105 
106 //*************************************************************************************************
114 template< typename MT // Type of the sparse matrix
115  , bool SF // Symmetry flag
116  , size_t... CRAs > // Compile time row arguments
117 class Row<MT,true,false,SF,CRAs...>
118  : public View< SparseVector< Row<MT,true,false,SF,CRAs...>, true > >
119  , private RowData<CRAs...>
120 {
121  private:
122  //**Type definitions****************************************************************************
123  using DataType = RowData<CRAs...>;
124  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
125  //**********************************************************************************************
126 
127  public:
128  //**Type definitions****************************************************************************
130  using This = Row<MT,true,false,SF,CRAs...>;
131 
132  using BaseType = SparseVector<This,true>;
133  using ViewedType = MT;
134  using ResultType = RowTrait_t<MT,CRAs...>;
135  using TransposeType = TransposeType_t<ResultType>;
136  using ElementType = ElementType_t<MT>;
137  using ReturnType = ReturnType_t<MT>;
138  using CompositeType = const Row&;
139 
141  using ConstReference = ConstReference_t<MT>;
142 
144  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
145 
147  using ConstIterator = ConstIterator_t<MT>;
148 
150  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
151  //**********************************************************************************************
152 
153  //**Compilation flags***************************************************************************
155  static constexpr bool smpAssignable = false;
156 
158  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
159  //**********************************************************************************************
160 
161  //**Constructors********************************************************************************
164  template< typename... RRAs >
165  explicit inline Row( MT& matrix, RRAs... args );
166 
167  Row( const Row& ) = default;
169  //**********************************************************************************************
170 
171  //**Destructor**********************************************************************************
174  ~Row() = default;
176  //**********************************************************************************************
177 
178  //**Data access functions***********************************************************************
181  inline Reference operator[]( size_t index );
182  inline ConstReference operator[]( size_t index ) const;
183  inline Reference at( size_t index );
184  inline ConstReference at( size_t index ) const;
185  inline Iterator begin ();
186  inline ConstIterator begin () const;
187  inline ConstIterator cbegin() const;
188  inline Iterator end ();
189  inline ConstIterator end () const;
190  inline ConstIterator cend () const;
192  //**********************************************************************************************
193 
194  //**Assignment operators************************************************************************
197  inline Row& operator=( initializer_list<ElementType> list );
198  inline Row& operator=( const Row& rhs );
199 
200  template< typename VT > inline Row& operator= ( const DenseVector<VT,true>& rhs );
201  template< typename VT > inline Row& operator= ( const SparseVector<VT,true>& rhs );
202  template< typename VT > inline Row& operator+=( const DenseVector<VT,true>& rhs );
203  template< typename VT > inline Row& operator+=( const SparseVector<VT,true>& rhs );
204  template< typename VT > inline Row& operator-=( const DenseVector<VT,true>& rhs );
205  template< typename VT > inline Row& operator-=( const SparseVector<VT,true>& rhs );
206  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
207  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
208  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
210  //**********************************************************************************************
211 
212  //**Utility functions***************************************************************************
215  using DataType::row;
216 
217  inline MT& operand() noexcept;
218  inline const MT& operand() const noexcept;
219 
220  inline size_t size() const noexcept;
221  inline size_t capacity() const noexcept;
222  inline size_t nonZeros() const;
223  inline void reset();
224  inline void reserve( size_t n );
226  //**********************************************************************************************
227 
228  //**Insertion functions*************************************************************************
231  inline Iterator set ( size_t index, const ElementType& value );
232  inline Iterator insert( size_t index, const ElementType& value );
233  inline void append( size_t index, const ElementType& value, bool check=false );
235  //**********************************************************************************************
236 
237  //**Erase functions*****************************************************************************
240  inline void erase( size_t index );
241  inline Iterator erase( Iterator pos );
242  inline Iterator erase( Iterator first, Iterator last );
243 
244  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
245  inline void erase( Pred predicate );
246 
247  template< typename Pred >
248  inline void erase( Iterator first, Iterator last, Pred predicate );
250  //**********************************************************************************************
251 
252  //**Lookup functions****************************************************************************
255  inline Iterator find ( size_t index );
256  inline ConstIterator find ( size_t index ) const;
257  inline Iterator lowerBound( size_t index );
258  inline ConstIterator lowerBound( size_t index ) const;
259  inline Iterator upperBound( size_t index );
260  inline ConstIterator upperBound( size_t index ) const;
262  //**********************************************************************************************
263 
264  //**Numeric functions***************************************************************************
267  template< typename Other > inline Row& scale( const Other& scalar );
269  //**********************************************************************************************
270 
271  //**Expression template evaluation functions****************************************************
274  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
275  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
276 
277  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
278  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
279  template< typename VT > inline void addAssign( const DenseVector <VT,true>& rhs );
280  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
281  template< typename VT > inline void subAssign( const DenseVector <VT,true>& rhs );
282  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
284  //**********************************************************************************************
285 
286  private:
287  //**Utility functions***************************************************************************
290  inline size_t extendCapacity() const noexcept;
292  //**********************************************************************************************
293 
294  //**Member variables****************************************************************************
297  Operand matrix_;
298 
299  //**********************************************************************************************
300 
301  //**Compile time checks*************************************************************************
309  //**********************************************************************************************
310 };
312 //*************************************************************************************************
313 
314 
315 
316 
317 //=================================================================================================
318 //
319 // CONSTRUCTORS
320 //
321 //=================================================================================================
322 
323 //*************************************************************************************************
336 template< typename MT // Type of the sparse matrix
337  , bool SF // Symmetry flag
338  , size_t... CRAs > // Compile time row arguments
339 template< typename... RRAs > // Runtime row arguments
340 inline Row<MT,true,false,SF,CRAs...>::Row( MT& matrix, RRAs... args )
341  : DataType( args... ) // Base class initialization
342  , matrix_ ( matrix ) // The matrix containing the row
343 {
344  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
345  if( matrix_.rows() <= row() ) {
346  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
347  }
348  }
349  else {
350  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
351  }
352 }
354 //*************************************************************************************************
355 
356 
357 
358 
359 //=================================================================================================
360 //
361 // DATA ACCESS FUNCTIONS
362 //
363 //=================================================================================================
364 
365 //*************************************************************************************************
375 template< typename MT // Type of the sparse matrix
376  , bool SF // Symmetry flag
377  , size_t... CRAs > // Compile time row arguments
378 inline typename Row<MT,true,false,SF,CRAs...>::Reference
379  Row<MT,true,false,SF,CRAs...>::operator[]( size_t index )
380 {
381  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
382  return matrix_(row(),index);
383 }
385 //*************************************************************************************************
386 
387 
388 //*************************************************************************************************
398 template< typename MT // Type of the sparse matrix
399  , bool SF // Symmetry flag
400  , size_t... CRAs > // Compile time row arguments
401 inline typename Row<MT,true,false,SF,CRAs...>::ConstReference
402  Row<MT,true,false,SF,CRAs...>::operator[]( size_t index ) const
403 {
404  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
405  return const_cast<const MT&>( matrix_ )(row(),index);
406 }
408 //*************************************************************************************************
409 
410 
411 //*************************************************************************************************
422 template< typename MT // Type of the sparse matrix
423  , bool SF // Symmetry flag
424  , size_t... CRAs > // Compile time row arguments
425 inline typename Row<MT,true,false,SF,CRAs...>::Reference
426  Row<MT,true,false,SF,CRAs...>::at( size_t index )
427 {
428  if( index >= size() ) {
429  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
430  }
431  return (*this)[index];
432 }
434 //*************************************************************************************************
435 
436 
437 //*************************************************************************************************
448 template< typename MT // Type of the sparse matrix
449  , bool SF // Symmetry flag
450  , size_t... CRAs > // Compile time row arguments
451 inline typename Row<MT,true,false,SF,CRAs...>::ConstReference
452  Row<MT,true,false,SF,CRAs...>::at( size_t index ) const
453 {
454  if( index >= size() ) {
455  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
456  }
457  return (*this)[index];
458 }
460 //*************************************************************************************************
461 
462 
463 //*************************************************************************************************
471 template< typename MT // Type of the sparse matrix
472  , bool SF // Symmetry flag
473  , size_t... CRAs > // Compile time row arguments
474 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
476 {
477  return matrix_.begin( row() );
478 }
480 //*************************************************************************************************
481 
482 
483 //*************************************************************************************************
491 template< typename MT // Type of the sparse matrix
492  , bool SF // Symmetry flag
493  , size_t... CRAs > // Compile time row arguments
494 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
496 {
497  return matrix_.cbegin( row() );
498 }
500 //*************************************************************************************************
501 
502 
503 //*************************************************************************************************
511 template< typename MT // Type of the sparse matrix
512  , bool SF // Symmetry flag
513  , size_t... CRAs > // Compile time row arguments
514 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
516 {
517  return matrix_.cbegin( row() );
518 }
520 //*************************************************************************************************
521 
522 
523 //*************************************************************************************************
531 template< typename MT // Type of the sparse matrix
532  , bool SF // Symmetry flag
533  , size_t... CRAs > // Compile time row arguments
534 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
536 {
537  return matrix_.end( row() );
538 }
540 //*************************************************************************************************
541 
542 
543 //*************************************************************************************************
551 template< typename MT // Type of the sparse matrix
552  , bool SF // Symmetry flag
553  , size_t... CRAs > // Compile time row arguments
554 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
556 {
557  return matrix_.cend( row() );
558 }
560 //*************************************************************************************************
561 
562 
563 //*************************************************************************************************
571 template< typename MT // Type of the sparse matrix
572  , bool SF // Symmetry flag
573  , size_t... CRAs > // Compile time row arguments
574 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
576 {
577  return matrix_.cend( row() );
578 }
580 //*************************************************************************************************
581 
582 
583 
584 
585 //=================================================================================================
586 //
587 // ASSIGNMENT OPERATORS
588 //
589 //=================================================================================================
590 
591 //*************************************************************************************************
606 template< typename MT // Type of the sparse matrix
607  , bool SF // Symmetry flag
608  , size_t... CRAs > // Compile time row arguments
609 inline Row<MT,true,false,SF,CRAs...>&
610  Row<MT,true,false,SF,CRAs...>::operator=( initializer_list<ElementType> list )
611 {
612  using blaze::assign;
613 
614  if( list.size() > size() ) {
615  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
616  }
617 
618  const InitializerVector<ElementType,true> tmp( list, size() );
619 
620  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
621  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
622  }
623 
624  decltype(auto) left( derestrict( *this ) );
625 
626  left.reset();
627  assign( left, tmp );
628 
629  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
630 
631  return *this;
632 }
634 //*************************************************************************************************
635 
636 
637 //*************************************************************************************************
651 template< typename MT // Type of the sparse matrix
652  , bool SF // Symmetry flag
653  , size_t... CRAs > // Compile time row arguments
654 inline Row<MT,true,false,SF,CRAs...>&
655  Row<MT,true,false,SF,CRAs...>::operator=( const Row& rhs )
656 {
657  using blaze::assign;
658 
662 
663  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
664  return *this;
665 
666  if( size() != rhs.size() ) {
667  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
668  }
669 
670  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
671  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
672  }
673 
674  decltype(auto) left( derestrict( *this ) );
675 
676  if( rhs.canAlias( &matrix_ ) ) {
677  const ResultType tmp( rhs );
678  left.reset();
679  left.reserve( tmp.nonZeros() );
680  assign( left, tmp );
681  }
682  else {
683  left.reset();
684  left.reserve( rhs.nonZeros() );
685  assign( left, rhs );
686  }
687 
688  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
689 
690  return *this;
691 }
693 //*************************************************************************************************
694 
695 
696 //*************************************************************************************************
710 template< typename MT // Type of the sparse matrix
711  , bool SF // Symmetry flag
712  , size_t... CRAs > // Compile time row arguments
713 template< typename VT > // Type of the right-hand side dense vector
714 inline Row<MT,true,false,SF,CRAs...>&
715  Row<MT,true,false,SF,CRAs...>::operator=( const DenseVector<VT,true>& rhs )
716 {
717  using blaze::assign;
718 
719  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
720  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
722 
723  if( size() != (~rhs).size() ) {
724  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
725  }
726 
727  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
728  Right right( ~rhs );
729 
730  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
731  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
732  }
733 
734  decltype(auto) left( derestrict( *this ) );
735 
736  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
737  const ResultType_t<VT> tmp( right );
738  left.reset();
739  assign( left, tmp );
740  }
741  else {
742  left.reset();
743  assign( left, right );
744  }
745 
746  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
747 
748  return *this;
749 }
751 //*************************************************************************************************
752 
753 
754 //*************************************************************************************************
768 template< typename MT // Type of the sparse matrix
769  , bool SF // Symmetry flag
770  , size_t... CRAs > // Compile time row arguments
771 template< typename VT > // Type of the right-hand side sparse vector
772 inline Row<MT,true,false,SF,CRAs...>&
773  Row<MT,true,false,SF,CRAs...>::operator=( const SparseVector<VT,true>& rhs )
774 {
775  using blaze::assign;
776 
777  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
778  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
780 
781  if( size() != (~rhs).size() ) {
782  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
783  }
784 
785  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
786  Right right( ~rhs );
787 
788  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
789  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
790  }
791 
792  decltype(auto) left( derestrict( *this ) );
793 
794  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
795  const ResultType_t<VT> tmp( right );
796  left.reset();
797  left.reserve( tmp.nonZeros() );
798  assign( left, tmp );
799  }
800  else {
801  left.reset();
802  left.reserve( right.nonZeros() );
803  assign( left, right );
804  }
805 
806  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
807 
808  return *this;
809 }
811 //*************************************************************************************************
812 
813 
814 //*************************************************************************************************
828 template< typename MT // Type of the sparse matrix
829  , bool SF // Symmetry flag
830  , size_t... CRAs > // Compile time row arguments
831 template< typename VT > // Type of the right-hand side dense vector
832 inline Row<MT,true,false,SF,CRAs...>&
833  Row<MT,true,false,SF,CRAs...>::operator+=( const DenseVector<VT,true>& rhs )
834 {
835  using blaze::assign;
836 
840  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
841  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
843 
844  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
845 
849 
850  if( size() != (~rhs).size() ) {
851  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
852  }
853 
854  const AddType tmp( *this + (~rhs) );
855 
856  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
857  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
858  }
859 
860  decltype(auto) left( derestrict( *this ) );
861 
862  left.reset();
863  assign( left, tmp );
864 
865  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
866 
867  return *this;
868 }
870 //*************************************************************************************************
871 
872 
873 //*************************************************************************************************
887 template< typename MT // Type of the sparse matrix
888  , bool SF // Symmetry flag
889  , size_t... CRAs > // Compile time row arguments
890 template< typename VT > // Type of the right-hand side sparse vector
891 inline Row<MT,true,false,SF,CRAs...>&
892  Row<MT,true,false,SF,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
893 {
894  using blaze::assign;
895 
899  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
900  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
902 
903  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
904 
908 
909  if( size() != (~rhs).size() ) {
910  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
911  }
912 
913  const AddType tmp( *this + (~rhs) );
914 
915  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
916  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
917  }
918 
919  decltype(auto) left( derestrict( *this ) );
920 
921  left.reset();
922  left.reserve( tmp.nonZeros() );
923  assign( left, tmp );
924 
925  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
926 
927  return *this;
928 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
948 template< typename MT // Type of the sparse matrix
949  , bool SF // Symmetry flag
950  , size_t... CRAs > // Compile time row arguments
951 template< typename VT > // Type of the right-hand side dense vector
952 inline Row<MT,true,false,SF,CRAs...>&
953  Row<MT,true,false,SF,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
954 {
955  using blaze::assign;
956 
960  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
961  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
963 
964  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
965 
969 
970  if( size() != (~rhs).size() ) {
971  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
972  }
973 
974  const SubType tmp( *this - (~rhs) );
975 
976  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
977  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
978  }
979 
980  decltype(auto) left( derestrict( *this ) );
981 
982  left.reset();
983  assign( left, tmp );
984 
985  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
986 
987  return *this;
988 }
990 //*************************************************************************************************
991 
992 
993 //*************************************************************************************************
1008 template< typename MT // Type of the sparse matrix
1009  , bool SF // Symmetry flag
1010  , size_t... CRAs > // Compile time row arguments
1011 template< typename VT > // Type of the right-hand side sparse vector
1012 inline Row<MT,true,false,SF,CRAs...>&
1013  Row<MT,true,false,SF,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
1014 {
1015  using blaze::assign;
1016 
1020  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
1021  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1023 
1024  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1025 
1029 
1030  if( size() != (~rhs).size() ) {
1031  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1032  }
1033 
1034  const SubType tmp( *this - (~rhs) );
1035 
1036  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1037  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1038  }
1039 
1040  decltype(auto) left( derestrict( *this ) );
1041 
1042  left.reset();
1043  left.reserve( tmp.nonZeros() );
1044  assign( left, tmp );
1045 
1046  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1047 
1048  return *this;
1049 }
1051 //*************************************************************************************************
1052 
1053 
1054 //*************************************************************************************************
1067 template< typename MT // Type of the sparse matrix
1068  , bool SF // Symmetry flag
1069  , size_t... CRAs > // Compile time row arguments
1070 template< typename VT > // Type of the right-hand side vector
1071 inline Row<MT,true,false,SF,CRAs...>&
1072  Row<MT,true,false,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1073 {
1074  using blaze::assign;
1075 
1079  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1081 
1082  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1083 
1086 
1087  if( size() != (~rhs).size() ) {
1088  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1089  }
1090 
1091  const MultType tmp( *this * (~rhs) );
1092 
1093  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1094  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1095  }
1096 
1097  decltype(auto) left( derestrict( *this ) );
1098 
1099  left.reset();
1100  assign( left, tmp );
1101 
1102  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1103 
1104  return *this;
1105 }
1107 //*************************************************************************************************
1108 
1109 
1110 //*************************************************************************************************
1122 template< typename MT // Type of the sparse matrix
1123  , bool SF // Symmetry flag
1124  , size_t... CRAs > // Compile time row arguments
1125 template< typename VT > // Type of the right-hand side vector
1126 inline Row<MT,true,false,SF,CRAs...>&
1127  Row<MT,true,false,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1128 {
1129  using blaze::assign;
1130 
1134  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
1135  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1137 
1138  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1139 
1143 
1144  if( size() != (~rhs).size() ) {
1145  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1146  }
1147 
1148  const DivType tmp( *this / (~rhs) );
1149 
1150  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1151  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1152  }
1153 
1154  decltype(auto) left( derestrict( *this ) );
1155 
1156  left.reset();
1157  assign( left, tmp );
1158 
1159  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1160 
1161  return *this;
1162 }
1164 //*************************************************************************************************
1165 
1166 
1167 //*************************************************************************************************
1180 template< typename MT // Type of the sparse matrix
1181  , bool SF // Symmetry flag
1182  , size_t... CRAs > // Compile time row arguments
1183 template< typename VT > // Type of the right-hand side vector
1184 inline Row<MT,true,false,SF,CRAs...>&
1185  Row<MT,true,false,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1186 {
1187  using blaze::assign;
1188 
1189  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1191 
1192  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1193 
1197 
1198  if( size() != 3UL || (~rhs).size() != 3UL ) {
1199  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1200  }
1201 
1202  const CrossType tmp( *this % (~rhs) );
1203 
1204  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1205  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1206  }
1207 
1208  decltype(auto) left( derestrict( *this ) );
1209 
1210  left.reset();
1211  assign( left, tmp );
1212 
1213  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1214 
1215  return *this;
1216 }
1218 //*************************************************************************************************
1219 
1220 
1221 
1222 
1223 //=================================================================================================
1224 //
1225 // UTILITY FUNCTIONS
1226 //
1227 //=================================================================================================
1228 
1229 //*************************************************************************************************
1235 template< typename MT // Type of the sparse matrix
1236  , bool SF // Symmetry flag
1237  , size_t... CRAs > // Compile time row arguments
1238 inline MT& Row<MT,true,false,SF,CRAs...>::operand() noexcept
1239 {
1240  return matrix_;
1241 }
1243 //*************************************************************************************************
1244 
1245 
1246 //*************************************************************************************************
1252 template< typename MT // Type of the sparse matrix
1253  , bool SF // Symmetry flag
1254  , size_t... CRAs > // Compile time row arguments
1255 inline const MT& Row<MT,true,false,SF,CRAs...>::operand() const noexcept
1256 {
1257  return matrix_;
1258 }
1260 //*************************************************************************************************
1261 
1262 
1263 //*************************************************************************************************
1269 template< typename MT // Type of the sparse matrix
1270  , bool SF // Symmetry flag
1271  , size_t... CRAs > // Compile time row arguments
1272 inline size_t Row<MT,true,false,SF,CRAs...>::size() const noexcept
1273 {
1274  return matrix_.columns();
1275 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1286 template< typename MT // Type of the sparse matrix
1287  , bool SF // Symmetry flag
1288  , size_t... CRAs > // Compile time row arguments
1289 inline size_t Row<MT,true,false,SF,CRAs...>::capacity() const noexcept
1290 {
1291  return matrix_.capacity( row() );
1292 }
1294 //*************************************************************************************************
1295 
1296 
1297 //*************************************************************************************************
1306 template< typename MT // Type of the sparse matrix
1307  , bool SF // Symmetry flag
1308  , size_t... CRAs > // Compile time row arguments
1309 inline size_t Row<MT,true,false,SF,CRAs...>::nonZeros() const
1310 {
1311  return matrix_.nonZeros( row() );
1312 }
1314 //*************************************************************************************************
1315 
1316 
1317 //*************************************************************************************************
1323 template< typename MT // Type of the sparse matrix
1324  , bool SF // Symmetry flag
1325  , size_t... CRAs > // Compile time row arguments
1327 {
1328  matrix_.reset( row() );
1329 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1344 template< typename MT // Type of the sparse matrix
1345  , bool SF // Symmetry flag
1346  , size_t... CRAs > // Compile time row arguments
1347 void Row<MT,true,false,SF,CRAs...>::reserve( size_t n )
1348 {
1349  matrix_.reserve( row(), n );
1350 }
1352 //*************************************************************************************************
1353 
1354 
1355 //*************************************************************************************************
1364 template< typename MT // Type of the sparse matrix
1365  , bool SF // Symmetry flag
1366  , size_t... CRAs > // Compile time row arguments
1367 inline size_t Row<MT,true,false,SF,CRAs...>::extendCapacity() const noexcept
1368 {
1369  using blaze::max;
1370  using blaze::min;
1371 
1372  size_t nonzeros( 2UL*capacity()+1UL );
1373  nonzeros = max( nonzeros, 7UL );
1374  nonzeros = min( nonzeros, size() );
1375 
1376  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
1377 
1378  return nonzeros;
1379 }
1381 //*************************************************************************************************
1382 
1383 
1384 
1385 
1386 //=================================================================================================
1387 //
1388 // INSERTION FUNCTIONS
1389 //
1390 //=================================================================================================
1391 
1392 //*************************************************************************************************
1404 template< typename MT // Type of the sparse matrix
1405  , bool SF // Symmetry flag
1406  , size_t... CRAs > // Compile time row arguments
1407 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1408  Row<MT,true,false,SF,CRAs...>::set( size_t index, const ElementType& value )
1409 {
1410  return matrix_.set( row(), index, value );
1411 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1429 template< typename MT // Type of the sparse matrix
1430  , bool SF // Symmetry flag
1431  , size_t... CRAs > // Compile time row arguments
1432 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1433  Row<MT,true,false,SF,CRAs...>::insert( size_t index, const ElementType& value )
1434 {
1435  return matrix_.insert( row(), index, value );
1436 }
1438 //*************************************************************************************************
1439 
1440 
1441 //*************************************************************************************************
1466 template< typename MT // Type of the sparse matrix
1467  , bool SF // Symmetry flag
1468  , size_t... CRAs > // Compile time row arguments
1469 inline void Row<MT,true,false,SF,CRAs...>::append( size_t index, const ElementType& value, bool check )
1470 {
1471  matrix_.append( row(), index, value, check );
1472 }
1474 //*************************************************************************************************
1475 
1476 
1477 
1478 
1479 //=================================================================================================
1480 //
1481 // ERASE FUNCTIONS
1482 //
1483 //=================================================================================================
1484 
1485 //*************************************************************************************************
1494 template< typename MT // Type of the sparse matrix
1495  , bool SF // Symmetry flag
1496  , size_t... CRAs > // Compile time row arguments
1497 inline void Row<MT,true,false,SF,CRAs...>::erase( size_t index )
1498 {
1499  matrix_.erase( row(), index );
1500 }
1502 //*************************************************************************************************
1503 
1504 
1505 //*************************************************************************************************
1514 template< typename MT // Type of the sparse matrix
1515  , bool SF // Symmetry flag
1516  , size_t... CRAs > // Compile time row arguments
1517 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1518  Row<MT,true,false,SF,CRAs...>::erase( Iterator pos )
1519 {
1520  return matrix_.erase( row(), pos );
1521 }
1523 //*************************************************************************************************
1524 
1525 
1526 //*************************************************************************************************
1536 template< typename MT // Type of the sparse matrix
1537  , bool SF // Symmetry flag
1538  , size_t... CRAs > // Compile time row arguments
1539 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1540  Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last )
1541 {
1542  return matrix_.erase( row(), first, last );
1543 }
1545 //*************************************************************************************************
1546 
1547 
1548 //*************************************************************************************************
1571 template< typename MT // Type of the sparse matrix
1572  , bool SF // Symmetry flag
1573  , size_t... CRAs > // Compile time row arguments
1574 template< typename Pred // Type of the unary predicate
1575  , typename > // Type restriction on the unary predicate
1576 inline void Row<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1577 {
1578  matrix_.erase( row(), begin(), end(), predicate );
1579 }
1581 //*************************************************************************************************
1582 
1583 
1584 //*************************************************************************************************
1609 template< typename MT // Type of the sparse matrix
1610  , bool SF // Symmetry flag
1611  , size_t... CRAs > // Compile time row arguments
1612 template< typename Pred > // Type of the unary predicate
1613 inline void Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
1614 {
1615  matrix_.erase( row(), first, last, predicate );
1616 }
1618 //*************************************************************************************************
1619 
1620 
1621 
1622 
1623 //=================================================================================================
1624 //
1625 // LOOKUP FUNCTIONS
1626 //
1627 //=================================================================================================
1628 
1629 //*************************************************************************************************
1643 template< typename MT // Type of the sparse matrix
1644  , bool SF // Symmetry flag
1645  , size_t... CRAs > // Compile time row arguments
1646 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1647  Row<MT,true,false,SF,CRAs...>::find( size_t index )
1648 {
1649  return matrix_.find( row(), index );
1650 }
1652 //*************************************************************************************************
1653 
1654 
1655 //*************************************************************************************************
1669 template< typename MT // Type of the sparse matrix
1670  , bool SF // Symmetry flag
1671  , size_t... CRAs > // Compile time row arguments
1672 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1673  Row<MT,true,false,SF,CRAs...>::find( size_t index ) const
1674 {
1675  return matrix_.find( row(), index );
1676 }
1678 //*************************************************************************************************
1679 
1680 
1681 //*************************************************************************************************
1694 template< typename MT // Type of the sparse matrix
1695  , bool SF // Symmetry flag
1696  , size_t... CRAs > // Compile time row arguments
1697 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1698  Row<MT,true,false,SF,CRAs...>::lowerBound( size_t index )
1699 {
1700  return matrix_.lowerBound( row(), index );
1701 }
1703 //*************************************************************************************************
1704 
1705 
1706 //*************************************************************************************************
1719 template< typename MT // Type of the sparse matrix
1720  , bool SF // Symmetry flag
1721  , size_t... CRAs > // Compile time row arguments
1722 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1723  Row<MT,true,false,SF,CRAs...>::lowerBound( size_t index ) const
1724 {
1725  return matrix_.lowerBound( row(), index );
1726 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1744 template< typename MT // Type of the sparse matrix
1745  , bool SF // Symmetry flag
1746  , size_t... CRAs > // Compile time row arguments
1747 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1748  Row<MT,true,false,SF,CRAs...>::upperBound( size_t index )
1749 {
1750  return matrix_.upperBound( row(), index );
1751 }
1753 //*************************************************************************************************
1754 
1755 
1756 //*************************************************************************************************
1769 template< typename MT // Type of the sparse matrix
1770  , bool SF // Symmetry flag
1771  , size_t... CRAs > // Compile time row arguments
1772 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1773  Row<MT,true,false,SF,CRAs...>::upperBound( size_t index ) const
1774 {
1775  return matrix_.upperBound( row(), index );
1776 }
1778 //*************************************************************************************************
1779 
1780 
1781 
1782 
1783 //=================================================================================================
1784 //
1785 // NUMERIC FUNCTIONS
1786 //
1787 //=================================================================================================
1788 
1789 //*************************************************************************************************
1802 template< typename MT // Type of the sparse matrix
1803  , bool SF // Symmetry flag
1804  , size_t... CRAs > // Compile time row arguments
1805 template< typename Other > // Data type of the scalar value
1806 inline Row<MT,true,false,SF,CRAs...>&
1807  Row<MT,true,false,SF,CRAs...>::scale( const Other& scalar )
1808 {
1810 
1811  for( Iterator element=begin(); element!=end(); ++element )
1812  element->value() *= scalar;
1813  return *this;
1814 }
1816 //*************************************************************************************************
1817 
1818 
1819 
1820 
1821 //=================================================================================================
1822 //
1823 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1824 //
1825 //=================================================================================================
1826 
1827 //*************************************************************************************************
1838 template< typename MT // Type of the sparse matrix
1839  , bool SF // Symmetry flag
1840  , size_t... CRAs > // Compile time row arguments
1841 template< typename Other > // Data type of the foreign expression
1842 inline bool Row<MT,true,false,SF,CRAs...>::canAlias( const Other* alias ) const noexcept
1843 {
1844  return matrix_.isAliased( alias );
1845 }
1847 //*************************************************************************************************
1848 
1849 
1850 //*************************************************************************************************
1861 template< typename MT // Type of the sparse matrix
1862  , bool SF // Symmetry flag
1863  , size_t... CRAs > // Compile time row arguments
1864 template< typename Other > // Data type of the foreign expression
1865 inline bool Row<MT,true,false,SF,CRAs...>::isAliased( const Other* alias ) const noexcept
1866 {
1867  return matrix_.isAliased( alias );
1868 }
1870 //*************************************************************************************************
1871 
1872 
1873 //*************************************************************************************************
1885 template< typename MT // Type of the sparse matrix
1886  , bool SF // Symmetry flag
1887  , size_t... CRAs > // Compile time row arguments
1888 template< typename VT > // Type of the right-hand side dense vector
1889 inline void Row<MT,true,false,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1890 {
1891  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1892  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1893 
1894  for( size_t j=0UL; j<size(); ++j )
1895  {
1896  if( matrix_.nonZeros( row() ) == matrix_.capacity( row() ) )
1897  matrix_.reserve( row(), extendCapacity() );
1898 
1899  matrix_.append( row(), j, (~rhs)[j], true );
1900  }
1901 }
1903 //*************************************************************************************************
1904 
1905 
1906 //*************************************************************************************************
1918 template< typename MT // Type of the sparse matrix
1919  , bool SF // Symmetry flag
1920  , size_t... CRAs > // Compile time row arguments
1921 template< typename VT > // Type of the right-hand side sparse vector
1922 inline void Row<MT,true,false,SF,CRAs...>::assign( const SparseVector<VT,true>& rhs )
1923 {
1924  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1925  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1926 
1927  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1928  matrix_.append( row(), element->index(), element->value(), true );
1929  }
1930 }
1932 //*************************************************************************************************
1933 
1934 
1935 //*************************************************************************************************
1947 template< typename MT // Type of the sparse matrix
1948  , bool SF // Symmetry flag
1949  , size_t... CRAs > // Compile time row arguments
1950 template< typename VT > // Type of the right-hand side dense vector
1951 inline void Row<MT,true,false,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1952 {
1953  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1954 
1958 
1959  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1960 
1961  const AddType tmp( serial( *this + (~rhs) ) );
1962  matrix_.reset( row() );
1963  assign( tmp );
1964 }
1966 //*************************************************************************************************
1967 
1968 
1969 //*************************************************************************************************
1981 template< typename MT // Type of the sparse matrix
1982  , bool SF // Symmetry flag
1983  , size_t... CRAs > // Compile time row arguments
1984 template< typename VT > // Type of the right-hand side sparse vector
1985 inline void Row<MT,true,false,SF,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
1986 {
1987  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1988 
1992 
1993  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1994 
1995  const AddType tmp( serial( *this + (~rhs) ) );
1996  matrix_.reset( row() );
1997  matrix_.reserve( row(), tmp.nonZeros() );
1998  assign( tmp );
1999 }
2001 //*************************************************************************************************
2002 
2003 
2004 //*************************************************************************************************
2016 template< typename MT // Type of the sparse matrix
2017  , bool SF // Symmetry flag
2018  , size_t... CRAs > // Compile time row arguments
2019 template< typename VT > // Type of the right-hand side dense vector
2020 inline void Row<MT,true,false,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
2021 {
2022  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2023 
2027 
2028  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2029 
2030  const SubType tmp( serial( *this - (~rhs) ) );
2031  matrix_.reset( row() );
2032  assign( tmp );
2033 }
2035 //*************************************************************************************************
2036 
2037 
2038 //*************************************************************************************************
2050 template< typename MT // Type of the sparse matrix
2051  , bool SF // Symmetry flag
2052  , size_t... CRAs > // Compile time row arguments
2053 template< typename VT > // Type of the right-hand side sparse vector
2054 inline void Row<MT,true,false,SF,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
2055 {
2056  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2057 
2061 
2062  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2063 
2064  const SubType tmp( serial( *this - (~rhs) ) );
2065  matrix_.reset( row() );
2066  matrix_.reserve( row(), tmp.nonZeros() );
2067  assign( tmp );
2068 }
2070 //*************************************************************************************************
2071 
2072 
2073 
2074 
2075 
2076 
2077 
2078 
2079 //=================================================================================================
2080 //
2081 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR SPARSE MATRICES
2082 //
2083 //=================================================================================================
2084 
2085 //*************************************************************************************************
2093 template< typename MT // Type of the sparse matrix
2094  , size_t... CRAs > // Compile time row arguments
2095 class Row<MT,false,false,false,CRAs...>
2096  : public View< SparseVector< Row<MT,false,false,false,CRAs...>, true > >
2097  , private RowData<CRAs...>
2098 {
2099  private:
2100  //**Type definitions****************************************************************************
2101  using DataType = RowData<CRAs...>;
2102  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2103  //**********************************************************************************************
2104 
2105  public:
2106  //**Type definitions****************************************************************************
2108  using This = Row<MT,false,false,false,CRAs...>;
2109 
2110  using BaseType = SparseVector<This,true>;
2111  using ViewedType = MT;
2112  using ResultType = RowTrait_t<MT,CRAs...>;
2113  using TransposeType = TransposeType_t<ResultType>;
2114  using ElementType = ElementType_t<MT>;
2115  using ReturnType = ReturnType_t<MT>;
2116  using CompositeType = const Row&;
2117 
2119  using ConstReference = ConstReference_t<MT>;
2120 
2122  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2123  //**********************************************************************************************
2124 
2125  //**RowElement class definition*****************************************************************
2128  template< typename MatrixType // Type of the sparse matrix
2129  , typename IteratorType > // Type of the sparse matrix iterator
2130  class RowElement
2131  : private SparseElement
2132  {
2133  public:
2134  //**Constructor******************************************************************************
2140  inline RowElement( IteratorType pos, size_t column )
2141  : pos_ ( pos ) // Iterator to the current position within the sparse row
2142  , column_( column ) // Index of the according column
2143  {}
2144  //*******************************************************************************************
2145 
2146  //**Assignment operator**********************************************************************
2152  template< typename T > inline RowElement& operator=( const T& v ) {
2153  *pos_ = v;
2154  return *this;
2155  }
2156  //*******************************************************************************************
2157 
2158  //**Addition assignment operator*************************************************************
2164  template< typename T > inline RowElement& operator+=( const T& v ) {
2165  *pos_ += v;
2166  return *this;
2167  }
2168  //*******************************************************************************************
2169 
2170  //**Subtraction assignment operator**********************************************************
2176  template< typename T > inline RowElement& operator-=( const T& v ) {
2177  *pos_ -= v;
2178  return *this;
2179  }
2180  //*******************************************************************************************
2181 
2182  //**Multiplication assignment operator*******************************************************
2188  template< typename T > inline RowElement& operator*=( const T& v ) {
2189  *pos_ *= v;
2190  return *this;
2191  }
2192  //*******************************************************************************************
2193 
2194  //**Division assignment operator*************************************************************
2200  template< typename T > inline RowElement& operator/=( const T& v ) {
2201  *pos_ /= v;
2202  return *this;
2203  }
2204  //*******************************************************************************************
2205 
2206  //**Element access operator******************************************************************
2211  inline const RowElement* operator->() const {
2212  return this;
2213  }
2214  //*******************************************************************************************
2215 
2216  //**Value function***************************************************************************
2221  inline decltype(auto) value() const {
2222  return pos_->value();
2223  }
2224  //*******************************************************************************************
2225 
2226  //**Index function***************************************************************************
2231  inline size_t index() const {
2232  return column_;
2233  }
2234  //*******************************************************************************************
2235 
2236  private:
2237  //**Member variables*************************************************************************
2238  IteratorType pos_;
2239  size_t column_;
2240  //*******************************************************************************************
2241  };
2242  //**********************************************************************************************
2243 
2244  //**RowIterator class definition****************************************************************
2247  template< typename MatrixType // Type of the sparse matrix
2248  , typename IteratorType > // Type of the sparse matrix iterator
2249  class RowIterator
2250  {
2251  public:
2252  //**Type definitions*************************************************************************
2253  using IteratorCategory = std::forward_iterator_tag;
2254  using ValueType = RowElement<MatrixType,IteratorType>;
2255  using PointerType = ValueType;
2256  using ReferenceType = ValueType;
2257  using DifferenceType = ptrdiff_t;
2258 
2259  // STL iterator requirements
2260  using iterator_category = IteratorCategory;
2261  using value_type = ValueType;
2262  using pointer = PointerType;
2263  using reference = ReferenceType;
2264  using difference_type = DifferenceType;
2265  //*******************************************************************************************
2266 
2267  //**Constructor******************************************************************************
2270  inline RowIterator()
2271  : matrix_( nullptr ) // The sparse matrix containing the row
2272  , row_ ( 0UL ) // The current row index
2273  , column_( 0UL ) // The current column index
2274  , pos_ () // Iterator to the current sparse element
2275  {}
2276  //*******************************************************************************************
2277 
2278  //**Constructor******************************************************************************
2285  inline RowIterator( MatrixType& matrix, size_t row, size_t column )
2286  : matrix_( &matrix ) // The sparse matrix containing the row
2287  , row_ ( row ) // The current row index
2288  , column_( column ) // The current column index
2289  , pos_ () // Iterator to the current sparse element
2290  {
2291  for( ; column_<matrix_->columns(); ++column_ ) {
2292  pos_ = matrix_->find( row_, column_ );
2293  if( pos_ != matrix_->end( column_ ) ) break;
2294  }
2295  }
2296  //*******************************************************************************************
2297 
2298  //**Constructor******************************************************************************
2306  inline RowIterator( MatrixType& matrix, size_t row, size_t column, IteratorType pos )
2307  : matrix_( &matrix ) // The sparse matrix containing the row
2308  , row_ ( row ) // The current row index
2309  , column_( column ) // The current column index
2310  , pos_ ( pos ) // Iterator to the current sparse element
2311  {
2312  BLAZE_INTERNAL_ASSERT( matrix.find( row, column ) == pos, "Invalid initial iterator position" );
2313  }
2314  //*******************************************************************************************
2315 
2316  //**Constructor******************************************************************************
2321  template< typename MatrixType2, typename IteratorType2 >
2322  inline RowIterator( const RowIterator<MatrixType2,IteratorType2>& it )
2323  : matrix_( it.matrix_ ) // The sparse matrix containing the row
2324  , row_ ( it.row_ ) // The current row index
2325  , column_( it.column_ ) // The current column index
2326  , pos_ ( it.pos_ ) // Iterator to the current sparse element
2327  {}
2328  //*******************************************************************************************
2329 
2330  //**Prefix increment operator****************************************************************
2335  inline RowIterator& operator++() {
2336  ++column_;
2337  for( ; column_<matrix_->columns(); ++column_ ) {
2338  pos_ = matrix_->find( row_, column_ );
2339  if( pos_ != matrix_->end( column_ ) ) break;
2340  }
2341 
2342  return *this;
2343  }
2344  //*******************************************************************************************
2345 
2346  //**Postfix increment operator***************************************************************
2351  inline const RowIterator operator++( int ) {
2352  const RowIterator tmp( *this );
2353  ++(*this);
2354  return tmp;
2355  }
2356  //*******************************************************************************************
2357 
2358  //**Element access operator******************************************************************
2363  inline ReferenceType operator*() const {
2364  return ReferenceType( pos_, column_ );
2365  }
2366  //*******************************************************************************************
2367 
2368  //**Element access operator******************************************************************
2373  inline PointerType operator->() const {
2374  return PointerType( pos_, column_ );
2375  }
2376  //*******************************************************************************************
2377 
2378  //**Equality operator************************************************************************
2384  template< typename MatrixType2, typename IteratorType2 >
2385  inline bool operator==( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2386  return column_ == rhs.column_;
2387  }
2388  //*******************************************************************************************
2389 
2390  //**Inequality operator**********************************************************************
2396  template< typename MatrixType2, typename IteratorType2 >
2397  inline bool operator!=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2398  return !( *this == rhs );
2399  }
2400  //*******************************************************************************************
2401 
2402  //**Subtraction operator*********************************************************************
2408  inline DifferenceType operator-( const RowIterator& rhs ) const {
2409  size_t counter( 0UL );
2410  for( size_t j=rhs.column_; j<column_; ++j ) {
2411  if( matrix_->find( row_, j ) != matrix_->end( j ) )
2412  ++counter;
2413  }
2414  return counter;
2415  }
2416  //*******************************************************************************************
2417 
2418  private:
2419  //**Member variables*************************************************************************
2420  MatrixType* matrix_;
2421  size_t row_;
2422  size_t column_;
2423  IteratorType pos_;
2424  //*******************************************************************************************
2425 
2426  //**Friend declarations**********************************************************************
2427  template< typename MatrixType2, typename IteratorType2 > friend class RowIterator;
2428  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
2429  //*******************************************************************************************
2430  };
2431  //**********************************************************************************************
2432 
2433  //**Type definitions****************************************************************************
2435  using ConstIterator = RowIterator< const MT, ConstIterator_t<MT> >;
2436 
2438  using Iterator = If_t< IsConst_v<MT>, ConstIterator, RowIterator< MT, Iterator_t<MT> > >;
2439  //**********************************************************************************************
2440 
2441  //**Compilation flags***************************************************************************
2443  static constexpr bool smpAssignable = false;
2444 
2446  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2447  //**********************************************************************************************
2448 
2449  //**Constructors********************************************************************************
2452  template< typename... RRAs >
2453  explicit inline Row( MT& matrix, RRAs... args );
2454 
2455  Row( const Row& ) = default;
2457  //**********************************************************************************************
2458 
2459  //**Destructor**********************************************************************************
2462  ~Row() = default;
2464  //**********************************************************************************************
2465 
2466  //**Data access functions***********************************************************************
2469  inline Reference operator[]( size_t index );
2470  inline ConstReference operator[]( size_t index ) const;
2471  inline Reference at( size_t index );
2472  inline ConstReference at( size_t index ) const;
2473  inline Iterator begin ();
2474  inline ConstIterator begin () const;
2475  inline ConstIterator cbegin() const;
2476  inline Iterator end ();
2477  inline ConstIterator end () const;
2478  inline ConstIterator cend () const;
2480  //**********************************************************************************************
2481 
2482  //**Assignment operators************************************************************************
2485  inline Row& operator=( initializer_list<ElementType> list );
2486  inline Row& operator=( const Row& rhs );
2487 
2488  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2489  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2490  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2491  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
2492  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2493  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
2495  //**********************************************************************************************
2496 
2497  //**Utility functions***************************************************************************
2500  using DataType::row;
2501 
2502  inline MT& operand() noexcept;
2503  inline const MT& operand() const noexcept;
2504 
2505  inline size_t size() const noexcept;
2506  inline size_t capacity() const noexcept;
2507  inline size_t nonZeros() const;
2508  inline void reset();
2509  inline void reserve( size_t n );
2511  //**********************************************************************************************
2512 
2513  //**Insertion functions*************************************************************************
2516  inline Iterator set ( size_t index, const ElementType& value );
2517  inline Iterator insert( size_t index, const ElementType& value );
2518  inline void append( size_t index, const ElementType& value, bool check=false );
2520  //**********************************************************************************************
2521 
2522  //**Erase functions*****************************************************************************
2525  inline void erase( size_t index );
2526  inline Iterator erase( Iterator pos );
2527  inline Iterator erase( Iterator first, Iterator last );
2528 
2529  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
2530  inline void erase( Pred predicate );
2531 
2532  template< typename Pred >
2533  inline void erase( Iterator first, Iterator last, Pred predicate );
2535  //**********************************************************************************************
2536 
2537  //**Lookup functions****************************************************************************
2540  inline Iterator find ( size_t index );
2541  inline ConstIterator find ( size_t index ) const;
2542  inline Iterator lowerBound( size_t index );
2543  inline ConstIterator lowerBound( size_t index ) const;
2544  inline Iterator upperBound( size_t index );
2545  inline ConstIterator upperBound( size_t index ) const;
2547  //**********************************************************************************************
2548 
2549  //**Numeric functions***************************************************************************
2552  template< typename Other > inline Row& scale( const Other& scalar );
2554  //**********************************************************************************************
2555 
2556  //**Expression template evaluation functions****************************************************
2559  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
2560  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
2561 
2562  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2563  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2564  template< typename VT > inline void addAssign( const Vector<VT,true>& rhs );
2565  template< typename VT > inline void subAssign( const Vector<VT,true>& rhs );
2567  //**********************************************************************************************
2568 
2569  private:
2570  //**Member variables****************************************************************************
2573  Operand matrix_;
2574 
2575  //**********************************************************************************************
2576 
2577  //**Compile time checks*************************************************************************
2586  //**********************************************************************************************
2587 };
2589 //*************************************************************************************************
2590 
2591 
2592 
2593 
2594 //=================================================================================================
2595 //
2596 // CONSTRUCTORS
2597 //
2598 //=================================================================================================
2599 
2600 //*************************************************************************************************
2608 template< typename MT // Type of the sparse matrix
2609  , size_t... CRAs > // Compile time row arguments
2610 template< typename... RRAs > // Runtime row arguments
2611 inline Row<MT,false,false,false,CRAs...>::Row( MT& matrix, RRAs... args )
2612  : DataType( args... ) // Base class initialization
2613  , matrix_ ( matrix ) // The matrix containing the row
2614 {
2615  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
2616  if( matrix_.rows() <= row() ) {
2617  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
2618  }
2619  }
2620  else {
2621  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
2622  }
2623 }
2625 //*************************************************************************************************
2626 
2627 
2628 
2629 
2630 //=================================================================================================
2631 //
2632 // DATA ACCESS FUNCTIONS
2633 //
2634 //=================================================================================================
2635 
2636 //*************************************************************************************************
2646 template< typename MT // Type of the sparse matrix
2647  , size_t... CRAs > // Compile time row arguments
2648 inline typename Row<MT,false,false,false,CRAs...>::Reference
2649  Row<MT,false,false,false,CRAs...>::operator[]( size_t index )
2650 {
2651  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2652  return matrix_(row(),index);
2653 }
2655 //*************************************************************************************************
2656 
2657 
2658 //*************************************************************************************************
2668 template< typename MT // Type of the sparse matrix
2669  , size_t... CRAs > // Compile time row arguments
2670 inline typename Row<MT,false,false,false,CRAs...>::ConstReference
2671  Row<MT,false,false,false,CRAs...>::operator[]( size_t index ) const
2672 {
2673  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2674  return const_cast<const MT&>( matrix_ )(row(),index);
2675 }
2677 //*************************************************************************************************
2678 
2679 
2680 //*************************************************************************************************
2691 template< typename MT // Type of the sparse matrix
2692  , size_t... CRAs > // Compile time row arguments
2693 inline typename Row<MT,false,false,false,CRAs...>::Reference
2694  Row<MT,false,false,false,CRAs...>::at( size_t index )
2695 {
2696  if( index >= size() ) {
2697  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2698  }
2699  return (*this)[index];
2700 }
2702 //*************************************************************************************************
2703 
2704 
2705 //*************************************************************************************************
2716 template< typename MT // Type of the sparse matrix
2717  , size_t... CRAs > // Compile time row arguments
2718 inline typename Row<MT,false,false,false,CRAs...>::ConstReference
2719  Row<MT,false,false,false,CRAs...>::at( size_t index ) const
2720 {
2721  if( index >= size() ) {
2722  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2723  }
2724  return (*this)[index];
2725 }
2727 //*************************************************************************************************
2728 
2729 
2730 //*************************************************************************************************
2738 template< typename MT // Type of the sparse matrix
2739  , size_t... CRAs > // Compile time row arguments
2740 inline typename Row<MT,false,false,false,CRAs...>::Iterator
2742 {
2743  return Iterator( matrix_, row(), 0UL );
2744 }
2746 //*************************************************************************************************
2747 
2748 
2749 //*************************************************************************************************
2757 template< typename MT // Type of the sparse matrix
2758  , size_t... CRAs > // Compile time row arguments
2759 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2761 {
2762  return ConstIterator( matrix_, row(), 0UL );
2763 }
2765 //*************************************************************************************************
2766 
2767 
2768 //*************************************************************************************************
2776 template< typename MT // Type of the sparse matrix
2777  , size_t... CRAs > // Compile time row arguments
2778 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2780 {
2781  return ConstIterator( matrix_, row(), 0UL );
2782 }
2784 //*************************************************************************************************
2785 
2786 
2787 //*************************************************************************************************
2795 template< typename MT // Type of the sparse matrix
2796  , size_t... CRAs > // Compile time row arguments
2797 inline typename Row<MT,false,false,false,CRAs...>::Iterator
2799 {
2800  return Iterator( matrix_, row(), size() );
2801 }
2803 //*************************************************************************************************
2804 
2805 
2806 //*************************************************************************************************
2814 template< typename MT // Type of the sparse matrix
2815  , size_t... CRAs > // Compile time row arguments
2816 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2818 {
2819  return ConstIterator( matrix_, row(), size() );
2820 }
2822 //*************************************************************************************************
2823 
2824 
2825 //*************************************************************************************************
2833 template< typename MT // Type of the sparse matrix
2834  , size_t... CRAs > // Compile time row arguments
2835 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2837 {
2838  return ConstIterator( matrix_, row(), size() );
2839 }
2841 //*************************************************************************************************
2842 
2843 
2844 
2845 
2846 //=================================================================================================
2847 //
2848 // ASSIGNMENT OPERATORS
2849 //
2850 //=================================================================================================
2851 
2852 //*************************************************************************************************
2867 template< typename MT // Type of the sparse matrix
2868  , size_t... CRAs > // Compile time row arguments
2869 inline Row<MT,false,false,false,CRAs...>&
2870  Row<MT,false,false,false,CRAs...>::operator=( initializer_list<ElementType> list )
2871 {
2872  using blaze::assign;
2873 
2874  if( list.size() > size() ) {
2875  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
2876  }
2877 
2878  const InitializerVector<ElementType,true> tmp( list, size() );
2879 
2880  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
2881  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2882  }
2883 
2884  decltype(auto) left( derestrict( *this ) );
2885 
2886  assign( left, tmp );
2887 
2888  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2889 
2890  return *this;
2891 }
2893 //*************************************************************************************************
2894 
2895 
2896 //*************************************************************************************************
2910 template< typename MT // Type of the sparse matrix
2911  , size_t... CRAs > // Compile time row arguments
2912 inline Row<MT,false,false,false,CRAs...>&
2913  Row<MT,false,false,false,CRAs...>::operator=( const Row& rhs )
2914 {
2915  using blaze::assign;
2916 
2920 
2921  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
2922  return *this;
2923 
2924  if( size() != rhs.size() ) {
2925  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
2926  }
2927 
2928  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
2929  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2930  }
2931 
2932  decltype(auto) left( derestrict( *this ) );
2933 
2934  if( rhs.canAlias( &matrix_ ) ) {
2935  const ResultType tmp( rhs );
2936  assign( left, tmp );
2937  }
2938  else {
2939  assign( left, rhs );
2940  }
2941 
2942  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2943 
2944  return *this;
2945 }
2947 //*************************************************************************************************
2948 
2949 
2950 //*************************************************************************************************
2964 template< typename MT // Type of the sparse matrix
2965  , size_t... CRAs > // Compile time row arguments
2966 template< typename VT > // Type of the right-hand side vector
2967 inline Row<MT,false,false,false,CRAs...>&
2968  Row<MT,false,false,false,CRAs...>::operator=( const Vector<VT,true>& rhs )
2969 {
2970  using blaze::assign;
2971 
2972  if( size() != (~rhs).size() ) {
2973  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
2974  }
2975 
2976  const CompositeType_t<VT> tmp( ~rhs );
2977 
2978  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
2979  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2980  }
2981 
2982  decltype(auto) left( derestrict( *this ) );
2983 
2984  assign( left, tmp );
2985 
2986  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2987 
2988  return *this;
2989 }
2991 //*************************************************************************************************
2992 
2993 
2994 //*************************************************************************************************
3008 template< typename MT // Type of the sparse matrix
3009  , size_t... CRAs > // Compile time row arguments
3010 template< typename VT > // Type of the right-hand side vector
3011 inline Row<MT,false,false,false,CRAs...>&
3012  Row<MT,false,false,false,CRAs...>::operator+=( const Vector<VT,true>& rhs )
3013 {
3014  using blaze::assign;
3015 
3019  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3021 
3022  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3023 
3026 
3027  if( size() != (~rhs).size() ) {
3028  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3029  }
3030 
3031  const AddType tmp( *this + (~rhs) );
3032 
3033  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3034  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3035  }
3036 
3037  decltype(auto) left( derestrict( *this ) );
3038 
3039  assign( left, tmp );
3040 
3041  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3042 
3043  return *this;
3044 }
3046 //*************************************************************************************************
3047 
3048 
3049 //*************************************************************************************************
3063 template< typename MT // Type of the sparse matrix
3064  , size_t... CRAs > // Compile time row arguments
3065 template< typename VT > // Type of the right-hand side vector
3066 inline Row<MT,false,false,false,CRAs...>&
3067  Row<MT,false,false,false,CRAs...>::operator-=( const Vector<VT,true>& rhs )
3068 {
3069  using blaze::assign;
3070 
3074  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3076 
3077  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3078 
3081 
3082  if( size() != (~rhs).size() ) {
3083  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3084  }
3085 
3086  const SubType tmp( *this - (~rhs) );
3087 
3088  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3089  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3090  }
3091 
3092  decltype(auto) left( derestrict( *this ) );
3093 
3094  assign( left, tmp );
3095 
3096  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3097 
3098  return *this;
3099 }
3101 //*************************************************************************************************
3102 
3103 
3104 //*************************************************************************************************
3117 template< typename MT // Type of the sparse matrix
3118  , size_t... CRAs > // Compile time row arguments
3119 template< typename VT > // Type of the right-hand side vector
3120 inline Row<MT,false,false,false,CRAs...>&
3121  Row<MT,false,false,false,CRAs...>::operator*=( const Vector<VT,true>& rhs )
3122 {
3123  using blaze::assign;
3124 
3128  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3130 
3131  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3132 
3135 
3136  if( size() != (~rhs).size() ) {
3137  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3138  }
3139 
3140  const MultType tmp( *this * (~rhs) );
3141 
3142  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3143  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3144  }
3145 
3146  decltype(auto) left( derestrict( *this ) );
3147 
3148  assign( left, tmp );
3149 
3150  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3151 
3152  return *this;
3153 }
3155 //*************************************************************************************************
3156 
3157 
3158 //*************************************************************************************************
3170 template< typename MT // Type of the sparse matrix
3171  , size_t... CRAs > // Compile time row arguments
3172 template< typename VT > // Type of the right-hand side vector
3173 inline Row<MT,false,false,false,CRAs...>&
3174  Row<MT,false,false,false,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
3175 {
3176  using blaze::assign;
3177 
3181  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
3182  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3184 
3185  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3186 
3190 
3191  if( size() != (~rhs).size() ) {
3192  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3193  }
3194 
3195  const DivType tmp( *this / (~rhs) );
3196 
3197  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3198  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3199  }
3200 
3201  decltype(auto) left( derestrict( *this ) );
3202 
3203  assign( left, tmp );
3204 
3205  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3206 
3207  return *this;
3208 }
3210 //*************************************************************************************************
3211 
3212 
3213 //*************************************************************************************************
3226 template< typename MT // Type of the sparse matrix
3227  , size_t... CRAs > // Compile time row arguments
3228 template< typename VT > // Type of the right-hand side vector
3229 inline Row<MT,false,false,false,CRAs...>&
3230  Row<MT,false,false,false,CRAs...>::operator%=( const Vector<VT,true>& rhs )
3231 {
3232  using blaze::assign;
3233 
3234  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3236 
3237  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3238 
3242 
3243  if( size() != 3UL || (~rhs).size() != 3UL ) {
3244  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
3245  }
3246 
3247  const CrossType tmp( *this % (~rhs) );
3248 
3249  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3250  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3251  }
3252 
3253  decltype(auto) left( derestrict( *this ) );
3254 
3255  assign( left, tmp );
3256 
3257  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3258 
3259  return *this;
3260 }
3262 //*************************************************************************************************
3263 
3264 
3265 
3266 
3267 //=================================================================================================
3268 //
3269 // UTILITY FUNCTIONS
3270 //
3271 //=================================================================================================
3272 
3273 //*************************************************************************************************
3279 template< typename MT // Type of the sparse matrix
3280  , size_t... CRAs > // Compile time row arguments
3281 inline MT& Row<MT,false,false,false,CRAs...>::operand() noexcept
3282 {
3283  return matrix_;
3284 }
3286 //*************************************************************************************************
3287 
3288 
3289 //*************************************************************************************************
3295 template< typename MT // Type of the sparse matrix
3296  , size_t... CRAs > // Compile time row arguments
3297 inline const MT& Row<MT,false,false,false,CRAs...>::operand() const noexcept
3298 {
3299  return matrix_;
3300 }
3302 //************************************************************************************************
3303 
3304 
3305 //*************************************************************************************************
3311 template< typename MT // Type of the sparse matrix
3312  , size_t... CRAs > // Compile time row arguments
3313 inline size_t Row<MT,false,false,false,CRAs...>::size() const noexcept
3314 {
3315  return matrix_.columns();
3316 }
3318 //*************************************************************************************************
3319 
3320 
3321 //*************************************************************************************************
3327 template< typename MT // Type of the sparse matrix
3328  , size_t... CRAs > // Compile time row arguments
3329 inline size_t Row<MT,false,false,false,CRAs...>::capacity() const noexcept
3330 {
3331  return matrix_.columns();
3332 }
3334 //*************************************************************************************************
3335 
3336 
3337 //*************************************************************************************************
3346 template< typename MT // Type of the sparse matrix
3347  , size_t... CRAs > // Compile time row arguments
3348 inline size_t Row<MT,false,false,false,CRAs...>::nonZeros() const
3349 {
3350  size_t counter( 0UL );
3351  for( ConstIterator element=begin(); element!=end(); ++element ) {
3352  ++counter;
3353  }
3354  return counter;
3355 }
3357 //*************************************************************************************************
3358 
3359 
3360 //*************************************************************************************************
3366 template< typename MT // Type of the sparse matrix
3367  , size_t... CRAs > // Compile time row arguments
3369 {
3370  const size_t jbegin( ( IsUpper_v<MT> )
3371  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3372  ?( row()+1UL )
3373  :( row() ) )
3374  :( 0UL ) );
3375  const size_t jend ( ( IsLower_v<MT> )
3376  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3377  ?( row() )
3378  :( row()+1UL ) )
3379  :( size() ) );
3380 
3381  for( size_t j=jbegin; j<jend; ++j ) {
3382  matrix_.erase( row(), j );
3383  }
3384 }
3386 //*************************************************************************************************
3387 
3388 
3389 //*************************************************************************************************
3399 template< typename MT // Type of the sparse matrix
3400  , size_t... CRAs > // Compile time row arguments
3401 void Row<MT,false,false,false,CRAs...>::reserve( size_t n )
3402 {
3403  MAYBE_UNUSED( n );
3404 
3405  return;
3406 }
3408 //*************************************************************************************************
3409 
3410 
3411 
3412 
3413 //=================================================================================================
3414 //
3415 // INSERTION FUNCTIONS
3416 //
3417 //=================================================================================================
3418 
3419 //*************************************************************************************************
3431 template< typename MT // Type of the sparse matrix
3432  , size_t... CRAs > // Compile time row arguments
3433 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3434  Row<MT,false,false,false,CRAs...>::set( size_t index, const ElementType& value )
3435 {
3436  return Iterator( matrix_, row(), index, matrix_.set( row(), index, value ) );
3437 }
3439 //*************************************************************************************************
3440 
3441 
3442 //*************************************************************************************************
3455 template< typename MT // Type of the sparse matrix
3456  , size_t... CRAs > // Compile time row arguments
3457 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3458  Row<MT,false,false,false,CRAs...>::insert( size_t index, const ElementType& value )
3459 {
3460  return Iterator( matrix_, row(), index, matrix_.insert( row(), index, value ) );
3461 }
3463 //*************************************************************************************************
3464 
3465 
3466 //*************************************************************************************************
3491 template< typename MT // Type of the sparse matrix
3492  , size_t... CRAs > // Compile time row arguments
3493 inline void Row<MT,false,false,false,CRAs...>::append( size_t index, const ElementType& value, bool check )
3494 {
3495  if( !check || !isDefault<strict>( value ) )
3496  matrix_.insert( row(), index, value );
3497 }
3499 //*************************************************************************************************
3500 
3501 
3502 
3503 
3504 //=================================================================================================
3505 //
3506 // ERASE FUNCTIONS
3507 //
3508 //=================================================================================================
3509 
3510 //*************************************************************************************************
3519 template< typename MT // Type of the sparse matrix
3520  , size_t... CRAs > // Compile time row arguments
3521 inline void Row<MT,false,false,false,CRAs...>::erase( size_t index )
3522 {
3523  matrix_.erase( row(), index );
3524 }
3526 //*************************************************************************************************
3527 
3528 
3529 //*************************************************************************************************
3538 template< typename MT // Type of the sparse matrix
3539  , size_t... CRAs > // Compile time row arguments
3540 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3541  Row<MT,false,false,false,CRAs...>::erase( Iterator pos )
3542 {
3543  const size_t column( pos.column_ );
3544 
3545  if( column == size() )
3546  return pos;
3547 
3548  matrix_.erase( column, pos.pos_ );
3549  return Iterator( matrix_, row(), column+1UL );
3550 }
3552 //*************************************************************************************************
3553 
3554 
3555 //*************************************************************************************************
3565 template< typename MT // Type of the sparse matrix
3566  , size_t... CRAs > // Compile time row arguments
3567 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3568  Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last )
3569 {
3570  for( ; first!=last; ++first ) {
3571  matrix_.erase( first.column_, first.pos_ );
3572  }
3573  return last;
3574 }
3576 //*************************************************************************************************
3577 
3578 
3579 //*************************************************************************************************
3602 template< typename MT // Type of the sparse matrix
3603  , size_t... CRAs > // Compile time row arguments
3604 template< typename Pred // Type of the unary predicate
3605  , typename > // Type restriction on the unary predicate
3606 inline void Row<MT,false,false,false,CRAs...>::erase( Pred predicate )
3607 {
3608  for( Iterator element=begin(); element!=end(); ++element ) {
3609  if( predicate( element->value() ) )
3610  matrix_.erase( element.column_, element.pos_ );
3611  }
3612 }
3614 //*************************************************************************************************
3615 
3616 
3617 //*************************************************************************************************
3642 template< typename MT // Type of the sparse matrix
3643  , size_t... CRAs > // Compile time row arguments
3644 template< typename Pred > // Type of the unary predicate
3645 inline void Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
3646 {
3647  for( ; first!=last; ++first ) {
3648  if( predicate( first->value() ) )
3649  matrix_.erase( first.column_, first.pos_ );
3650  }
3651 }
3653 //*************************************************************************************************
3654 
3655 
3656 
3657 
3658 //=================================================================================================
3659 //
3660 // LOOKUP FUNCTIONS
3661 //
3662 //=================================================================================================
3663 
3664 //*************************************************************************************************
3678 template< typename MT // Type of the sparse matrix
3679  , size_t... CRAs > // Compile time row arguments
3680 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3681  Row<MT,false,false,false,CRAs...>::find( size_t index )
3682 {
3683  const Iterator_t<MT> pos( matrix_.find( row(), index ) );
3684 
3685  if( pos != matrix_.end( index ) )
3686  return Iterator( matrix_, row(), index, pos );
3687  else
3688  return end();
3689 }
3691 //*************************************************************************************************
3692 
3693 
3694 //*************************************************************************************************
3708 template< typename MT // Type of the sparse matrix
3709  , size_t... CRAs > // Compile time row arguments
3710 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3711  Row<MT,false,false,false,CRAs...>::find( size_t index ) const
3712 {
3713  const ConstIterator_t<MT> pos( matrix_.find( row(), index ) );
3714 
3715  if( pos != matrix_.end( index ) )
3716  return ConstIterator( matrix_, row(), index, pos );
3717  else
3718  return end();
3719 }
3721 //*************************************************************************************************
3722 
3723 
3724 //*************************************************************************************************
3737 template< typename MT // Type of the sparse matrix
3738  , size_t... CRAs > // Compile time row arguments
3739 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3740  Row<MT,false,false,false,CRAs...>::lowerBound( size_t index )
3741 {
3742  for( size_t i=index; i<size(); ++i )
3743  {
3744  const Iterator_t<MT> pos( matrix_.find( row(), i ) );
3745 
3746  if( pos != matrix_.end( i ) )
3747  return Iterator( matrix_, row(), i, pos );
3748  }
3749 
3750  return end();
3751 }
3753 //*************************************************************************************************
3754 
3755 
3756 //*************************************************************************************************
3769 template< typename MT // Type of the sparse matrix
3770  , size_t... CRAs > // Compile time row arguments
3771 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3772  Row<MT,false,false,false,CRAs...>::lowerBound( size_t index ) const
3773 {
3774  for( size_t i=index; i<size(); ++i )
3775  {
3776  const ConstIterator_t<MT> pos( matrix_.find( row(), i ) );
3777 
3778  if( pos != matrix_.end( i ) )
3779  return ConstIterator( matrix_, row(), i, pos );
3780  }
3781 
3782  return end();
3783 }
3785 //*************************************************************************************************
3786 
3787 
3788 //*************************************************************************************************
3801 template< typename MT // Type of the sparse matrix
3802  , size_t... CRAs > // Compile time row arguments
3803 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3804  Row<MT,false,false,false,CRAs...>::upperBound( size_t index )
3805 {
3806  for( size_t i=index+1UL; i<size(); ++i )
3807  {
3808  const Iterator_t<MT> pos( matrix_.find( row(), i ) );
3809 
3810  if( pos != matrix_.end( i ) )
3811  return Iterator( matrix_, row(), i, pos );
3812  }
3813 
3814  return end();
3815 }
3817 //*************************************************************************************************
3818 
3819 
3820 //*************************************************************************************************
3833 template< typename MT // Type of the sparse matrix
3834  , size_t... CRAs > // Compile time row arguments
3835 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3836  Row<MT,false,false,false,CRAs...>::upperBound( size_t index ) const
3837 {
3838  for( size_t i=index+1UL; i<size(); ++i )
3839  {
3840  const ConstIterator_t<MT> pos( matrix_.find( row(), i ) );
3841 
3842  if( pos != matrix_.end( i ) )
3843  return ConstIterator( matrix_, row(), i, pos );
3844  }
3845 
3846  return end();
3847 }
3849 //*************************************************************************************************
3850 
3851 
3852 
3853 
3854 //=================================================================================================
3855 //
3856 // NUMERIC FUNCTIONS
3857 //
3858 //=================================================================================================
3859 
3860 //*************************************************************************************************
3873 template< typename MT // Type of the sparse matrix
3874  , size_t... CRAs > // Compile time row arguments
3875 template< typename Other > // Data type of the scalar value
3876 inline Row<MT,false,false,false,CRAs...>&
3877  Row<MT,false,false,false,CRAs...>::scale( const Other& scalar )
3878 {
3880 
3881  for( Iterator element=begin(); element!=end(); ++element )
3882  element->value() *= scalar;
3883  return *this;
3884 }
3886 //*************************************************************************************************
3887 
3888 
3889 
3890 
3891 //=================================================================================================
3892 //
3893 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3894 //
3895 //=================================================================================================
3896 
3897 //*************************************************************************************************
3908 template< typename MT // Type of the sparse matrix
3909  , size_t... CRAs > // Compile time row arguments
3910 template< typename Other > // Data type of the foreign expression
3911 inline bool Row<MT,false,false,false,CRAs...>::canAlias( const Other* alias ) const noexcept
3912 {
3913  return matrix_.isAliased( alias );
3914 }
3916 //*************************************************************************************************
3917 
3918 
3919 //*************************************************************************************************
3926 template< typename MT // Type of the sparse matrix
3927  , size_t... CRAs > // Compile time row arguments
3928 template< typename Other > // Data type of the foreign expression
3929 inline bool Row<MT,false,false,false,CRAs...>::isAliased( const Other* alias ) const noexcept
3930 {
3931  return matrix_.isAliased( alias );
3932 }
3934 //*************************************************************************************************
3935 
3936 
3937 //*************************************************************************************************
3949 template< typename MT // Type of the sparse matrix
3950  , size_t... CRAs > // Compile time row arguments
3951 template< typename VT > // Type of the right-hand side dense vector
3952 inline void Row<MT,false,false,false,CRAs...>::assign( const DenseVector<VT,true>& rhs )
3953 {
3954  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3955 
3956  for( size_t j=0UL; j<(~rhs).size(); ++j ) {
3957  matrix_(row(),j) = (~rhs)[j];
3958  }
3959 }
3961 //*************************************************************************************************
3962 
3963 
3964 //*************************************************************************************************
3976 template< typename MT // Type of the sparse matrix
3977  , size_t... CRAs > // Compile time row arguments
3978 template< typename VT > // Type of the right-hand side sparse vector
3979 inline void Row<MT,false,false,false,CRAs...>::assign( const SparseVector<VT,true>& rhs )
3980 {
3981  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3982 
3983  size_t j( 0UL );
3984 
3985  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3986  for( ; j<element->index(); ++j )
3987  matrix_.erase( row(), j );
3988  matrix_(row(),j++) = element->value();
3989  }
3990  for( ; j<size(); ++j ) {
3991  matrix_.erase( row(), j );
3992  }
3993 }
3995 //*************************************************************************************************
3996 
3997 
3998 //*************************************************************************************************
4010 template< typename MT // Type of the sparse matrix
4011  , size_t... CRAs > // Compile time row arguments
4012 template< typename VT > // Type of the right-hand side vector
4013 inline void Row<MT,false,false,false,CRAs...>::addAssign( const Vector<VT,true>& rhs )
4014 {
4015  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4016 
4019 
4020  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4021 
4022  const AddType tmp( serial( *this + (~rhs) ) );
4023  assign( tmp );
4024 }
4026 //*************************************************************************************************
4027 
4028 
4029 //*************************************************************************************************
4041 template< typename MT // Type of the sparse matrix
4042  , size_t... CRAs > // Compile time row arguments
4043 template< typename VT > // Type of the right-hand side vector
4044 inline void Row<MT,false,false,false,CRAs...>::subAssign( const Vector<VT,true>& rhs )
4045 {
4046  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4047 
4050 
4051  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4052 
4053  const SubType tmp( serial( *this - (~rhs) ) );
4054  assign( tmp );
4055 }
4057 //*************************************************************************************************
4058 
4059 
4060 
4061 
4062 
4063 
4064 
4065 
4066 //=================================================================================================
4067 //
4068 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR SPARSE MATRICES
4069 //
4070 //=================================================================================================
4071 
4072 //*************************************************************************************************
4080 template< typename MT // Type of the sparse matrix
4081  , size_t... CRAs > // Compile time row arguments
4082 class Row<MT,false,false,true,CRAs...>
4083  : public View< SparseVector< Row<MT,false,false,true,CRAs...>, true > >
4084  , private RowData<CRAs...>
4085 {
4086  private:
4087  //**Type definitions****************************************************************************
4088  using DataType = RowData<CRAs...>;
4089  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4090  //**********************************************************************************************
4091 
4092  public:
4093  //**Type definitions****************************************************************************
4095  using This = Row<MT,false,false,true,CRAs...>;
4096 
4097  using BaseType = SparseVector<This,true>;
4098  using ViewedType = MT;
4099  using ResultType = RowTrait_t<MT,CRAs...>;
4100  using TransposeType = TransposeType_t<ResultType>;
4101  using ElementType = ElementType_t<MT>;
4102  using ReturnType = ReturnType_t<MT>;
4103  using CompositeType = const Row&;
4104 
4106  using ConstReference = ConstReference_t<MT>;
4107 
4109  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4110 
4112  using ConstIterator = ConstIterator_t<MT>;
4113 
4115  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4116  //**********************************************************************************************
4117 
4118  //**Compilation flags***************************************************************************
4120  static constexpr bool smpAssignable = false;
4121 
4123  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4124  //**********************************************************************************************
4125 
4126  //**Constructors********************************************************************************
4129  template< typename... RRAs >
4130  explicit inline Row( MT& matrix, RRAs... args );
4131 
4132  Row( const Row& ) = default;
4134  //**********************************************************************************************
4135 
4136  //**Destructor**********************************************************************************
4139  ~Row() = default;
4141  //**********************************************************************************************
4142 
4143  //**Data access functions***********************************************************************
4146  inline Reference operator[]( size_t index );
4147  inline ConstReference operator[]( size_t index ) const;
4148  inline Reference at( size_t index );
4149  inline ConstReference at( size_t index ) const;
4150  inline Iterator begin ();
4151  inline ConstIterator begin () const;
4152  inline ConstIterator cbegin() const;
4153  inline Iterator end ();
4154  inline ConstIterator end () const;
4155  inline ConstIterator cend () const;
4157  //**********************************************************************************************
4158 
4159  //**Assignment operators************************************************************************
4162  inline Row& operator=( initializer_list<ElementType> list );
4163  inline Row& operator=( const Row& rhs );
4164 
4165  template< typename VT > inline Row& operator= ( const DenseVector<VT,true>& rhs );
4166  template< typename VT > inline Row& operator= ( const SparseVector<VT,true>& rhs );
4167  template< typename VT > inline Row& operator+=( const DenseVector<VT,true>& rhs );
4168  template< typename VT > inline Row& operator+=( const SparseVector<VT,true>& rhs );
4169  template< typename VT > inline Row& operator-=( const DenseVector<VT,true>& rhs );
4170  template< typename VT > inline Row& operator-=( const SparseVector<VT,true>& rhs );
4171  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
4172  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4173  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4175  //**********************************************************************************************
4176 
4177  //**Utility functions***************************************************************************
4180  using DataType::row;
4181 
4182  inline MT& operand() noexcept;
4183  inline const MT& operand() const noexcept;
4184 
4185  inline size_t size() const noexcept;
4186  inline size_t capacity() const noexcept;
4187  inline size_t nonZeros() const;
4188  inline void reset();
4189  inline void reserve( size_t n );
4191  //**********************************************************************************************
4192 
4193  //**Insertion functions*************************************************************************
4196  inline Iterator set ( size_t index, const ElementType& value );
4197  inline Iterator insert( size_t index, const ElementType& value );
4198  inline void append( size_t index, const ElementType& value, bool check=false );
4200  //**********************************************************************************************
4201 
4202  //**Erase functions*****************************************************************************
4205  inline void erase( size_t index );
4206  inline Iterator erase( Iterator pos );
4207  inline Iterator erase( Iterator first, Iterator last );
4208 
4209  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
4210  inline void erase( Pred predicate );
4211 
4212  template< typename Pred >
4213  inline void erase( Iterator first, Iterator last, Pred predicate );
4215  //**********************************************************************************************
4216 
4217  //**Lookup functions****************************************************************************
4220  inline Iterator find ( size_t index );
4221  inline ConstIterator find ( size_t index ) const;
4222  inline Iterator lowerBound( size_t index );
4223  inline ConstIterator lowerBound( size_t index ) const;
4224  inline Iterator upperBound( size_t index );
4225  inline ConstIterator upperBound( size_t index ) const;
4227  //**********************************************************************************************
4228 
4229  //**Numeric functions***************************************************************************
4232  template< typename Other > inline Row& scale( const Other& scalar );
4234  //**********************************************************************************************
4235 
4236  //**Expression template evaluation functions****************************************************
4239  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
4240  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
4241 
4242  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
4243  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
4244  template< typename VT > inline void addAssign( const DenseVector <VT,true>& rhs );
4245  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
4246  template< typename VT > inline void subAssign( const DenseVector <VT,true>& rhs );
4247  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
4249  //**********************************************************************************************
4250 
4251  private:
4252  //**Utility functions***************************************************************************
4255  inline size_t extendCapacity() const;
4257  //**********************************************************************************************
4258 
4259  //**Member variables****************************************************************************
4262  Operand matrix_;
4263 
4264  //**********************************************************************************************
4265 
4266  //**Compile time checks*************************************************************************
4275  //**********************************************************************************************
4276 };
4278 //*************************************************************************************************
4279 
4280 
4281 
4282 
4283 //=================================================================================================
4284 //
4285 // CONSTRUCTORS
4286 //
4287 //=================================================================================================
4288 
4289 //*************************************************************************************************
4302 template< typename MT // Type of the sparse matrix
4303  , size_t... CRAs > // Compile time row arguments
4304 template< typename... RRAs > // Runtime row arguments
4305 inline Row<MT,false,false,true,CRAs...>::Row( MT& matrix, RRAs... args )
4306  : DataType( args... ) // Base class initialization
4307  , matrix_ ( matrix ) // The matrix containing the row
4308 {
4309  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
4310  if( matrix_.rows() <= row() ) {
4311  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
4312  }
4313  }
4314  else {
4315  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
4316  }
4317 }
4319 //*************************************************************************************************
4320 
4321 
4322 
4323 
4324 //=================================================================================================
4325 //
4326 // DATA ACCESS FUNCTIONS
4327 //
4328 //=================================================================================================
4329 
4330 //*************************************************************************************************
4340 template< typename MT // Type of the sparse matrix
4341  , size_t... CRAs > // Compile time row arguments
4342 inline typename Row<MT,false,false,true,CRAs...>::Reference
4343  Row<MT,false,false,true,CRAs...>::operator[]( size_t index )
4344 {
4345  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4346  return matrix_(index,row());
4347 }
4349 //*************************************************************************************************
4350 
4351 
4352 //*************************************************************************************************
4362 template< typename MT // Type of the sparse matrix
4363  , size_t... CRAs > // Compile time row arguments
4364 inline typename Row<MT,false,false,true,CRAs...>::ConstReference
4365  Row<MT,false,false,true,CRAs...>::operator[]( size_t index ) const
4366 {
4367  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4368  return const_cast<const MT&>( matrix_ )(index,row());
4369 }
4371 //*************************************************************************************************
4372 
4373 
4374 //*************************************************************************************************
4385 template< typename MT // Type of the sparse matrix
4386  , size_t... CRAs > // Compile time row arguments
4387 inline typename Row<MT,false,false,true,CRAs...>::Reference
4388  Row<MT,false,false,true,CRAs...>::at( size_t index )
4389 {
4390  if( index >= size() ) {
4391  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4392  }
4393  return (*this)[index];
4394 }
4396 //*************************************************************************************************
4397 
4398 
4399 //*************************************************************************************************
4410 template< typename MT // Type of the sparse matrix
4411  , size_t... CRAs > // Compile time row arguments
4412 inline typename Row<MT,false,false,true,CRAs...>::ConstReference
4413  Row<MT,false,false,true,CRAs...>::at( size_t index ) const
4414 {
4415  if( index >= size() ) {
4416  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4417  }
4418  return (*this)[index];
4419 }
4421 //*************************************************************************************************
4422 
4423 
4424 //*************************************************************************************************
4432 template< typename MT // Type of the sparse matrix
4433  , size_t... CRAs > // Compile time row arguments
4434 inline typename Row<MT,false,false,true,CRAs...>::Iterator
4436 {
4437  return matrix_.begin( row() );
4438 }
4440 //*************************************************************************************************
4441 
4442 
4443 //*************************************************************************************************
4451 template< typename MT // Type of the sparse matrix
4452  , size_t... CRAs > // Compile time row arguments
4453 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4455 {
4456  return matrix_.cbegin( row() );
4457 }
4459 //*************************************************************************************************
4460 
4461 
4462 //*************************************************************************************************
4470 template< typename MT // Type of the sparse matrix
4471  , size_t... CRAs > // Compile time row arguments
4472 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4474 {
4475  return matrix_.cbegin( row() );
4476 }
4478 //*************************************************************************************************
4479 
4480 
4481 //*************************************************************************************************
4489 template< typename MT // Type of the sparse matrix
4490  , size_t... CRAs > // Compile time row arguments
4491 inline typename Row<MT,false,false,true,CRAs...>::Iterator
4493 {
4494  return matrix_.end( row() );
4495 }
4497 //*************************************************************************************************
4498 
4499 
4500 //*************************************************************************************************
4508 template< typename MT // Type of the sparse matrix
4509  , size_t... CRAs > // Compile time row arguments
4510 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4512 {
4513  return matrix_.cend( row() );
4514 }
4516 //*************************************************************************************************
4517 
4518 
4519 //*************************************************************************************************
4527 template< typename MT // Type of the sparse matrix
4528  , size_t... CRAs > // Compile time row arguments
4529 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4531 {
4532  return matrix_.cend( row() );
4533 }
4535 //*************************************************************************************************
4536 
4537 
4538 
4539 
4540 //=================================================================================================
4541 //
4542 // ASSIGNMENT OPERATORS
4543 //
4544 //=================================================================================================
4545 
4546 //*************************************************************************************************
4561 template< typename MT // Type of the sparse matrix
4562  , size_t... CRAs > // Compile time row arguments
4563 inline Row<MT,false,false,true,CRAs...>&
4564  Row<MT,false,false,true,CRAs...>::operator=( initializer_list<ElementType> list )
4565 {
4566  using blaze::assign;
4567 
4568  if( list.size() > size() ) {
4569  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
4570  }
4571 
4572  const InitializerVector<ElementType,true> tmp( list, size() );
4573 
4574  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4575  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4576  }
4577 
4578  decltype(auto) left( derestrict( *this ) );
4579 
4580  left.reset();
4581  assign( left, tmp );
4582 
4583  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4584 
4585  return *this;
4586 }
4588 //*************************************************************************************************
4589 
4590 
4591 //*************************************************************************************************
4605 template< typename MT // Type of the sparse matrix
4606  , size_t... CRAs > // Compile time row arguments
4607 inline Row<MT,false,false,true,CRAs...>&
4608  Row<MT,false,false,true,CRAs...>::operator=( const Row& rhs )
4609 {
4610  using blaze::assign;
4611 
4615 
4616  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
4617  return *this;
4618 
4619  if( size() != rhs.size() ) {
4620  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
4621  }
4622 
4623  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
4624  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4625  }
4626 
4627  decltype(auto) left( derestrict( *this ) );
4628 
4629  if( rhs.canAlias( &matrix_ ) ) {
4630  const ResultType tmp( rhs );
4631  left.reset();
4632  left.reserve( tmp.nonZeros() );
4633  assign( left, tmp );
4634  }
4635  else {
4636  left.reset();
4637  left.reserve( rhs.nonZeros() );
4638  assign( left, rhs );
4639  }
4640 
4641  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4642 
4643  return *this;
4644 }
4646 //*************************************************************************************************
4647 
4648 
4649 //*************************************************************************************************
4663 template< typename MT // Type of the sparse matrix
4664  , size_t... CRAs > // Compile time row arguments
4665 template< typename VT > // Type of the right-hand side dense vector
4666 inline Row<MT,false,false,true,CRAs...>&
4667  Row<MT,false,false,true,CRAs...>::operator=( const DenseVector<VT,true>& rhs )
4668 {
4669  using blaze::assign;
4670 
4671  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4672  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4674 
4675  if( size() != (~rhs).size() ) {
4676  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4677  }
4678 
4679  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4680  Right right( ~rhs );
4681 
4682  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4683  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4684  }
4685 
4686  decltype(auto) left( derestrict( *this ) );
4687 
4688  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4689  const ResultType_t<VT> tmp( right );
4690  left.reset();
4691  assign( left, tmp );
4692  }
4693  else {
4694  left.reset();
4695  assign( left, right );
4696  }
4697 
4698  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4699 
4700  return *this;
4701 }
4703 //*************************************************************************************************
4704 
4705 
4706 //*************************************************************************************************
4720 template< typename MT // Type of the sparse matrix
4721  , size_t... CRAs > // Compile time row arguments
4722 template< typename VT > // Type of the right-hand side sparse vector
4723 inline Row<MT,false,false,true,CRAs...>&
4724  Row<MT,false,false,true,CRAs...>::operator=( const SparseVector<VT,true>& rhs )
4725 {
4726  using blaze::assign;
4727 
4728  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4729  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4731 
4732  if( size() != (~rhs).size() ) {
4733  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4734  }
4735 
4736  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4737  Right right( ~rhs );
4738 
4739  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4740  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4741  }
4742 
4743  decltype(auto) left( derestrict( *this ) );
4744 
4745  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4746  const ResultType_t<VT> tmp( right );
4747  left.reset();
4748  left.reserve( tmp.nonZeros() );
4749  assign( left, tmp );
4750  }
4751  else {
4752  left.reset();
4753  left.reserve( right.nonZeros() );
4754  assign( left, right );
4755  }
4756 
4757  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4758 
4759  return *this;
4760 }
4762 //*************************************************************************************************
4763 
4764 
4765 //*************************************************************************************************
4779 template< typename MT // Type of the sparse matrix
4780  , size_t... CRAs > // Compile time row arguments
4781 template< typename VT > // Type of the right-hand side dense vector
4782 inline Row<MT,false,false,true,CRAs...>&
4783  Row<MT,false,false,true,CRAs...>::operator+=( const DenseVector<VT,true>& rhs )
4784 {
4785  using blaze::assign;
4786 
4790  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4791  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4793 
4794  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4795 
4799 
4800  if( size() != (~rhs).size() ) {
4801  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4802  }
4803 
4804  const AddType tmp( *this + (~rhs) );
4805 
4806  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4807  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4808  }
4809 
4810  decltype(auto) left( derestrict( *this ) );
4811 
4812  left.reset();
4813  assign( left, tmp );
4814 
4815  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4816 
4817  return *this;
4818 }
4820 //*************************************************************************************************
4821 
4822 
4823 //*************************************************************************************************
4837 template< typename MT // Type of the sparse matrix
4838  , size_t... CRAs > // Compile time row arguments
4839 template< typename VT > // Type of the right-hand side sparse vector
4840 inline Row<MT,false,false,true,CRAs...>&
4841  Row<MT,false,false,true,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
4842 {
4843  using blaze::assign;
4844 
4848  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4849  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4851 
4852  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4853 
4857 
4858  if( size() != (~rhs).size() ) {
4859  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4860  }
4861 
4862  const AddType tmp( *this + (~rhs) );
4863 
4864  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4865  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4866  }
4867 
4868  decltype(auto) left( derestrict( *this ) );
4869 
4870  left.reset();
4871  left.reserve( tmp.nonZeros() );
4872  assign( left, tmp );
4873 
4874  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4875 
4876  return *this;
4877 }
4879 //*************************************************************************************************
4880 
4881 
4882 //*************************************************************************************************
4897 template< typename MT // Type of the sparse matrix
4898  , size_t... CRAs > // Compile time row arguments
4899 template< typename VT > // Type of the right-hand side dense vector
4900 inline Row<MT,false,false,true,CRAs...>&
4901  Row<MT,false,false,true,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
4902 {
4903  using blaze::assign;
4904 
4908  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4909  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4911 
4912  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4913 
4917 
4918  if( size() != (~rhs).size() ) {
4919  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4920  }
4921 
4922  const SubType tmp( *this - (~rhs) );
4923 
4924  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4925  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4926  }
4927 
4928  decltype(auto) left( derestrict( *this ) );
4929 
4930  left.reset();
4931  assign( left, tmp );
4932 
4933  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4934 
4935  return *this;
4936 }
4938 //*************************************************************************************************
4939 
4940 
4941 //*************************************************************************************************
4956 template< typename MT // Type of the sparse matrix
4957  , size_t... CRAs > // Compile time row arguments
4958 template< typename VT > // Type of the right-hand side sparse vector
4959 inline Row<MT,false,false,true,CRAs...>&
4960  Row<MT,false,false,true,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
4961 {
4962  using blaze::assign;
4963 
4967  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4968  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4970 
4971  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4972 
4976 
4977  if( size() != (~rhs).size() ) {
4978  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4979  }
4980 
4981  const SubType tmp( *this - (~rhs) );
4982 
4983  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4984  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4985  }
4986 
4987  decltype(auto) left( derestrict( *this ) );
4988 
4989  left.reset();
4990  left.reserve( tmp.nonZeros() );
4991  assign( left, tmp );
4992 
4993  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4994 
4995  return *this;
4996 }
4998 //*************************************************************************************************
4999 
5000 
5001 //*************************************************************************************************
5014 template< typename MT // Type of the sparse matrix
5015  , size_t... CRAs > // Compile time row arguments
5016 template< typename VT > // Type of the right-hand side vector
5017 inline Row<MT,false,false,true,CRAs...>&
5018  Row<MT,false,false,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
5019 {
5020  using blaze::assign;
5021 
5025  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5027 
5028  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5029 
5032 
5033  if( size() != (~rhs).size() ) {
5034  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5035  }
5036 
5037  const MultType tmp( *this * (~rhs) );
5038 
5039  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5040  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5041  }
5042 
5043  decltype(auto) left( derestrict( *this ) );
5044 
5045  left.reset();
5046  assign( left, tmp );
5047 
5048  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5049 
5050  return *this;
5051 }
5053 //*************************************************************************************************
5054 
5055 
5056 //*************************************************************************************************
5068 template< typename MT // Type of the sparse matrix
5069  , size_t... CRAs > // Compile time row arguments
5070 template< typename VT > // Type of the right-hand side vector
5071 inline Row<MT,false,false,true,CRAs...>&
5072  Row<MT,false,false,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5073 {
5074  using blaze::assign;
5075 
5079  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
5080  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5082 
5083  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5084 
5088 
5089  if( size() != (~rhs).size() ) {
5090  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5091  }
5092 
5093  const DivType tmp( *this / (~rhs) );
5094 
5095  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5096  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5097  }
5098 
5099  decltype(auto) left( derestrict( *this ) );
5100 
5101  left.reset();
5102  assign( left, tmp );
5103 
5104  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5105 
5106  return *this;
5107 }
5109 //*************************************************************************************************
5110 
5111 
5112 //*************************************************************************************************
5125 template< typename MT // Type of the sparse matrix
5126  , size_t... CRAs > // Compile time row arguments
5127 template< typename VT > // Type of the right-hand side vector
5128 inline Row<MT,false,false,true,CRAs...>&
5129  Row<MT,false,false,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5130 {
5131  using blaze::assign;
5132 
5133  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5135 
5136  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5137 
5141 
5142  if( size() != 3UL || (~rhs).size() != 3UL ) {
5143  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5144  }
5145 
5146  const CrossType tmp( *this % (~rhs) );
5147 
5148  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5149  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5150  }
5151 
5152  decltype(auto) left( derestrict( *this ) );
5153 
5154  left.reset();
5155  assign( left, tmp );
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 sparse matrix
5180  , size_t... CRAs > // Compile time row arguments
5181 inline MT& Row<MT,false,false,true,CRAs...>::operand() noexcept
5182 {
5183  return matrix_;
5184 }
5186 //*************************************************************************************************
5187 
5188 
5189 //*************************************************************************************************
5195 template< typename MT // Type of the sparse matrix
5196  , size_t... CRAs > // Compile time row arguments
5197 inline const MT& Row<MT,false,false,true,CRAs...>::operand() const noexcept
5198 {
5199  return matrix_;
5200 }
5202 //*************************************************************************************************
5203 
5204 
5205 //*************************************************************************************************
5211 template< typename MT // Type of the sparse matrix
5212  , size_t... CRAs > // Compile time row arguments
5213 inline size_t Row<MT,false,false,true,CRAs...>::size() const noexcept
5214 {
5215  return matrix_.columns();
5216 }
5218 //*************************************************************************************************
5219 
5220 
5221 //*************************************************************************************************
5227 template< typename MT // Type of the sparse matrix
5228  , size_t... CRAs > // Compile time row arguments
5229 inline size_t Row<MT,false,false,true,CRAs...>::capacity() const noexcept
5230 {
5231  return matrix_.capacity( row() );
5232 }
5234 //*************************************************************************************************
5235 
5236 
5237 //*************************************************************************************************
5246 template< typename MT // Type of the sparse matrix
5247  , size_t... CRAs > // Compile time row arguments
5248 inline size_t Row<MT,false,false,true,CRAs...>::nonZeros() const
5249 {
5250  return matrix_.nonZeros( row() );
5251 }
5253 //*************************************************************************************************
5254 
5255 
5256 //*************************************************************************************************
5262 template< typename MT // Type of the sparse matrix
5263  , size_t... CRAs > // Compile time row arguments
5265 {
5266  matrix_.reset( row() );
5267 }
5269 //*************************************************************************************************
5270 
5271 
5272 //*************************************************************************************************
5282 template< typename MT // Type of the sparse matrix
5283  , size_t... CRAs > // Compile time row arguments
5284 void Row<MT,false,false,true,CRAs...>::reserve( size_t n )
5285 {
5286  matrix_.reserve( row(), n );
5287 }
5289 //*************************************************************************************************
5290 
5291 
5292 //*************************************************************************************************
5301 template< typename MT // Type of the sparse matrix
5302  , size_t... CRAs > // Compile time row arguments
5303 inline size_t Row<MT,false,false,true,CRAs...>::extendCapacity() const
5304 {
5305  using blaze::max;
5306  using blaze::min;
5307 
5308  size_t nonzeros( 2UL*capacity()+1UL );
5309  nonzeros = max( nonzeros, 7UL );
5310  nonzeros = min( nonzeros, size() );
5311 
5312  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
5313 
5314  return nonzeros;
5315 }
5317 //*************************************************************************************************
5318 
5319 
5320 
5321 
5322 //=================================================================================================
5323 //
5324 // INSERTION FUNCTIONS
5325 //
5326 //=================================================================================================
5327 
5328 //*************************************************************************************************
5340 template< typename MT // Type of the sparse matrix
5341  , size_t... CRAs > // Compile time row arguments
5342 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5343  Row<MT,false,false,true,CRAs...>::set( size_t index, const ElementType& value )
5344 {
5345  return matrix_.set( index, row(), value );
5346 }
5348 //*************************************************************************************************
5349 
5350 
5351 //*************************************************************************************************
5364 template< typename MT // Type of the sparse matrix
5365  , size_t... CRAs > // Compile time row arguments
5366 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5367  Row<MT,false,false,true,CRAs...>::insert( size_t index, const ElementType& value )
5368 {
5369  return matrix_.insert( index, row(), value );
5370 }
5372 //*************************************************************************************************
5373 
5374 
5375 //*************************************************************************************************
5400 template< typename MT // Type of the sparse matrix
5401  , size_t... CRAs > // Compile time row arguments
5402 inline void Row<MT,false,false,true,CRAs...>::append( size_t index, const ElementType& value, bool check )
5403 {
5404  matrix_.append( index, row(), value, check );
5405 }
5407 //*************************************************************************************************
5408 
5409 
5410 
5411 
5412 //=================================================================================================
5413 //
5414 // ERASE FUNCTIONS
5415 //
5416 //=================================================================================================
5417 
5418 //*************************************************************************************************
5427 template< typename MT // Type of the sparse matrix
5428  , size_t... CRAs > // Compile time row arguments
5429 inline void Row<MT,false,false,true,CRAs...>::erase( size_t index )
5430 {
5431  matrix_.erase( index, row() );
5432 }
5434 //*************************************************************************************************
5435 
5436 
5437 //*************************************************************************************************
5446 template< typename MT // Type of the sparse matrix
5447  , size_t... CRAs > // Compile time row arguments
5448 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5449  Row<MT,false,false,true,CRAs...>::erase( Iterator pos )
5450 {
5451  return matrix_.erase( row(), pos );
5452 }
5454 //*************************************************************************************************
5455 
5456 
5457 //*************************************************************************************************
5467 template< typename MT // Type of the sparse matrix
5468  , size_t... CRAs > // Compile time row arguments
5469 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5470  Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last )
5471 {
5472  return matrix_.erase( row(), first, last );
5473 }
5475 //*************************************************************************************************
5476 
5477 
5478 //*************************************************************************************************
5501 template< typename MT // Type of the sparse matrix
5502  , size_t... CRAs > // Compile time row arguments
5503 template< typename Pred // Type of the unary predicate
5504  , typename > // Type restriction on the unary predicate
5505 inline void Row<MT,false,false,true,CRAs...>::erase( Pred predicate )
5506 {
5507  matrix_.erase( row(), begin(), end(), predicate );
5508 }
5510 //*************************************************************************************************
5511 
5512 
5513 //*************************************************************************************************
5538 template< typename MT // Type of the sparse matrix
5539  , size_t... CRAs > // Compile time row arguments
5540 template< typename Pred > // Type of the unary predicate
5541 inline void Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
5542 {
5543  matrix_.erase( row(), first, last, predicate );
5544 }
5546 //*************************************************************************************************
5547 
5548 
5549 
5550 
5551 //=================================================================================================
5552 //
5553 // LOOKUP FUNCTIONS
5554 //
5555 //=================================================================================================
5556 
5557 //*************************************************************************************************
5571 template< typename MT // Type of the sparse matrix
5572  , size_t... CRAs > // Compile time row arguments
5573 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5574  Row<MT,false,false,true,CRAs...>::find( size_t index )
5575 {
5576  return matrix_.find( index, row() );
5577 }
5579 //*************************************************************************************************
5580 
5581 
5582 //*************************************************************************************************
5596 template< typename MT // Type of the sparse matrix
5597  , size_t... CRAs > // Compile time row arguments
5598 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5599  Row<MT,false,false,true,CRAs...>::find( size_t index ) const
5600 {
5601  return matrix_.find( index, row() );
5602 }
5604 //*************************************************************************************************
5605 
5606 
5607 //*************************************************************************************************
5620 template< typename MT // Type of the sparse matrix
5621  , size_t... CRAs > // Compile time row arguments
5622 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5623  Row<MT,false,false,true,CRAs...>::lowerBound( size_t index )
5624 {
5625  return matrix_.lowerBound( index, row() );
5626 }
5628 //*************************************************************************************************
5629 
5630 
5631 //*************************************************************************************************
5644 template< typename MT // Type of the sparse matrix
5645  , size_t... CRAs > // Compile time row arguments
5646 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5647  Row<MT,false,false,true,CRAs...>::lowerBound( size_t index ) const
5648 {
5649  return matrix_.lowerBound( index, row() );
5650 }
5652 //*************************************************************************************************
5653 
5654 
5655 //*************************************************************************************************
5668 template< typename MT // Type of the sparse matrix
5669  , size_t... CRAs > // Compile time row arguments
5670 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5671  Row<MT,false,false,true,CRAs...>::upperBound( size_t index )
5672 {
5673  return matrix_.upperBound( index, row() );
5674 }
5676 //*************************************************************************************************
5677 
5678 
5679 //*************************************************************************************************
5692 template< typename MT // Type of the sparse matrix
5693  , size_t... CRAs > // Compile time row arguments
5694 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5695  Row<MT,false,false,true,CRAs...>::upperBound( size_t index ) const
5696 {
5697  return matrix_.upperBound( index, row() );
5698 }
5700 //*************************************************************************************************
5701 
5702 
5703 
5704 
5705 //=================================================================================================
5706 //
5707 // NUMERIC FUNCTIONS
5708 //
5709 //=================================================================================================
5710 
5711 //*************************************************************************************************
5724 template< typename MT // Type of the sparse matrix
5725  , size_t... CRAs > // Compile time row arguments
5726 template< typename Other > // Data type of the scalar value
5727 inline Row<MT,false,false,true,CRAs...>&
5728  Row<MT,false,false,true,CRAs...>::scale( const Other& scalar )
5729 {
5731 
5732  for( Iterator element=begin(); element!=end(); ++element )
5733  element->value() *= scalar;
5734  return *this;
5735 }
5737 //*************************************************************************************************
5738 
5739 
5740 
5741 
5742 //=================================================================================================
5743 //
5744 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5745 //
5746 //=================================================================================================
5747 
5748 //*************************************************************************************************
5759 template< typename MT // Type of the sparse matrix
5760  , size_t... CRAs > // Compile time row arguments
5761 template< typename Other > // Data type of the foreign expression
5762 inline bool Row<MT,false,false,true,CRAs...>::canAlias( const Other* alias ) const noexcept
5763 {
5764  return matrix_.isAliased( alias );
5765 }
5767 //*************************************************************************************************
5768 
5769 
5770 //*************************************************************************************************
5781 template< typename MT // Type of the sparse matrix
5782  , size_t... CRAs > // Compile time row arguments
5783 template< typename Other > // Data type of the foreign expression
5784 inline bool Row<MT,false,false,true,CRAs...>::isAliased( const Other* alias ) const noexcept
5785 {
5786  return matrix_.isAliased( alias );
5787 }
5789 //*************************************************************************************************
5790 
5791 
5792 //*************************************************************************************************
5804 template< typename MT // Type of the sparse matrix
5805  , size_t... CRAs > // Compile time row arguments
5806 template< typename VT > // Type of the right-hand side dense vector
5807 inline void Row<MT,false,false,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5808 {
5809  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5810  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5811 
5812  for( size_t i=0UL; i<size(); ++i )
5813  {
5814  if( matrix_.nonZeros( row() ) == matrix_.capacity( row() ) )
5815  matrix_.reserve( row(), extendCapacity() );
5816 
5817  matrix_.append( i, row(), (~rhs)[i], true );
5818  }
5819 }
5821 //*************************************************************************************************
5822 
5823 
5824 //*************************************************************************************************
5836 template< typename MT // Type of the sparse matrix
5837  , size_t... CRAs > // Compile time row arguments
5838 template< typename VT > // Type of the right-hand side sparse vector
5839 inline void Row<MT,false,false,true,CRAs...>::assign( const SparseVector<VT,true>& rhs )
5840 {
5841  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5842  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5843 
5844  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5845  matrix_.append( element->index(), row(), element->value(), true );
5846  }
5847 }
5849 //*************************************************************************************************
5850 
5851 
5852 //*************************************************************************************************
5864 template< typename MT // Type of the sparse matrix
5865  , size_t... CRAs > // Compile time row arguments
5866 template< typename VT > // Type of the right-hand side dense vector
5867 inline void Row<MT,false,false,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5868 {
5869  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5870 
5874 
5875  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5876 
5877  const AddType tmp( serial( *this + (~rhs) ) );
5878  matrix_.reset( row() );
5879  assign( tmp );
5880 }
5882 //*************************************************************************************************
5883 
5884 
5885 //*************************************************************************************************
5897 template< typename MT // Type of the sparse matrix
5898  , size_t... CRAs > // Compile time row arguments
5899 template< typename VT > // Type of the right-hand side sparse vector
5900 inline void Row<MT,false,false,true,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
5901 {
5902  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5903 
5907 
5908  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5909 
5910  const AddType tmp( serial( *this + (~rhs) ) );
5911  matrix_.reset( row() );
5912  matrix_.reserve( row(), tmp.nonZeros() );
5913  assign( tmp );
5914 }
5916 //*************************************************************************************************
5917 
5918 
5919 //*************************************************************************************************
5931 template< typename MT // Type of the sparse matrix
5932  , size_t... CRAs > // Compile time row arguments
5933 template< typename VT > // Type of the right-hand side dense vector
5934 inline void Row<MT,false,false,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5935 {
5936  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5937 
5941 
5942  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5943 
5944  const SubType tmp( serial( *this - (~rhs) ) );
5945  matrix_.reset( row() );
5946  assign( tmp );
5947 }
5949 //*************************************************************************************************
5950 
5951 
5952 //*************************************************************************************************
5964 template< typename MT // Type of the sparse matrix
5965  , size_t... CRAs > // Compile time row arguments
5966 template< typename VT > // Type of the right-hand side sparse vector
5967 inline void Row<MT,false,false,true,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
5968 {
5969  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5970 
5974 
5975  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5976 
5977  const SubType tmp( serial( *this - (~rhs) ) );
5978  matrix_.reset( row() );
5979  matrix_.reserve( row(), tmp.nonZeros() );
5980  assign( tmp );
5981 }
5983 //*************************************************************************************************
5984 
5985 } // namespace blaze
5986 
5987 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
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,...
Definition: Assert.h:117
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
Header file for the SparseVector base class.
Header file for the View base class.
Header file for the row trait.
Header file for the serial shim.
#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
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Header file for the IsIntegral type trait.
#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....
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
Header file for the MAYBE_UNUSED function template.
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type,...
Definition: Symmetric.h:60
Header file for the reset shim.
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 IsUniLower type trait.
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
Constraint on the data type.
Constraint on the data type.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the implementation of the Row base template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#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
decltype(auto) operator *(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9091
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type,...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:558
#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,...
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 IsConst type trait.
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division 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:133
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type,...
Definition: Reference.h:79
typename RowTrait< MT, CRAs... >::Type RowTrait_t
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_t alias declaration provides a c...
Definition: RowTrait.h:170
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#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.
#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
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
#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
auto operator *=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:494
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the IsRestricted type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type,...
Definition: SparseMatrix.h:61
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Constraint on the data type.