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>
79 #include <blaze/math/views/Check.h>
84 #include <blaze/util/Assert.h>
87 #include <blaze/util/DisableIf.h>
88 #include <blaze/util/mpl/If.h>
89 #include <blaze/util/TypeList.h>
90 #include <blaze/util/Types.h>
95 #include <blaze/util/Unused.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR SPARSE MATRICES
103 //
104 //=================================================================================================
105 
106 //*************************************************************************************************
114 template< typename MT // Type of the sparse matrix
115  , bool SF // Symmetry flag
116  , size_t... CRAs > // Compile time row arguments
117 class Row<MT,true,false,SF,CRAs...>
118  : public View< SparseVector< Row<MT,true,false,SF,CRAs...>, true > >
119  , private RowData<CRAs...>
120 {
121  private:
122  //**Type definitions****************************************************************************
123  using DataType = RowData<CRAs...>;
124  using Operand = If_< IsExpression<MT>, MT, MT& >;
125  //**********************************************************************************************
126 
127  public:
128  //**Type definitions****************************************************************************
130  using This = Row<MT,true,false,SF,CRAs...>;
131 
132  using BaseType = SparseVector<This,true>;
133  using ViewedType = MT;
134  using ResultType = RowTrait_<MT,CRAs...>;
135  using TransposeType = TransposeType_<ResultType>;
136  using ElementType = ElementType_<MT>;
137  using ReturnType = ReturnType_<MT>;
138  using CompositeType = const Row&;
139 
141  using ConstReference = ConstReference_<MT>;
142 
144  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
145 
147  using ConstIterator = ConstIterator_<MT>;
148 
150  using Iterator = If_< IsConst<MT>, ConstIterator, Iterator_<MT> >;
151  //**********************************************************************************************
152 
153  //**Compilation flags***************************************************************************
155  enum : bool { smpAssignable = false };
156  //**********************************************************************************************
157 
158  //**Constructors********************************************************************************
161  template< typename... RRAs >
162  explicit inline Row( MT& matrix, RRAs... args );
163  // No explicitly declared copy constructor.
165  //**********************************************************************************************
166 
167  //**Destructor**********************************************************************************
168  // No explicitly declared destructor.
169  //**********************************************************************************************
170 
171  //**Data access functions***********************************************************************
174  inline Reference operator[]( size_t index );
175  inline ConstReference operator[]( size_t index ) const;
176  inline Reference at( size_t index );
177  inline ConstReference at( size_t index ) const;
178  inline Iterator begin ();
179  inline ConstIterator begin () const;
180  inline ConstIterator cbegin() const;
181  inline Iterator end ();
182  inline ConstIterator end () const;
183  inline ConstIterator cend () const;
185  //**********************************************************************************************
186 
187  //**Assignment operators************************************************************************
190  inline Row& operator=( initializer_list<ElementType> list );
191  inline Row& operator=( const Row& rhs );
192 
193  template< typename VT > inline Row& operator= ( const DenseVector<VT,true>& rhs );
194  template< typename VT > inline Row& operator= ( const SparseVector<VT,true>& rhs );
195  template< typename VT > inline Row& operator+=( const DenseVector<VT,true>& rhs );
196  template< typename VT > inline Row& operator+=( const SparseVector<VT,true>& rhs );
197  template< typename VT > inline Row& operator-=( const DenseVector<VT,true>& rhs );
198  template< typename VT > inline Row& operator-=( const SparseVector<VT,true>& rhs );
199  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
200  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
201  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
203  //**********************************************************************************************
204 
205  //**Utility functions***************************************************************************
208  using DataType::row;
209 
210  inline MT& operand() noexcept;
211  inline const MT& operand() const noexcept;
212 
213  inline size_t size() const noexcept;
214  inline size_t capacity() const noexcept;
215  inline size_t nonZeros() const;
216  inline void reset();
217  inline void reserve( size_t n );
219  //**********************************************************************************************
220 
221  //**Insertion functions*************************************************************************
224  inline Iterator set ( size_t index, const ElementType& value );
225  inline Iterator insert( size_t index, const ElementType& value );
226  inline void append( size_t index, const ElementType& value, bool check=false );
228  //**********************************************************************************************
229 
230  //**Erase functions*****************************************************************************
233  inline void erase( size_t index );
234  inline Iterator erase( Iterator pos );
235  inline Iterator erase( Iterator first, Iterator last );
236 
237  template< typename Pred, typename = DisableIf_< IsIntegral<Pred> > >
238  inline void erase( Pred predicate );
239 
240  template< typename Pred >
241  inline void erase( Iterator first, Iterator last, Pred predicate );
243  //**********************************************************************************************
244 
245  //**Lookup functions****************************************************************************
248  inline Iterator find ( size_t index );
249  inline ConstIterator find ( size_t index ) const;
250  inline Iterator lowerBound( size_t index );
251  inline ConstIterator lowerBound( size_t index ) const;
252  inline Iterator upperBound( size_t index );
253  inline ConstIterator upperBound( size_t index ) const;
255  //**********************************************************************************************
256 
257  //**Numeric functions***************************************************************************
260  template< typename Other > inline Row& scale( const Other& scalar );
262  //**********************************************************************************************
263 
264  //**Expression template evaluation functions****************************************************
267  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
268  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
269 
270  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
271  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
272  template< typename VT > inline void addAssign( const DenseVector <VT,true>& rhs );
273  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
274  template< typename VT > inline void subAssign( const DenseVector <VT,true>& rhs );
275  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
277  //**********************************************************************************************
278 
279  private:
280  //**Utility functions***************************************************************************
283  inline size_t extendCapacity() const noexcept;
285  //**********************************************************************************************
286 
287  //**Member variables****************************************************************************
290  Operand matrix_;
291 
292  //**********************************************************************************************
293 
294  //**Compile time checks*************************************************************************
302  //**********************************************************************************************
303 };
305 //*************************************************************************************************
306 
307 
308 
309 
310 //=================================================================================================
311 //
312 // CONSTRUCTORS
313 //
314 //=================================================================================================
315 
316 //*************************************************************************************************
329 template< typename MT // Type of the sparse matrix
330  , bool SF // Symmetry flag
331  , size_t... CRAs > // Compile time row arguments
332 template< typename... RRAs > // Runtime row arguments
333 inline Row<MT,true,false,SF,CRAs...>::Row( MT& matrix, RRAs... args )
334  : DataType( args... ) // Base class initialization
335  , matrix_ ( matrix ) // The matrix containing the row
336 {
337  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
338  if( matrix_.rows() <= row() ) {
339  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
340  }
341  }
342  else {
343  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
344  }
345 }
347 //*************************************************************************************************
348 
349 
350 
351 
352 //=================================================================================================
353 //
354 // DATA ACCESS FUNCTIONS
355 //
356 //=================================================================================================
357 
358 //*************************************************************************************************
368 template< typename MT // Type of the sparse matrix
369  , bool SF // Symmetry flag
370  , size_t... CRAs > // Compile time row arguments
371 inline typename Row<MT,true,false,SF,CRAs...>::Reference
372  Row<MT,true,false,SF,CRAs...>::operator[]( size_t index )
373 {
374  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
375  return matrix_(row(),index);
376 }
378 //*************************************************************************************************
379 
380 
381 //*************************************************************************************************
391 template< typename MT // Type of the sparse matrix
392  , bool SF // Symmetry flag
393  , size_t... CRAs > // Compile time row arguments
394 inline typename Row<MT,true,false,SF,CRAs...>::ConstReference
395  Row<MT,true,false,SF,CRAs...>::operator[]( size_t index ) const
396 {
397  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
398  return const_cast<const MT&>( matrix_ )(row(),index);
399 }
401 //*************************************************************************************************
402 
403 
404 //*************************************************************************************************
415 template< typename MT // Type of the sparse matrix
416  , bool SF // Symmetry flag
417  , size_t... CRAs > // Compile time row arguments
418 inline typename Row<MT,true,false,SF,CRAs...>::Reference
419  Row<MT,true,false,SF,CRAs...>::at( size_t index )
420 {
421  if( index >= size() ) {
422  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
423  }
424  return (*this)[index];
425 }
427 //*************************************************************************************************
428 
429 
430 //*************************************************************************************************
441 template< typename MT // Type of the sparse matrix
442  , bool SF // Symmetry flag
443  , size_t... CRAs > // Compile time row arguments
444 inline typename Row<MT,true,false,SF,CRAs...>::ConstReference
445  Row<MT,true,false,SF,CRAs...>::at( size_t index ) const
446 {
447  if( index >= size() ) {
448  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
449  }
450  return (*this)[index];
451 }
453 //*************************************************************************************************
454 
455 
456 //*************************************************************************************************
464 template< typename MT // Type of the sparse matrix
465  , bool SF // Symmetry flag
466  , size_t... CRAs > // Compile time row arguments
467 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
469 {
470  return matrix_.begin( row() );
471 }
473 //*************************************************************************************************
474 
475 
476 //*************************************************************************************************
484 template< typename MT // Type of the sparse matrix
485  , bool SF // Symmetry flag
486  , size_t... CRAs > // Compile time row arguments
487 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
489 {
490  return matrix_.cbegin( row() );
491 }
493 //*************************************************************************************************
494 
495 
496 //*************************************************************************************************
504 template< typename MT // Type of the sparse matrix
505  , bool SF // Symmetry flag
506  , size_t... CRAs > // Compile time row arguments
507 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
509 {
510  return matrix_.cbegin( row() );
511 }
513 //*************************************************************************************************
514 
515 
516 //*************************************************************************************************
524 template< typename MT // Type of the sparse matrix
525  , bool SF // Symmetry flag
526  , size_t... CRAs > // Compile time row arguments
527 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
529 {
530  return matrix_.end( row() );
531 }
533 //*************************************************************************************************
534 
535 
536 //*************************************************************************************************
544 template< typename MT // Type of the sparse matrix
545  , bool SF // Symmetry flag
546  , size_t... CRAs > // Compile time row arguments
547 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
549 {
550  return matrix_.cend( row() );
551 }
553 //*************************************************************************************************
554 
555 
556 //*************************************************************************************************
564 template< typename MT // Type of the sparse matrix
565  , bool SF // Symmetry flag
566  , size_t... CRAs > // Compile time row arguments
567 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
569 {
570  return matrix_.cend( row() );
571 }
573 //*************************************************************************************************
574 
575 
576 
577 
578 //=================================================================================================
579 //
580 // ASSIGNMENT OPERATORS
581 //
582 //=================================================================================================
583 
584 //*************************************************************************************************
599 template< typename MT // Type of the sparse matrix
600  , bool SF // Symmetry flag
601  , size_t... CRAs > // Compile time row arguments
602 inline Row<MT,true,false,SF,CRAs...>&
603  Row<MT,true,false,SF,CRAs...>::operator=( initializer_list<ElementType> list )
604 {
605  using blaze::assign;
606 
607  if( list.size() > size() ) {
608  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
609  }
610 
611  const InitializerVector<ElementType,true> tmp( list, size() );
612 
613  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
614  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
615  }
616 
617  decltype(auto) left( derestrict( *this ) );
618 
619  left.reset();
620  assign( left, tmp );
621 
622  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
623 
624  return *this;
625 }
627 //*************************************************************************************************
628 
629 
630 //*************************************************************************************************
644 template< typename MT // Type of the sparse matrix
645  , bool SF // Symmetry flag
646  , size_t... CRAs > // Compile time row arguments
647 inline Row<MT,true,false,SF,CRAs...>&
648  Row<MT,true,false,SF,CRAs...>::operator=( const Row& rhs )
649 {
650  using blaze::assign;
651 
655 
656  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
657  return *this;
658 
659  if( size() != rhs.size() ) {
660  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
661  }
662 
663  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
664  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
665  }
666 
667  decltype(auto) left( derestrict( *this ) );
668 
669  if( rhs.canAlias( &matrix_ ) ) {
670  const ResultType tmp( rhs );
671  left.reset();
672  left.reserve( tmp.nonZeros() );
673  assign( left, tmp );
674  }
675  else {
676  left.reset();
677  left.reserve( rhs.nonZeros() );
678  assign( left, rhs );
679  }
680 
681  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
682 
683  return *this;
684 }
686 //*************************************************************************************************
687 
688 
689 //*************************************************************************************************
703 template< typename MT // Type of the sparse matrix
704  , bool SF // Symmetry flag
705  , size_t... CRAs > // Compile time row arguments
706 template< typename VT > // Type of the right-hand side dense vector
707 inline Row<MT,true,false,SF,CRAs...>&
708  Row<MT,true,false,SF,CRAs...>::operator=( const DenseVector<VT,true>& rhs )
709 {
710  using blaze::assign;
711 
712  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
713  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
715 
716  if( size() != (~rhs).size() ) {
717  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
718  }
719 
720  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
721  Right right( ~rhs );
722 
723  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
724  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
725  }
726 
727  decltype(auto) left( derestrict( *this ) );
728 
729  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
730  const ResultType_<VT> tmp( right );
731  left.reset();
732  assign( left, tmp );
733  }
734  else {
735  left.reset();
736  assign( left, right );
737  }
738 
739  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
740 
741  return *this;
742 }
744 //*************************************************************************************************
745 
746 
747 //*************************************************************************************************
761 template< typename MT // Type of the sparse matrix
762  , bool SF // Symmetry flag
763  , size_t... CRAs > // Compile time row arguments
764 template< typename VT > // Type of the right-hand side sparse vector
765 inline Row<MT,true,false,SF,CRAs...>&
766  Row<MT,true,false,SF,CRAs...>::operator=( const SparseVector<VT,true>& rhs )
767 {
768  using blaze::assign;
769 
771  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
773 
774  if( size() != (~rhs).size() ) {
775  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
776  }
777 
778  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
779  Right right( ~rhs );
780 
781  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
782  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
783  }
784 
785  decltype(auto) left( derestrict( *this ) );
786 
787  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
788  const ResultType_<VT> tmp( right );
789  left.reset();
790  left.reserve( tmp.nonZeros() );
791  assign( left, tmp );
792  }
793  else {
794  left.reset();
795  left.reserve( right.nonZeros() );
796  assign( left, right );
797  }
798 
799  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
800 
801  return *this;
802 }
804 //*************************************************************************************************
805 
806 
807 //*************************************************************************************************
821 template< typename MT // Type of the sparse matrix
822  , bool SF // Symmetry flag
823  , size_t... CRAs > // Compile time row arguments
824 template< typename VT > // Type of the right-hand side dense vector
825 inline Row<MT,true,false,SF,CRAs...>&
826  Row<MT,true,false,SF,CRAs...>::operator+=( const DenseVector<VT,true>& rhs )
827 {
828  using blaze::assign;
829 
833  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
834  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
836 
837  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
838 
842 
843  if( size() != (~rhs).size() ) {
844  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
845  }
846 
847  const AddType tmp( *this + (~rhs) );
848 
849  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
850  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
851  }
852 
853  decltype(auto) left( derestrict( *this ) );
854 
855  left.reset();
856  assign( left, tmp );
857 
858  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
859 
860  return *this;
861 }
863 //*************************************************************************************************
864 
865 
866 //*************************************************************************************************
880 template< typename MT // Type of the sparse matrix
881  , bool SF // Symmetry flag
882  , size_t... CRAs > // Compile time row arguments
883 template< typename VT > // Type of the right-hand side sparse vector
884 inline Row<MT,true,false,SF,CRAs...>&
885  Row<MT,true,false,SF,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
886 {
887  using blaze::assign;
888 
893  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
895 
896  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
897 
901 
902  if( size() != (~rhs).size() ) {
903  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
904  }
905 
906  const AddType tmp( *this + (~rhs) );
907 
908  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
909  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
910  }
911 
912  decltype(auto) left( derestrict( *this ) );
913 
914  left.reset();
915  left.reserve( tmp.nonZeros() );
916  assign( left, tmp );
917 
918  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
919 
920  return *this;
921 }
923 //*************************************************************************************************
924 
925 
926 //*************************************************************************************************
941 template< typename MT // Type of the sparse matrix
942  , bool SF // Symmetry flag
943  , size_t... CRAs > // Compile time row arguments
944 template< typename VT > // Type of the right-hand side dense vector
945 inline Row<MT,true,false,SF,CRAs...>&
946  Row<MT,true,false,SF,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
947 {
948  using blaze::assign;
949 
953  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
954  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
956 
957  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
958 
962 
963  if( size() != (~rhs).size() ) {
964  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
965  }
966 
967  const SubType tmp( *this - (~rhs) );
968 
969  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
970  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
971  }
972 
973  decltype(auto) left( derestrict( *this ) );
974 
975  left.reset();
976  assign( left, tmp );
977 
978  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
979 
980  return *this;
981 }
983 //*************************************************************************************************
984 
985 
986 //*************************************************************************************************
1001 template< typename MT // Type of the sparse matrix
1002  , bool SF // Symmetry flag
1003  , size_t... CRAs > // Compile time row arguments
1004 template< typename VT > // Type of the right-hand side sparse vector
1005 inline Row<MT,true,false,SF,CRAs...>&
1006  Row<MT,true,false,SF,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
1007 {
1008  using blaze::assign;
1009 
1013  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_<VT> );
1014  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1016 
1017  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
1018 
1022 
1023  if( size() != (~rhs).size() ) {
1024  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1025  }
1026 
1027  const SubType tmp( *this - (~rhs) );
1028 
1029  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1030  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1031  }
1032 
1033  decltype(auto) left( derestrict( *this ) );
1034 
1035  left.reset();
1036  left.reserve( tmp.nonZeros() );
1037  assign( left, tmp );
1038 
1039  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1040 
1041  return *this;
1042 }
1044 //*************************************************************************************************
1045 
1046 
1047 //*************************************************************************************************
1060 template< typename MT // Type of the sparse matrix
1061  , bool SF // Symmetry flag
1062  , size_t... CRAs > // Compile time row arguments
1063 template< typename VT > // Type of the right-hand side vector
1064 inline Row<MT,true,false,SF,CRAs...>&
1065  Row<MT,true,false,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1066 {
1067  using blaze::assign;
1068 
1072  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1074 
1075  using MultType = MultTrait_< ResultType, ResultType_<VT> >;
1076 
1079 
1080  if( size() != (~rhs).size() ) {
1081  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1082  }
1083 
1084  const MultType tmp( *this * (~rhs) );
1085 
1086  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1087  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1088  }
1089 
1090  decltype(auto) left( derestrict( *this ) );
1091 
1092  left.reset();
1093  assign( left, tmp );
1094 
1095  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1096 
1097  return *this;
1098 }
1100 //*************************************************************************************************
1101 
1102 
1103 //*************************************************************************************************
1115 template< typename MT // Type of the sparse matrix
1116  , bool SF // Symmetry flag
1117  , size_t... CRAs > // Compile time row arguments
1118 template< typename VT > // Type of the right-hand side vector
1119 inline Row<MT,true,false,SF,CRAs...>&
1120  Row<MT,true,false,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1121 {
1122  using blaze::assign;
1123 
1127  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
1128  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1130 
1131  using DivType = DivTrait_< ResultType, ResultType_<VT> >;
1132 
1136 
1137  if( size() != (~rhs).size() ) {
1138  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1139  }
1140 
1141  const DivType tmp( *this / (~rhs) );
1142 
1143  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1144  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1145  }
1146 
1147  decltype(auto) left( derestrict( *this ) );
1148 
1149  left.reset();
1150  assign( left, tmp );
1151 
1152  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1153 
1154  return *this;
1155 }
1157 //*************************************************************************************************
1158 
1159 
1160 //*************************************************************************************************
1173 template< typename MT // Type of the sparse matrix
1174  , bool SF // Symmetry flag
1175  , size_t... CRAs > // Compile time row arguments
1176 template< typename VT > // Type of the right-hand side vector
1177 inline Row<MT,true,false,SF,CRAs...>&
1178  Row<MT,true,false,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1179 {
1180  using blaze::assign;
1181 
1182  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
1184 
1185  using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1186 
1190 
1191  if( size() != 3UL || (~rhs).size() != 3UL ) {
1192  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1193  }
1194 
1195  const CrossType tmp( *this % (~rhs) );
1196 
1197  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
1198  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1199  }
1200 
1201  decltype(auto) left( derestrict( *this ) );
1202 
1203  left.reset();
1204  assign( left, tmp );
1205 
1206  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1207 
1208  return *this;
1209 }
1211 //*************************************************************************************************
1212 
1213 
1214 
1215 
1216 //=================================================================================================
1217 //
1218 // UTILITY FUNCTIONS
1219 //
1220 //=================================================================================================
1221 
1222 //*************************************************************************************************
1228 template< typename MT // Type of the sparse matrix
1229  , bool SF // Symmetry flag
1230  , size_t... CRAs > // Compile time row arguments
1231 inline MT& Row<MT,true,false,SF,CRAs...>::operand() noexcept
1232 {
1233  return matrix_;
1234 }
1236 //*************************************************************************************************
1237 
1238 
1239 //*************************************************************************************************
1245 template< typename MT // Type of the sparse matrix
1246  , bool SF // Symmetry flag
1247  , size_t... CRAs > // Compile time row arguments
1248 inline const MT& Row<MT,true,false,SF,CRAs...>::operand() const noexcept
1249 {
1250  return matrix_;
1251 }
1253 //*************************************************************************************************
1254 
1255 
1256 //*************************************************************************************************
1262 template< typename MT // Type of the sparse matrix
1263  , bool SF // Symmetry flag
1264  , size_t... CRAs > // Compile time row arguments
1265 inline size_t Row<MT,true,false,SF,CRAs...>::size() const noexcept
1266 {
1267  return matrix_.columns();
1268 }
1270 //*************************************************************************************************
1271 
1272 
1273 //*************************************************************************************************
1279 template< typename MT // Type of the sparse matrix
1280  , bool SF // Symmetry flag
1281  , size_t... CRAs > // Compile time row arguments
1282 inline size_t Row<MT,true,false,SF,CRAs...>::capacity() const noexcept
1283 {
1284  return matrix_.capacity( row() );
1285 }
1287 //*************************************************************************************************
1288 
1289 
1290 //*************************************************************************************************
1299 template< typename MT // Type of the sparse matrix
1300  , bool SF // Symmetry flag
1301  , size_t... CRAs > // Compile time row arguments
1302 inline size_t Row<MT,true,false,SF,CRAs...>::nonZeros() const
1303 {
1304  return matrix_.nonZeros( row() );
1305 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1316 template< typename MT // Type of the sparse matrix
1317  , bool SF // Symmetry flag
1318  , size_t... CRAs > // Compile time row arguments
1320 {
1321  matrix_.reset( row() );
1322 }
1324 //*************************************************************************************************
1325 
1326 
1327 //*************************************************************************************************
1337 template< typename MT // Type of the sparse matrix
1338  , bool SF // Symmetry flag
1339  , size_t... CRAs > // Compile time row arguments
1340 void Row<MT,true,false,SF,CRAs...>::reserve( size_t n )
1341 {
1342  matrix_.reserve( row(), n );
1343 }
1345 //*************************************************************************************************
1346 
1347 
1348 //*************************************************************************************************
1357 template< typename MT // Type of the sparse matrix
1358  , bool SF // Symmetry flag
1359  , size_t... CRAs > // Compile time row arguments
1360 inline size_t Row<MT,true,false,SF,CRAs...>::extendCapacity() const noexcept
1361 {
1362  using blaze::max;
1363  using blaze::min;
1364 
1365  size_t nonzeros( 2UL*capacity()+1UL );
1366  nonzeros = max( nonzeros, 7UL );
1367  nonzeros = min( nonzeros, size() );
1368 
1369  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
1370 
1371  return nonzeros;
1372 }
1374 //*************************************************************************************************
1375 
1376 
1377 
1378 
1379 //=================================================================================================
1380 //
1381 // INSERTION FUNCTIONS
1382 //
1383 //=================================================================================================
1384 
1385 //*************************************************************************************************
1397 template< typename MT // Type of the sparse matrix
1398  , bool SF // Symmetry flag
1399  , size_t... CRAs > // Compile time row arguments
1400 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1401  Row<MT,true,false,SF,CRAs...>::set( size_t index, const ElementType& value )
1402 {
1403  return matrix_.set( row(), index, value );
1404 }
1406 //*************************************************************************************************
1407 
1408 
1409 //*************************************************************************************************
1422 template< typename MT // Type of the sparse matrix
1423  , bool SF // Symmetry flag
1424  , size_t... CRAs > // Compile time row arguments
1425 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1426  Row<MT,true,false,SF,CRAs...>::insert( size_t index, const ElementType& value )
1427 {
1428  return matrix_.insert( row(), index, value );
1429 }
1431 //*************************************************************************************************
1432 
1433 
1434 //*************************************************************************************************
1459 template< typename MT // Type of the sparse matrix
1460  , bool SF // Symmetry flag
1461  , size_t... CRAs > // Compile time row arguments
1462 inline void Row<MT,true,false,SF,CRAs...>::append( size_t index, const ElementType& value, bool check )
1463 {
1464  matrix_.append( row(), index, value, check );
1465 }
1467 //*************************************************************************************************
1468 
1469 
1470 
1471 
1472 //=================================================================================================
1473 //
1474 // ERASE FUNCTIONS
1475 //
1476 //=================================================================================================
1477 
1478 //*************************************************************************************************
1487 template< typename MT // Type of the sparse matrix
1488  , bool SF // Symmetry flag
1489  , size_t... CRAs > // Compile time row arguments
1490 inline void Row<MT,true,false,SF,CRAs...>::erase( size_t index )
1491 {
1492  matrix_.erase( row(), index );
1493 }
1495 //*************************************************************************************************
1496 
1497 
1498 //*************************************************************************************************
1507 template< typename MT // Type of the sparse matrix
1508  , bool SF // Symmetry flag
1509  , size_t... CRAs > // Compile time row arguments
1510 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1511  Row<MT,true,false,SF,CRAs...>::erase( Iterator pos )
1512 {
1513  return matrix_.erase( row(), pos );
1514 }
1516 //*************************************************************************************************
1517 
1518 
1519 //*************************************************************************************************
1529 template< typename MT // Type of the sparse matrix
1530  , bool SF // Symmetry flag
1531  , size_t... CRAs > // Compile time row arguments
1532 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1533  Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last )
1534 {
1535  return matrix_.erase( row(), first, last );
1536 }
1538 //*************************************************************************************************
1539 
1540 
1541 //*************************************************************************************************
1564 template< typename MT // Type of the sparse matrix
1565  , bool SF // Symmetry flag
1566  , size_t... CRAs > // Compile time row arguments
1567 template< typename Pred // Type of the unary predicate
1568  , typename > // Type restriction on the unary predicate
1569 inline void Row<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1570 {
1571  matrix_.erase( row(), begin(), end(), predicate );
1572 }
1574 //*************************************************************************************************
1575 
1576 
1577 //*************************************************************************************************
1602 template< typename MT // Type of the sparse matrix
1603  , bool SF // Symmetry flag
1604  , size_t... CRAs > // Compile time row arguments
1605 template< typename Pred > // Type of the unary predicate
1606 inline void Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
1607 {
1608  matrix_.erase( row(), first, last, predicate );
1609 }
1611 //*************************************************************************************************
1612 
1613 
1614 
1615 
1616 //=================================================================================================
1617 //
1618 // LOOKUP FUNCTIONS
1619 //
1620 //=================================================================================================
1621 
1622 //*************************************************************************************************
1636 template< typename MT // Type of the sparse matrix
1637  , bool SF // Symmetry flag
1638  , size_t... CRAs > // Compile time row arguments
1639 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1640  Row<MT,true,false,SF,CRAs...>::find( size_t index )
1641 {
1642  return matrix_.find( row(), index );
1643 }
1645 //*************************************************************************************************
1646 
1647 
1648 //*************************************************************************************************
1662 template< typename MT // Type of the sparse matrix
1663  , bool SF // Symmetry flag
1664  , size_t... CRAs > // Compile time row arguments
1665 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1666  Row<MT,true,false,SF,CRAs...>::find( size_t index ) const
1667 {
1668  return matrix_.find( row(), index );
1669 }
1671 //*************************************************************************************************
1672 
1673 
1674 //*************************************************************************************************
1687 template< typename MT // Type of the sparse matrix
1688  , bool SF // Symmetry flag
1689  , size_t... CRAs > // Compile time row arguments
1690 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1691  Row<MT,true,false,SF,CRAs...>::lowerBound( size_t index )
1692 {
1693  return matrix_.lowerBound( row(), index );
1694 }
1696 //*************************************************************************************************
1697 
1698 
1699 //*************************************************************************************************
1712 template< typename MT // Type of the sparse matrix
1713  , bool SF // Symmetry flag
1714  , size_t... CRAs > // Compile time row arguments
1715 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1716  Row<MT,true,false,SF,CRAs...>::lowerBound( size_t index ) const
1717 {
1718  return matrix_.lowerBound( row(), index );
1719 }
1721 //*************************************************************************************************
1722 
1723 
1724 //*************************************************************************************************
1737 template< typename MT // Type of the sparse matrix
1738  , bool SF // Symmetry flag
1739  , size_t... CRAs > // Compile time row arguments
1740 inline typename Row<MT,true,false,SF,CRAs...>::Iterator
1741  Row<MT,true,false,SF,CRAs...>::upperBound( size_t index )
1742 {
1743  return matrix_.upperBound( row(), index );
1744 }
1746 //*************************************************************************************************
1747 
1748 
1749 //*************************************************************************************************
1762 template< typename MT // Type of the sparse matrix
1763  , bool SF // Symmetry flag
1764  , size_t... CRAs > // Compile time row arguments
1765 inline typename Row<MT,true,false,SF,CRAs...>::ConstIterator
1766  Row<MT,true,false,SF,CRAs...>::upperBound( size_t index ) const
1767 {
1768  return matrix_.upperBound( row(), index );
1769 }
1771 //*************************************************************************************************
1772 
1773 
1774 
1775 
1776 //=================================================================================================
1777 //
1778 // NUMERIC FUNCTIONS
1779 //
1780 //=================================================================================================
1781 
1782 //*************************************************************************************************
1795 template< typename MT // Type of the sparse matrix
1796  , bool SF // Symmetry flag
1797  , size_t... CRAs > // Compile time row arguments
1798 template< typename Other > // Data type of the scalar value
1799 inline Row<MT,true,false,SF,CRAs...>&
1800  Row<MT,true,false,SF,CRAs...>::scale( const Other& scalar )
1801 {
1803 
1804  for( Iterator element=begin(); element!=end(); ++element )
1805  element->value() *= scalar;
1806  return *this;
1807 }
1809 //*************************************************************************************************
1810 
1811 
1812 
1813 
1814 //=================================================================================================
1815 //
1816 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1817 //
1818 //=================================================================================================
1819 
1820 //*************************************************************************************************
1831 template< typename MT // Type of the sparse matrix
1832  , bool SF // Symmetry flag
1833  , size_t... CRAs > // Compile time row arguments
1834 template< typename Other > // Data type of the foreign expression
1835 inline bool Row<MT,true,false,SF,CRAs...>::canAlias( const Other* alias ) const noexcept
1836 {
1837  return matrix_.isAliased( alias );
1838 }
1840 //*************************************************************************************************
1841 
1842 
1843 //*************************************************************************************************
1854 template< typename MT // Type of the sparse matrix
1855  , bool SF // Symmetry flag
1856  , size_t... CRAs > // Compile time row arguments
1857 template< typename Other > // Data type of the foreign expression
1858 inline bool Row<MT,true,false,SF,CRAs...>::isAliased( const Other* alias ) const noexcept
1859 {
1860  return matrix_.isAliased( alias );
1861 }
1863 //*************************************************************************************************
1864 
1865 
1866 //*************************************************************************************************
1878 template< typename MT // Type of the sparse matrix
1879  , bool SF // Symmetry flag
1880  , size_t... CRAs > // Compile time row arguments
1881 template< typename VT > // Type of the right-hand side dense vector
1882 inline void Row<MT,true,false,SF,CRAs...>::assign( const DenseVector<VT,true>& rhs )
1883 {
1884  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1885  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1886 
1887  for( size_t j=0UL; j<size(); ++j )
1888  {
1889  if( matrix_.nonZeros( row() ) == matrix_.capacity( row() ) )
1890  matrix_.reserve( row(), extendCapacity() );
1891 
1892  matrix_.append( row(), j, (~rhs)[j], true );
1893  }
1894 }
1896 //*************************************************************************************************
1897 
1898 
1899 //*************************************************************************************************
1911 template< typename MT // Type of the sparse matrix
1912  , bool SF // Symmetry flag
1913  , size_t... CRAs > // Compile time row arguments
1914 template< typename VT > // Type of the right-hand side sparse vector
1915 inline void Row<MT,true,false,SF,CRAs...>::assign( const SparseVector<VT,true>& rhs )
1916 {
1917  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1918  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1919 
1920  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1921  matrix_.append( row(), element->index(), element->value(), true );
1922  }
1923 }
1925 //*************************************************************************************************
1926 
1927 
1928 //*************************************************************************************************
1940 template< typename MT // Type of the sparse matrix
1941  , bool SF // Symmetry flag
1942  , size_t... CRAs > // Compile time row arguments
1943 template< typename VT > // Type of the right-hand side dense vector
1944 inline void Row<MT,true,false,SF,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
1945 {
1946  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1947 
1951 
1952  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1953 
1954  const AddType tmp( serial( *this + (~rhs) ) );
1955  matrix_.reset( row() );
1956  assign( tmp );
1957 }
1959 //*************************************************************************************************
1960 
1961 
1962 //*************************************************************************************************
1974 template< typename MT // Type of the sparse matrix
1975  , bool SF // Symmetry flag
1976  , size_t... CRAs > // Compile time row arguments
1977 template< typename VT > // Type of the right-hand side sparse vector
1978 inline void Row<MT,true,false,SF,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
1979 {
1980  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1981 
1985 
1986  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1987 
1988  const AddType tmp( serial( *this + (~rhs) ) );
1989  matrix_.reset( row() );
1990  matrix_.reserve( row(), tmp.nonZeros() );
1991  assign( tmp );
1992 }
1994 //*************************************************************************************************
1995 
1996 
1997 //*************************************************************************************************
2009 template< typename MT // Type of the sparse matrix
2010  , bool SF // Symmetry flag
2011  , size_t... CRAs > // Compile time row arguments
2012 template< typename VT > // Type of the right-hand side dense vector
2013 inline void Row<MT,true,false,SF,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
2014 {
2015  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2016 
2020 
2021  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2022 
2023  const SubType tmp( serial( *this - (~rhs) ) );
2024  matrix_.reset( row() );
2025  assign( tmp );
2026 }
2028 //*************************************************************************************************
2029 
2030 
2031 //*************************************************************************************************
2043 template< typename MT // Type of the sparse matrix
2044  , bool SF // Symmetry flag
2045  , size_t... CRAs > // Compile time row arguments
2046 template< typename VT > // Type of the right-hand side sparse vector
2047 inline void Row<MT,true,false,SF,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
2048 {
2049  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2050 
2054 
2055  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2056 
2057  const SubType tmp( serial( *this - (~rhs) ) );
2058  matrix_.reset( row() );
2059  matrix_.reserve( row(), tmp.nonZeros() );
2060  assign( tmp );
2061 }
2063 //*************************************************************************************************
2064 
2065 
2066 
2067 
2068 
2069 
2070 
2071 
2072 //=================================================================================================
2073 //
2074 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR SPARSE MATRICES
2075 //
2076 //=================================================================================================
2077 
2078 //*************************************************************************************************
2086 template< typename MT // Type of the sparse matrix
2087  , size_t... CRAs > // Compile time row arguments
2088 class Row<MT,false,false,false,CRAs...>
2089  : public View< SparseVector< Row<MT,false,false,false,CRAs...>, true > >
2090  , private RowData<CRAs...>
2091 {
2092  private:
2093  //**Type definitions****************************************************************************
2094  using DataType = RowData<CRAs...>;
2095  using Operand = If_< IsExpression<MT>, MT, MT& >;
2096  //**********************************************************************************************
2097 
2098  public:
2099  //**Type definitions****************************************************************************
2101  using This = Row<MT,false,false,false,CRAs...>;
2102 
2103  using BaseType = SparseVector<This,true>;
2104  using ViewedType = MT;
2105  using ResultType = RowTrait_<MT,CRAs...>;
2106  using TransposeType = TransposeType_<ResultType>;
2107  using ElementType = ElementType_<MT>;
2108  using ReturnType = ReturnType_<MT>;
2109  using CompositeType = const Row&;
2110 
2112  using ConstReference = ConstReference_<MT>;
2113 
2115  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
2116  //**********************************************************************************************
2117 
2118  //**RowElement class definition*****************************************************************
2121  template< typename MatrixType // Type of the sparse matrix
2122  , typename IteratorType > // Type of the sparse matrix iterator
2123  class RowElement
2124  : private SparseElement
2125  {
2126  public:
2127  //**Constructor******************************************************************************
2133  inline RowElement( IteratorType pos, size_t column )
2134  : pos_ ( pos ) // Iterator to the current position within the sparse row
2135  , column_( column ) // Index of the according column
2136  {}
2137  //*******************************************************************************************
2138 
2139  //**Assignment operator**********************************************************************
2145  template< typename T > inline RowElement& operator=( const T& v ) {
2146  *pos_ = v;
2147  return *this;
2148  }
2149  //*******************************************************************************************
2150 
2151  //**Addition assignment operator*************************************************************
2157  template< typename T > inline RowElement& operator+=( const T& v ) {
2158  *pos_ += v;
2159  return *this;
2160  }
2161  //*******************************************************************************************
2162 
2163  //**Subtraction assignment operator**********************************************************
2169  template< typename T > inline RowElement& operator-=( const T& v ) {
2170  *pos_ -= v;
2171  return *this;
2172  }
2173  //*******************************************************************************************
2174 
2175  //**Multiplication assignment operator*******************************************************
2181  template< typename T > inline RowElement& operator*=( const T& v ) {
2182  *pos_ *= v;
2183  return *this;
2184  }
2185  //*******************************************************************************************
2186 
2187  //**Division assignment operator*************************************************************
2193  template< typename T > inline RowElement& operator/=( const T& v ) {
2194  *pos_ /= v;
2195  return *this;
2196  }
2197  //*******************************************************************************************
2198 
2199  //**Element access operator******************************************************************
2204  inline const RowElement* operator->() const {
2205  return this;
2206  }
2207  //*******************************************************************************************
2208 
2209  //**Value function***************************************************************************
2214  inline decltype(auto) value() const {
2215  return pos_->value();
2216  }
2217  //*******************************************************************************************
2218 
2219  //**Index function***************************************************************************
2224  inline size_t index() const {
2225  return column_;
2226  }
2227  //*******************************************************************************************
2228 
2229  private:
2230  //**Member variables*************************************************************************
2231  IteratorType pos_;
2232  size_t column_;
2233  //*******************************************************************************************
2234  };
2235  //**********************************************************************************************
2236 
2237  //**RowIterator class definition****************************************************************
2240  template< typename MatrixType // Type of the sparse matrix
2241  , typename IteratorType > // Type of the sparse matrix iterator
2242  class RowIterator
2243  {
2244  public:
2245  //**Type definitions*************************************************************************
2246  using IteratorCategory = std::forward_iterator_tag;
2247  using ValueType = RowElement<MatrixType,IteratorType>;
2248  using PointerType = ValueType;
2249  using ReferenceType = ValueType;
2250  using DifferenceType = ptrdiff_t;
2251 
2252  // STL iterator requirements
2253  using iterator_category = IteratorCategory;
2254  using value_type = ValueType;
2255  using pointer = PointerType;
2256  using reference = ReferenceType;
2257  using difference_type = DifferenceType;
2258  //*******************************************************************************************
2259 
2260  //**Constructor******************************************************************************
2263  inline RowIterator()
2264  : matrix_( nullptr ) // The sparse matrix containing the row
2265  , row_ ( 0UL ) // The current row index
2266  , column_( 0UL ) // The current column index
2267  , pos_ () // Iterator to the current sparse element
2268  {}
2269  //*******************************************************************************************
2270 
2271  //**Constructor******************************************************************************
2278  inline RowIterator( MatrixType& matrix, size_t row, size_t column )
2279  : matrix_( &matrix ) // The sparse matrix containing the row
2280  , row_ ( row ) // The current row index
2281  , column_( column ) // The current column index
2282  , pos_ () // Iterator to the current sparse element
2283  {
2284  for( ; column_<matrix_->columns(); ++column_ ) {
2285  pos_ = matrix_->find( row_, column_ );
2286  if( pos_ != matrix_->end( column_ ) ) break;
2287  }
2288  }
2289  //*******************************************************************************************
2290 
2291  //**Constructor******************************************************************************
2299  inline RowIterator( MatrixType& matrix, size_t row, size_t column, IteratorType pos )
2300  : matrix_( &matrix ) // The sparse matrix containing the row
2301  , row_ ( row ) // The current row index
2302  , column_( column ) // The current column index
2303  , pos_ ( pos ) // Iterator to the current sparse element
2304  {
2305  BLAZE_INTERNAL_ASSERT( matrix.find( row, column ) == pos, "Invalid initial iterator position" );
2306  }
2307  //*******************************************************************************************
2308 
2309  //**Constructor******************************************************************************
2314  template< typename MatrixType2, typename IteratorType2 >
2315  inline RowIterator( const RowIterator<MatrixType2,IteratorType2>& it )
2316  : matrix_( it.matrix_ ) // The sparse matrix containing the row
2317  , row_ ( it.row_ ) // The current row index
2318  , column_( it.column_ ) // The current column index
2319  , pos_ ( it.pos_ ) // Iterator to the current sparse element
2320  {}
2321  //*******************************************************************************************
2322 
2323  //**Prefix increment operator****************************************************************
2328  inline RowIterator& operator++() {
2329  ++column_;
2330  for( ; column_<matrix_->columns(); ++column_ ) {
2331  pos_ = matrix_->find( row_, column_ );
2332  if( pos_ != matrix_->end( column_ ) ) break;
2333  }
2334 
2335  return *this;
2336  }
2337  //*******************************************************************************************
2338 
2339  //**Postfix increment operator***************************************************************
2344  inline const RowIterator operator++( int ) {
2345  const RowIterator tmp( *this );
2346  ++(*this);
2347  return tmp;
2348  }
2349  //*******************************************************************************************
2350 
2351  //**Element access operator******************************************************************
2356  inline ReferenceType operator*() const {
2357  return ReferenceType( pos_, column_ );
2358  }
2359  //*******************************************************************************************
2360 
2361  //**Element access operator******************************************************************
2366  inline PointerType operator->() const {
2367  return PointerType( pos_, column_ );
2368  }
2369  //*******************************************************************************************
2370 
2371  //**Equality operator************************************************************************
2377  template< typename MatrixType2, typename IteratorType2 >
2378  inline bool operator==( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2379  return column_ == rhs.column_;
2380  }
2381  //*******************************************************************************************
2382 
2383  //**Inequality operator**********************************************************************
2389  template< typename MatrixType2, typename IteratorType2 >
2390  inline bool operator!=( const RowIterator<MatrixType2,IteratorType2>& rhs ) const noexcept {
2391  return !( *this == rhs );
2392  }
2393  //*******************************************************************************************
2394 
2395  //**Subtraction operator*********************************************************************
2401  inline DifferenceType operator-( const RowIterator& rhs ) const {
2402  size_t counter( 0UL );
2403  for( size_t j=rhs.column_; j<column_; ++j ) {
2404  if( matrix_->find( row_, j ) != matrix_->end( j ) )
2405  ++counter;
2406  }
2407  return counter;
2408  }
2409  //*******************************************************************************************
2410 
2411  private:
2412  //**Member variables*************************************************************************
2413  MatrixType* matrix_;
2414  size_t row_;
2415  size_t column_;
2416  IteratorType pos_;
2417  //*******************************************************************************************
2418 
2419  //**Friend declarations**********************************************************************
2420  template< typename MatrixType2, typename IteratorType2 > friend class RowIterator;
2421  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CRAs2 > friend class Row;
2422  //*******************************************************************************************
2423  };
2424  //**********************************************************************************************
2425 
2426  //**Type definitions****************************************************************************
2428  using ConstIterator = RowIterator< const MT, ConstIterator_<MT> >;
2429 
2431  using Iterator = If_< IsConst<MT>, ConstIterator, RowIterator< MT, Iterator_<MT> > >;
2432  //**********************************************************************************************
2433 
2434  //**Compilation flags***************************************************************************
2436  enum : bool { smpAssignable = false };
2437  //**********************************************************************************************
2438 
2439  //**Constructors********************************************************************************
2442  template< typename... RRAs >
2443  explicit inline Row( MT& matrix, RRAs... args );
2444  // No explicitly declared copy constructor.
2446  //**********************************************************************************************
2447 
2448  //**Destructor**********************************************************************************
2449  // No explicitly declared destructor.
2450  //**********************************************************************************************
2451 
2452  //**Data access functions***********************************************************************
2455  inline Reference operator[]( size_t index );
2456  inline ConstReference operator[]( size_t index ) const;
2457  inline Reference at( size_t index );
2458  inline ConstReference at( size_t index ) const;
2459  inline Iterator begin ();
2460  inline ConstIterator begin () const;
2461  inline ConstIterator cbegin() const;
2462  inline Iterator end ();
2463  inline ConstIterator end () const;
2464  inline ConstIterator cend () const;
2466  //**********************************************************************************************
2467 
2468  //**Assignment operators************************************************************************
2471  inline Row& operator=( initializer_list<ElementType> list );
2472  inline Row& operator=( const Row& rhs );
2473 
2474  template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2475  template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2476  template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2477  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
2478  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2479  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
2481  //**********************************************************************************************
2482 
2483  //**Utility functions***************************************************************************
2486  using DataType::row;
2487 
2488  inline MT& operand() noexcept;
2489  inline const MT& operand() const noexcept;
2490 
2491  inline size_t size() const noexcept;
2492  inline size_t capacity() const noexcept;
2493  inline size_t nonZeros() const;
2494  inline void reset();
2495  inline void reserve( size_t n );
2497  //**********************************************************************************************
2498 
2499  //**Insertion functions*************************************************************************
2502  inline Iterator set ( size_t index, const ElementType& value );
2503  inline Iterator insert( size_t index, const ElementType& value );
2504  inline void append( size_t index, const ElementType& value, bool check=false );
2506  //**********************************************************************************************
2507 
2508  //**Erase functions*****************************************************************************
2511  inline void erase( size_t index );
2512  inline Iterator erase( Iterator pos );
2513  inline Iterator erase( Iterator first, Iterator last );
2514 
2515  template< typename Pred, typename = DisableIf_< IsIntegral<Pred> > >
2516  inline void erase( Pred predicate );
2517 
2518  template< typename Pred >
2519  inline void erase( Iterator first, Iterator last, Pred predicate );
2521  //**********************************************************************************************
2522 
2523  //**Lookup functions****************************************************************************
2526  inline Iterator find ( size_t index );
2527  inline ConstIterator find ( size_t index ) const;
2528  inline Iterator lowerBound( size_t index );
2529  inline ConstIterator lowerBound( size_t index ) const;
2530  inline Iterator upperBound( size_t index );
2531  inline ConstIterator upperBound( size_t index ) const;
2533  //**********************************************************************************************
2534 
2535  //**Numeric functions***************************************************************************
2538  template< typename Other > inline Row& scale( const Other& scalar );
2540  //**********************************************************************************************
2541 
2542  //**Expression template evaluation functions****************************************************
2545  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
2546  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
2547 
2548  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2549  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2550  template< typename VT > inline void addAssign( const Vector<VT,true>& rhs );
2551  template< typename VT > inline void subAssign( const Vector<VT,true>& rhs );
2553  //**********************************************************************************************
2554 
2555  private:
2556  //**Member variables****************************************************************************
2559  Operand matrix_;
2560 
2561  //**********************************************************************************************
2562 
2563  //**Compile time checks*************************************************************************
2572  //**********************************************************************************************
2573 };
2575 //*************************************************************************************************
2576 
2577 
2578 
2579 
2580 //=================================================================================================
2581 //
2582 // CONSTRUCTORS
2583 //
2584 //=================================================================================================
2585 
2586 //*************************************************************************************************
2594 template< typename MT // Type of the sparse matrix
2595  , size_t... CRAs > // Compile time row arguments
2596 template< typename... RRAs > // Runtime row arguments
2597 inline Row<MT,false,false,false,CRAs...>::Row( MT& matrix, RRAs... args )
2598  : DataType( args... ) // Base class initialization
2599  , matrix_ ( matrix ) // The matrix containing the row
2600 {
2601  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
2602  if( matrix_.rows() <= row() ) {
2603  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
2604  }
2605  }
2606  else {
2607  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
2608  }
2609 }
2611 //*************************************************************************************************
2612 
2613 
2614 
2615 
2616 //=================================================================================================
2617 //
2618 // DATA ACCESS FUNCTIONS
2619 //
2620 //=================================================================================================
2621 
2622 //*************************************************************************************************
2632 template< typename MT // Type of the sparse matrix
2633  , size_t... CRAs > // Compile time row arguments
2634 inline typename Row<MT,false,false,false,CRAs...>::Reference
2635  Row<MT,false,false,false,CRAs...>::operator[]( size_t index )
2636 {
2637  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2638  return matrix_(row(),index);
2639 }
2641 //*************************************************************************************************
2642 
2643 
2644 //*************************************************************************************************
2654 template< typename MT // Type of the sparse matrix
2655  , size_t... CRAs > // Compile time row arguments
2656 inline typename Row<MT,false,false,false,CRAs...>::ConstReference
2657  Row<MT,false,false,false,CRAs...>::operator[]( size_t index ) const
2658 {
2659  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2660  return const_cast<const MT&>( matrix_ )(row(),index);
2661 }
2663 //*************************************************************************************************
2664 
2665 
2666 //*************************************************************************************************
2677 template< typename MT // Type of the sparse matrix
2678  , size_t... CRAs > // Compile time row arguments
2679 inline typename Row<MT,false,false,false,CRAs...>::Reference
2680  Row<MT,false,false,false,CRAs...>::at( size_t index )
2681 {
2682  if( index >= size() ) {
2683  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2684  }
2685  return (*this)[index];
2686 }
2688 //*************************************************************************************************
2689 
2690 
2691 //*************************************************************************************************
2702 template< typename MT // Type of the sparse matrix
2703  , size_t... CRAs > // Compile time row arguments
2704 inline typename Row<MT,false,false,false,CRAs...>::ConstReference
2705  Row<MT,false,false,false,CRAs...>::at( size_t index ) const
2706 {
2707  if( index >= size() ) {
2708  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
2709  }
2710  return (*this)[index];
2711 }
2713 //*************************************************************************************************
2714 
2715 
2716 //*************************************************************************************************
2724 template< typename MT // Type of the sparse matrix
2725  , size_t... CRAs > // Compile time row arguments
2726 inline typename Row<MT,false,false,false,CRAs...>::Iterator
2728 {
2729  return Iterator( matrix_, row(), 0UL );
2730 }
2732 //*************************************************************************************************
2733 
2734 
2735 //*************************************************************************************************
2743 template< typename MT // Type of the sparse matrix
2744  , size_t... CRAs > // Compile time row arguments
2745 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2747 {
2748  return ConstIterator( matrix_, row(), 0UL );
2749 }
2751 //*************************************************************************************************
2752 
2753 
2754 //*************************************************************************************************
2762 template< typename MT // Type of the sparse matrix
2763  , size_t... CRAs > // Compile time row arguments
2764 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2766 {
2767  return ConstIterator( matrix_, row(), 0UL );
2768 }
2770 //*************************************************************************************************
2771 
2772 
2773 //*************************************************************************************************
2781 template< typename MT // Type of the sparse matrix
2782  , size_t... CRAs > // Compile time row arguments
2783 inline typename Row<MT,false,false,false,CRAs...>::Iterator
2785 {
2786  return Iterator( matrix_, row(), size() );
2787 }
2789 //*************************************************************************************************
2790 
2791 
2792 //*************************************************************************************************
2800 template< typename MT // Type of the sparse matrix
2801  , size_t... CRAs > // Compile time row arguments
2802 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2804 {
2805  return ConstIterator( matrix_, row(), size() );
2806 }
2808 //*************************************************************************************************
2809 
2810 
2811 //*************************************************************************************************
2819 template< typename MT // Type of the sparse matrix
2820  , size_t... CRAs > // Compile time row arguments
2821 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
2823 {
2824  return ConstIterator( matrix_, row(), size() );
2825 }
2827 //*************************************************************************************************
2828 
2829 
2830 
2831 
2832 //=================================================================================================
2833 //
2834 // ASSIGNMENT OPERATORS
2835 //
2836 //=================================================================================================
2837 
2838 //*************************************************************************************************
2853 template< typename MT // Type of the sparse matrix
2854  , size_t... CRAs > // Compile time row arguments
2855 inline Row<MT,false,false,false,CRAs...>&
2856  Row<MT,false,false,false,CRAs...>::operator=( initializer_list<ElementType> list )
2857 {
2858  using blaze::assign;
2859 
2860  if( list.size() > size() ) {
2861  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
2862  }
2863 
2864  const InitializerVector<ElementType,true> tmp( list, size() );
2865 
2866  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
2867  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2868  }
2869 
2870  decltype(auto) left( derestrict( *this ) );
2871 
2872  assign( left, tmp );
2873 
2874  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2875 
2876  return *this;
2877 }
2879 //*************************************************************************************************
2880 
2881 
2882 //*************************************************************************************************
2896 template< typename MT // Type of the sparse matrix
2897  , size_t... CRAs > // Compile time row arguments
2898 inline Row<MT,false,false,false,CRAs...>&
2899  Row<MT,false,false,false,CRAs...>::operator=( const Row& rhs )
2900 {
2901  using blaze::assign;
2902 
2906 
2907  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
2908  return *this;
2909 
2910  if( size() != rhs.size() ) {
2911  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
2912  }
2913 
2914  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
2915  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2916  }
2917 
2918  decltype(auto) left( derestrict( *this ) );
2919 
2920  if( rhs.canAlias( &matrix_ ) ) {
2921  const ResultType tmp( rhs );
2922  assign( left, tmp );
2923  }
2924  else {
2925  assign( left, rhs );
2926  }
2927 
2928  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2929 
2930  return *this;
2931 }
2933 //*************************************************************************************************
2934 
2935 
2936 //*************************************************************************************************
2950 template< typename MT // Type of the sparse matrix
2951  , size_t... CRAs > // Compile time row arguments
2952 template< typename VT > // Type of the right-hand side vector
2953 inline Row<MT,false,false,false,CRAs...>&
2954  Row<MT,false,false,false,CRAs...>::operator=( const Vector<VT,true>& rhs )
2955 {
2956  using blaze::assign;
2957 
2958  if( size() != (~rhs).size() ) {
2959  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
2960  }
2961 
2962  const CompositeType_<VT> tmp( ~rhs );
2963 
2964  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
2965  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2966  }
2967 
2968  decltype(auto) left( derestrict( *this ) );
2969 
2970  assign( left, tmp );
2971 
2972  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2973 
2974  return *this;
2975 }
2977 //*************************************************************************************************
2978 
2979 
2980 //*************************************************************************************************
2994 template< typename MT // Type of the sparse matrix
2995  , size_t... CRAs > // Compile time row arguments
2996 template< typename VT > // Type of the right-hand side vector
2997 inline Row<MT,false,false,false,CRAs...>&
2998  Row<MT,false,false,false,CRAs...>::operator+=( const Vector<VT,true>& rhs )
2999 {
3000  using blaze::assign;
3001 
3005  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
3007 
3008  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
3009 
3012 
3013  if( size() != (~rhs).size() ) {
3014  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3015  }
3016 
3017  const AddType tmp( *this + (~rhs) );
3018 
3019  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3020  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3021  }
3022 
3023  decltype(auto) left( derestrict( *this ) );
3024 
3025  assign( left, tmp );
3026 
3027  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3028 
3029  return *this;
3030 }
3032 //*************************************************************************************************
3033 
3034 
3035 //*************************************************************************************************
3049 template< typename MT // Type of the sparse matrix
3050  , size_t... CRAs > // Compile time row arguments
3051 template< typename VT > // Type of the right-hand side vector
3052 inline Row<MT,false,false,false,CRAs...>&
3053  Row<MT,false,false,false,CRAs...>::operator-=( const Vector<VT,true>& rhs )
3054 {
3055  using blaze::assign;
3056 
3060  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
3062 
3063  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
3064 
3067 
3068  if( size() != (~rhs).size() ) {
3069  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3070  }
3071 
3072  const SubType tmp( *this - (~rhs) );
3073 
3074  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3075  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3076  }
3077 
3078  decltype(auto) left( derestrict( *this ) );
3079 
3080  assign( left, tmp );
3081 
3082  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3083 
3084  return *this;
3085 }
3087 //*************************************************************************************************
3088 
3089 
3090 //*************************************************************************************************
3103 template< typename MT // Type of the sparse matrix
3104  , size_t... CRAs > // Compile time row arguments
3105 template< typename VT > // Type of the right-hand side vector
3106 inline Row<MT,false,false,false,CRAs...>&
3107  Row<MT,false,false,false,CRAs...>::operator*=( const Vector<VT,true>& rhs )
3108 {
3109  using blaze::assign;
3110 
3114  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
3116 
3117  using MultType = MultTrait_< ResultType, ResultType_<VT> >;
3118 
3121 
3122  if( size() != (~rhs).size() ) {
3123  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3124  }
3125 
3126  const MultType tmp( *this * (~rhs) );
3127 
3128  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3129  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3130  }
3131 
3132  decltype(auto) left( derestrict( *this ) );
3133 
3134  assign( left, tmp );
3135 
3136  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3137 
3138  return *this;
3139 }
3141 //*************************************************************************************************
3142 
3143 
3144 //*************************************************************************************************
3156 template< typename MT // Type of the sparse matrix
3157  , size_t... CRAs > // Compile time row arguments
3158 template< typename VT > // Type of the right-hand side vector
3159 inline Row<MT,false,false,false,CRAs...>&
3160  Row<MT,false,false,false,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
3161 {
3162  using blaze::assign;
3163 
3167  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
3168  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
3170 
3171  using DivType = DivTrait_< ResultType, ResultType_<VT> >;
3172 
3176 
3177  if( size() != (~rhs).size() ) {
3178  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3179  }
3180 
3181  const DivType tmp( *this / (~rhs) );
3182 
3183  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3184  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3185  }
3186 
3187  decltype(auto) left( derestrict( *this ) );
3188 
3189  assign( left, tmp );
3190 
3191  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3192 
3193  return *this;
3194 }
3196 //*************************************************************************************************
3197 
3198 
3199 //*************************************************************************************************
3212 template< typename MT // Type of the sparse matrix
3213  , size_t... CRAs > // Compile time row arguments
3214 template< typename VT > // Type of the right-hand side vector
3215 inline Row<MT,false,false,false,CRAs...>&
3216  Row<MT,false,false,false,CRAs...>::operator%=( const Vector<VT,true>& rhs )
3217 {
3218  using blaze::assign;
3219 
3220  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
3222 
3223  using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3224 
3228 
3229  if( size() != 3UL || (~rhs).size() != 3UL ) {
3230  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
3231  }
3232 
3233  const CrossType tmp( *this % (~rhs) );
3234 
3235  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
3236  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3237  }
3238 
3239  decltype(auto) left( derestrict( *this ) );
3240 
3241  assign( left, tmp );
3242 
3243  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3244 
3245  return *this;
3246 }
3248 //*************************************************************************************************
3249 
3250 
3251 
3252 
3253 //=================================================================================================
3254 //
3255 // UTILITY FUNCTIONS
3256 //
3257 //=================================================================================================
3258 
3259 //*************************************************************************************************
3265 template< typename MT // Type of the sparse matrix
3266  , size_t... CRAs > // Compile time row arguments
3267 inline MT& Row<MT,false,false,false,CRAs...>::operand() noexcept
3268 {
3269  return matrix_;
3270 }
3272 //*************************************************************************************************
3273 
3274 
3275 //*************************************************************************************************
3281 template< typename MT // Type of the sparse matrix
3282  , size_t... CRAs > // Compile time row arguments
3283 inline const MT& Row<MT,false,false,false,CRAs...>::operand() const noexcept
3284 {
3285  return matrix_;
3286 }
3288 //************************************************************************************************
3289 
3290 
3291 //*************************************************************************************************
3297 template< typename MT // Type of the sparse matrix
3298  , size_t... CRAs > // Compile time row arguments
3299 inline size_t Row<MT,false,false,false,CRAs...>::size() const noexcept
3300 {
3301  return matrix_.columns();
3302 }
3304 //*************************************************************************************************
3305 
3306 
3307 //*************************************************************************************************
3313 template< typename MT // Type of the sparse matrix
3314  , size_t... CRAs > // Compile time row arguments
3315 inline size_t Row<MT,false,false,false,CRAs...>::capacity() const noexcept
3316 {
3317  return matrix_.columns();
3318 }
3320 //*************************************************************************************************
3321 
3322 
3323 //*************************************************************************************************
3332 template< typename MT // Type of the sparse matrix
3333  , size_t... CRAs > // Compile time row arguments
3334 inline size_t Row<MT,false,false,false,CRAs...>::nonZeros() const
3335 {
3336  size_t counter( 0UL );
3337  for( ConstIterator element=begin(); element!=end(); ++element ) {
3338  ++counter;
3339  }
3340  return counter;
3341 }
3343 //*************************************************************************************************
3344 
3345 
3346 //*************************************************************************************************
3352 template< typename MT // Type of the sparse matrix
3353  , size_t... CRAs > // Compile time row arguments
3355 {
3356  const size_t jbegin( ( IsUpper<MT>::value )
3357  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3358  ?( row()+1UL )
3359  :( row() ) )
3360  :( 0UL ) );
3361  const size_t jend ( ( IsLower<MT>::value )
3362  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3363  ?( row() )
3364  :( row()+1UL ) )
3365  :( size() ) );
3366 
3367  for( size_t j=jbegin; j<jend; ++j ) {
3368  matrix_.erase( row(), j );
3369  }
3370 }
3372 //*************************************************************************************************
3373 
3374 
3375 //*************************************************************************************************
3385 template< typename MT // Type of the sparse matrix
3386  , size_t... CRAs > // Compile time row arguments
3387 void Row<MT,false,false,false,CRAs...>::reserve( size_t n )
3388 {
3389  UNUSED_PARAMETER( n );
3390 
3391  return;
3392 }
3394 //*************************************************************************************************
3395 
3396 
3397 
3398 
3399 //=================================================================================================
3400 //
3401 // INSERTION FUNCTIONS
3402 //
3403 //=================================================================================================
3404 
3405 //*************************************************************************************************
3417 template< typename MT // Type of the sparse matrix
3418  , size_t... CRAs > // Compile time row arguments
3419 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3420  Row<MT,false,false,false,CRAs...>::set( size_t index, const ElementType& value )
3421 {
3422  return Iterator( matrix_, row(), index, matrix_.set( row(), index, value ) );
3423 }
3425 //*************************************************************************************************
3426 
3427 
3428 //*************************************************************************************************
3441 template< typename MT // Type of the sparse matrix
3442  , size_t... CRAs > // Compile time row arguments
3443 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3444  Row<MT,false,false,false,CRAs...>::insert( size_t index, const ElementType& value )
3445 {
3446  return Iterator( matrix_, row(), index, matrix_.insert( row(), index, value ) );
3447 }
3449 //*************************************************************************************************
3450 
3451 
3452 //*************************************************************************************************
3477 template< typename MT // Type of the sparse matrix
3478  , size_t... CRAs > // Compile time row arguments
3479 inline void Row<MT,false,false,false,CRAs...>::append( size_t index, const ElementType& value, bool check )
3480 {
3481  if( !check || !isDefault<strict>( value ) )
3482  matrix_.insert( row(), index, value );
3483 }
3485 //*************************************************************************************************
3486 
3487 
3488 
3489 
3490 //=================================================================================================
3491 //
3492 // ERASE FUNCTIONS
3493 //
3494 //=================================================================================================
3495 
3496 //*************************************************************************************************
3505 template< typename MT // Type of the sparse matrix
3506  , size_t... CRAs > // Compile time row arguments
3507 inline void Row<MT,false,false,false,CRAs...>::erase( size_t index )
3508 {
3509  matrix_.erase( row(), index );
3510 }
3512 //*************************************************************************************************
3513 
3514 
3515 //*************************************************************************************************
3524 template< typename MT // Type of the sparse matrix
3525  , size_t... CRAs > // Compile time row arguments
3526 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3527  Row<MT,false,false,false,CRAs...>::erase( Iterator pos )
3528 {
3529  const size_t column( pos.column_ );
3530 
3531  if( column == size() )
3532  return pos;
3533 
3534  matrix_.erase( column, pos.pos_ );
3535  return Iterator( matrix_, row(), column+1UL );
3536 }
3538 //*************************************************************************************************
3539 
3540 
3541 //*************************************************************************************************
3551 template< typename MT // Type of the sparse matrix
3552  , size_t... CRAs > // Compile time row arguments
3553 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3554  Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last )
3555 {
3556  for( ; first!=last; ++first ) {
3557  matrix_.erase( first.column_, first.pos_ );
3558  }
3559  return last;
3560 }
3562 //*************************************************************************************************
3563 
3564 
3565 //*************************************************************************************************
3588 template< typename MT // Type of the sparse matrix
3589  , size_t... CRAs > // Compile time row arguments
3590 template< typename Pred // Type of the unary predicate
3591  , typename > // Type restriction on the unary predicate
3592 inline void Row<MT,false,false,false,CRAs...>::erase( Pred predicate )
3593 {
3594  for( Iterator element=begin(); element!=end(); ++element ) {
3595  if( predicate( element->value() ) )
3596  matrix_.erase( element.column_, element.pos_ );
3597  }
3598 }
3600 //*************************************************************************************************
3601 
3602 
3603 //*************************************************************************************************
3628 template< typename MT // Type of the sparse matrix
3629  , size_t... CRAs > // Compile time row arguments
3630 template< typename Pred > // Type of the unary predicate
3631 inline void Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
3632 {
3633  for( ; first!=last; ++first ) {
3634  if( predicate( first->value() ) )
3635  matrix_.erase( first.column_, first.pos_ );
3636  }
3637 }
3639 //*************************************************************************************************
3640 
3641 
3642 
3643 
3644 //=================================================================================================
3645 //
3646 // LOOKUP FUNCTIONS
3647 //
3648 //=================================================================================================
3649 
3650 //*************************************************************************************************
3664 template< typename MT // Type of the sparse matrix
3665  , size_t... CRAs > // Compile time row arguments
3666 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3667  Row<MT,false,false,false,CRAs...>::find( size_t index )
3668 {
3669  const Iterator_<MT> pos( matrix_.find( row(), index ) );
3670 
3671  if( pos != matrix_.end( index ) )
3672  return Iterator( matrix_, row(), index, pos );
3673  else
3674  return end();
3675 }
3677 //*************************************************************************************************
3678 
3679 
3680 //*************************************************************************************************
3694 template< typename MT // Type of the sparse matrix
3695  , size_t... CRAs > // Compile time row arguments
3696 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3697  Row<MT,false,false,false,CRAs...>::find( size_t index ) const
3698 {
3699  const ConstIterator_<MT> pos( matrix_.find( row(), index ) );
3700 
3701  if( pos != matrix_.end( index ) )
3702  return ConstIterator( matrix_, row(), index, pos );
3703  else
3704  return end();
3705 }
3707 //*************************************************************************************************
3708 
3709 
3710 //*************************************************************************************************
3723 template< typename MT // Type of the sparse matrix
3724  , size_t... CRAs > // Compile time row arguments
3725 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3726  Row<MT,false,false,false,CRAs...>::lowerBound( size_t index )
3727 {
3728  for( size_t i=index; i<size(); ++i )
3729  {
3730  const Iterator_<MT> pos( matrix_.find( row(), i ) );
3731 
3732  if( pos != matrix_.end( i ) )
3733  return Iterator( matrix_, row(), i, pos );
3734  }
3735 
3736  return end();
3737 }
3739 //*************************************************************************************************
3740 
3741 
3742 //*************************************************************************************************
3755 template< typename MT // Type of the sparse matrix
3756  , size_t... CRAs > // Compile time row arguments
3757 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3758  Row<MT,false,false,false,CRAs...>::lowerBound( size_t index ) const
3759 {
3760  for( size_t i=index; i<size(); ++i )
3761  {
3762  const ConstIterator_<MT> pos( matrix_.find( row(), i ) );
3763 
3764  if( pos != matrix_.end( i ) )
3765  return ConstIterator( matrix_, row(), i, pos );
3766  }
3767 
3768  return end();
3769 }
3771 //*************************************************************************************************
3772 
3773 
3774 //*************************************************************************************************
3787 template< typename MT // Type of the sparse matrix
3788  , size_t... CRAs > // Compile time row arguments
3789 inline typename Row<MT,false,false,false,CRAs...>::Iterator
3790  Row<MT,false,false,false,CRAs...>::upperBound( size_t index )
3791 {
3792  for( size_t i=index+1UL; i<size(); ++i )
3793  {
3794  const Iterator_<MT> pos( matrix_.find( row(), i ) );
3795 
3796  if( pos != matrix_.end( i ) )
3797  return Iterator( matrix_, row(), i, pos );
3798  }
3799 
3800  return end();
3801 }
3803 //*************************************************************************************************
3804 
3805 
3806 //*************************************************************************************************
3819 template< typename MT // Type of the sparse matrix
3820  , size_t... CRAs > // Compile time row arguments
3821 inline typename Row<MT,false,false,false,CRAs...>::ConstIterator
3822  Row<MT,false,false,false,CRAs...>::upperBound( size_t index ) const
3823 {
3824  for( size_t i=index+1UL; i<size(); ++i )
3825  {
3826  const ConstIterator_<MT> pos( matrix_.find( row(), i ) );
3827 
3828  if( pos != matrix_.end( i ) )
3829  return ConstIterator( matrix_, row(), i, pos );
3830  }
3831 
3832  return end();
3833 }
3835 //*************************************************************************************************
3836 
3837 
3838 
3839 
3840 //=================================================================================================
3841 //
3842 // NUMERIC FUNCTIONS
3843 //
3844 //=================================================================================================
3845 
3846 //*************************************************************************************************
3859 template< typename MT // Type of the sparse matrix
3860  , size_t... CRAs > // Compile time row arguments
3861 template< typename Other > // Data type of the scalar value
3862 inline Row<MT,false,false,false,CRAs...>&
3863  Row<MT,false,false,false,CRAs...>::scale( const Other& scalar )
3864 {
3866 
3867  for( Iterator element=begin(); element!=end(); ++element )
3868  element->value() *= scalar;
3869  return *this;
3870 }
3872 //*************************************************************************************************
3873 
3874 
3875 
3876 
3877 //=================================================================================================
3878 //
3879 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3880 //
3881 //=================================================================================================
3882 
3883 //*************************************************************************************************
3894 template< typename MT // Type of the sparse matrix
3895  , size_t... CRAs > // Compile time row arguments
3896 template< typename Other > // Data type of the foreign expression
3897 inline bool Row<MT,false,false,false,CRAs...>::canAlias( const Other* alias ) const noexcept
3898 {
3899  return matrix_.isAliased( alias );
3900 }
3902 //*************************************************************************************************
3903 
3904 
3905 //*************************************************************************************************
3912 template< typename MT // Type of the sparse matrix
3913  , size_t... CRAs > // Compile time row arguments
3914 template< typename Other > // Data type of the foreign expression
3915 inline bool Row<MT,false,false,false,CRAs...>::isAliased( const Other* alias ) const noexcept
3916 {
3917  return matrix_.isAliased( alias );
3918 }
3920 //*************************************************************************************************
3921 
3922 
3923 //*************************************************************************************************
3935 template< typename MT // Type of the sparse matrix
3936  , size_t... CRAs > // Compile time row arguments
3937 template< typename VT > // Type of the right-hand side dense vector
3938 inline void Row<MT,false,false,false,CRAs...>::assign( const DenseVector<VT,true>& rhs )
3939 {
3940  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3941 
3942  for( size_t j=0UL; j<(~rhs).size(); ++j ) {
3943  matrix_(row(),j) = (~rhs)[j];
3944  }
3945 }
3947 //*************************************************************************************************
3948 
3949 
3950 //*************************************************************************************************
3962 template< typename MT // Type of the sparse matrix
3963  , size_t... CRAs > // Compile time row arguments
3964 template< typename VT > // Type of the right-hand side sparse vector
3965 inline void Row<MT,false,false,false,CRAs...>::assign( const SparseVector<VT,true>& rhs )
3966 {
3967  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3968 
3969  size_t j( 0UL );
3970 
3971  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3972  for( ; j<element->index(); ++j )
3973  matrix_.erase( row(), j );
3974  matrix_(row(),j++) = element->value();
3975  }
3976  for( ; j<size(); ++j ) {
3977  matrix_.erase( row(), j );
3978  }
3979 }
3981 //*************************************************************************************************
3982 
3983 
3984 //*************************************************************************************************
3996 template< typename MT // Type of the sparse matrix
3997  , size_t... CRAs > // Compile time row arguments
3998 template< typename VT > // Type of the right-hand side vector
3999 inline void Row<MT,false,false,false,CRAs...>::addAssign( const Vector<VT,true>& rhs )
4000 {
4001  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4002 
4005 
4006  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4007 
4008  const AddType tmp( serial( *this + (~rhs) ) );
4009  assign( tmp );
4010 }
4012 //*************************************************************************************************
4013 
4014 
4015 //*************************************************************************************************
4027 template< typename MT // Type of the sparse matrix
4028  , size_t... CRAs > // Compile time row arguments
4029 template< typename VT > // Type of the right-hand side vector
4030 inline void Row<MT,false,false,false,CRAs...>::subAssign( const Vector<VT,true>& rhs )
4031 {
4032  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4033 
4036 
4037  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4038 
4039  const SubType tmp( serial( *this - (~rhs) ) );
4040  assign( tmp );
4041 }
4043 //*************************************************************************************************
4044 
4045 
4046 
4047 
4048 
4049 
4050 
4051 
4052 //=================================================================================================
4053 //
4054 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR SPARSE MATRICES
4055 //
4056 //=================================================================================================
4057 
4058 //*************************************************************************************************
4066 template< typename MT // Type of the sparse matrix
4067  , size_t... CRAs > // Compile time row arguments
4068 class Row<MT,false,false,true,CRAs...>
4069  : public View< SparseVector< Row<MT,false,false,true,CRAs...>, true > >
4070  , private RowData<CRAs...>
4071 {
4072  private:
4073  //**Type definitions****************************************************************************
4074  using DataType = RowData<CRAs...>;
4075  using Operand = If_< IsExpression<MT>, MT, MT& >;
4076  //**********************************************************************************************
4077 
4078  public:
4079  //**Type definitions****************************************************************************
4081  using This = Row<MT,false,false,true,CRAs...>;
4082 
4083  using BaseType = SparseVector<This,true>;
4084  using ViewedType = MT;
4085  using ResultType = RowTrait_<MT,CRAs...>;
4086  using TransposeType = TransposeType_<ResultType>;
4087  using ElementType = ElementType_<MT>;
4088  using ReturnType = ReturnType_<MT>;
4089  using CompositeType = const Row&;
4090 
4092  using ConstReference = ConstReference_<MT>;
4093 
4095  using Reference = If_< IsConst<MT>, ConstReference, Reference_<MT> >;
4096 
4098  using ConstIterator = ConstIterator_<MT>;
4099 
4101  using Iterator = If_< IsConst<MT>, ConstIterator, Iterator_<MT> >;
4102  //**********************************************************************************************
4103 
4104  //**Compilation flags***************************************************************************
4106  enum : bool { smpAssignable = false };
4107  //**********************************************************************************************
4108 
4109  //**Constructors********************************************************************************
4112  template< typename... RRAs >
4113  explicit inline Row( MT& matrix, RRAs... args );
4114  // No explicitly declared copy constructor.
4116  //**********************************************************************************************
4117 
4118  //**Destructor**********************************************************************************
4119  // No explicitly declared destructor.
4120  //**********************************************************************************************
4121 
4122  //**Data access functions***********************************************************************
4125  inline Reference operator[]( size_t index );
4126  inline ConstReference operator[]( size_t index ) const;
4127  inline Reference at( size_t index );
4128  inline ConstReference at( size_t index ) const;
4129  inline Iterator begin ();
4130  inline ConstIterator begin () const;
4131  inline ConstIterator cbegin() const;
4132  inline Iterator end ();
4133  inline ConstIterator end () const;
4134  inline ConstIterator cend () const;
4136  //**********************************************************************************************
4137 
4138  //**Assignment operators************************************************************************
4141  inline Row& operator=( initializer_list<ElementType> list );
4142  inline Row& operator=( const Row& rhs );
4143 
4144  template< typename VT > inline Row& operator= ( const DenseVector<VT,true>& rhs );
4145  template< typename VT > inline Row& operator= ( const SparseVector<VT,true>& rhs );
4146  template< typename VT > inline Row& operator+=( const DenseVector<VT,true>& rhs );
4147  template< typename VT > inline Row& operator+=( const SparseVector<VT,true>& rhs );
4148  template< typename VT > inline Row& operator-=( const DenseVector<VT,true>& rhs );
4149  template< typename VT > inline Row& operator-=( const SparseVector<VT,true>& rhs );
4150  template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
4151  template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4152  template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4154  //**********************************************************************************************
4155 
4156  //**Utility functions***************************************************************************
4159  using DataType::row;
4160 
4161  inline MT& operand() noexcept;
4162  inline const MT& operand() const noexcept;
4163 
4164  inline size_t size() const noexcept;
4165  inline size_t capacity() const noexcept;
4166  inline size_t nonZeros() const;
4167  inline void reset();
4168  inline void reserve( size_t n );
4170  //**********************************************************************************************
4171 
4172  //**Insertion functions*************************************************************************
4175  inline Iterator set ( size_t index, const ElementType& value );
4176  inline Iterator insert( size_t index, const ElementType& value );
4177  inline void append( size_t index, const ElementType& value, bool check=false );
4179  //**********************************************************************************************
4180 
4181  //**Erase functions*****************************************************************************
4184  inline void erase( size_t index );
4185  inline Iterator erase( Iterator pos );
4186  inline Iterator erase( Iterator first, Iterator last );
4187 
4188  template< typename Pred, typename = DisableIf_< IsIntegral<Pred> > >
4189  inline void erase( Pred predicate );
4190 
4191  template< typename Pred >
4192  inline void erase( Iterator first, Iterator last, Pred predicate );
4194  //**********************************************************************************************
4195 
4196  //**Lookup functions****************************************************************************
4199  inline Iterator find ( size_t index );
4200  inline ConstIterator find ( size_t index ) const;
4201  inline Iterator lowerBound( size_t index );
4202  inline ConstIterator lowerBound( size_t index ) const;
4203  inline Iterator upperBound( size_t index );
4204  inline ConstIterator upperBound( size_t index ) const;
4206  //**********************************************************************************************
4207 
4208  //**Numeric functions***************************************************************************
4211  template< typename Other > inline Row& scale( const Other& scalar );
4213  //**********************************************************************************************
4214 
4215  //**Expression template evaluation functions****************************************************
4218  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
4219  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
4220 
4221  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
4222  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
4223  template< typename VT > inline void addAssign( const DenseVector <VT,true>& rhs );
4224  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
4225  template< typename VT > inline void subAssign( const DenseVector <VT,true>& rhs );
4226  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
4228  //**********************************************************************************************
4229 
4230  private:
4231  //**Utility functions***************************************************************************
4234  inline size_t extendCapacity() const;
4236  //**********************************************************************************************
4237 
4238  //**Member variables****************************************************************************
4241  Operand matrix_;
4242 
4243  //**********************************************************************************************
4244 
4245  //**Compile time checks*************************************************************************
4254  //**********************************************************************************************
4255 };
4257 //*************************************************************************************************
4258 
4259 
4260 
4261 
4262 //=================================================================================================
4263 //
4264 // CONSTRUCTORS
4265 //
4266 //=================================================================================================
4267 
4268 //*************************************************************************************************
4281 template< typename MT // Type of the sparse matrix
4282  , size_t... CRAs > // Compile time row arguments
4283 template< typename... RRAs > // Runtime row arguments
4284 inline Row<MT,false,false,true,CRAs...>::Row( MT& matrix, RRAs... args )
4285  : DataType( args... ) // Base class initialization
4286  , matrix_ ( matrix ) // The matrix containing the row
4287 {
4288  if( !Contains< TypeList<RRAs...>, Unchecked >::value ) {
4289  if( matrix_.rows() <= row() ) {
4290  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
4291  }
4292  }
4293  else {
4294  BLAZE_USER_ASSERT( row() < matrix_.rows(), "Invalid row access index" );
4295  }
4296 }
4298 //*************************************************************************************************
4299 
4300 
4301 
4302 
4303 //=================================================================================================
4304 //
4305 // DATA ACCESS FUNCTIONS
4306 //
4307 //=================================================================================================
4308 
4309 //*************************************************************************************************
4319 template< typename MT // Type of the sparse matrix
4320  , size_t... CRAs > // Compile time row arguments
4321 inline typename Row<MT,false,false,true,CRAs...>::Reference
4322  Row<MT,false,false,true,CRAs...>::operator[]( size_t index )
4323 {
4324  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4325  return matrix_(index,row());
4326 }
4328 //*************************************************************************************************
4329 
4330 
4331 //*************************************************************************************************
4341 template< typename MT // Type of the sparse matrix
4342  , size_t... CRAs > // Compile time row arguments
4343 inline typename Row<MT,false,false,true,CRAs...>::ConstReference
4344  Row<MT,false,false,true,CRAs...>::operator[]( size_t index ) const
4345 {
4346  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4347  return const_cast<const MT&>( matrix_ )(index,row());
4348 }
4350 //*************************************************************************************************
4351 
4352 
4353 //*************************************************************************************************
4364 template< typename MT // Type of the sparse matrix
4365  , size_t... CRAs > // Compile time row arguments
4366 inline typename Row<MT,false,false,true,CRAs...>::Reference
4367  Row<MT,false,false,true,CRAs...>::at( size_t index )
4368 {
4369  if( index >= size() ) {
4370  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4371  }
4372  return (*this)[index];
4373 }
4375 //*************************************************************************************************
4376 
4377 
4378 //*************************************************************************************************
4389 template< typename MT // Type of the sparse matrix
4390  , size_t... CRAs > // Compile time row arguments
4391 inline typename Row<MT,false,false,true,CRAs...>::ConstReference
4392  Row<MT,false,false,true,CRAs...>::at( size_t index ) const
4393 {
4394  if( index >= size() ) {
4395  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4396  }
4397  return (*this)[index];
4398 }
4400 //*************************************************************************************************
4401 
4402 
4403 //*************************************************************************************************
4411 template< typename MT // Type of the sparse matrix
4412  , size_t... CRAs > // Compile time row arguments
4413 inline typename Row<MT,false,false,true,CRAs...>::Iterator
4415 {
4416  return matrix_.begin( row() );
4417 }
4419 //*************************************************************************************************
4420 
4421 
4422 //*************************************************************************************************
4430 template< typename MT // Type of the sparse matrix
4431  , size_t... CRAs > // Compile time row arguments
4432 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4434 {
4435  return matrix_.cbegin( row() );
4436 }
4438 //*************************************************************************************************
4439 
4440 
4441 //*************************************************************************************************
4449 template< typename MT // Type of the sparse matrix
4450  , size_t... CRAs > // Compile time row arguments
4451 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4453 {
4454  return matrix_.cbegin( row() );
4455 }
4457 //*************************************************************************************************
4458 
4459 
4460 //*************************************************************************************************
4468 template< typename MT // Type of the sparse matrix
4469  , size_t... CRAs > // Compile time row arguments
4470 inline typename Row<MT,false,false,true,CRAs...>::Iterator
4472 {
4473  return matrix_.end( row() );
4474 }
4476 //*************************************************************************************************
4477 
4478 
4479 //*************************************************************************************************
4487 template< typename MT // Type of the sparse matrix
4488  , size_t... CRAs > // Compile time row arguments
4489 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4491 {
4492  return matrix_.cend( row() );
4493 }
4495 //*************************************************************************************************
4496 
4497 
4498 //*************************************************************************************************
4506 template< typename MT // Type of the sparse matrix
4507  , size_t... CRAs > // Compile time row arguments
4508 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
4510 {
4511  return matrix_.cend( row() );
4512 }
4514 //*************************************************************************************************
4515 
4516 
4517 
4518 
4519 //=================================================================================================
4520 //
4521 // ASSIGNMENT OPERATORS
4522 //
4523 //=================================================================================================
4524 
4525 //*************************************************************************************************
4540 template< typename MT // Type of the sparse matrix
4541  , size_t... CRAs > // Compile time row arguments
4542 inline Row<MT,false,false,true,CRAs...>&
4543  Row<MT,false,false,true,CRAs...>::operator=( initializer_list<ElementType> list )
4544 {
4545  using blaze::assign;
4546 
4547  if( list.size() > size() ) {
4548  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to row" );
4549  }
4550 
4551  const InitializerVector<ElementType,true> tmp( list, size() );
4552 
4553  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4554  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4555  }
4556 
4557  decltype(auto) left( derestrict( *this ) );
4558 
4559  left.reset();
4560  assign( left, tmp );
4561 
4562  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4563 
4564  return *this;
4565 }
4567 //*************************************************************************************************
4568 
4569 
4570 //*************************************************************************************************
4584 template< typename MT // Type of the sparse matrix
4585  , size_t... CRAs > // Compile time row arguments
4586 inline Row<MT,false,false,true,CRAs...>&
4587  Row<MT,false,false,true,CRAs...>::operator=( const Row& rhs )
4588 {
4589  using blaze::assign;
4590 
4594 
4595  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
4596  return *this;
4597 
4598  if( size() != rhs.size() ) {
4599  BLAZE_THROW_INVALID_ARGUMENT( "Row sizes do not match" );
4600  }
4601 
4602  if( !tryAssign( matrix_, rhs, row(), 0UL ) ) {
4603  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4604  }
4605 
4606  decltype(auto) left( derestrict( *this ) );
4607 
4608  if( rhs.canAlias( &matrix_ ) ) {
4609  const ResultType tmp( rhs );
4610  left.reset();
4611  left.reserve( tmp.nonZeros() );
4612  assign( left, tmp );
4613  }
4614  else {
4615  left.reset();
4616  left.reserve( rhs.nonZeros() );
4617  assign( left, rhs );
4618  }
4619 
4620  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4621 
4622  return *this;
4623 }
4625 //*************************************************************************************************
4626 
4627 
4628 //*************************************************************************************************
4642 template< typename MT // Type of the sparse matrix
4643  , size_t... CRAs > // Compile time row arguments
4644 template< typename VT > // Type of the right-hand side dense vector
4645 inline Row<MT,false,false,true,CRAs...>&
4646  Row<MT,false,false,true,CRAs...>::operator=( const DenseVector<VT,true>& rhs )
4647 {
4648  using blaze::assign;
4649 
4650  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
4651  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4653 
4654  if( size() != (~rhs).size() ) {
4655  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4656  }
4657 
4658  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
4659  Right right( ~rhs );
4660 
4661  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4662  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4663  }
4664 
4665  decltype(auto) left( derestrict( *this ) );
4666 
4667  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4668  const ResultType_<VT> tmp( right );
4669  left.reset();
4670  assign( left, tmp );
4671  }
4672  else {
4673  left.reset();
4674  assign( left, right );
4675  }
4676 
4677  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4678 
4679  return *this;
4680 }
4682 //*************************************************************************************************
4683 
4684 
4685 //*************************************************************************************************
4699 template< typename MT // Type of the sparse matrix
4700  , size_t... CRAs > // Compile time row arguments
4701 template< typename VT > // Type of the right-hand side sparse vector
4702 inline Row<MT,false,false,true,CRAs...>&
4703  Row<MT,false,false,true,CRAs...>::operator=( const SparseVector<VT,true>& rhs )
4704 {
4705  using blaze::assign;
4706 
4707  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_<VT> );
4708  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4710 
4711  if( size() != (~rhs).size() ) {
4712  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4713  }
4714 
4715  using Right = If_< IsRestricted<MT>, CompositeType_<VT>, const VT& >;
4716  Right right( ~rhs );
4717 
4718  if( !tryAssign( matrix_, right, row(), 0UL ) ) {
4719  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4720  }
4721 
4722  decltype(auto) left( derestrict( *this ) );
4723 
4724  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4725  const ResultType_<VT> tmp( right );
4726  left.reset();
4727  left.reserve( tmp.nonZeros() );
4728  assign( left, tmp );
4729  }
4730  else {
4731  left.reset();
4732  left.reserve( right.nonZeros() );
4733  assign( left, right );
4734  }
4735 
4736  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4737 
4738  return *this;
4739 }
4741 //*************************************************************************************************
4742 
4743 
4744 //*************************************************************************************************
4758 template< typename MT // Type of the sparse matrix
4759  , size_t... CRAs > // Compile time row arguments
4760 template< typename VT > // Type of the right-hand side dense vector
4761 inline Row<MT,false,false,true,CRAs...>&
4762  Row<MT,false,false,true,CRAs...>::operator+=( const DenseVector<VT,true>& rhs )
4763 {
4764  using blaze::assign;
4765 
4769  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
4770  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4772 
4773  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4774 
4778 
4779  if( size() != (~rhs).size() ) {
4780  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4781  }
4782 
4783  const AddType tmp( *this + (~rhs) );
4784 
4785  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4786  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4787  }
4788 
4789  decltype(auto) left( derestrict( *this ) );
4790 
4791  left.reset();
4792  assign( left, tmp );
4793 
4794  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4795 
4796  return *this;
4797 }
4799 //*************************************************************************************************
4800 
4801 
4802 //*************************************************************************************************
4816 template< typename MT // Type of the sparse matrix
4817  , size_t... CRAs > // Compile time row arguments
4818 template< typename VT > // Type of the right-hand side sparse vector
4819 inline Row<MT,false,false,true,CRAs...>&
4820  Row<MT,false,false,true,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
4821 {
4822  using blaze::assign;
4823 
4827  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_<VT> );
4828  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4830 
4831  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4832 
4836 
4837  if( size() != (~rhs).size() ) {
4838  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4839  }
4840 
4841  const AddType tmp( *this + (~rhs) );
4842 
4843  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4844  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4845  }
4846 
4847  decltype(auto) left( derestrict( *this ) );
4848 
4849  left.reset();
4850  left.reserve( tmp.nonZeros() );
4851  assign( left, tmp );
4852 
4853  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4854 
4855  return *this;
4856 }
4858 //*************************************************************************************************
4859 
4860 
4861 //*************************************************************************************************
4876 template< typename MT // Type of the sparse matrix
4877  , size_t... CRAs > // Compile time row arguments
4878 template< typename VT > // Type of the right-hand side dense vector
4879 inline Row<MT,false,false,true,CRAs...>&
4880  Row<MT,false,false,true,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
4881 {
4882  using blaze::assign;
4883 
4887  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
4888  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4890 
4891  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4892 
4896 
4897  if( size() != (~rhs).size() ) {
4898  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4899  }
4900 
4901  const SubType tmp( *this - (~rhs) );
4902 
4903  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4904  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4905  }
4906 
4907  decltype(auto) left( derestrict( *this ) );
4908 
4909  left.reset();
4910  assign( left, tmp );
4911 
4912  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4913 
4914  return *this;
4915 }
4917 //*************************************************************************************************
4918 
4919 
4920 //*************************************************************************************************
4935 template< typename MT // Type of the sparse matrix
4936  , size_t... CRAs > // Compile time row arguments
4937 template< typename VT > // Type of the right-hand side sparse vector
4938 inline Row<MT,false,false,true,CRAs...>&
4939  Row<MT,false,false,true,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
4940 {
4941  using blaze::assign;
4942 
4946  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_<VT> );
4947  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
4949 
4950  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4951 
4955 
4956  if( size() != (~rhs).size() ) {
4957  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4958  }
4959 
4960  const SubType tmp( *this - (~rhs) );
4961 
4962  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
4963  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4964  }
4965 
4966  decltype(auto) left( derestrict( *this ) );
4967 
4968  left.reset();
4969  left.reserve( tmp.nonZeros() );
4970  assign( left, tmp );
4971 
4972  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4973 
4974  return *this;
4975 }
4977 //*************************************************************************************************
4978 
4979 
4980 //*************************************************************************************************
4993 template< typename MT // Type of the sparse matrix
4994  , size_t... CRAs > // Compile time row arguments
4995 template< typename VT > // Type of the right-hand side vector
4996 inline Row<MT,false,false,true,CRAs...>&
4997  Row<MT,false,false,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
4998 {
4999  using blaze::assign;
5000 
5004  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
5006 
5007  using MultType = MultTrait_< ResultType, ResultType_<VT> >;
5008 
5011 
5012  if( size() != (~rhs).size() ) {
5013  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5014  }
5015 
5016  const MultType tmp( *this * (~rhs) );
5017 
5018  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5019  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5020  }
5021 
5022  decltype(auto) left( derestrict( *this ) );
5023 
5024  left.reset();
5025  assign( left, tmp );
5026 
5027  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5028 
5029  return *this;
5030 }
5032 //*************************************************************************************************
5033 
5034 
5035 //*************************************************************************************************
5047 template< typename MT // Type of the sparse matrix
5048  , size_t... CRAs > // Compile time row arguments
5049 template< typename VT > // Type of the right-hand side vector
5050 inline Row<MT,false,false,true,CRAs...>&
5051  Row<MT,false,false,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5052 {
5053  using blaze::assign;
5054 
5058  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_<VT> );
5059  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
5061 
5062  using DivType = DivTrait_< ResultType, ResultType_<VT> >;
5063 
5067 
5068  if( size() != (~rhs).size() ) {
5069  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5070  }
5071 
5072  const DivType tmp( *this / (~rhs) );
5073 
5074  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5075  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5076  }
5077 
5078  decltype(auto) left( derestrict( *this ) );
5079 
5080  left.reset();
5081  assign( left, tmp );
5082 
5083  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5084 
5085  return *this;
5086 }
5088 //*************************************************************************************************
5089 
5090 
5091 //*************************************************************************************************
5104 template< typename MT // Type of the sparse matrix
5105  , size_t... CRAs > // Compile time row arguments
5106 template< typename VT > // Type of the right-hand side vector
5107 inline Row<MT,false,false,true,CRAs...>&
5108  Row<MT,false,false,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5109 {
5110  using blaze::assign;
5111 
5112  BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE ( ResultType_<VT> );
5114 
5115  using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5116 
5120 
5121  if( size() != 3UL || (~rhs).size() != 3UL ) {
5122  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5123  }
5124 
5125  const CrossType tmp( *this % (~rhs) );
5126 
5127  if( !tryAssign( matrix_, tmp, row(), 0UL ) ) {
5128  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5129  }
5130 
5131  decltype(auto) left( derestrict( *this ) );
5132 
5133  left.reset();
5134  assign( left, tmp );
5135 
5136  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5137 
5138  return *this;
5139 }
5141 //*************************************************************************************************
5142 
5143 
5144 
5145 
5146 //=================================================================================================
5147 //
5148 // UTILITY FUNCTIONS
5149 //
5150 //=================================================================================================
5151 
5152 //*************************************************************************************************
5158 template< typename MT // Type of the sparse matrix
5159  , size_t... CRAs > // Compile time row arguments
5160 inline MT& Row<MT,false,false,true,CRAs...>::operand() noexcept
5161 {
5162  return matrix_;
5163 }
5165 //*************************************************************************************************
5166 
5167 
5168 //*************************************************************************************************
5174 template< typename MT // Type of the sparse matrix
5175  , size_t... CRAs > // Compile time row arguments
5176 inline const MT& Row<MT,false,false,true,CRAs...>::operand() const noexcept
5177 {
5178  return matrix_;
5179 }
5181 //*************************************************************************************************
5182 
5183 
5184 //*************************************************************************************************
5190 template< typename MT // Type of the sparse matrix
5191  , size_t... CRAs > // Compile time row arguments
5192 inline size_t Row<MT,false,false,true,CRAs...>::size() const noexcept
5193 {
5194  return matrix_.columns();
5195 }
5197 //*************************************************************************************************
5198 
5199 
5200 //*************************************************************************************************
5206 template< typename MT // Type of the sparse matrix
5207  , size_t... CRAs > // Compile time row arguments
5208 inline size_t Row<MT,false,false,true,CRAs...>::capacity() const noexcept
5209 {
5210  return matrix_.capacity( row() );
5211 }
5213 //*************************************************************************************************
5214 
5215 
5216 //*************************************************************************************************
5225 template< typename MT // Type of the sparse matrix
5226  , size_t... CRAs > // Compile time row arguments
5227 inline size_t Row<MT,false,false,true,CRAs...>::nonZeros() const
5228 {
5229  return matrix_.nonZeros( row() );
5230 }
5232 //*************************************************************************************************
5233 
5234 
5235 //*************************************************************************************************
5241 template< typename MT // Type of the sparse matrix
5242  , size_t... CRAs > // Compile time row arguments
5244 {
5245  matrix_.reset( row() );
5246 }
5248 //*************************************************************************************************
5249 
5250 
5251 //*************************************************************************************************
5261 template< typename MT // Type of the sparse matrix
5262  , size_t... CRAs > // Compile time row arguments
5263 void Row<MT,false,false,true,CRAs...>::reserve( size_t n )
5264 {
5265  matrix_.reserve( row(), n );
5266 }
5268 //*************************************************************************************************
5269 
5270 
5271 //*************************************************************************************************
5280 template< typename MT // Type of the sparse matrix
5281  , size_t... CRAs > // Compile time row arguments
5282 inline size_t Row<MT,false,false,true,CRAs...>::extendCapacity() const
5283 {
5284  using blaze::max;
5285  using blaze::min;
5286 
5287  size_t nonzeros( 2UL*capacity()+1UL );
5288  nonzeros = max( nonzeros, 7UL );
5289  nonzeros = min( nonzeros, size() );
5290 
5291  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
5292 
5293  return nonzeros;
5294 }
5296 //*************************************************************************************************
5297 
5298 
5299 
5300 
5301 //=================================================================================================
5302 //
5303 // INSERTION FUNCTIONS
5304 //
5305 //=================================================================================================
5306 
5307 //*************************************************************************************************
5319 template< typename MT // Type of the sparse matrix
5320  , size_t... CRAs > // Compile time row arguments
5321 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5322  Row<MT,false,false,true,CRAs...>::set( size_t index, const ElementType& value )
5323 {
5324  return matrix_.set( index, row(), value );
5325 }
5327 //*************************************************************************************************
5328 
5329 
5330 //*************************************************************************************************
5343 template< typename MT // Type of the sparse matrix
5344  , size_t... CRAs > // Compile time row arguments
5345 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5346  Row<MT,false,false,true,CRAs...>::insert( size_t index, const ElementType& value )
5347 {
5348  return matrix_.insert( index, row(), value );
5349 }
5351 //*************************************************************************************************
5352 
5353 
5354 //*************************************************************************************************
5379 template< typename MT // Type of the sparse matrix
5380  , size_t... CRAs > // Compile time row arguments
5381 inline void Row<MT,false,false,true,CRAs...>::append( size_t index, const ElementType& value, bool check )
5382 {
5383  matrix_.append( index, row(), value, check );
5384 }
5386 //*************************************************************************************************
5387 
5388 
5389 
5390 
5391 //=================================================================================================
5392 //
5393 // ERASE FUNCTIONS
5394 //
5395 //=================================================================================================
5396 
5397 //*************************************************************************************************
5406 template< typename MT // Type of the sparse matrix
5407  , size_t... CRAs > // Compile time row arguments
5408 inline void Row<MT,false,false,true,CRAs...>::erase( size_t index )
5409 {
5410  matrix_.erase( index, row() );
5411 }
5413 //*************************************************************************************************
5414 
5415 
5416 //*************************************************************************************************
5425 template< typename MT // Type of the sparse matrix
5426  , size_t... CRAs > // Compile time row arguments
5427 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5428  Row<MT,false,false,true,CRAs...>::erase( Iterator pos )
5429 {
5430  return matrix_.erase( row(), pos );
5431 }
5433 //*************************************************************************************************
5434 
5435 
5436 //*************************************************************************************************
5446 template< typename MT // Type of the sparse matrix
5447  , size_t... CRAs > // Compile time row arguments
5448 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5449  Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last )
5450 {
5451  return matrix_.erase( row(), first, last );
5452 }
5454 //*************************************************************************************************
5455 
5456 
5457 //*************************************************************************************************
5480 template< typename MT // Type of the sparse matrix
5481  , size_t... CRAs > // Compile time row arguments
5482 template< typename Pred // Type of the unary predicate
5483  , typename > // Type restriction on the unary predicate
5484 inline void Row<MT,false,false,true,CRAs...>::erase( Pred predicate )
5485 {
5486  matrix_.erase( row(), begin(), end(), predicate );
5487 }
5489 //*************************************************************************************************
5490 
5491 
5492 //*************************************************************************************************
5517 template< typename MT // Type of the sparse matrix
5518  , size_t... CRAs > // Compile time row arguments
5519 template< typename Pred > // Type of the unary predicate
5520 inline void Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
5521 {
5522  matrix_.erase( row(), first, last, predicate );
5523 }
5525 //*************************************************************************************************
5526 
5527 
5528 
5529 
5530 //=================================================================================================
5531 //
5532 // LOOKUP FUNCTIONS
5533 //
5534 //=================================================================================================
5535 
5536 //*************************************************************************************************
5550 template< typename MT // Type of the sparse matrix
5551  , size_t... CRAs > // Compile time row arguments
5552 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5553  Row<MT,false,false,true,CRAs...>::find( size_t index )
5554 {
5555  return matrix_.find( index, row() );
5556 }
5558 //*************************************************************************************************
5559 
5560 
5561 //*************************************************************************************************
5575 template< typename MT // Type of the sparse matrix
5576  , size_t... CRAs > // Compile time row arguments
5577 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5578  Row<MT,false,false,true,CRAs...>::find( size_t index ) const
5579 {
5580  return matrix_.find( index, row() );
5581 }
5583 //*************************************************************************************************
5584 
5585 
5586 //*************************************************************************************************
5599 template< typename MT // Type of the sparse matrix
5600  , size_t... CRAs > // Compile time row arguments
5601 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5602  Row<MT,false,false,true,CRAs...>::lowerBound( size_t index )
5603 {
5604  return matrix_.lowerBound( index, row() );
5605 }
5607 //*************************************************************************************************
5608 
5609 
5610 //*************************************************************************************************
5623 template< typename MT // Type of the sparse matrix
5624  , size_t... CRAs > // Compile time row arguments
5625 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5626  Row<MT,false,false,true,CRAs...>::lowerBound( size_t index ) const
5627 {
5628  return matrix_.lowerBound( index, row() );
5629 }
5631 //*************************************************************************************************
5632 
5633 
5634 //*************************************************************************************************
5647 template< typename MT // Type of the sparse matrix
5648  , size_t... CRAs > // Compile time row arguments
5649 inline typename Row<MT,false,false,true,CRAs...>::Iterator
5650  Row<MT,false,false,true,CRAs...>::upperBound( size_t index )
5651 {
5652  return matrix_.upperBound( index, row() );
5653 }
5655 //*************************************************************************************************
5656 
5657 
5658 //*************************************************************************************************
5671 template< typename MT // Type of the sparse matrix
5672  , size_t... CRAs > // Compile time row arguments
5673 inline typename Row<MT,false,false,true,CRAs...>::ConstIterator
5674  Row<MT,false,false,true,CRAs...>::upperBound( size_t index ) const
5675 {
5676  return matrix_.upperBound( index, row() );
5677 }
5679 //*************************************************************************************************
5680 
5681 
5682 
5683 
5684 //=================================================================================================
5685 //
5686 // NUMERIC FUNCTIONS
5687 //
5688 //=================================================================================================
5689 
5690 //*************************************************************************************************
5703 template< typename MT // Type of the sparse matrix
5704  , size_t... CRAs > // Compile time row arguments
5705 template< typename Other > // Data type of the scalar value
5706 inline Row<MT,false,false,true,CRAs...>&
5707  Row<MT,false,false,true,CRAs...>::scale( const Other& scalar )
5708 {
5710 
5711  for( Iterator element=begin(); element!=end(); ++element )
5712  element->value() *= scalar;
5713  return *this;
5714 }
5716 //*************************************************************************************************
5717 
5718 
5719 
5720 
5721 //=================================================================================================
5722 //
5723 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5724 //
5725 //=================================================================================================
5726 
5727 //*************************************************************************************************
5738 template< typename MT // Type of the sparse matrix
5739  , size_t... CRAs > // Compile time row arguments
5740 template< typename Other > // Data type of the foreign expression
5741 inline bool Row<MT,false,false,true,CRAs...>::canAlias( const Other* alias ) const noexcept
5742 {
5743  return matrix_.isAliased( alias );
5744 }
5746 //*************************************************************************************************
5747 
5748 
5749 //*************************************************************************************************
5760 template< typename MT // Type of the sparse matrix
5761  , size_t... CRAs > // Compile time row arguments
5762 template< typename Other > // Data type of the foreign expression
5763 inline bool Row<MT,false,false,true,CRAs...>::isAliased( const Other* alias ) const noexcept
5764 {
5765  return matrix_.isAliased( alias );
5766 }
5768 //*************************************************************************************************
5769 
5770 
5771 //*************************************************************************************************
5783 template< typename MT // Type of the sparse matrix
5784  , size_t... CRAs > // Compile time row arguments
5785 template< typename VT > // Type of the right-hand side dense vector
5786 inline void Row<MT,false,false,true,CRAs...>::assign( const DenseVector<VT,true>& rhs )
5787 {
5788  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5789  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5790 
5791  for( size_t i=0UL; i<size(); ++i )
5792  {
5793  if( matrix_.nonZeros( row() ) == matrix_.capacity( row() ) )
5794  matrix_.reserve( row(), extendCapacity() );
5795 
5796  matrix_.append( i, row(), (~rhs)[i], true );
5797  }
5798 }
5800 //*************************************************************************************************
5801 
5802 
5803 //*************************************************************************************************
5815 template< typename MT // Type of the sparse matrix
5816  , size_t... CRAs > // Compile time row arguments
5817 template< typename VT > // Type of the right-hand side sparse vector
5818 inline void Row<MT,false,false,true,CRAs...>::assign( const SparseVector<VT,true>& rhs )
5819 {
5820  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5821  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5822 
5823  for( ConstIterator_<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5824  matrix_.append( element->index(), row(), element->value(), true );
5825  }
5826 }
5828 //*************************************************************************************************
5829 
5830 
5831 //*************************************************************************************************
5843 template< typename MT // Type of the sparse matrix
5844  , size_t... CRAs > // Compile time row arguments
5845 template< typename VT > // Type of the right-hand side dense vector
5846 inline void Row<MT,false,false,true,CRAs...>::addAssign( const DenseVector<VT,true>& rhs )
5847 {
5848  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5849 
5853 
5854  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5855 
5856  const AddType tmp( serial( *this + (~rhs) ) );
5857  matrix_.reset( row() );
5858  assign( tmp );
5859 }
5861 //*************************************************************************************************
5862 
5863 
5864 //*************************************************************************************************
5876 template< typename MT // Type of the sparse matrix
5877  , size_t... CRAs > // Compile time row arguments
5878 template< typename VT > // Type of the right-hand side sparse vector
5879 inline void Row<MT,false,false,true,CRAs...>::addAssign( const SparseVector<VT,true>& rhs )
5880 {
5881  using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5882 
5886 
5887  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5888 
5889  const AddType tmp( serial( *this + (~rhs) ) );
5890  matrix_.reset( row() );
5891  matrix_.reserve( row(), tmp.nonZeros() );
5892  assign( tmp );
5893 }
5895 //*************************************************************************************************
5896 
5897 
5898 //*************************************************************************************************
5910 template< typename MT // Type of the sparse matrix
5911  , size_t... CRAs > // Compile time row arguments
5912 template< typename VT > // Type of the right-hand side dense vector
5913 inline void Row<MT,false,false,true,CRAs...>::subAssign( const DenseVector<VT,true>& rhs )
5914 {
5915  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5916 
5920 
5921  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5922 
5923  const SubType tmp( serial( *this - (~rhs) ) );
5924  matrix_.reset( row() );
5925  assign( tmp );
5926 }
5928 //*************************************************************************************************
5929 
5930 
5931 //*************************************************************************************************
5943 template< typename MT // Type of the sparse matrix
5944  , size_t... CRAs > // Compile time row arguments
5945 template< typename VT > // Type of the right-hand side sparse vector
5946 inline void Row<MT,false,false,true,CRAs...>::subAssign( const SparseVector<VT,true>& rhs )
5947 {
5948  using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5949 
5953 
5954  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5955 
5956  const SubType tmp( serial( *this - (~rhs) ) );
5957  matrix_.reset( row() );
5958  matrix_.reserve( row(), tmp.nonZeros() );
5959  assign( tmp );
5960 }
5962 //*************************************************************************************************
5963 
5964 } // namespace blaze
5965 
5966 #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:131
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
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the View base class.
Header file for the row trait.
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
Header file for the IsUniLower type trait.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
typename RowTrait< MT, CRAs... >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:145
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Constraint on the data type.
Constraint on the data type.
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:3082
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:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#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:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for 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.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#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:131
Header file for the reset shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
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:816
#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:3080
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsRestricted type trait.
#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.
Constraint on the data type.