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/mpl/If.h>
90 #include <blaze/util/TypeList.h>
91 #include <blaze/util/Types.h>
96 #include <blaze/util/Unused.h>
97 
98 
99 namespace blaze {
100 
101 //=================================================================================================
102 //
103 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR SPARSE MATRICES
104 //
105 //=================================================================================================
106 
107 //*************************************************************************************************
115 template< typename MT // Type of the sparse matrix
116  , bool SF // Symmetry flag
117  , size_t... CRAs > // Compile time row arguments
118 class Row<MT,true,false,SF,CRAs...>
119  : public View< SparseVector< Row<MT,true,false,SF,CRAs...>, true > >
120  , private RowData<CRAs...>
121 {
122  private:
123  //**Type definitions****************************************************************************
124  using DataType = RowData<CRAs...>;
125  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
126  //**********************************************************************************************
127 
128  public:
129  //**Type definitions****************************************************************************
131  using This = Row<MT,true,false,SF,CRAs...>;
132 
133  using BaseType = SparseVector<This,true>;
134  using ViewedType = MT;
135  using ResultType = RowTrait_t<MT,CRAs...>;
136  using TransposeType = TransposeType_t<ResultType>;
137  using ElementType = ElementType_t<MT>;
138  using ReturnType = ReturnType_t<MT>;
139  using CompositeType = const Row&;
140 
142  using ConstReference = ConstReference_t<MT>;
143 
145  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
146 
148  using ConstIterator = ConstIterator_t<MT>;
149 
151  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
152  //**********************************************************************************************
153 
154  //**Compilation flags***************************************************************************
156  static constexpr bool smpAssignable = false;
157  //**********************************************************************************************
158 
159  //**Constructors********************************************************************************
162  template< typename... RRAs >
163  explicit inline Row( MT& matrix, RRAs... args );
164 
165  Row( const Row& ) = default;
167  //**********************************************************************************************
168 
169  //**Destructor**********************************************************************************
172  ~Row() = default;
174  //**********************************************************************************************
175 
176  //**Data access functions***********************************************************************
179  inline Reference operator[]( size_t index );
180  inline ConstReference operator[]( size_t index ) const;
181  inline Reference at( size_t index );
182  inline ConstReference at( size_t index ) const;
183  inline Iterator begin ();
184  inline ConstIterator begin () const;
185  inline ConstIterator cbegin() const;
186  inline Iterator end ();
187  inline ConstIterator end () const;
188  inline ConstIterator cend () const;
190  //**********************************************************************************************
191 
192  //**Assignment operators************************************************************************
195  inline Row& operator=( initializer_list<ElementType> list );
196  inline Row& operator=( const Row& rhs );
197 
198  template< typename VT > inline Row& operator= ( const DenseVector<VT,true>& rhs );
199  template< typename VT > inline Row& operator= ( const SparseVector<VT,true>& rhs );
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 Vector<VT,true>& rhs );
205  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
206  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
208  //**********************************************************************************************
209 
210  //**Utility functions***************************************************************************
213  using DataType::row;
214 
215  inline MT& operand() noexcept;
216  inline const MT& operand() const noexcept;
217 
218  inline size_t size() const noexcept;
219  inline size_t capacity() const noexcept;
220  inline size_t nonZeros() const;
221  inline void reset();
222  inline void reserve( size_t n );
224  //**********************************************************************************************
225 
226  //**Insertion functions*************************************************************************
229  inline Iterator set ( size_t index, const ElementType& value );
230  inline Iterator insert( size_t index, const ElementType& value );
231  inline void append( size_t index, const ElementType& value, bool check=false );
233  //**********************************************************************************************
234 
235  //**Erase functions*****************************************************************************
238  inline void erase( size_t index );
239  inline Iterator erase( Iterator pos );
240  inline Iterator erase( Iterator first, Iterator last );
241 
242  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
243  inline void erase( Pred predicate );
244 
245  template< typename Pred >
246  inline void erase( Iterator first, Iterator last, Pred predicate );
248  //**********************************************************************************************
249 
250  //**Lookup functions****************************************************************************
253  inline Iterator find ( size_t index );
254  inline ConstIterator find ( size_t index ) const;
255  inline Iterator lowerBound( size_t index );
256  inline ConstIterator lowerBound( size_t index ) const;
257  inline Iterator upperBound( size_t index );
258  inline ConstIterator upperBound( size_t index ) const;
260  //**********************************************************************************************
261 
262  //**Numeric functions***************************************************************************
265  template< typename Other > inline Row& scale( const Other& scalar );
267  //**********************************************************************************************
268 
269  //**Expression template evaluation functions****************************************************
272  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
273  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
274 
275  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
276  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
277  template< typename VT > inline void addAssign( const DenseVector <VT,true>& rhs );
278  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
279  template< typename VT > inline void subAssign( const DenseVector <VT,true>& rhs );
280  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
282  //**********************************************************************************************
283 
284  private:
285  //**Utility functions***************************************************************************
288  inline size_t extendCapacity() const noexcept;
290  //**********************************************************************************************
291 
292  //**Member variables****************************************************************************
295  Operand matrix_;
296 
297  //**********************************************************************************************
298 
299  //**Compile time checks*************************************************************************
307  //**********************************************************************************************
308 };
310 //*************************************************************************************************
311 
312 
313 
314 
315 //=================================================================================================
316 //
317 // CONSTRUCTORS
318 //
319 //=================================================================================================
320 
321 //*************************************************************************************************
334 template< typename MT // Type of the sparse matrix
335  , bool SF // Symmetry flag
336  , size_t... CRAs > // Compile time row arguments
337 template< typename... RRAs > // Runtime row arguments
338 inline Row<MT,true,false,SF,CRAs...>::Row( MT& matrix, RRAs... args )
339  : DataType( args... ) // Base class initialization
340  , matrix_ ( matrix ) // The matrix containing the row
341 {
342  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
343  if( matrix_.rows() <= row() ) {
344  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
345  }
346  }
347  else {
348  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
349  }
350 }
352 //*************************************************************************************************
353 
354 
355 
356 
357 //=================================================================================================
358 //
359 // DATA ACCESS FUNCTIONS
360 //
361 //=================================================================================================
362 
363 //*************************************************************************************************
373 template< typename MT // Type of the sparse matrix
374  , bool SF // Symmetry flag
375  , size_t... CRAs > // Compile time row arguments
376 inline typename Row<MT,true,false,SF,CRAs...>::Reference
377  Row<MT,true,false,SF,CRAs...>::operator[]( size_t index )
378 {
379  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
380  return matrix_(row(),index);
381 }
383 //*************************************************************************************************
384 
385 
386 //*************************************************************************************************
396 template< typename MT // Type of the sparse matrix
397  , bool SF // Symmetry flag
398  , size_t... CRAs > // Compile time row arguments
399 inline typename Row<MT,true,false,SF,CRAs...>::ConstReference
400  Row<MT,true,false,SF,CRAs...>::operator[]( size_t index ) const
401 {
402  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
403  return const_cast<const MT&>( matrix_ )(row(),index);
404 }
406 //*************************************************************************************************
407 
408 
409 //*************************************************************************************************
420 template< typename MT // Type of the sparse matrix
421  , bool SF // Symmetry flag
422  , size_t... CRAs > // Compile time row arguments
423 inline typename Row<MT,true,false,SF,CRAs...>::Reference
424  Row<MT,true,false,SF,CRAs...>::at( size_t index )
425 {
426  if( index >= size() ) {
427  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
428  }
429  return (*this)[index];
430 }
432 //*************************************************************************************************
433 
434 
435 //*************************************************************************************************
446 template< typename MT // Type of the sparse matrix
447  , bool SF // Symmetry flag
448  , size_t... CRAs > // Compile time row arguments
449 inline typename Row<MT,true,false,SF,CRAs...>::ConstReference
450  Row<MT,true,false,SF,CRAs...>::at( size_t index ) const
451 {
452  if( index >= size() ) {
453  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
454  }
455  return (*this)[index];
456 }
458 //*************************************************************************************************
459 
460 
461 //*************************************************************************************************
469 template< typename MT // Type of the sparse matrix
470  , bool SF // Symmetry flag
471  , size_t... CRAs > // Compile time row arguments
472 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
474 {
475  return matrix_.begin( row() );
476 }
478 //*************************************************************************************************
479 
480 
481 //*************************************************************************************************
489 template< typename MT // Type of the sparse matrix
490  , bool SF // Symmetry flag
491  , size_t... CRAs > // Compile time row arguments
492 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
494 {
495  return matrix_.cbegin( row() );
496 }
498 //*************************************************************************************************
499 
500 
501 //*************************************************************************************************
509 template< typename MT // Type of the sparse matrix
510  , bool SF // Symmetry flag
511  , size_t... CRAs > // Compile time row arguments
512 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
514 {
515  return matrix_.cbegin( row() );
516 }
518 //*************************************************************************************************
519 
520 
521 //*************************************************************************************************
529 template< typename MT // Type of the sparse matrix
530  , bool SF // Symmetry flag
531  , size_t... CRAs > // Compile time row arguments
532 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
534 {
535  return matrix_.end( row() );
536 }
538 //*************************************************************************************************
539 
540 
541 //*************************************************************************************************
549 template< typename MT // Type of the sparse matrix
550  , bool SF // Symmetry flag
551  , size_t... CRAs > // Compile time row arguments
552 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
554 {
555  return matrix_.cend( row() );
556 }
558 //*************************************************************************************************
559 
560 
561 //*************************************************************************************************
569 template< typename MT // Type of the sparse matrix
570  , bool SF // Symmetry flag
571  , size_t... CRAs > // Compile time row arguments
572 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
574 {
575  return matrix_.cend( row() );
576 }
578 //*************************************************************************************************
579 
580 
581 
582 
583 //=================================================================================================
584 //
585 // ASSIGNMENT OPERATORS
586 //
587 //=================================================================================================
588 
589 //*************************************************************************************************
604 template< typename MT // Type of the sparse matrix
605  , bool SF // Symmetry flag
606  , size_t... CRAs > // Compile time row arguments
607 inline Row<MT,true,false,SF,CRAs...>&
608  Row<MT,true,false,SF,CRAs...>::operator=( initializer_list<ElementType> list )
609 {
610  using blaze::assign;
611 
612  if( list.size() > size() ) {
613  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
614  }
615 
616  const InitializerVector<ElementType,true> tmp( list, size() );
617 
618  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
619  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
620  }
621 
622  decltype(auto) left( derestrict( *this ) );
623 
624  left.reset();
625  assign( left, tmp );
626 
627  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
628 
629  return *this;
630 }
632 //*************************************************************************************************
633 
634 
635 //*************************************************************************************************
649 template< typename MT // Type of the sparse matrix
650  , bool SF // Symmetry flag
651  , size_t... CRAs > // Compile time row arguments
652 inline Row<MT,true,false,SF,CRAs...>&
653  Row<MT,true,false,SF,CRAs...>::operator=( const Row& rhs )
654 {
655  using blaze::assign;
656 
660 
661  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
662  return *this;
663 
664  if( size() != rhs.size() ) {
665  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
666  }
667 
668  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
669  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
670  }
671 
672  decltype(auto) left( derestrict( *this ) );
673 
674  if( rhs.canAlias( &matrix_ ) ) {
675  const ResultType tmp( rhs );
676  left.reset();
677  left.reserve( tmp.nonZeros() );
678  assign( left, tmp );
679  }
680  else {
681  left.reset();
682  left.reserve( rhs.nonZeros() );
683  assign( left, rhs );
684  }
685 
686  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
687 
688  return *this;
689 }
691 //*************************************************************************************************
692 
693 
694 //*************************************************************************************************
708 template< typename MT // Type of the sparse matrix
709  , bool SF // Symmetry flag
710  , size_t... CRAs > // Compile time row arguments
711 template< typename VT > // Type of the right-hand side dense vector
712 inline Row<MT,true,false,SF,CRAs...>&
713  Row<MT,true,false,SF,CRAs...>::operator=( const DenseVector<VT,true>& rhs )
714 {
715  using blaze::assign;
716 
717  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
718  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
720 
721  if( size() != (~rhs).size() ) {
722  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
723  }
724 
725  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
726  Right right( ~rhs );
727 
728  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
729  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
730  }
731 
732  decltype(auto) left( derestrict( *this ) );
733 
734  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
735  const ResultType_t<VT> tmp( right );
736  left.reset();
737  assign( left, tmp );
738  }
739  else {
740  left.reset();
741  assign( left, right );
742  }
743 
744  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
745 
746  return *this;
747 }
749 //*************************************************************************************************
750 
751 
752 //*************************************************************************************************
766 template< typename MT // Type of the sparse matrix
767  , bool SF // Symmetry flag
768  , size_t... CRAs > // Compile time row arguments
769 template< typename VT > // Type of the right-hand side sparse vector
770 inline Row<MT,true,false,SF,CRAs...>&
771  Row<MT,true,false,SF,CRAs...>::operator=( const SparseVector<VT,true>& rhs )
772 {
773  using blaze::assign;
774 
775  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
776  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
778 
779  if( size() != (~rhs).size() ) {
780  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
781  }
782 
783  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
784  Right right( ~rhs );
785 
786  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
787  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
788  }
789 
790  decltype(auto) left( derestrict( *this ) );
791 
792  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
793  const ResultType_t<VT> tmp( right );
794  left.reset();
795  left.reserve( tmp.nonZeros() );
796  assign( left, tmp );
797  }
798  else {
799  left.reset();
800  left.reserve( right.nonZeros() );
801  assign( left, right );
802  }
803 
804  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
805 
806  return *this;
807 }
809 //*************************************************************************************************
810 
811 
812 //*************************************************************************************************
826 template< typename MT // Type of the sparse matrix
827  , bool SF // Symmetry flag
828  , size_t... CRAs > // Compile time row arguments
829 template< typename VT > // Type of the right-hand side dense vector
830 inline Row<MT,true,false,SF,CRAs...>&
831  Row<MT,true,false,SF,CRAs...>::operator+=( const DenseVector<VT,true>& rhs )
832 {
833  using blaze::assign;
834 
838  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
839  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
841 
842  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
843 
847 
848  if( size() != (~rhs).size() ) {
849  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
850  }
851 
852  const AddType tmp( *this + (~rhs) );
853 
854  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
855  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
856  }
857 
858  decltype(auto) left( derestrict( *this ) );
859 
860  left.reset();
861  assign( left, tmp );
862 
863  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
864 
865  return *this;
866 }
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
885 template< typename MT // Type of the sparse matrix
886  , bool SF // Symmetry flag
887  , size_t... CRAs > // Compile time row arguments
888 template< typename VT > // Type of the right-hand side sparse vector
889 inline Row<MT,true,false,SF,CRAs...>&
890  Row<MT,true,false,SF,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
891 {
892  using blaze::assign;
893 
897  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
898  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
900 
901  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
902 
906 
907  if( size() != (~rhs).size() ) {
908  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
909  }
910 
911  const AddType tmp( *this + (~rhs) );
912 
913  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
914  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
915  }
916 
917  decltype(auto) left( derestrict( *this ) );
918 
919  left.reset();
920  left.reserve( tmp.nonZeros() );
921  assign( left, tmp );
922 
923  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
924 
925  return *this;
926 }
928 //*************************************************************************************************
929 
930 
931 //*************************************************************************************************
946 template< typename MT // Type of the sparse matrix
947  , bool SF // Symmetry flag
948  , size_t... CRAs > // Compile time row arguments
949 template< typename VT > // Type of the right-hand side dense vector
950 inline Row<MT,true,false,SF,CRAs...>&
951  Row<MT,true,false,SF,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
952 {
953  using blaze::assign;
954 
958  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
959  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
961 
962  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
963 
967 
968  if( size() != (~rhs).size() ) {
969  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
970  }
971 
972  const SubType tmp( *this - (~rhs) );
973 
974  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
975  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
976  }
977 
978  decltype(auto) left( derestrict( *this ) );
979 
980  left.reset();
981  assign( left, tmp );
982 
983  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
984 
985  return *this;
986 }
988 //*************************************************************************************************
989 
990 
991 //*************************************************************************************************
1006 template< typename MT // Type of the sparse matrix
1007  , bool SF // Symmetry flag
1008  , size_t... CRAs > // Compile time row arguments
1009 template< typename VT > // Type of the right-hand side sparse vector
1010 inline Row<MT,true,false,SF,CRAs...>&
1011  Row<MT,true,false,SF,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
1012 {
1013  using blaze::assign;
1014 
1018  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
1019  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1021 
1022  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1023 
1027 
1028  if( size() != (~rhs).size() ) {
1029  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1030  }
1031 
1032  const SubType tmp( *this - (~rhs) );
1033 
1034  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1035  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1036  }
1037 
1038  decltype(auto) left( derestrict( *this ) );
1039 
1040  left.reset();
1041  left.reserve( tmp.nonZeros() );
1042  assign( left, tmp );
1043 
1044  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1045 
1046  return *this;
1047 }
1049 //*************************************************************************************************
1050 
1051 
1052 //*************************************************************************************************
1065 template< typename MT // Type of the sparse matrix
1066  , bool SF // Symmetry flag
1067  , size_t... CRAs > // Compile time row arguments
1068 template< typename VT > // Type of the right-hand side vector
1069 inline Row<MT,true,false,SF,CRAs...>&
1070  Row<MT,true,false,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1071 {
1072  using blaze::assign;
1073 
1077  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1079 
1080  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1081 
1084 
1085  if( size() != (~rhs).size() ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1087  }
1088 
1089  const MultType tmp( *this * (~rhs) );
1090 
1091  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1092  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1093  }
1094 
1095  decltype(auto) left( derestrict( *this ) );
1096 
1097  left.reset();
1098  assign( left, tmp );
1099 
1100  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1101 
1102  return *this;
1103 }
1105 //*************************************************************************************************
1106 
1107 
1108 //*************************************************************************************************
1120 template< typename MT // Type of the sparse matrix
1121  , bool SF // Symmetry flag
1122  , size_t... CRAs > // Compile time row arguments
1123 template< typename VT > // Type of the right-hand side vector
1124 inline Row<MT,true,false,SF,CRAs...>&
1125  Row<MT,true,false,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1126 {
1127  using blaze::assign;
1128 
1132  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
1133  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1135 
1136  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1137 
1141 
1142  if( size() != (~rhs).size() ) {
1143  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1144  }
1145 
1146  const DivType tmp( *this / (~rhs) );
1147 
1148  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1149  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1150  }
1151 
1152  decltype(auto) left( derestrict( *this ) );
1153 
1154  left.reset();
1155  assign( left, tmp );
1156 
1157  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1158 
1159  return *this;
1160 }
1162 //*************************************************************************************************
1163 
1164 
1165 //*************************************************************************************************
1178 template< typename MT // Type of the sparse matrix
1179  , bool SF // Symmetry flag
1180  , size_t... CRAs > // Compile time row arguments
1181 template< typename VT > // Type of the right-hand side vector
1182 inline Row<MT,true,false,SF,CRAs...>&
1183  Row<MT,true,false,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1184 {
1185  using blaze::assign;
1186 
1187  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
1189 
1190  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1191 
1195 
1196  if( size() != 3UL || (~rhs).size() != 3UL ) {
1197  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1198  }
1199 
1200  const CrossType tmp( *this % (~rhs) );
1201 
1202  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1203  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1204  }
1205 
1206  decltype(auto) left( derestrict( *this ) );
1207 
1208  left.reset();
1209  assign( left, tmp );
1210 
1211  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1212 
1213  return *this;
1214 }
1216 //*************************************************************************************************
1217 
1218 
1219 
1220 
1221 //=================================================================================================
1222 //
1223 // UTILITY FUNCTIONS
1224 //
1225 //=================================================================================================
1226 
1227 //*************************************************************************************************
1233 template< typename MT // Type of the sparse matrix
1234  , bool SF // Symmetry flag
1235  , size_t... CRAs > // Compile time row arguments
1236 inline MT& Row<MT,true,false,SF,CRAs...>::operand() noexcept
1237 {
1238  return matrix_;
1239 }
1241 //*************************************************************************************************
1242 
1243 
1244 //*************************************************************************************************
1250 template< typename MT // Type of the sparse matrix
1251  , bool SF // Symmetry flag
1252  , size_t... CRAs > // Compile time row arguments
1253 inline const MT& Row<MT,true,false,SF,CRAs...>::operand() const noexcept
1254 {
1255  return matrix_;
1256 }
1258 //*************************************************************************************************
1259 
1260 
1261 //*************************************************************************************************
1267 template< typename MT // Type of the sparse matrix
1268  , bool SF // Symmetry flag
1269  , size_t... CRAs > // Compile time row arguments
1270 inline size_t Row<MT,true,false,SF,CRAs...>::size() const noexcept
1271 {
1272  return matrix_.columns();
1273 }
1275 //*************************************************************************************************
1276 
1277 
1278 //*************************************************************************************************
1284 template< typename MT // Type of the sparse matrix
1285  , bool SF // Symmetry flag
1286  , size_t... CRAs > // Compile time row arguments
1287 inline size_t Row<MT,true,false,SF,CRAs...>::capacity() const noexcept
1288 {
1289  return matrix_.capacity( row() );
1290 }
1292 //*************************************************************************************************
1293 
1294 
1295 //*************************************************************************************************
1304 template< typename MT // Type of the sparse matrix
1305  , bool SF // Symmetry flag
1306  , size_t... CRAs > // Compile time row arguments
1307 inline size_t Row<MT,true,false,SF,CRAs...>::nonZeros() const
1308 {
1309  return matrix_.nonZeros( row() );
1310 }
1312 //*************************************************************************************************
1313 
1314 
1315 //*************************************************************************************************
1321 template< typename MT // Type of the sparse matrix
1322  , bool SF // Symmetry flag
1323  , size_t... CRAs > // Compile time row arguments
1325 {
1326  matrix_.reset( row() );
1327 }
1329 //*************************************************************************************************
1330 
1331 
1332 //*************************************************************************************************
1342 template< typename MT // Type of the sparse matrix
1343  , bool SF // Symmetry flag
1344  , size_t... CRAs > // Compile time row arguments
1345 void Row<MT,true,false,SF,CRAs...>::reserve( size_t n )
1346 {
1347  matrix_.reserve( row(), n );
1348 }
1350 //*************************************************************************************************
1351 
1352 
1353 //*************************************************************************************************
1362 template< typename MT // Type of the sparse matrix
1363  , bool SF // Symmetry flag
1364  , size_t... CRAs > // Compile time row arguments
1365 inline size_t Row<MT,true,false,SF,CRAs...>::extendCapacity() const noexcept
1366 {
1367  using blaze::max;
1368  using blaze::min;
1369 
1370  size_t nonzeros( 2UL*capacity()+1UL );
1371  nonzeros = max( nonzeros, 7UL );
1372  nonzeros = min( nonzeros, size() );
1373 
1374  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
1375 
1376  return nonzeros;
1377 }
1379 //*************************************************************************************************
1380 
1381 
1382 
1383 
1384 //=================================================================================================
1385 //
1386 // INSERTION FUNCTIONS
1387 //
1388 //=================================================================================================
1389 
1390 //*************************************************************************************************
1402 template< typename MT // Type of the sparse matrix
1403  , bool SF // Symmetry flag
1404  , size_t... CRAs > // Compile time row arguments
1405 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1406  Row<MT,true,false,SF,CRAs...>::set( size_t index, const ElementType& value )
1407 {
1408  return matrix_.set( row(), index, value );
1409 }
1411 //*************************************************************************************************
1412 
1413 
1414 //*************************************************************************************************
1427 template< typename MT // Type of the sparse matrix
1428  , bool SF // Symmetry flag
1429  , size_t... CRAs > // Compile time row arguments
1430 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1431  Row<MT,true,false,SF,CRAs...>::insert( size_t index, const ElementType& value )
1432 {
1433  return matrix_.insert( row(), index, value );
1434 }
1436 //*************************************************************************************************
1437 
1438 
1439 //*************************************************************************************************
1464 template< typename MT // Type of the sparse matrix
1465  , bool SF // Symmetry flag
1466  , size_t... CRAs > // Compile time row arguments
1467 inline void Row<MT,true,false,SF,CRAs...>::append( size_t index, const ElementType& value, bool check )
1468 {
1469  matrix_.append( row(), index, value, check );
1470 }
1472 //*************************************************************************************************
1473 
1474 
1475 
1476 
1477 //=================================================================================================
1478 //
1479 // ERASE FUNCTIONS
1480 //
1481 //=================================================================================================
1482 
1483 //*************************************************************************************************
1492 template< typename MT // Type of the sparse matrix
1493  , bool SF // Symmetry flag
1494  , size_t... CRAs > // Compile time row arguments
1495 inline void Row<MT,true,false,SF,CRAs...>::erase( size_t index )
1496 {
1497  matrix_.erase( row(), index );
1498 }
1500 //*************************************************************************************************
1501 
1502 
1503 //*************************************************************************************************
1512 template< typename MT // Type of the sparse matrix
1513  , bool SF // Symmetry flag
1514  , size_t... CRAs > // Compile time row arguments
1515 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1516  Row<MT,true,false,SF,CRAs...>::erase( Iterator pos )
1517 {
1518  return matrix_.erase( row(), pos );
1519 }
1521 //*************************************************************************************************
1522 
1523 
1524 //*************************************************************************************************
1534 template< typename MT // Type of the sparse matrix
1535  , bool SF // Symmetry flag
1536  , size_t... CRAs > // Compile time row arguments
1537 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1538  Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last )
1539 {
1540  return matrix_.erase( row(), first, last );
1541 }
1543 //*************************************************************************************************
1544 
1545 
1546 //*************************************************************************************************
1569 template< typename MT // Type of the sparse matrix
1570  , bool SF // Symmetry flag
1571  , size_t... CRAs > // Compile time row arguments
1572 template< typename Pred // Type of the unary predicate
1573  , typename > // Type restriction on the unary predicate
1574 inline void Row<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1575 {
1576  matrix_.erase( row(), begin(), end(), predicate );
1577 }
1579 //*************************************************************************************************
1580 
1581 
1582 //*************************************************************************************************
1607 template< typename MT // Type of the sparse matrix
1608  , bool SF // Symmetry flag
1609  , size_t... CRAs > // Compile time row arguments
1610 template< typename Pred > // Type of the unary predicate
1611 inline void Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
1612 {
1613  matrix_.erase( row(), first, last, predicate );
1614 }
1616 //*************************************************************************************************
1617 
1618 
1619 
1620 
1621 //=================================================================================================
1622 //
1623 // LOOKUP FUNCTIONS
1624 //
1625 //=================================================================================================
1626 
1627 //*************************************************************************************************
1641 template< typename MT // Type of the sparse matrix
1642  , bool SF // Symmetry flag
1643  , size_t... CRAs > // Compile time row arguments
1644 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1645  Row<MT,true,false,SF,CRAs...>::find( size_t index )
1646 {
1647  return matrix_.find( row(), index );
1648 }
1650 //*************************************************************************************************
1651 
1652 
1653 //*************************************************************************************************
1667 template< typename MT // Type of the sparse matrix
1668  , bool SF // Symmetry flag
1669  , size_t... CRAs > // Compile time row arguments
1670 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1671  Row<MT,true,false,SF,CRAs...>::find( size_t index ) const
1672 {
1673  return matrix_.find( row(), index );
1674 }
1676 //*************************************************************************************************
1677 
1678 
1679 //*************************************************************************************************
1692 template< typename MT // Type of the sparse matrix
1693  , bool SF // Symmetry flag
1694  , size_t... CRAs > // Compile time row arguments
1695 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1696  Row<MT,true,false,SF,CRAs...>::lowerBound( size_t index )
1697 {
1698  return matrix_.lowerBound( row(), index );
1699 }
1701 //*************************************************************************************************
1702 
1703 
1704 //*************************************************************************************************
1717 template< typename MT // Type of the sparse matrix
1718  , bool SF // Symmetry flag
1719  , size_t... CRAs > // Compile time row arguments
1720 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1721  Row<MT,true,false,SF,CRAs...>::lowerBound( size_t index ) const
1722 {
1723  return matrix_.lowerBound( row(), index );
1724 }
1726 //*************************************************************************************************
1727 
1728 
1729 //*************************************************************************************************
1742 template< typename MT // Type of the sparse matrix
1743  , bool SF // Symmetry flag
1744  , size_t... CRAs > // Compile time row arguments
1745 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1746  Row<MT,true,false,SF,CRAs...>::upperBound( size_t index )
1747 {
1748  return matrix_.upperBound( row(), index );
1749 }
1751 //*************************************************************************************************
1752 
1753 
1754 //*************************************************************************************************
1767 template< typename MT // Type of the sparse matrix
1768  , bool SF // Symmetry flag
1769  , size_t... CRAs > // Compile time row arguments
1770 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1771  Row<MT,true,false,SF,CRAs...>::upperBound( size_t index ) const
1772 {
1773  return matrix_.upperBound( row(), index );
1774 }
1776 //*************************************************************************************************
1777 
1778 
1779 
1780 
1781 //=================================================================================================
1782 //
1783 // NUMERIC FUNCTIONS
1784 //
1785 //=================================================================================================
1786 
1787 //*************************************************************************************************
1800 template< typename MT // Type of the sparse matrix
1801  , bool SF // Symmetry flag
1802  , size_t... CRAs > // Compile time row arguments
1803 template< typename Other > // Data type of the scalar value
1804 inline Row<MT,true,false,SF,CRAs...>&
1805  Row<MT,true,false,SF,CRAs...>::scale( const Other& scalar )
1806 {
1808 
1809  for( Iterator element=begin(); element!=end(); ++element )
1810  element->value() *= scalar;
1811  return *this;
1812 }
1814 //*************************************************************************************************
1815 
1816 
1817 
1818 
1819 //=================================================================================================
1820 //
1821 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1822 //
1823 //=================================================================================================
1824 
1825 //*************************************************************************************************
1836 template< typename MT // Type of the sparse matrix
1837  , bool SF // Symmetry flag
1838  , size_t... CRAs > // Compile time row arguments
1839 template< typename Other > // Data type of the foreign expression
1840 inline bool Row<MT,true,false,SF,CRAs...>::canAlias( const Other* alias ) const noexcept
1841 {
1842  return matrix_.isAliased( alias );
1843 }
1845 //*************************************************************************************************
1846 
1847 
1848 //*************************************************************************************************
1859 template< typename MT // Type of the sparse matrix
1860  , bool SF // Symmetry flag
1861  , size_t... CRAs > // Compile time row arguments
1862 template< typename Other > // Data type of the foreign expression
1863 inline bool Row<MT,true,false,SF,CRAs...>::isAliased( const Other* alias ) const noexcept
1864 {
1865  return matrix_.isAliased( alias );
1866 }
1868 //*************************************************************************************************
1869 
1870 
1871 //*************************************************************************************************
1883 template< typename MT // Type of the sparse matrix
1884  , bool SF // Symmetry flag
1885  , size_t... CRAs > // Compile time row arguments
1886 template< typename VT > // Type of the right-hand side dense vector
1887 inline void Row<MT,true,false,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1888 {
1889  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1890  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1891 
1892  for( size_t j=0UL; j<size(); ++j )
1893  {
1894  if( matrix_.nonZeros( row() ) == matrix_.capacity( row() ) )
1895  matrix_.reserve( row(), extendCapacity() );
1896 
1897  matrix_.append( row(), j, (~rhs)[j], true );
1898  }
1899 }
1901 //*************************************************************************************************
1902 
1903 
1904 //*************************************************************************************************
1916 template< typename MT // Type of the sparse matrix
1917  , bool SF // Symmetry flag
1918  , size_t... CRAs > // Compile time row arguments
1919 template< typename VT > // Type of the right-hand side sparse vector
1920 inline void Row<MT,true,false,SF,CRAs...>::assign( const SparseVector<VT,true>& rhs )
1921 {
1922  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1923  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1924 
1925  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1926  matrix_.append( row(), element->index(), element->value(), true );
1927  }
1928 }
1930 //*************************************************************************************************
1931 
1932 
1933 //*************************************************************************************************
1945 template< typename MT // Type of the sparse matrix
1946  , bool SF // Symmetry flag
1947  , size_t... CRAs > // Compile time row arguments
1948 template< typename VT > // Type of the right-hand side dense vector
1949 inline void Row<MT,true,false,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1950 {
1951  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1952 
1956 
1957  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1958 
1959  const AddType tmp( serial( *this + (~rhs) ) );
1960  matrix_.reset( row() );
1961  assign( tmp );
1962 }
1964 //*************************************************************************************************
1965 
1966 
1967 //*************************************************************************************************
1979 template< typename MT // Type of the sparse matrix
1980  , bool SF // Symmetry flag
1981  , size_t... CRAs > // Compile time row arguments
1982 template< typename VT > // Type of the right-hand side sparse vector
1983 inline void Row<MT,true,false,SF,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
1984 {
1985  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1986 
1990 
1991  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1992 
1993  const AddType tmp( serial( *this + (~rhs) ) );
1994  matrix_.reset( row() );
1995  matrix_.reserve( row(), tmp.nonZeros() );
1996  assign( tmp );
1997 }
1999 //*************************************************************************************************
2000 
2001 
2002 //*************************************************************************************************
2014 template< typename MT // Type of the sparse matrix
2015  , bool SF // Symmetry flag
2016  , size_t... CRAs > // Compile time row arguments
2017 template< typename VT > // Type of the right-hand side dense vector
2018 inline void Row<MT,true,false,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
2019 {
2020  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2021 
2025 
2026  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2027 
2028  const SubType tmp( serial( *this - (~rhs) ) );
2029  matrix_.reset( row() );
2030  assign( tmp );
2031 }
2033 //*************************************************************************************************
2034 
2035 
2036 //*************************************************************************************************
2048 template< typename MT // Type of the sparse matrix
2049  , bool SF // Symmetry flag
2050  , size_t... CRAs > // Compile time row arguments
2051 template< typename VT > // Type of the right-hand side sparse vector
2052 inline void Row<MT,true,false,SF,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
2053 {
2054  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2055 
2059 
2060  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2061 
2062  const SubType tmp( serial( *this - (~rhs) ) );
2063  matrix_.reset( row() );
2064  matrix_.reserve( row(), tmp.nonZeros() );
2065  assign( tmp );
2066 }
2068 //*************************************************************************************************
2069 
2070 
2071 
2072 
2073 
2074 
2075 
2076 
2077 //=================================================================================================
2078 //
2079 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR SPARSE MATRICES
2080 //
2081 //=================================================================================================
2082 
2083 //*************************************************************************************************
2091 template< typename MT // Type of the sparse matrix
2092  , size_t... CRAs > // Compile time row arguments
2093 class Row<MT,false,false,false,CRAs...>
2094  : public View< SparseVector< Row<MT,false,false,false,CRAs...>, true > >
2095  , private RowData<CRAs...>
2096 {
2097  private:
2098  //**Type definitions****************************************************************************
2099  using DataType = RowData<CRAs...>;
2100  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2101  //**********************************************************************************************
2102 
2103  public:
2104  //**Type definitions****************************************************************************
2106  using This = Row<MT,false,false,false,CRAs...>;
2107 
2108  using BaseType = SparseVector<This,true>;
2109  using ViewedType = MT;
2110  using ResultType = RowTrait_t<MT,CRAs...>;
2111  using TransposeType = TransposeType_t<ResultType>;
2112  using ElementType = ElementType_t<MT>;
2113  using ReturnType = ReturnType_t<MT>;
2114  using CompositeType = const Row&;
2115 
2117  using ConstReference = ConstReference_t<MT>;
2118 
2120  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2121  //**********************************************************************************************
2122 
2123  //**RowElement class definition*****************************************************************
2126  template< typename MatrixType // Type of the sparse matrix
2127  , typename IteratorType > // Type of the sparse matrix iterator
2128  class RowElement
2129  : private SparseElement
2130  {
2131  public:
2132  //**Constructor******************************************************************************
2138  inline RowElement( IteratorType pos, size_t column )
2139  : pos_ ( pos ) // Iterator to the current position within the sparse row
2140  , column_( column ) // Index of the according column
2141  {}
2142  //*******************************************************************************************
2143 
2144  //**Assignment operator**********************************************************************
2150  template< typename T > inline RowElement& operator=( const T& v ) {
2151  *pos_ = v;
2152  return *this;
2153  }
2154  //*******************************************************************************************
2155 
2156  //**Addition assignment operator*************************************************************
2162  template< typename T > inline RowElement& operator+=( const T& v ) {
2163  *pos_ += v;
2164  return *this;
2165  }
2166  //*******************************************************************************************
2167 
2168  //**Subtraction assignment operator**********************************************************
2174  template< typename T > inline RowElement& operator-=( const T& v ) {
2175  *pos_ -= v;
2176  return *this;
2177  }
2178  //*******************************************************************************************
2179 
2180  //**Multiplication assignment operator*******************************************************
2186  template< typename T > inline RowElement& operator*=( const T& v ) {
2187  *pos_ *= v;
2188  return *this;
2189  }
2190  //*******************************************************************************************
2191 
2192  //**Division assignment operator*************************************************************
2198  template< typename T > inline RowElement& operator/=( const T& v ) {
2199  *pos_ /= v;
2200  return *this;
2201  }
2202  //*******************************************************************************************
2203 
2204  //**Element access operator******************************************************************
2209  inline const RowElement* operator->() const {
2210  return this;
2211  }
2212  //*******************************************************************************************
2213 
2214  //**Value function***************************************************************************
2219  inline decltype(auto) value() const {
2220  return pos_->value();
2221  }
2222  //*******************************************************************************************
2223 
2224  //**Index function***************************************************************************
2229  inline size_t index() const {
2230  return column_;
2231  }
2232  //*******************************************************************************************
2233 
2234  private:
2235  //**Member variables*************************************************************************
2236  IteratorType pos_;
2237  size_t column_;
2238  //*******************************************************************************************
2239  };
2240  //**********************************************************************************************
2241 
2242  //**RowIterator class definition****************************************************************
2245  template< typename MatrixType // Type of the sparse matrix
2246  , typename IteratorType > // Type of the sparse matrix iterator
2247  class RowIterator
2248  {
2249  public:
2250  //**Type definitions*************************************************************************
2251  using IteratorCategory = std::forward_iterator_tag;
2252  using ValueType = RowElement<MatrixType,IteratorType>;
2253  using PointerType = ValueType;
2254  using ReferenceType = ValueType;
2255  using DifferenceType = ptrdiff_t;
2256 
2257  // STL iterator requirements
2258  using iterator_category = IteratorCategory;
2259  using value_type = ValueType;
2260  using pointer = PointerType;
2261  using reference = ReferenceType;
2262  using difference_type = DifferenceType;
2263  //*******************************************************************************************
2264 
2265  //**Constructor******************************************************************************
2268  inline RowIterator()
2269  : matrix_( nullptr ) // The sparse matrix containing the row
2270  , row_ ( 0UL ) // The current row index
2271  , column_( 0UL ) // The current column index
2272  , pos_ () // Iterator to the current sparse element
2273  {}
2274  //*******************************************************************************************
2275 
2276  //**Constructor******************************************************************************
2283  inline RowIterator( MatrixType& matrix, size_t row, size_t column )
2284  : matrix_( &matrix ) // The sparse matrix containing the row
2285  , row_ ( row ) // The current row index
2286  , column_( column ) // The current column index
2287  , pos_ () // Iterator to the current sparse element
2288  {
2289  for( ; column_<matrix_->columns(); ++column_ ) {
2290  pos_ = matrix_->find( row_, column_ );
2291  if( pos_ != matrix_->end( column_ ) ) break;
2292  }
2293  }
2294  //*******************************************************************************************
2295 
2296  //**Constructor******************************************************************************
2304  inline RowIterator( MatrixType& matrix, size_t row, size_t column, IteratorType pos )
2305  : matrix_( &matrix ) // The sparse matrix containing the row
2306  , row_ ( row ) // The current row index
2307  , column_( column ) // The current column index
2308  , pos_ ( pos ) // Iterator to the current sparse element
2309  {
2310  BLAZE_INTERNAL_ASSERT( matrix.find( row, column ) == pos, "Invalid initial iterator position" );
2311  }
2312  //*******************************************************************************************
2313 
2314  //**Constructor******************************************************************************
2319  template< typename MatrixType2, typename IteratorType2 >
2320  inline RowIterator( const RowIterator<MatrixType2,IteratorType2>& it )
2321  : matrix_( it.matrix_ ) // The sparse matrix containing the row
2322  , row_ ( it.row_ ) // The current row index
2323  , column_( it.column_ ) // The current column index
2324  , pos_ ( it.pos_ ) // Iterator to the current sparse element
2325  {}
2326  //*******************************************************************************************
2327 
2328  //**Prefix increment operator****************************************************************
2333  inline RowIterator& operator++() {
2334  ++column_;
2335  for( ; column_<matrix_->columns(); ++column_ ) {
2336  pos_ = matrix_->find( row_, column_ );
2337  if( pos_ != matrix_->end( column_ ) ) break;
2338  }
2339 
2340  return *this;
2341  }
2342  //*******************************************************************************************
2343 
2344  //**Postfix increment operator***************************************************************
2349  inline const RowIterator operator++( int ) {
2350  const RowIterator tmp( *this );
2351  ++(*this);
2352  return tmp;
2353  }
2354  //*******************************************************************************************
2355 
2356  //**Element access operator******************************************************************
2361  inline ReferenceType operator*() const {
2362  return ReferenceType( pos_, column_ );
2363  }
2364  //*******************************************************************************************
2365 
2366  //**Element access operator******************************************************************
2371  inline PointerType operator->() const {
2372  return PointerType( pos_, column_ );
2373  }
2374  //*******************************************************************************************
2375 
2376  //**Equality operator************************************************************************
2382  template< typename MatrixType2, typename IteratorType2 >
2383  inline bool operator==( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2384  return column_ == rhs.column_;
2385  }
2386  //*******************************************************************************************
2387 
2388  //**Inequality operator**********************************************************************
2394  template< typename MatrixType2, typename IteratorType2 >
2395  inline bool operator!=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2396  return !( *this == rhs );
2397  }
2398  //*******************************************************************************************
2399 
2400  //**Subtraction operator*********************************************************************
2406  inline DifferenceType operator-( const RowIterator& rhs ) const {
2407  size_t counter( 0UL );
2408  for( size_t j=rhs.column_; j<column_; ++j ) {
2409  if( matrix_->find( row_, j ) != matrix_->end( j ) )
2410  ++counter;
2411  }
2412  return counter;
2413  }
2414  //*******************************************************************************************
2415 
2416  private:
2417  //**Member variables*************************************************************************
2418  MatrixType* matrix_;
2419  size_t row_;
2420  size_t column_;
2421  IteratorType pos_;
2422  //*******************************************************************************************
2423 
2424  //**Friend declarations**********************************************************************
2425  template< typename MatrixType2, typename IteratorType2 > friend class RowIterator;
2426  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
2427  //*******************************************************************************************
2428  };
2429  //**********************************************************************************************
2430 
2431  //**Type definitions****************************************************************************
2433  using ConstIterator = RowIterator< const MT, ConstIterator_t<MT> >;
2434 
2436  using Iterator = If_t< IsConst_v<MT>, ConstIterator, RowIterator< MT, Iterator_t<MT> > >;
2437  //**********************************************************************************************
2438 
2439  //**Compilation flags***************************************************************************
2441  static constexpr bool smpAssignable = false;
2442  //**********************************************************************************************
2443 
2444  //**Constructors********************************************************************************
2447  template< typename... RRAs >
2448  explicit inline Row( MT& matrix, RRAs... args );
2449 
2450  Row( const Row& ) = default;
2452  //**********************************************************************************************
2453 
2454  //**Destructor**********************************************************************************
2457  ~Row() = default;
2459  //**********************************************************************************************
2460 
2461  //**Data access functions***********************************************************************
2464  inline Reference operator[]( size_t index );
2465  inline ConstReference operator[]( size_t index ) const;
2466  inline Reference at( size_t index );
2467  inline ConstReference at( size_t index ) const;
2468  inline Iterator begin ();
2469  inline ConstIterator begin () const;
2470  inline ConstIterator cbegin() const;
2471  inline Iterator end ();
2472  inline ConstIterator end () const;
2473  inline ConstIterator cend () const;
2475  //**********************************************************************************************
2476 
2477  //**Assignment operators************************************************************************
2480  inline Row& operator=( initializer_list<ElementType> list );
2481  inline Row& operator=( const Row& rhs );
2482 
2483  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2484  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2485  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2486  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
2487  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2488  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
2490  //**********************************************************************************************
2491 
2492  //**Utility functions***************************************************************************
2495  using DataType::row;
2496 
2497  inline MT& operand() noexcept;
2498  inline const MT& operand() const noexcept;
2499 
2500  inline size_t size() const noexcept;
2501  inline size_t capacity() const noexcept;
2502  inline size_t nonZeros() const;
2503  inline void reset();
2504  inline void reserve( size_t n );
2506  //**********************************************************************************************
2507 
2508  //**Insertion functions*************************************************************************
2511  inline Iterator set ( size_t index, const ElementType& value );
2512  inline Iterator insert( size_t index, const ElementType& value );
2513  inline void append( size_t index, const ElementType& value, bool check=false );
2515  //**********************************************************************************************
2516 
2517  //**Erase functions*****************************************************************************
2520  inline void erase( size_t index );
2521  inline Iterator erase( Iterator pos );
2522  inline Iterator erase( Iterator first, Iterator last );
2523 
2524  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
2525  inline void erase( Pred predicate );
2526 
2527  template< typename Pred >
2528  inline void erase( Iterator first, Iterator last, Pred predicate );
2530  //**********************************************************************************************
2531 
2532  //**Lookup functions****************************************************************************
2535  inline Iterator find ( size_t index );
2536  inline ConstIterator find ( size_t index ) const;
2537  inline Iterator lowerBound( size_t index );
2538  inline ConstIterator lowerBound( size_t index ) const;
2539  inline Iterator upperBound( size_t index );
2540  inline ConstIterator upperBound( size_t index ) const;
2542  //**********************************************************************************************
2543 
2544  //**Numeric functions***************************************************************************
2547  template< typename Other > inline Row& scale( const Other& scalar );
2549  //**********************************************************************************************
2550 
2551  //**Expression template evaluation functions****************************************************
2554  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
2555  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
2556 
2557  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2558  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2559  template< typename VT > inline void addAssign( const Vector<VT,true>& rhs );
2560  template< typename VT > inline void subAssign( const Vector<VT,true>& rhs );
2562  //**********************************************************************************************
2563 
2564  private:
2565  //**Member variables****************************************************************************
2568  Operand matrix_;
2569 
2570  //**********************************************************************************************
2571 
2572  //**Compile time checks*************************************************************************
2581  //**********************************************************************************************
2582 };
2584 //*************************************************************************************************
2585 
2586 
2587 
2588 
2589 //=================================================================================================
2590 //
2591 // CONSTRUCTORS
2592 //
2593 //=================================================================================================
2594 
2595 //*************************************************************************************************
2603 template< typename MT // Type of the sparse matrix
2604  , size_t... CRAs > // Compile time row arguments
2605 template< typename... RRAs > // Runtime row arguments
2606 inline Row<MT,false,false,false,CRAs...>::Row( MT& matrix, RRAs... args )
2607  : DataType( args... ) // Base class initialization
2608  , matrix_ ( matrix ) // The matrix containing the row
2609 {
2610  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
2611  if( matrix_.rows() <= row() ) {
2612  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
2613  }
2614  }
2615  else {
2616  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
2617  }
2618 }
2620 //*************************************************************************************************
2621 
2622 
2623 
2624 
2625 //=================================================================================================
2626 //
2627 // DATA ACCESS FUNCTIONS
2628 //
2629 //=================================================================================================
2630 
2631 //*************************************************************************************************
2641 template< typename MT // Type of the sparse matrix
2642  , size_t... CRAs > // Compile time row arguments
2643 inline typename Row<MT,false,false,false,CRAs...>::Reference
2644  Row<MT,false,false,false,CRAs...>::operator[]( size_t index )
2645 {
2646  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2647  return matrix_(row(),index);
2648 }
2650 //*************************************************************************************************
2651 
2652 
2653 //*************************************************************************************************
2663 template< typename MT // Type of the sparse matrix
2664  , size_t... CRAs > // Compile time row arguments
2665 inline typename Row<MT,false,false,false,CRAs...>::ConstReference
2666  Row<MT,false,false,false,CRAs...>::operator[]( size_t index ) const
2667 {
2668  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2669  return const_cast<const MT&>( matrix_ )(row(),index);
2670 }
2672 //*************************************************************************************************
2673 
2674 
2675 //*************************************************************************************************
2686 template< typename MT // Type of the sparse matrix
2687  , size_t... CRAs > // Compile time row arguments
2688 inline typename Row<MT,false,false,false,CRAs...>::Reference
2689  Row<MT,false,false,false,CRAs...>::at( size_t index )
2690 {
2691  if( index >= size() ) {
2692  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2693  }
2694  return (*this)[index];
2695 }
2697 //*************************************************************************************************
2698 
2699 
2700 //*************************************************************************************************
2711 template< typename MT // Type of the sparse matrix
2712  , size_t... CRAs > // Compile time row arguments
2713 inline typename Row<MT,false,false,false,CRAs...>::ConstReference
2714  Row<MT,false,false,false,CRAs...>::at( size_t index ) const
2715 {
2716  if( index >= size() ) {
2717  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2718  }
2719  return (*this)[index];
2720 }
2722 //*************************************************************************************************
2723 
2724 
2725 //*************************************************************************************************
2733 template< typename MT // Type of the sparse matrix
2734  , size_t... CRAs > // Compile time row arguments
2735 inline typename Row<MT,false,false,false,CRAs...>::Iterator
2737 {
2738  return Iterator( matrix_, row(), 0UL );
2739 }
2741 //*************************************************************************************************
2742 
2743 
2744 //*************************************************************************************************
2752 template< typename MT // Type of the sparse matrix
2753  , size_t... CRAs > // Compile time row arguments
2754 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2756 {
2757  return ConstIterator( matrix_, row(), 0UL );
2758 }
2760 //*************************************************************************************************
2761 
2762 
2763 //*************************************************************************************************
2771 template< typename MT // Type of the sparse matrix
2772  , size_t... CRAs > // Compile time row arguments
2773 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2775 {
2776  return ConstIterator( matrix_, row(), 0UL );
2777 }
2779 //*************************************************************************************************
2780 
2781 
2782 //*************************************************************************************************
2790 template< typename MT // Type of the sparse matrix
2791  , size_t... CRAs > // Compile time row arguments
2792 inline typename Row<MT,false,false,false,CRAs...>::Iterator
2794 {
2795  return Iterator( matrix_, row(), size() );
2796 }
2798 //*************************************************************************************************
2799 
2800 
2801 //*************************************************************************************************
2809 template< typename MT // Type of the sparse matrix
2810  , size_t... CRAs > // Compile time row arguments
2811 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2813 {
2814  return ConstIterator( matrix_, row(), size() );
2815 }
2817 //*************************************************************************************************
2818 
2819 
2820 //*************************************************************************************************
2828 template< typename MT // Type of the sparse matrix
2829  , size_t... CRAs > // Compile time row arguments
2830 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2832 {
2833  return ConstIterator( matrix_, row(), size() );
2834 }
2836 //*************************************************************************************************
2837 
2838 
2839 
2840 
2841 //=================================================================================================
2842 //
2843 // ASSIGNMENT OPERATORS
2844 //
2845 //=================================================================================================
2846 
2847 //*************************************************************************************************
2862 template< typename MT // Type of the sparse matrix
2863  , size_t... CRAs > // Compile time row arguments
2864 inline Row<MT,false,false,false,CRAs...>&
2865  Row<MT,false,false,false,CRAs...>::operator=( initializer_list<ElementType> list )
2866 {
2867  using blaze::assign;
2868 
2869  if( list.size() > size() ) {
2870  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
2871  }
2872 
2873  const InitializerVector<ElementType,true> tmp( list, size() );
2874 
2875  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
2876  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2877  }
2878 
2879  decltype(auto) left( derestrict( *this ) );
2880 
2881  assign( left, tmp );
2882 
2883  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2884 
2885  return *this;
2886 }
2888 //*************************************************************************************************
2889 
2890 
2891 //*************************************************************************************************
2905 template< typename MT // Type of the sparse matrix
2906  , size_t... CRAs > // Compile time row arguments
2907 inline Row<MT,false,false,false,CRAs...>&
2908  Row<MT,false,false,false,CRAs...>::operator=( const Row& rhs )
2909 {
2910  using blaze::assign;
2911 
2915 
2916  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
2917  return *this;
2918 
2919  if( size() != rhs.size() ) {
2920  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
2921  }
2922 
2923  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
2924  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2925  }
2926 
2927  decltype(auto) left( derestrict( *this ) );
2928 
2929  if( rhs.canAlias( &matrix_ ) ) {
2930  const ResultType tmp( rhs );
2931  assign( left, tmp );
2932  }
2933  else {
2934  assign( left, rhs );
2935  }
2936 
2937  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2938 
2939  return *this;
2940 }
2942 //*************************************************************************************************
2943 
2944 
2945 //*************************************************************************************************
2959 template< typename MT // Type of the sparse matrix
2960  , size_t... CRAs > // Compile time row arguments
2961 template< typename VT > // Type of the right-hand side vector
2962 inline Row<MT,false,false,false,CRAs...>&
2963  Row<MT,false,false,false,CRAs...>::operator=( const Vector<VT,true>& rhs )
2964 {
2965  using blaze::assign;
2966 
2967  if( size() != (~rhs).size() ) {
2968  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
2969  }
2970 
2971  const CompositeType_t<VT> tmp( ~rhs );
2972 
2973  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
2974  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2975  }
2976 
2977  decltype(auto) left( derestrict( *this ) );
2978 
2979  assign( left, tmp );
2980 
2981  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2982 
2983  return *this;
2984 }
2986 //*************************************************************************************************
2987 
2988 
2989 //*************************************************************************************************
3003 template< typename MT // Type of the sparse matrix
3004  , size_t... CRAs > // Compile time row arguments
3005 template< typename VT > // Type of the right-hand side vector
3006 inline Row<MT,false,false,false,CRAs...>&
3007  Row<MT,false,false,false,CRAs...>::operator+=( const Vector<VT,true>& rhs )
3008 {
3009  using blaze::assign;
3010 
3014  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3016 
3017  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3018 
3021 
3022  if( size() != (~rhs).size() ) {
3023  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3024  }
3025 
3026  const AddType tmp( *this + (~rhs) );
3027 
3028  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3029  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3030  }
3031 
3032  decltype(auto) left( derestrict( *this ) );
3033 
3034  assign( left, tmp );
3035 
3036  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3037 
3038  return *this;
3039 }
3041 //*************************************************************************************************
3042 
3043 
3044 //*************************************************************************************************
3058 template< typename MT // Type of the sparse matrix
3059  , size_t... CRAs > // Compile time row arguments
3060 template< typename VT > // Type of the right-hand side vector
3061 inline Row<MT,false,false,false,CRAs...>&
3062  Row<MT,false,false,false,CRAs...>::operator-=( const Vector<VT,true>& rhs )
3063 {
3064  using blaze::assign;
3065 
3069  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3071 
3072  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3073 
3076 
3077  if( size() != (~rhs).size() ) {
3078  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3079  }
3080 
3081  const SubType tmp( *this - (~rhs) );
3082 
3083  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3084  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3085  }
3086 
3087  decltype(auto) left( derestrict( *this ) );
3088 
3089  assign( left, tmp );
3090 
3091  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3092 
3093  return *this;
3094 }
3096 //*************************************************************************************************
3097 
3098 
3099 //*************************************************************************************************
3112 template< typename MT // Type of the sparse matrix
3113  , size_t... CRAs > // Compile time row arguments
3114 template< typename VT > // Type of the right-hand side vector
3115 inline Row<MT,false,false,false,CRAs...>&
3116  Row<MT,false,false,false,CRAs...>::operator*=( const Vector<VT,true>& rhs )
3117 {
3118  using blaze::assign;
3119 
3123  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3125 
3126  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3127 
3130 
3131  if( size() != (~rhs).size() ) {
3132  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3133  }
3134 
3135  const MultType tmp( *this * (~rhs) );
3136 
3137  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3138  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3139  }
3140 
3141  decltype(auto) left( derestrict( *this ) );
3142 
3143  assign( left, tmp );
3144 
3145  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3146 
3147  return *this;
3148 }
3150 //*************************************************************************************************
3151 
3152 
3153 //*************************************************************************************************
3165 template< typename MT // Type of the sparse matrix
3166  , size_t... CRAs > // Compile time row arguments
3167 template< typename VT > // Type of the right-hand side vector
3168 inline Row<MT,false,false,false,CRAs...>&
3169  Row<MT,false,false,false,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
3170 {
3171  using blaze::assign;
3172 
3176  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
3177  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3179 
3180  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3181 
3185 
3186  if( size() != (~rhs).size() ) {
3187  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3188  }
3189 
3190  const DivType tmp( *this / (~rhs) );
3191 
3192  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3193  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3194  }
3195 
3196  decltype(auto) left( derestrict( *this ) );
3197 
3198  assign( left, tmp );
3199 
3200  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3201 
3202  return *this;
3203 }
3205 //*************************************************************************************************
3206 
3207 
3208 //*************************************************************************************************
3221 template< typename MT // Type of the sparse matrix
3222  , size_t... CRAs > // Compile time row arguments
3223 template< typename VT > // Type of the right-hand side vector
3224 inline Row<MT,false,false,false,CRAs...>&
3225  Row<MT,false,false,false,CRAs...>::operator%=( const Vector<VT,true>& rhs )
3226 {
3227  using blaze::assign;
3228 
3229  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
3231 
3232  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3233 
3237 
3238  if( size() != 3UL || (~rhs).size() != 3UL ) {
3239  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
3240  }
3241 
3242  const CrossType tmp( *this % (~rhs) );
3243 
3244  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3245  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3246  }
3247 
3248  decltype(auto) left( derestrict( *this ) );
3249 
3250  assign( left, tmp );
3251 
3252  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3253 
3254  return *this;
3255 }
3257 //*************************************************************************************************
3258 
3259 
3260 
3261 
3262 //=================================================================================================
3263 //
3264 // UTILITY FUNCTIONS
3265 //
3266 //=================================================================================================
3267 
3268 //*************************************************************************************************
3274 template< typename MT // Type of the sparse matrix
3275  , size_t... CRAs > // Compile time row arguments
3276 inline MT& Row<MT,false,false,false,CRAs...>::operand() noexcept
3277 {
3278  return matrix_;
3279 }
3281 //*************************************************************************************************
3282 
3283 
3284 //*************************************************************************************************
3290 template< typename MT // Type of the sparse matrix
3291  , size_t... CRAs > // Compile time row arguments
3292 inline const MT& Row<MT,false,false,false,CRAs...>::operand() const noexcept
3293 {
3294  return matrix_;
3295 }
3297 //************************************************************************************************
3298 
3299 
3300 //*************************************************************************************************
3306 template< typename MT // Type of the sparse matrix
3307  , size_t... CRAs > // Compile time row arguments
3308 inline size_t Row<MT,false,false,false,CRAs...>::size() const noexcept
3309 {
3310  return matrix_.columns();
3311 }
3313 //*************************************************************************************************
3314 
3315 
3316 //*************************************************************************************************
3322 template< typename MT // Type of the sparse matrix
3323  , size_t... CRAs > // Compile time row arguments
3324 inline size_t Row<MT,false,false,false,CRAs...>::capacity() const noexcept
3325 {
3326  return matrix_.columns();
3327 }
3329 //*************************************************************************************************
3330 
3331 
3332 //*************************************************************************************************
3341 template< typename MT // Type of the sparse matrix
3342  , size_t... CRAs > // Compile time row arguments
3343 inline size_t Row<MT,false,false,false,CRAs...>::nonZeros() const
3344 {
3345  size_t counter( 0UL );
3346  for( ConstIterator element=begin(); element!=end(); ++element ) {
3347  ++counter;
3348  }
3349  return counter;
3350 }
3352 //*************************************************************************************************
3353 
3354 
3355 //*************************************************************************************************
3361 template< typename MT // Type of the sparse matrix
3362  , size_t... CRAs > // Compile time row arguments
3364 {
3365  const size_t jbegin( ( IsUpper_v<MT> )
3366  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3367  ?( row()+1UL )
3368  :( row() ) )
3369  :( 0UL ) );
3370  const size_t jend ( ( IsLower_v<MT> )
3371  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3372  ?( row() )
3373  :( row()+1UL ) )
3374  :( size() ) );
3375 
3376  for( size_t j=jbegin; j<jend; ++j ) {
3377  matrix_.erase( row(), j );
3378  }
3379 }
3381 //*************************************************************************************************
3382 
3383 
3384 //*************************************************************************************************
3394 template< typename MT // Type of the sparse matrix
3395  , size_t... CRAs > // Compile time row arguments
3396 void Row<MT,false,false,false,CRAs...>::reserve( size_t n )
3397 {
3398  UNUSED_PARAMETER( n );
3399 
3400  return;
3401 }
3403 //*************************************************************************************************
3404 
3405 
3406 
3407 
3408 //=================================================================================================
3409 //
3410 // INSERTION FUNCTIONS
3411 //
3412 //=================================================================================================
3413 
3414 //*************************************************************************************************
3426 template< typename MT // Type of the sparse matrix
3427  , size_t... CRAs > // Compile time row arguments
3428 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3429  Row<MT,false,false,false,CRAs...>::set( size_t index, const ElementType& value )
3430 {
3431  return Iterator( matrix_, row(), index, matrix_.set( row(), index, value ) );
3432 }
3434 //*************************************************************************************************
3435 
3436 
3437 //*************************************************************************************************
3450 template< typename MT // Type of the sparse matrix
3451  , size_t... CRAs > // Compile time row arguments
3452 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3453  Row<MT,false,false,false,CRAs...>::insert( size_t index, const ElementType& value )
3454 {
3455  return Iterator( matrix_, row(), index, matrix_.insert( row(), index, value ) );
3456 }
3458 //*************************************************************************************************
3459 
3460 
3461 //*************************************************************************************************
3486 template< typename MT // Type of the sparse matrix
3487  , size_t... CRAs > // Compile time row arguments
3488 inline void Row<MT,false,false,false,CRAs...>::append( size_t index, const ElementType& value, bool check )
3489 {
3490  if( !check || !isDefault<strict>( value ) )
3491  matrix_.insert( row(), index, value );
3492 }
3494 //*************************************************************************************************
3495 
3496 
3497 
3498 
3499 //=================================================================================================
3500 //
3501 // ERASE FUNCTIONS
3502 //
3503 //=================================================================================================
3504 
3505 //*************************************************************************************************
3514 template< typename MT // Type of the sparse matrix
3515  , size_t... CRAs > // Compile time row arguments
3516 inline void Row<MT,false,false,false,CRAs...>::erase( size_t index )
3517 {
3518  matrix_.erase( row(), index );
3519 }
3521 //*************************************************************************************************
3522 
3523 
3524 //*************************************************************************************************
3533 template< typename MT // Type of the sparse matrix
3534  , size_t... CRAs > // Compile time row arguments
3535 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3536  Row<MT,false,false,false,CRAs...>::erase( Iterator pos )
3537 {
3538  const size_t column( pos.column_ );
3539 
3540  if( column == size() )
3541  return pos;
3542 
3543  matrix_.erase( column, pos.pos_ );
3544  return Iterator( matrix_, row(), column+1UL );
3545 }
3547 //*************************************************************************************************
3548 
3549 
3550 //*************************************************************************************************
3560 template< typename MT // Type of the sparse matrix
3561  , size_t... CRAs > // Compile time row arguments
3562 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3563  Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last )
3564 {
3565  for( ; first!=last; ++first ) {
3566  matrix_.erase( first.column_, first.pos_ );
3567  }
3568  return last;
3569 }
3571 //*************************************************************************************************
3572 
3573 
3574 //*************************************************************************************************
3597 template< typename MT // Type of the sparse matrix
3598  , size_t... CRAs > // Compile time row arguments
3599 template< typename Pred // Type of the unary predicate
3600  , typename > // Type restriction on the unary predicate
3601 inline void Row<MT,false,false,false,CRAs...>::erase( Pred predicate )
3602 {
3603  for( Iterator element=begin(); element!=end(); ++element ) {
3604  if( predicate( element->value() ) )
3605  matrix_.erase( element.column_, element.pos_ );
3606  }
3607 }
3609 //*************************************************************************************************
3610 
3611 
3612 //*************************************************************************************************
3637 template< typename MT // Type of the sparse matrix
3638  , size_t... CRAs > // Compile time row arguments
3639 template< typename Pred > // Type of the unary predicate
3640 inline void Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
3641 {
3642  for( ; first!=last; ++first ) {
3643  if( predicate( first->value() ) )
3644  matrix_.erase( first.column_, first.pos_ );
3645  }
3646 }
3648 //*************************************************************************************************
3649 
3650 
3651 
3652 
3653 //=================================================================================================
3654 //
3655 // LOOKUP FUNCTIONS
3656 //
3657 //=================================================================================================
3658 
3659 //*************************************************************************************************
3673 template< typename MT // Type of the sparse matrix
3674  , size_t... CRAs > // Compile time row arguments
3675 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3676  Row<MT,false,false,false,CRAs...>::find( size_t index )
3677 {
3678  const Iterator_t<MT> pos( matrix_.find( row(), index ) );
3679 
3680  if( pos != matrix_.end( index ) )
3681  return Iterator( matrix_, row(), index, pos );
3682  else
3683  return end();
3684 }
3686 //*************************************************************************************************
3687 
3688 
3689 //*************************************************************************************************
3703 template< typename MT // Type of the sparse matrix
3704  , size_t... CRAs > // Compile time row arguments
3705 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3706  Row<MT,false,false,false,CRAs...>::find( size_t index ) const
3707 {
3708  const ConstIterator_t<MT> pos( matrix_.find( row(), index ) );
3709 
3710  if( pos != matrix_.end( index ) )
3711  return ConstIterator( matrix_, row(), index, pos );
3712  else
3713  return end();
3714 }
3716 //*************************************************************************************************
3717 
3718 
3719 //*************************************************************************************************
3732 template< typename MT // Type of the sparse matrix
3733  , size_t... CRAs > // Compile time row arguments
3734 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3735  Row<MT,false,false,false,CRAs...>::lowerBound( size_t index )
3736 {
3737  for( size_t i=index; i<size(); ++i )
3738  {
3739  const Iterator_t<MT> pos( matrix_.find( row(), i ) );
3740 
3741  if( pos != matrix_.end( i ) )
3742  return Iterator( matrix_, row(), i, pos );
3743  }
3744 
3745  return end();
3746 }
3748 //*************************************************************************************************
3749 
3750 
3751 //*************************************************************************************************
3764 template< typename MT // Type of the sparse matrix
3765  , size_t... CRAs > // Compile time row arguments
3766 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3767  Row<MT,false,false,false,CRAs...>::lowerBound( size_t index ) const
3768 {
3769  for( size_t i=index; i<size(); ++i )
3770  {
3771  const ConstIterator_t<MT> pos( matrix_.find( row(), i ) );
3772 
3773  if( pos != matrix_.end( i ) )
3774  return ConstIterator( matrix_, row(), i, pos );
3775  }
3776 
3777  return end();
3778 }
3780 //*************************************************************************************************
3781 
3782 
3783 //*************************************************************************************************
3796 template< typename MT // Type of the sparse matrix
3797  , size_t... CRAs > // Compile time row arguments
3798 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3799  Row<MT,false,false,false,CRAs...>::upperBound( size_t index )
3800 {
3801  for( size_t i=index+1UL; i<size(); ++i )
3802  {
3803  const Iterator_t<MT> pos( matrix_.find( row(), i ) );
3804 
3805  if( pos != matrix_.end( i ) )
3806  return Iterator( matrix_, row(), i, pos );
3807  }
3808 
3809  return end();
3810 }
3812 //*************************************************************************************************
3813 
3814 
3815 //*************************************************************************************************
3828 template< typename MT // Type of the sparse matrix
3829  , size_t... CRAs > // Compile time row arguments
3830 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3831  Row<MT,false,false,false,CRAs...>::upperBound( size_t index ) const
3832 {
3833  for( size_t i=index+1UL; i<size(); ++i )
3834  {
3835  const ConstIterator_t<MT> pos( matrix_.find( row(), i ) );
3836 
3837  if( pos != matrix_.end( i ) )
3838  return ConstIterator( matrix_, row(), i, pos );
3839  }
3840 
3841  return end();
3842 }
3844 //*************************************************************************************************
3845 
3846 
3847 
3848 
3849 //=================================================================================================
3850 //
3851 // NUMERIC FUNCTIONS
3852 //
3853 //=================================================================================================
3854 
3855 //*************************************************************************************************
3868 template< typename MT // Type of the sparse matrix
3869  , size_t... CRAs > // Compile time row arguments
3870 template< typename Other > // Data type of the scalar value
3871 inline Row<MT,false,false,false,CRAs...>&
3872  Row<MT,false,false,false,CRAs...>::scale( const Other& scalar )
3873 {
3875 
3876  for( Iterator element=begin(); element!=end(); ++element )
3877  element->value() *= scalar;
3878  return *this;
3879 }
3881 //*************************************************************************************************
3882 
3883 
3884 
3885 
3886 //=================================================================================================
3887 //
3888 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3889 //
3890 //=================================================================================================
3891 
3892 //*************************************************************************************************
3903 template< typename MT // Type of the sparse matrix
3904  , size_t... CRAs > // Compile time row arguments
3905 template< typename Other > // Data type of the foreign expression
3906 inline bool Row<MT,false,false,false,CRAs...>::canAlias( const Other* alias ) const noexcept
3907 {
3908  return matrix_.isAliased( alias );
3909 }
3911 //*************************************************************************************************
3912 
3913 
3914 //*************************************************************************************************
3921 template< typename MT // Type of the sparse matrix
3922  , size_t... CRAs > // Compile time row arguments
3923 template< typename Other > // Data type of the foreign expression
3924 inline bool Row<MT,false,false,false,CRAs...>::isAliased( const Other* alias ) const noexcept
3925 {
3926  return matrix_.isAliased( alias );
3927 }
3929 //*************************************************************************************************
3930 
3931 
3932 //*************************************************************************************************
3944 template< typename MT // Type of the sparse matrix
3945  , size_t... CRAs > // Compile time row arguments
3946 template< typename VT > // Type of the right-hand side dense vector
3947 inline void Row<MT,false,false,false,CRAs...>::assign( const DenseVector<VT,true>& rhs )
3948 {
3949  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3950 
3951  for( size_t j=0UL; j<(~rhs).size(); ++j ) {
3952  matrix_(row(),j) = (~rhs)[j];
3953  }
3954 }
3956 //*************************************************************************************************
3957 
3958 
3959 //*************************************************************************************************
3971 template< typename MT // Type of the sparse matrix
3972  , size_t... CRAs > // Compile time row arguments
3973 template< typename VT > // Type of the right-hand side sparse vector
3974 inline void Row<MT,false,false,false,CRAs...>::assign( const SparseVector<VT,true>& rhs )
3975 {
3976  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3977 
3978  size_t j( 0UL );
3979 
3980  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3981  for( ; j<element->index(); ++j )
3982  matrix_.erase( row(), j );
3983  matrix_(row(),j++) = element->value();
3984  }
3985  for( ; j<size(); ++j ) {
3986  matrix_.erase( row(), j );
3987  }
3988 }
3990 //*************************************************************************************************
3991 
3992 
3993 //*************************************************************************************************
4005 template< typename MT // Type of the sparse matrix
4006  , size_t... CRAs > // Compile time row arguments
4007 template< typename VT > // Type of the right-hand side vector
4008 inline void Row<MT,false,false,false,CRAs...>::addAssign( const Vector<VT,true>& rhs )
4009 {
4010  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4011 
4014 
4015  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4016 
4017  const AddType tmp( serial( *this + (~rhs) ) );
4018  assign( tmp );
4019 }
4021 //*************************************************************************************************
4022 
4023 
4024 //*************************************************************************************************
4036 template< typename MT // Type of the sparse matrix
4037  , size_t... CRAs > // Compile time row arguments
4038 template< typename VT > // Type of the right-hand side vector
4039 inline void Row<MT,false,false,false,CRAs...>::subAssign( const Vector<VT,true>& rhs )
4040 {
4041  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4042 
4045 
4046  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4047 
4048  const SubType tmp( serial( *this - (~rhs) ) );
4049  assign( tmp );
4050 }
4052 //*************************************************************************************************
4053 
4054 
4055 
4056 
4057 
4058 
4059 
4060 
4061 //=================================================================================================
4062 //
4063 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR SPARSE MATRICES
4064 //
4065 //=================================================================================================
4066 
4067 //*************************************************************************************************
4075 template< typename MT // Type of the sparse matrix
4076  , size_t... CRAs > // Compile time row arguments
4077 class Row<MT,false,false,true,CRAs...>
4078  : public View< SparseVector< Row<MT,false,false,true,CRAs...>, true > >
4079  , private RowData<CRAs...>
4080 {
4081  private:
4082  //**Type definitions****************************************************************************
4083  using DataType = RowData<CRAs...>;
4084  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4085  //**********************************************************************************************
4086 
4087  public:
4088  //**Type definitions****************************************************************************
4090  using This = Row<MT,false,false,true,CRAs...>;
4091 
4092  using BaseType = SparseVector<This,true>;
4093  using ViewedType = MT;
4094  using ResultType = RowTrait_t<MT,CRAs...>;
4095  using TransposeType = TransposeType_t<ResultType>;
4096  using ElementType = ElementType_t<MT>;
4097  using ReturnType = ReturnType_t<MT>;
4098  using CompositeType = const Row&;
4099 
4101  using ConstReference = ConstReference_t<MT>;
4102 
4104  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4105 
4107  using ConstIterator = ConstIterator_t<MT>;
4108 
4110  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4111  //**********************************************************************************************
4112 
4113  //**Compilation flags***************************************************************************
4115  static constexpr bool smpAssignable = false;
4116  //**********************************************************************************************
4117 
4118  //**Constructors********************************************************************************
4121  template< typename... RRAs >
4122  explicit inline Row( MT& matrix, RRAs... args );
4123 
4124  Row( const Row& ) = default;
4126  //**********************************************************************************************
4127 
4128  //**Destructor**********************************************************************************
4131  ~Row() = default;
4133  //**********************************************************************************************
4134 
4135  //**Data access functions***********************************************************************
4138  inline Reference operator[]( size_t index );
4139  inline ConstReference operator[]( size_t index ) const;
4140  inline Reference at( size_t index );
4141  inline ConstReference at( size_t index ) const;
4142  inline Iterator begin ();
4143  inline ConstIterator begin () const;
4144  inline ConstIterator cbegin() const;
4145  inline Iterator end ();
4146  inline ConstIterator end () const;
4147  inline ConstIterator cend () const;
4149  //**********************************************************************************************
4150 
4151  //**Assignment operators************************************************************************
4154  inline Row& operator=( initializer_list<ElementType> list );
4155  inline Row& operator=( const Row& rhs );
4156 
4157  template< typename VT > inline Row& operator= ( const DenseVector<VT,true>& rhs );
4158  template< typename VT > inline Row& operator= ( const SparseVector<VT,true>& rhs );
4159  template< typename VT > inline Row& operator+=( const DenseVector<VT,true>& rhs );
4160  template< typename VT > inline Row& operator+=( const SparseVector<VT,true>& rhs );
4161  template< typename VT > inline Row& operator-=( const DenseVector<VT,true>& rhs );
4162  template< typename VT > inline Row& operator-=( const SparseVector<VT,true>& rhs );
4163  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
4164  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4165  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4167  //**********************************************************************************************
4168 
4169  //**Utility functions***************************************************************************
4172  using DataType::row;
4173 
4174  inline MT& operand() noexcept;
4175  inline const MT& operand() const noexcept;
4176 
4177  inline size_t size() const noexcept;
4178  inline size_t capacity() const noexcept;
4179  inline size_t nonZeros() const;
4180  inline void reset();
4181  inline void reserve( size_t n );
4183  //**********************************************************************************************
4184 
4185  //**Insertion functions*************************************************************************
4188  inline Iterator set ( size_t index, const ElementType& value );
4189  inline Iterator insert( size_t index, const ElementType& value );
4190  inline void append( size_t index, const ElementType& value, bool check=false );
4192  //**********************************************************************************************
4193 
4194  //**Erase functions*****************************************************************************
4197  inline void erase( size_t index );
4198  inline Iterator erase( Iterator pos );
4199  inline Iterator erase( Iterator first, Iterator last );
4200 
4201  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
4202  inline void erase( Pred predicate );
4203 
4204  template< typename Pred >
4205  inline void erase( Iterator first, Iterator last, Pred predicate );
4207  //**********************************************************************************************
4208 
4209  //**Lookup functions****************************************************************************
4212  inline Iterator find ( size_t index );
4213  inline ConstIterator find ( size_t index ) const;
4214  inline Iterator lowerBound( size_t index );
4215  inline ConstIterator lowerBound( size_t index ) const;
4216  inline Iterator upperBound( size_t index );
4217  inline ConstIterator upperBound( size_t index ) const;
4219  //**********************************************************************************************
4220 
4221  //**Numeric functions***************************************************************************
4224  template< typename Other > inline Row& scale( const Other& scalar );
4226  //**********************************************************************************************
4227 
4228  //**Expression template evaluation functions****************************************************
4231  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
4232  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
4233 
4234  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
4235  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
4236  template< typename VT > inline void addAssign( const DenseVector <VT,true>& rhs );
4237  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
4238  template< typename VT > inline void subAssign( const DenseVector <VT,true>& rhs );
4239  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
4241  //**********************************************************************************************
4242 
4243  private:
4244  //**Utility functions***************************************************************************
4247  inline size_t extendCapacity() const;
4249  //**********************************************************************************************
4250 
4251  //**Member variables****************************************************************************
4254  Operand matrix_;
4255 
4256  //**********************************************************************************************
4257 
4258  //**Compile time checks*************************************************************************
4267  //**********************************************************************************************
4268 };
4270 //*************************************************************************************************
4271 
4272 
4273 
4274 
4275 //=================================================================================================
4276 //
4277 // CONSTRUCTORS
4278 //
4279 //=================================================================================================
4280 
4281 //*************************************************************************************************
4294 template< typename MT // Type of the sparse matrix
4295  , size_t... CRAs > // Compile time row arguments
4296 template< typename... RRAs > // Runtime row arguments
4297 inline Row<MT,false,false,true,CRAs...>::Row( MT& matrix, RRAs... args )
4298  : DataType( args... ) // Base class initialization
4299  , matrix_ ( matrix ) // The matrix containing the row
4300 {
4301  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
4302  if( matrix_.rows() <= row() ) {
4303  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
4304  }
4305  }
4306  else {
4307  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
4308  }
4309 }
4311 //*************************************************************************************************
4312 
4313 
4314 
4315 
4316 //=================================================================================================
4317 //
4318 // DATA ACCESS FUNCTIONS
4319 //
4320 //=================================================================================================
4321 
4322 //*************************************************************************************************
4332 template< typename MT // Type of the sparse matrix
4333  , size_t... CRAs > // Compile time row arguments
4334 inline typename Row<MT,false,false,true,CRAs...>::Reference
4335  Row<MT,false,false,true,CRAs...>::operator[]( size_t index )
4336 {
4337  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4338  return matrix_(index,row());
4339 }
4341 //*************************************************************************************************
4342 
4343 
4344 //*************************************************************************************************
4354 template< typename MT // Type of the sparse matrix
4355  , size_t... CRAs > // Compile time row arguments
4356 inline typename Row<MT,false,false,true,CRAs...>::ConstReference
4357  Row<MT,false,false,true,CRAs...>::operator[]( size_t index ) const
4358 {
4359  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4360  return const_cast<const MT&>( matrix_ )(index,row());
4361 }
4363 //*************************************************************************************************
4364 
4365 
4366 //*************************************************************************************************
4377 template< typename MT // Type of the sparse matrix
4378  , size_t... CRAs > // Compile time row arguments
4379 inline typename Row<MT,false,false,true,CRAs...>::Reference
4380  Row<MT,false,false,true,CRAs...>::at( size_t index )
4381 {
4382  if( index >= size() ) {
4383  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4384  }
4385  return (*this)[index];
4386 }
4388 //*************************************************************************************************
4389 
4390 
4391 //*************************************************************************************************
4402 template< typename MT // Type of the sparse matrix
4403  , size_t... CRAs > // Compile time row arguments
4404 inline typename Row<MT,false,false,true,CRAs...>::ConstReference
4405  Row<MT,false,false,true,CRAs...>::at( size_t index ) const
4406 {
4407  if( index >= size() ) {
4408  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4409  }
4410  return (*this)[index];
4411 }
4413 //*************************************************************************************************
4414 
4415 
4416 //*************************************************************************************************
4424 template< typename MT // Type of the sparse matrix
4425  , size_t... CRAs > // Compile time row arguments
4426 inline typename Row<MT,false,false,true,CRAs...>::Iterator
4428 {
4429  return matrix_.begin( row() );
4430 }
4432 //*************************************************************************************************
4433 
4434 
4435 //*************************************************************************************************
4443 template< typename MT // Type of the sparse matrix
4444  , size_t... CRAs > // Compile time row arguments
4445 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4447 {
4448  return matrix_.cbegin( row() );
4449 }
4451 //*************************************************************************************************
4452 
4453 
4454 //*************************************************************************************************
4462 template< typename MT // Type of the sparse matrix
4463  , size_t... CRAs > // Compile time row arguments
4464 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4466 {
4467  return matrix_.cbegin( row() );
4468 }
4470 //*************************************************************************************************
4471 
4472 
4473 //*************************************************************************************************
4481 template< typename MT // Type of the sparse matrix
4482  , size_t... CRAs > // Compile time row arguments
4483 inline typename Row<MT,false,false,true,CRAs...>::Iterator
4485 {
4486  return matrix_.end( row() );
4487 }
4489 //*************************************************************************************************
4490 
4491 
4492 //*************************************************************************************************
4500 template< typename MT // Type of the sparse matrix
4501  , size_t... CRAs > // Compile time row arguments
4502 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4504 {
4505  return matrix_.cend( row() );
4506 }
4508 //*************************************************************************************************
4509 
4510 
4511 //*************************************************************************************************
4519 template< typename MT // Type of the sparse matrix
4520  , size_t... CRAs > // Compile time row arguments
4521 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4523 {
4524  return matrix_.cend( row() );
4525 }
4527 //*************************************************************************************************
4528 
4529 
4530 
4531 
4532 //=================================================================================================
4533 //
4534 // ASSIGNMENT OPERATORS
4535 //
4536 //=================================================================================================
4537 
4538 //*************************************************************************************************
4553 template< typename MT // Type of the sparse matrix
4554  , size_t... CRAs > // Compile time row arguments
4555 inline Row<MT,false,false,true,CRAs...>&
4556  Row<MT,false,false,true,CRAs...>::operator=( initializer_list<ElementType> list )
4557 {
4558  using blaze::assign;
4559 
4560  if( list.size() > size() ) {
4561  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
4562  }
4563 
4564  const InitializerVector<ElementType,true> tmp( list, size() );
4565 
4566  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4567  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4568  }
4569 
4570  decltype(auto) left( derestrict( *this ) );
4571 
4572  left.reset();
4573  assign( left, tmp );
4574 
4575  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4576 
4577  return *this;
4578 }
4580 //*************************************************************************************************
4581 
4582 
4583 //*************************************************************************************************
4597 template< typename MT // Type of the sparse matrix
4598  , size_t... CRAs > // Compile time row arguments
4599 inline Row<MT,false,false,true,CRAs...>&
4600  Row<MT,false,false,true,CRAs...>::operator=( const Row& rhs )
4601 {
4602  using blaze::assign;
4603 
4607 
4608  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
4609  return *this;
4610 
4611  if( size() != rhs.size() ) {
4612  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
4613  }
4614 
4615  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
4616  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4617  }
4618 
4619  decltype(auto) left( derestrict( *this ) );
4620 
4621  if( rhs.canAlias( &matrix_ ) ) {
4622  const ResultType tmp( rhs );
4623  left.reset();
4624  left.reserve( tmp.nonZeros() );
4625  assign( left, tmp );
4626  }
4627  else {
4628  left.reset();
4629  left.reserve( rhs.nonZeros() );
4630  assign( left, rhs );
4631  }
4632 
4633  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4634 
4635  return *this;
4636 }
4638 //*************************************************************************************************
4639 
4640 
4641 //*************************************************************************************************
4655 template< typename MT // Type of the sparse matrix
4656  , size_t... CRAs > // Compile time row arguments
4657 template< typename VT > // Type of the right-hand side dense vector
4658 inline Row<MT,false,false,true,CRAs...>&
4659  Row<MT,false,false,true,CRAs...>::operator=( const DenseVector<VT,true>& rhs )
4660 {
4661  using blaze::assign;
4662 
4663  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4664  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4666 
4667  if( size() != (~rhs).size() ) {
4668  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4669  }
4670 
4671  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4672  Right right( ~rhs );
4673 
4674  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4675  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4676  }
4677 
4678  decltype(auto) left( derestrict( *this ) );
4679 
4680  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4681  const ResultType_t<VT> tmp( right );
4682  left.reset();
4683  assign( left, tmp );
4684  }
4685  else {
4686  left.reset();
4687  assign( left, right );
4688  }
4689 
4690  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4691 
4692  return *this;
4693 }
4695 //*************************************************************************************************
4696 
4697 
4698 //*************************************************************************************************
4712 template< typename MT // Type of the sparse matrix
4713  , size_t... CRAs > // Compile time row arguments
4714 template< typename VT > // Type of the right-hand side sparse vector
4715 inline Row<MT,false,false,true,CRAs...>&
4716  Row<MT,false,false,true,CRAs...>::operator=( const SparseVector<VT,true>& rhs )
4717 {
4718  using blaze::assign;
4719 
4720  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4721  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4723 
4724  if( size() != (~rhs).size() ) {
4725  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4726  }
4727 
4728  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4729  Right right( ~rhs );
4730 
4731  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4732  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4733  }
4734 
4735  decltype(auto) left( derestrict( *this ) );
4736 
4737  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4738  const ResultType_t<VT> tmp( right );
4739  left.reset();
4740  left.reserve( tmp.nonZeros() );
4741  assign( left, tmp );
4742  }
4743  else {
4744  left.reset();
4745  left.reserve( right.nonZeros() );
4746  assign( left, right );
4747  }
4748 
4749  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4750 
4751  return *this;
4752 }
4754 //*************************************************************************************************
4755 
4756 
4757 //*************************************************************************************************
4771 template< typename MT // Type of the sparse matrix
4772  , size_t... CRAs > // Compile time row arguments
4773 template< typename VT > // Type of the right-hand side dense vector
4774 inline Row<MT,false,false,true,CRAs...>&
4775  Row<MT,false,false,true,CRAs...>::operator+=( const DenseVector<VT,true>& rhs )
4776 {
4777  using blaze::assign;
4778 
4782  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4783  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4785 
4786  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4787 
4791 
4792  if( size() != (~rhs).size() ) {
4793  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4794  }
4795 
4796  const AddType tmp( *this + (~rhs) );
4797 
4798  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4799  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4800  }
4801 
4802  decltype(auto) left( derestrict( *this ) );
4803 
4804  left.reset();
4805  assign( left, tmp );
4806 
4807  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4808 
4809  return *this;
4810 }
4812 //*************************************************************************************************
4813 
4814 
4815 //*************************************************************************************************
4829 template< typename MT // Type of the sparse matrix
4830  , size_t... CRAs > // Compile time row arguments
4831 template< typename VT > // Type of the right-hand side sparse vector
4832 inline Row<MT,false,false,true,CRAs...>&
4833  Row<MT,false,false,true,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
4834 {
4835  using blaze::assign;
4836 
4840  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4841  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4843 
4844  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4845 
4849 
4850  if( size() != (~rhs).size() ) {
4851  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4852  }
4853 
4854  const AddType tmp( *this + (~rhs) );
4855 
4856  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4857  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4858  }
4859 
4860  decltype(auto) left( derestrict( *this ) );
4861 
4862  left.reset();
4863  left.reserve( tmp.nonZeros() );
4864  assign( left, tmp );
4865 
4866  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4867 
4868  return *this;
4869 }
4871 //*************************************************************************************************
4872 
4873 
4874 //*************************************************************************************************
4889 template< typename MT // Type of the sparse matrix
4890  , size_t... CRAs > // Compile time row arguments
4891 template< typename VT > // Type of the right-hand side dense vector
4892 inline Row<MT,false,false,true,CRAs...>&
4893  Row<MT,false,false,true,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
4894 {
4895  using blaze::assign;
4896 
4900  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4901  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4903 
4904  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4905 
4909 
4910  if( size() != (~rhs).size() ) {
4911  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4912  }
4913 
4914  const SubType tmp( *this - (~rhs) );
4915 
4916  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4917  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4918  }
4919 
4920  decltype(auto) left( derestrict( *this ) );
4921 
4922  left.reset();
4923  assign( left, tmp );
4924 
4925  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4926 
4927  return *this;
4928 }
4930 //*************************************************************************************************
4931 
4932 
4933 //*************************************************************************************************
4948 template< typename MT // Type of the sparse matrix
4949  , size_t... CRAs > // Compile time row arguments
4950 template< typename VT > // Type of the right-hand side sparse vector
4951 inline Row<MT,false,false,true,CRAs...>&
4952  Row<MT,false,false,true,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
4953 {
4954  using blaze::assign;
4955 
4959  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4960  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
4962 
4963  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4964 
4968 
4969  if( size() != (~rhs).size() ) {
4970  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4971  }
4972 
4973  const SubType tmp( *this - (~rhs) );
4974 
4975  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4976  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4977  }
4978 
4979  decltype(auto) left( derestrict( *this ) );
4980 
4981  left.reset();
4982  left.reserve( tmp.nonZeros() );
4983  assign( left, tmp );
4984 
4985  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4986 
4987  return *this;
4988 }
4990 //*************************************************************************************************
4991 
4992 
4993 //*************************************************************************************************
5006 template< typename MT // Type of the sparse matrix
5007  , size_t... CRAs > // Compile time row arguments
5008 template< typename VT > // Type of the right-hand side vector
5009 inline Row<MT,false,false,true,CRAs...>&
5010  Row<MT,false,false,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
5011 {
5012  using blaze::assign;
5013 
5017  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5019 
5020  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5021 
5024 
5025  if( size() != (~rhs).size() ) {
5026  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5027  }
5028 
5029  const MultType tmp( *this * (~rhs) );
5030 
5031  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5032  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5033  }
5034 
5035  decltype(auto) left( derestrict( *this ) );
5036 
5037  left.reset();
5038  assign( left, tmp );
5039 
5040  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5041 
5042  return *this;
5043 }
5045 //*************************************************************************************************
5046 
5047 
5048 //*************************************************************************************************
5060 template< typename MT // Type of the sparse matrix
5061  , size_t... CRAs > // Compile time row arguments
5062 template< typename VT > // Type of the right-hand side vector
5063 inline Row<MT,false,false,true,CRAs...>&
5064  Row<MT,false,false,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5065 {
5066  using blaze::assign;
5067 
5071  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
5072  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5074 
5075  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5076 
5080 
5081  if( size() != (~rhs).size() ) {
5082  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5083  }
5084 
5085  const DivType tmp( *this / (~rhs) );
5086 
5087  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5088  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5089  }
5090 
5091  decltype(auto) left( derestrict( *this ) );
5092 
5093  left.reset();
5094  assign( left, tmp );
5095 
5096  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5097 
5098  return *this;
5099 }
5101 //*************************************************************************************************
5102 
5103 
5104 //*************************************************************************************************
5117 template< typename MT // Type of the sparse matrix
5118  , size_t... CRAs > // Compile time row arguments
5119 template< typename VT > // Type of the right-hand side vector
5120 inline Row<MT,false,false,true,CRAs...>&
5121  Row<MT,false,false,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5122 {
5123  using blaze::assign;
5124 
5125  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_t<VT> );
5127 
5128  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5129 
5133 
5134  if( size() != 3UL || (~rhs).size() != 3UL ) {
5135  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5136  }
5137 
5138  const CrossType tmp( *this % (~rhs) );
5139 
5140  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5141  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5142  }
5143 
5144  decltype(auto) left( derestrict( *this ) );
5145 
5146  left.reset();
5147  assign( left, tmp );
5148 
5149  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5150 
5151  return *this;
5152 }
5154 //*************************************************************************************************
5155 
5156 
5157 
5158 
5159 //=================================================================================================
5160 //
5161 // UTILITY FUNCTIONS
5162 //
5163 //=================================================================================================
5164 
5165 //*************************************************************************************************
5171 template< typename MT // Type of the sparse matrix
5172  , size_t... CRAs > // Compile time row arguments
5173 inline MT& Row<MT,false,false,true,CRAs...>::operand() noexcept
5174 {
5175  return matrix_;
5176 }
5178 //*************************************************************************************************
5179 
5180 
5181 //*************************************************************************************************
5187 template< typename MT // Type of the sparse matrix
5188  , size_t... CRAs > // Compile time row arguments
5189 inline const MT& Row<MT,false,false,true,CRAs...>::operand() const noexcept
5190 {
5191  return matrix_;
5192 }
5194 //*************************************************************************************************
5195 
5196 
5197 //*************************************************************************************************
5203 template< typename MT // Type of the sparse matrix
5204  , size_t... CRAs > // Compile time row arguments
5205 inline size_t Row<MT,false,false,true,CRAs...>::size() const noexcept
5206 {
5207  return matrix_.columns();
5208 }
5210 //*************************************************************************************************
5211 
5212 
5213 //*************************************************************************************************
5219 template< typename MT // Type of the sparse matrix
5220  , size_t... CRAs > // Compile time row arguments
5221 inline size_t Row<MT,false,false,true,CRAs...>::capacity() const noexcept
5222 {
5223  return matrix_.capacity( row() );
5224 }
5226 //*************************************************************************************************
5227 
5228 
5229 //*************************************************************************************************
5238 template< typename MT // Type of the sparse matrix
5239  , size_t... CRAs > // Compile time row arguments
5240 inline size_t Row<MT,false,false,true,CRAs...>::nonZeros() const
5241 {
5242  return matrix_.nonZeros( row() );
5243 }
5245 //*************************************************************************************************
5246 
5247 
5248 //*************************************************************************************************
5254 template< typename MT // Type of the sparse matrix
5255  , size_t... CRAs > // Compile time row arguments
5257 {
5258  matrix_.reset( row() );
5259 }
5261 //*************************************************************************************************
5262 
5263 
5264 //*************************************************************************************************
5274 template< typename MT // Type of the sparse matrix
5275  , size_t... CRAs > // Compile time row arguments
5276 void Row<MT,false,false,true,CRAs...>::reserve( size_t n )
5277 {
5278  matrix_.reserve( row(), n );
5279 }
5281 //*************************************************************************************************
5282 
5283 
5284 //*************************************************************************************************
5293 template< typename MT // Type of the sparse matrix
5294  , size_t... CRAs > // Compile time row arguments
5295 inline size_t Row<MT,false,false,true,CRAs...>::extendCapacity() const
5296 {
5297  using blaze::max;
5298  using blaze::min;
5299 
5300  size_t nonzeros( 2UL*capacity()+1UL );
5301  nonzeros = max( nonzeros, 7UL );
5302  nonzeros = min( nonzeros, size() );
5303 
5304  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
5305 
5306  return nonzeros;
5307 }
5309 //*************************************************************************************************
5310 
5311 
5312 
5313 
5314 //=================================================================================================
5315 //
5316 // INSERTION FUNCTIONS
5317 //
5318 //=================================================================================================
5319 
5320 //*************************************************************************************************
5332 template< typename MT // Type of the sparse matrix
5333  , size_t... CRAs > // Compile time row arguments
5334 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5335  Row<MT,false,false,true,CRAs...>::set( size_t index, const ElementType& value )
5336 {
5337  return matrix_.set( index, row(), value );
5338 }
5340 //*************************************************************************************************
5341 
5342 
5343 //*************************************************************************************************
5356 template< typename MT // Type of the sparse matrix
5357  , size_t... CRAs > // Compile time row arguments
5358 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5359  Row<MT,false,false,true,CRAs...>::insert( size_t index, const ElementType& value )
5360 {
5361  return matrix_.insert( index, row(), value );
5362 }
5364 //*************************************************************************************************
5365 
5366 
5367 //*************************************************************************************************
5392 template< typename MT // Type of the sparse matrix
5393  , size_t... CRAs > // Compile time row arguments
5394 inline void Row<MT,false,false,true,CRAs...>::append( size_t index, const ElementType& value, bool check )
5395 {
5396  matrix_.append( index, row(), value, check );
5397 }
5399 //*************************************************************************************************
5400 
5401 
5402 
5403 
5404 //=================================================================================================
5405 //
5406 // ERASE FUNCTIONS
5407 //
5408 //=================================================================================================
5409 
5410 //*************************************************************************************************
5419 template< typename MT // Type of the sparse matrix
5420  , size_t... CRAs > // Compile time row arguments
5421 inline void Row<MT,false,false,true,CRAs...>::erase( size_t index )
5422 {
5423  matrix_.erase( index, row() );
5424 }
5426 //*************************************************************************************************
5427 
5428 
5429 //*************************************************************************************************
5438 template< typename MT // Type of the sparse matrix
5439  , size_t... CRAs > // Compile time row arguments
5440 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5441  Row<MT,false,false,true,CRAs...>::erase( Iterator pos )
5442 {
5443  return matrix_.erase( row(), pos );
5444 }
5446 //*************************************************************************************************
5447 
5448 
5449 //*************************************************************************************************
5459 template< typename MT // Type of the sparse matrix
5460  , size_t... CRAs > // Compile time row arguments
5461 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5462  Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last )
5463 {
5464  return matrix_.erase( row(), first, last );
5465 }
5467 //*************************************************************************************************
5468 
5469 
5470 //*************************************************************************************************
5493 template< typename MT // Type of the sparse matrix
5494  , size_t... CRAs > // Compile time row arguments
5495 template< typename Pred // Type of the unary predicate
5496  , typename > // Type restriction on the unary predicate
5497 inline void Row<MT,false,false,true,CRAs...>::erase( Pred predicate )
5498 {
5499  matrix_.erase( row(), begin(), end(), predicate );
5500 }
5502 //*************************************************************************************************
5503 
5504 
5505 //*************************************************************************************************
5530 template< typename MT // Type of the sparse matrix
5531  , size_t... CRAs > // Compile time row arguments
5532 template< typename Pred > // Type of the unary predicate
5533 inline void Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
5534 {
5535  matrix_.erase( row(), first, last, predicate );
5536 }
5538 //*************************************************************************************************
5539 
5540 
5541 
5542 
5543 //=================================================================================================
5544 //
5545 // LOOKUP FUNCTIONS
5546 //
5547 //=================================================================================================
5548 
5549 //*************************************************************************************************
5563 template< typename MT // Type of the sparse matrix
5564  , size_t... CRAs > // Compile time row arguments
5565 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5566  Row<MT,false,false,true,CRAs...>::find( size_t index )
5567 {
5568  return matrix_.find( index, row() );
5569 }
5571 //*************************************************************************************************
5572 
5573 
5574 //*************************************************************************************************
5588 template< typename MT // Type of the sparse matrix
5589  , size_t... CRAs > // Compile time row arguments
5590 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5591  Row<MT,false,false,true,CRAs...>::find( size_t index ) const
5592 {
5593  return matrix_.find( index, row() );
5594 }
5596 //*************************************************************************************************
5597 
5598 
5599 //*************************************************************************************************
5612 template< typename MT // Type of the sparse matrix
5613  , size_t... CRAs > // Compile time row arguments
5614 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5615  Row<MT,false,false,true,CRAs...>::lowerBound( size_t index )
5616 {
5617  return matrix_.lowerBound( index, row() );
5618 }
5620 //*************************************************************************************************
5621 
5622 
5623 //*************************************************************************************************
5636 template< typename MT // Type of the sparse matrix
5637  , size_t... CRAs > // Compile time row arguments
5638 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5639  Row<MT,false,false,true,CRAs...>::lowerBound( size_t index ) const
5640 {
5641  return matrix_.lowerBound( index, row() );
5642 }
5644 //*************************************************************************************************
5645 
5646 
5647 //*************************************************************************************************
5660 template< typename MT // Type of the sparse matrix
5661  , size_t... CRAs > // Compile time row arguments
5662 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5663  Row<MT,false,false,true,CRAs...>::upperBound( size_t index )
5664 {
5665  return matrix_.upperBound( index, row() );
5666 }
5668 //*************************************************************************************************
5669 
5670 
5671 //*************************************************************************************************
5684 template< typename MT // Type of the sparse matrix
5685  , size_t... CRAs > // Compile time row arguments
5686 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5687  Row<MT,false,false,true,CRAs...>::upperBound( size_t index ) const
5688 {
5689  return matrix_.upperBound( index, row() );
5690 }
5692 //*************************************************************************************************
5693 
5694 
5695 
5696 
5697 //=================================================================================================
5698 //
5699 // NUMERIC FUNCTIONS
5700 //
5701 //=================================================================================================
5702 
5703 //*************************************************************************************************
5716 template< typename MT // Type of the sparse matrix
5717  , size_t... CRAs > // Compile time row arguments
5718 template< typename Other > // Data type of the scalar value
5719 inline Row<MT,false,false,true,CRAs...>&
5720  Row<MT,false,false,true,CRAs...>::scale( const Other& scalar )
5721 {
5723 
5724  for( Iterator element=begin(); element!=end(); ++element )
5725  element->value() *= scalar;
5726  return *this;
5727 }
5729 //*************************************************************************************************
5730 
5731 
5732 
5733 
5734 //=================================================================================================
5735 //
5736 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5737 //
5738 //=================================================================================================
5739 
5740 //*************************************************************************************************
5751 template< typename MT // Type of the sparse matrix
5752  , size_t... CRAs > // Compile time row arguments
5753 template< typename Other > // Data type of the foreign expression
5754 inline bool Row<MT,false,false,true,CRAs...>::canAlias( const Other* alias ) const noexcept
5755 {
5756  return matrix_.isAliased( alias );
5757 }
5759 //*************************************************************************************************
5760 
5761 
5762 //*************************************************************************************************
5773 template< typename MT // Type of the sparse matrix
5774  , size_t... CRAs > // Compile time row arguments
5775 template< typename Other > // Data type of the foreign expression
5776 inline bool Row<MT,false,false,true,CRAs...>::isAliased( const Other* alias ) const noexcept
5777 {
5778  return matrix_.isAliased( alias );
5779 }
5781 //*************************************************************************************************
5782 
5783 
5784 //*************************************************************************************************
5796 template< typename MT // Type of the sparse matrix
5797  , size_t... CRAs > // Compile time row arguments
5798 template< typename VT > // Type of the right-hand side dense vector
5799 inline void Row<MT,false,false,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5800 {
5801  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5802  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5803 
5804  for( size_t i=0UL; i<size(); ++i )
5805  {
5806  if( matrix_.nonZeros( row() ) == matrix_.capacity( row() ) )
5807  matrix_.reserve( row(), extendCapacity() );
5808 
5809  matrix_.append( i, row(), (~rhs)[i], true );
5810  }
5811 }
5813 //*************************************************************************************************
5814 
5815 
5816 //*************************************************************************************************
5828 template< typename MT // Type of the sparse matrix
5829  , size_t... CRAs > // Compile time row arguments
5830 template< typename VT > // Type of the right-hand side sparse vector
5831 inline void Row<MT,false,false,true,CRAs...>::assign( const SparseVector<VT,true>& rhs )
5832 {
5833  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5834  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5835 
5836  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5837  matrix_.append( element->index(), row(), element->value(), true );
5838  }
5839 }
5841 //*************************************************************************************************
5842 
5843 
5844 //*************************************************************************************************
5856 template< typename MT // Type of the sparse matrix
5857  , size_t... CRAs > // Compile time row arguments
5858 template< typename VT > // Type of the right-hand side dense vector
5859 inline void Row<MT,false,false,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5860 {
5861  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5862 
5866 
5867  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5868 
5869  const AddType tmp( serial( *this + (~rhs) ) );
5870  matrix_.reset( row() );
5871  assign( tmp );
5872 }
5874 //*************************************************************************************************
5875 
5876 
5877 //*************************************************************************************************
5889 template< typename MT // Type of the sparse matrix
5890  , size_t... CRAs > // Compile time row arguments
5891 template< typename VT > // Type of the right-hand side sparse vector
5892 inline void Row<MT,false,false,true,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
5893 {
5894  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5895 
5899 
5900  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5901 
5902  const AddType tmp( serial( *this + (~rhs) ) );
5903  matrix_.reset( row() );
5904  matrix_.reserve( row(), tmp.nonZeros() );
5905  assign( tmp );
5906 }
5908 //*************************************************************************************************
5909 
5910 
5911 //*************************************************************************************************
5923 template< typename MT // Type of the sparse matrix
5924  , size_t... CRAs > // Compile time row arguments
5925 template< typename VT > // Type of the right-hand side dense vector
5926 inline void Row<MT,false,false,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5927 {
5928  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5929 
5933 
5934  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5935 
5936  const SubType tmp( serial( *this - (~rhs) ) );
5937  matrix_.reset( row() );
5938  assign( tmp );
5939 }
5941 //*************************************************************************************************
5942 
5943 
5944 //*************************************************************************************************
5956 template< typename MT // Type of the sparse matrix
5957  , size_t... CRAs > // Compile time row arguments
5958 template< typename VT > // Type of the right-hand side sparse vector
5959 inline void Row<MT,false,false,true,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
5960 {
5961  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5962 
5966 
5967  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5968 
5969  const SubType tmp( serial( *this - (~rhs) ) );
5970  matrix_.reset( row() );
5971  matrix_.reserve( row(), tmp.nonZeros() );
5972  assign( tmp );
5973 }
5975 //*************************************************************************************************
5976 
5977 } // namespace blaze
5978 
5979 #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.
Header file for the implementation of the RowData class template.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.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.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
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:1147
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
#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:1179
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the 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, a compilation error is created.
Definition: Reference.h:79
typename RowTrait< MT, CRAs... >::Type RowTrait_t
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_t alias declaration provides a c...
Definition: RowTrait.h:170
Header file for the isDefault shim.
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.
Header file for the RemoveReference type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the IsRestricted type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#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.