Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_
36 #define _BLAZE_MATH_VIEWS_COLUMN_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
58 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Reset.h>
80 #include <blaze/math/views/Check.h>
85 #include <blaze/util/Assert.h>
88 #include <blaze/util/DisableIf.h>
89 #include <blaze/util/mpl/If.h>
90 #include <blaze/util/TypeList.h>
91 #include <blaze/util/Types.h>
95 #include <blaze/util/Unused.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // CLASS TEMPLATE SPECIALIZATION FOR COLUMN-MAJOR SPARSE MATRICES
103 //
104 //=================================================================================================
105 
106 //*************************************************************************************************
114 template< typename MT // Type of the sparse matrix
115  , bool SF // Symmetry flag
116  , size_t... CCAs > // Compile time column arguments
117 class Column<MT,true,false,SF,CCAs...>
118  : public View< SparseVector< Column<MT,true,false,SF,CCAs...>, false > >
119  , private ColumnData<CCAs...>
120 {
121  private:
122  //**Type definitions****************************************************************************
123  using DataType = ColumnData<CCAs...>;
124  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
125  //**********************************************************************************************
126 
127  public:
128  //**Type definitions****************************************************************************
130  using This = Column<MT,true,false,SF,CCAs...>;
131 
132  using BaseType = SparseVector<This,false>;
133  using ViewedType = MT;
134  using ResultType = ColumnTrait_t<MT,CCAs...>;
135  using TransposeType = TransposeType_t<ResultType>;
136  using ElementType = ElementType_t<MT>;
137  using ReturnType = ReturnType_t<MT>;
138  using CompositeType = const Column&;
139 
141  using ConstReference = ConstReference_t<MT>;
142 
144  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
145 
147  using ConstIterator = ConstIterator_t<MT>;
148 
150  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
151  //**********************************************************************************************
152 
153  //**Compilation flags***************************************************************************
155  static constexpr bool smpAssignable = false;
156  //**********************************************************************************************
157 
158  //**Constructors********************************************************************************
161  template< typename... RCAs >
162  explicit inline Column( MT& matrix, RCAs... args );
163 
164  Column( const Column& ) = default;
166  //**********************************************************************************************
167 
168  //**Destructor**********************************************************************************
171  ~Column() = default;
173  //**********************************************************************************************
174 
175  //**Data access functions***********************************************************************
178  inline Reference operator[]( size_t index );
179  inline ConstReference operator[]( size_t index ) const;
180  inline Reference at( size_t index );
181  inline ConstReference at( size_t index ) const;
182  inline Iterator begin ();
183  inline ConstIterator begin () const;
184  inline ConstIterator cbegin() const;
185  inline Iterator end ();
186  inline ConstIterator end () const;
187  inline ConstIterator cend () const;
189  //**********************************************************************************************
190 
191  //**Assignment operators************************************************************************
194  inline Column& operator=( initializer_list<ElementType> list );
195  inline Column& operator=( const Column& rhs );
196 
197  template< typename VT > inline Column& operator= ( const DenseVector<VT,false>& rhs );
198  template< typename VT > inline Column& operator= ( const SparseVector<VT,false>& rhs );
199  template< typename VT > inline Column& operator+=( const DenseVector<VT,false>& rhs );
200  template< typename VT > inline Column& operator+=( const SparseVector<VT,false>& rhs );
201  template< typename VT > inline Column& operator-=( const DenseVector<VT,false>& rhs );
202  template< typename VT > inline Column& operator-=( const SparseVector<VT,false>& rhs );
203  template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
204  template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
205  template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
207  //**********************************************************************************************
208 
209  //**Utility functions***************************************************************************
212  using DataType::column;
213 
214  inline MT& operand() noexcept;
215  inline const MT& operand() const noexcept;
216 
217  inline size_t size() const noexcept;
218  inline size_t capacity() const noexcept;
219  inline size_t nonZeros() const;
220  inline void reset();
221  inline void reserve( size_t n );
223  //**********************************************************************************************
224 
225  //**Insertion functions*************************************************************************
228  inline Iterator set ( size_t index, const ElementType& value );
229  inline Iterator insert( size_t index, const ElementType& value );
230  inline void append( size_t index, const ElementType& value, bool check=false );
232  //**********************************************************************************************
233 
234  //**Erase functions*****************************************************************************
237  inline void erase( size_t index );
238  inline Iterator erase( Iterator pos );
239  inline Iterator erase( Iterator first, Iterator last );
240 
241  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
242  inline void erase( Pred predicate );
243 
244  template< typename Pred >
245  inline void erase( Iterator first, Iterator last, Pred predicate );
247  //**********************************************************************************************
248 
249  //**Lookup functions****************************************************************************
252  inline Iterator find ( size_t index );
253  inline ConstIterator find ( size_t index ) const;
254  inline Iterator lowerBound( size_t index );
255  inline ConstIterator lowerBound( size_t index ) const;
256  inline Iterator upperBound( size_t index );
257  inline ConstIterator upperBound( size_t index ) const;
259  //**********************************************************************************************
260 
261  //**Numeric functions***************************************************************************
264  template< typename Other > inline Column& scale( const Other& scalar );
266  //**********************************************************************************************
267 
268  //**Expression template evaluation functions****************************************************
271  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
272  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
273 
274  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
275  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
276  template< typename VT > inline void addAssign( const DenseVector <VT,false>& rhs );
277  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
278  template< typename VT > inline void subAssign( const DenseVector <VT,false>& rhs );
279  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
281  //**********************************************************************************************
282 
283  private:
284  //**Utility functions***************************************************************************
287  inline size_t extendCapacity() const noexcept;
289  //**********************************************************************************************
290 
291  //**Member variables****************************************************************************
294  Operand matrix_;
295 
296  //**********************************************************************************************
297 
298  //**Compile time checks*************************************************************************
306  //**********************************************************************************************
307 };
309 //*************************************************************************************************
310 
311 
312 
313 
314 //=================================================================================================
315 //
316 // CONSTRUCTORS
317 //
318 //=================================================================================================
319 
320 //*************************************************************************************************
333 template< typename MT // Type of the sparse matrix
334  , bool SF // Symmetry flag
335  , size_t... CCAs > // Compile time column arguments
336 template< typename... RCAs > // Runtime column arguments
337 inline Column<MT,true,false,SF,CCAs...>::Column( MT& matrix, RCAs... args )
338  : DataType( args... ) // Base class initialization
339  , matrix_ ( matrix ) // The matrix containing the column
340 {
341  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
342  if( matrix_.columns() <= column() ) {
343  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
344  }
345  }
346  else {
347  BLAZE_USER_ASSERT( column() < matrix_.columns(), "Invalid column access index" );
348  }
349 }
351 //*************************************************************************************************
352 
353 
354 
355 
356 //=================================================================================================
357 //
358 // DATA ACCESS FUNCTIONS
359 //
360 //=================================================================================================
361 
362 //*************************************************************************************************
372 template< typename MT // Type of the sparse matrix
373  , bool SF // Symmetry flag
374  , size_t... CCAs > // Compile time column arguments
375 inline typename Column<MT,true,false,SF,CCAs...>::Reference
376  Column<MT,true,false,SF,CCAs...>::operator[]( size_t index )
377 {
378  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
379  return matrix_(index,column());
380 }
382 //*************************************************************************************************
383 
384 
385 //*************************************************************************************************
395 template< typename MT // Type of the sparse matrix
396  , bool SF // Symmetry flag
397  , size_t... CCAs > // Compile time column arguments
398 inline typename Column<MT,true,false,SF,CCAs...>::ConstReference
399  Column<MT,true,false,SF,CCAs...>::operator[]( size_t index ) const
400 {
401  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
402  return const_cast<const MT&>( matrix_ )(index,column());
403 }
405 //*************************************************************************************************
406 
407 
408 //*************************************************************************************************
419 template< typename MT // Type of the sparse matrix
420  , bool SF // Symmetry flag
421  , size_t... CCAs > // Compile time column arguments
422 inline typename Column<MT,true,false,SF,CCAs...>::Reference
423  Column<MT,true,false,SF,CCAs...>::at( size_t index )
424 {
425  if( index >= size() ) {
426  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
427  }
428  return (*this)[index];
429 }
431 //*************************************************************************************************
432 
433 
434 //*************************************************************************************************
445 template< typename MT // Type of the sparse matrix
446  , bool SF // Symmetry flag
447  , size_t... CCAs > // Compile time column arguments
448 inline typename Column<MT,true,false,SF,CCAs...>::ConstReference
449  Column<MT,true,false,SF,CCAs...>::at( size_t index ) const
450 {
451  if( index >= size() ) {
452  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
453  }
454  return (*this)[index];
455 }
457 //*************************************************************************************************
458 
459 
460 //*************************************************************************************************
468 template< typename MT // Type of the sparse matrix
469  , bool SF // Symmetry flag
470  , size_t... CCAs > // Compile time column arguments
471 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
473 {
474  return matrix_.begin( column() );
475 }
477 //*************************************************************************************************
478 
479 
480 //*************************************************************************************************
488 template< typename MT // Type of the sparse matrix
489  , bool SF // Symmetry flag
490  , size_t... CCAs > // Compile time column arguments
491 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
493 {
494  return matrix_.cbegin( column() );
495 }
497 //*************************************************************************************************
498 
499 
500 //*************************************************************************************************
508 template< typename MT // Type of the sparse matrix
509  , bool SF // Symmetry flag
510  , size_t... CCAs > // Compile time column arguments
511 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
513 {
514  return matrix_.cbegin( column() );
515 }
517 //*************************************************************************************************
518 
519 
520 //*************************************************************************************************
528 template< typename MT // Type of the sparse matrix
529  , bool SF // Symmetry flag
530  , size_t... CCAs > // Compile time column arguments
531 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
533 {
534  return matrix_.end( column() );
535 }
537 //*************************************************************************************************
538 
539 
540 //*************************************************************************************************
548 template< typename MT // Type of the sparse matrix
549  , bool SF // Symmetry flag
550  , size_t... CCAs > // Compile time column arguments
551 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
553 {
554  return matrix_.cend( column() );
555 }
557 //*************************************************************************************************
558 
559 
560 //*************************************************************************************************
568 template< typename MT // Type of the sparse matrix
569  , bool SF // Symmetry flag
570  , size_t... CCAs > // Compile time column arguments
571 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
573 {
574  return matrix_.cend( column() );
575 }
577 //*************************************************************************************************
578 
579 
580 
581 
582 //=================================================================================================
583 //
584 // ASSIGNMENT OPERATORS
585 //
586 //=================================================================================================
587 
588 //*************************************************************************************************
603 template< typename MT // Type of the sparse matrix
604  , bool SF // Symmetry flag
605  , size_t... CCAs > // Compile time column arguments
606 inline Column<MT,true,false,SF,CCAs...>&
607  Column<MT,true,false,SF,CCAs...>::operator=( initializer_list<ElementType> list )
608 {
609  using blaze::assign;
610 
611  if( list.size() > size() ) {
612  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to column" );
613  }
614 
615  const InitializerVector<ElementType,false> tmp( list, size() );
616 
617  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
618  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
619  }
620 
621  decltype(auto) left( derestrict( *this ) );
622 
623  left.reset();
624  assign( left, tmp );
625 
626  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
627 
628  return *this;
629 }
631 //*************************************************************************************************
632 
633 
634 //*************************************************************************************************
648 template< typename MT // Type of the sparse matrix
649  , bool SF // Symmetry flag
650  , size_t... CCAs > // Compile time column arguments
651 inline Column<MT,true,false,SF,CCAs...>&
652  Column<MT,true,false,SF,CCAs...>::operator=( const Column& rhs )
653 {
654  using blaze::assign;
655 
659 
660  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
661  return *this;
662 
663  if( size() != rhs.size() ) {
664  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
665  }
666 
667  if( !tryAssign( matrix_, rhs, 0UL, column() ) ) {
668  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
669  }
670 
671  decltype(auto) left( derestrict( *this ) );
672 
673  if( rhs.canAlias( &matrix_ ) ) {
674  const ResultType tmp( rhs );
675  left.reset();
676  left.reserve( tmp.nonZeros() );
677  assign( left, tmp );
678  }
679  else {
680  left.reset();
681  left.reserve( rhs.nonZeros() );
682  assign( left, rhs );
683  }
684 
685  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
686 
687  return *this;
688 }
690 //*************************************************************************************************
691 
692 
693 //*************************************************************************************************
707 template< typename MT // Type of the sparse matrix
708  , bool SF // Symmetry flag
709  , size_t... CCAs > // Compile time column arguments
710 template< typename VT > // Type of the right-hand side dense vector
711 inline Column<MT,true,false,SF,CCAs...>&
712  Column<MT,true,false,SF,CCAs...>::operator=( const DenseVector<VT,false>& rhs )
713 {
714  using blaze::assign;
715 
716  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
717  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
719 
720  if( size() != (~rhs).size() ) {
721  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
722  }
723 
724  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
725  Right right( ~rhs );
726 
727  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
728  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
729  }
730 
731  decltype(auto) left( derestrict( *this ) );
732 
733  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
734  const ResultType_t<VT> tmp( right );
735  left.reset();
736  assign( left, tmp );
737  }
738  else {
739  left.reset();
740  assign( left, right );
741  }
742 
743  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
744 
745  return *this;
746 }
748 //*************************************************************************************************
749 
750 
751 //*************************************************************************************************
765 template< typename MT // Type of the sparse matrix
766  , bool SF // Symmetry flag
767  , size_t... CCAs > // Compile time column arguments
768 template< typename VT > // Type of the right-hand side sparse vector
769 inline Column<MT,true,false,SF,CCAs...>&
770  Column<MT,true,false,SF,CCAs...>::operator=( const SparseVector<VT,false>& rhs )
771 {
772  using blaze::assign;
773 
774  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
775  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
777 
778  if( size() != (~rhs).size() ) {
779  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
780  }
781 
782  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
783  Right right( ~rhs );
784 
785  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
786  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
787  }
788 
789  decltype(auto) left( derestrict( *this ) );
790 
791  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
792  const ResultType_t<VT> tmp( right );
793  left.reset();
794  left.reserve( tmp.nonZeros() );
795  assign( left, tmp );
796  }
797  else {
798  left.reset();
799  left.reserve( right.nonZeros() );
800  assign( left, right );
801  }
802 
803  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
804 
805  return *this;
806 }
808 //*************************************************************************************************
809 
810 
811 //*************************************************************************************************
825 template< typename MT // Type of the sparse matrix
826  , bool SF // Symmetry flag
827  , size_t... CCAs > // Compile time column arguments
828 template< typename VT > // Type of the right-hand side dense vector
829 inline Column<MT,true,false,SF,CCAs...>&
830  Column<MT,true,false,SF,CCAs...>::operator+=( const DenseVector<VT,false>& rhs )
831 {
832  using blaze::assign;
833 
837  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
838  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
840 
841  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
842 
846 
847  if( size() != (~rhs).size() ) {
848  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
849  }
850 
851  const AddType tmp( *this + (~rhs) );
852 
853  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
854  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
855  }
856 
857  decltype(auto) left( derestrict( *this ) );
858 
859  left.reset();
860  assign( left, tmp );
861 
862  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
863 
864  return *this;
865 }
867 //*************************************************************************************************
868 
869 
870 //*************************************************************************************************
884 template< typename MT // Type of the sparse matrix
885  , bool SF // Symmetry flag
886  , size_t... CCAs > // Compile time column arguments
887 template< typename VT > // Type of the right-hand side sparse vector
888 inline Column<MT,true,false,SF,CCAs...>&
889  Column<MT,true,false,SF,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
890 {
891  using blaze::assign;
892 
896  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
897  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
899 
900  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
901 
905 
906  if( size() != (~rhs).size() ) {
907  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
908  }
909 
910  const AddType tmp( *this + (~rhs) );
911 
912  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
913  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
914  }
915 
916  decltype(auto) left( derestrict( *this ) );
917 
918  left.reset();
919  left.reserve( tmp.nonZeros() );
920  assign( left, tmp );
921 
922  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
923 
924  return *this;
925 }
927 //*************************************************************************************************
928 
929 
930 //*************************************************************************************************
945 template< typename MT // Type of the sparse matrix
946  , bool SF // Symmetry flag
947  , size_t... CCAs > // Compile time column arguments
948 template< typename VT > // Type of the right-hand side dense vector
949 inline Column<MT,true,false,SF,CCAs...>&
950  Column<MT,true,false,SF,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
951 {
952  using blaze::assign;
953 
957  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
958  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
960 
961  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
962 
966 
967  if( size() != (~rhs).size() ) {
968  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
969  }
970 
971  const SubType tmp( *this - (~rhs) );
972 
973  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
974  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
975  }
976 
977  decltype(auto) left( derestrict( *this ) );
978 
979  left.reset();
980  assign( left, tmp );
981 
982  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
983 
984  return *this;
985 }
987 //*************************************************************************************************
988 
989 
990 //*************************************************************************************************
1005 template< typename MT // Type of the sparse matrix
1006  , bool SF // Symmetry flag
1007  , size_t... CCAs > // Compile time column arguments
1008 template< typename VT > // Type of the right-hand side sparse vector
1009 inline Column<MT,true,false,SF,CCAs...>&
1010  Column<MT,true,false,SF,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
1011 {
1012  using blaze::assign;
1013 
1017  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
1018  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1020 
1021  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1022 
1026 
1027  if( size() != (~rhs).size() ) {
1028  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1029  }
1030 
1031  const SubType tmp( *this - (~rhs) );
1032 
1033  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1034  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1035  }
1036 
1037  decltype(auto) left( derestrict( *this ) );
1038 
1039  left.reset();
1040  left.reserve( tmp.nonZeros() );
1041  assign( left, tmp );
1042 
1043  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1044 
1045  return *this;
1046 }
1048 //*************************************************************************************************
1049 
1050 
1051 //*************************************************************************************************
1064 template< typename MT // Type of the sparse matrix
1065  , bool SF // Symmetry flag
1066  , size_t... CCAs > // Compile time column arguments
1067 template< typename VT > // Type of the right-hand side vector
1068 inline Column<MT,true,false,SF,CCAs...>&
1069  Column<MT,true,false,SF,CCAs...>::operator*=( const Vector<VT,false>& rhs )
1070 {
1071  using blaze::assign;
1072 
1076  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1078 
1079  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1080 
1083 
1084  if( size() != (~rhs).size() ) {
1085  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1086  }
1087 
1088  const MultType tmp( *this * (~rhs) );
1089 
1090  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1091  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1092  }
1093 
1094  decltype(auto) left( derestrict( *this ) );
1095 
1096  left.reset();
1097  assign( left, tmp );
1098 
1099  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1100 
1101  return *this;
1102 }
1104 //*************************************************************************************************
1105 
1106 
1107 //*************************************************************************************************
1119 template< typename MT // Type of the sparse matrix
1120  , bool SF // Symmetry flag
1121  , size_t... CCAs > // Compile time column arguments
1122 template< typename VT > // Type of the right-hand side vector
1123 inline Column<MT,true,false,SF,CCAs...>&
1124  Column<MT,true,false,SF,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
1125 {
1126  using blaze::assign;
1127 
1131  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
1132  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1134 
1135  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1136 
1140 
1141  if( size() != (~rhs).size() ) {
1142  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1143  }
1144 
1145  const DivType tmp( *this / (~rhs) );
1146 
1147  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1148  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1149  }
1150 
1151  decltype(auto) left( derestrict( *this ) );
1152 
1153  left.reset();
1154  assign( left, tmp );
1155 
1156  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1157 
1158  return *this;
1159 }
1161 //*************************************************************************************************
1162 
1163 
1164 //*************************************************************************************************
1177 template< typename MT // Type of the sparse matrix
1178  , bool SF // Symmetry flag
1179  , size_t... CCAs > // Compile time column arguments
1180 template< typename VT > // Type of the right-hand side vector
1181 inline Column<MT,true,false,SF,CCAs...>&
1182  Column<MT,true,false,SF,CCAs...>::operator%=( const Vector<VT,false>& rhs )
1183 {
1184  using blaze::assign;
1185 
1186  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1188 
1189  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1190 
1194 
1195  if( size() != 3UL || (~rhs).size() != 3UL ) {
1196  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1197  }
1198 
1199  const CrossType tmp( *this % (~rhs) );
1200 
1201  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1202  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1203  }
1204 
1205  decltype(auto) left( derestrict( *this ) );
1206 
1207  left.reset();
1208  assign( left, tmp );
1209 
1210  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1211 
1212  return *this;
1213 }
1215 //*************************************************************************************************
1216 
1217 
1218 
1219 
1220 //=================================================================================================
1221 //
1222 // UTILITY FUNCTIONS
1223 //
1224 //=================================================================================================
1225 
1226 //*************************************************************************************************
1232 template< typename MT // Type of the sparse matrix
1233  , bool SF // Symmetry flag
1234  , size_t... CCAs > // Compile time column arguments
1235 inline MT& Column<MT,true,false,SF,CCAs...>::operand() noexcept
1236 {
1237  return matrix_;
1238 }
1240 //*************************************************************************************************
1241 
1242 
1243 //*************************************************************************************************
1249 template< typename MT // Type of the sparse matrix
1250  , bool SF // Symmetry flag
1251  , size_t... CCAs > // Compile time column arguments
1252 inline const MT& Column<MT,true,false,SF,CCAs...>::operand() const noexcept
1253 {
1254  return matrix_;
1255 }
1257 //*************************************************************************************************
1258 
1259 
1260 //*************************************************************************************************
1266 template< typename MT // Type of the sparse matrix
1267  , bool SF // Symmetry flag
1268  , size_t... CCAs > // Compile time column arguments
1269 inline size_t Column<MT,true,false,SF,CCAs...>::size() const noexcept
1270 {
1271  return matrix_.rows();
1272 }
1274 //*************************************************************************************************
1275 
1276 
1277 //*************************************************************************************************
1283 template< typename MT // Type of the sparse matrix
1284  , bool SF // Symmetry flag
1285  , size_t... CCAs > // Compile time column arguments
1286 inline size_t Column<MT,true,false,SF,CCAs...>::capacity() const noexcept
1287 {
1288  return matrix_.capacity( column() );
1289 }
1291 //*************************************************************************************************
1292 
1293 
1294 //*************************************************************************************************
1303 template< typename MT // Type of the sparse matrix
1304  , bool SF // Symmetry flag
1305  , size_t... CCAs > // Compile time column arguments
1306 inline size_t Column<MT,true,false,SF,CCAs...>::nonZeros() const
1307 {
1308  return matrix_.nonZeros( column() );
1309 }
1311 //*************************************************************************************************
1312 
1313 
1314 //*************************************************************************************************
1320 template< typename MT // Type of the sparse matrix
1321  , bool SF // Symmetry flag
1322  , size_t... CCAs > // Compile time column arguments
1324 {
1325  matrix_.reset( column() );
1326 }
1328 //*************************************************************************************************
1329 
1330 
1331 //*************************************************************************************************
1341 template< typename MT // Type of the sparse matrix
1342  , bool SF // Symmetry flag
1343  , size_t... CCAs > // Compile time column arguments
1344 void Column<MT,true,false,SF,CCAs...>::reserve( size_t n )
1345 {
1346  matrix_.reserve( column(), n );
1347 }
1349 //*************************************************************************************************
1350 
1351 
1352 //*************************************************************************************************
1361 template< typename MT // Type of the sparse matrix
1362  , bool SF // Symmetry flag
1363  , size_t... CCAs > // Compile time column arguments
1364 inline size_t Column<MT,true,false,SF,CCAs...>::extendCapacity() const noexcept
1365 {
1366  using blaze::max;
1367  using blaze::min;
1368 
1369  size_t nonzeros( 2UL*capacity()+1UL );
1370  nonzeros = max( nonzeros, 7UL );
1371  nonzeros = min( nonzeros, size() );
1372 
1373  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
1374 
1375  return nonzeros;
1376 }
1378 //*************************************************************************************************
1379 
1380 
1381 
1382 
1383 //=================================================================================================
1384 //
1385 // INSERTION FUNCTIONS
1386 //
1387 //=================================================================================================
1388 
1389 //*************************************************************************************************
1401 template< typename MT // Type of the sparse matrix
1402  , bool SF // Symmetry flag
1403  , size_t... CCAs > // Compile time column arguments
1404 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1405  Column<MT,true,false,SF,CCAs...>::set( size_t index, const ElementType& value )
1406 {
1407  return matrix_.set( index, column(), value );
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1426 template< typename MT // Type of the sparse matrix
1427  , bool SF // Symmetry flag
1428  , size_t... CCAs > // Compile time column arguments
1429 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1430  Column<MT,true,false,SF,CCAs...>::insert( size_t index, const ElementType& value )
1431 {
1432  return matrix_.insert( index, column(), value );
1433 }
1435 //*************************************************************************************************
1436 
1437 
1438 //*************************************************************************************************
1463 template< typename MT // Type of the sparse matrix
1464  , bool SF // Symmetry flag
1465  , size_t... CCAs > // Compile time column arguments
1466 inline void Column<MT,true,false,SF,CCAs...>::append( size_t index, const ElementType& value, bool check )
1467 {
1468  matrix_.append( index, column(), value, check );
1469 }
1471 //*************************************************************************************************
1472 
1473 
1474 
1475 
1476 //=================================================================================================
1477 //
1478 // ERASE FUNCTIONS
1479 //
1480 //=================================================================================================
1481 
1482 //*************************************************************************************************
1491 template< typename MT // Type of the sparse matrix
1492  , bool SF // Symmetry flag
1493  , size_t... CCAs > // Compile time column arguments
1494 inline void Column<MT,true,false,SF,CCAs...>::erase( size_t index )
1495 {
1496  matrix_.erase( index, column() );
1497 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1511 template< typename MT // Type of the sparse matrix
1512  , bool SF // Symmetry flag
1513  , size_t... CCAs > // Compile time column arguments
1514 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1515  Column<MT,true,false,SF,CCAs...>::erase( Iterator pos )
1516 {
1517  return matrix_.erase( column(), pos );
1518 }
1520 //*************************************************************************************************
1521 
1522 
1523 //*************************************************************************************************
1533 template< typename MT // Type of the sparse matrix
1534  , bool SF // Symmetry flag
1535  , size_t... CCAs > // Compile time column arguments
1536 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1537  Column<MT,true,false,SF,CCAs...>::erase( Iterator first, Iterator last )
1538 {
1539  return matrix_.erase( column(), first, last );
1540 }
1542 //*************************************************************************************************
1543 
1544 
1545 //*************************************************************************************************
1568 template< typename MT // Type of the sparse matrix
1569  , bool SF // Symmetry flag
1570  , size_t... CCAs > // Compile time column arguments
1571 template< typename Pred // Type of the unary predicate
1572  , typename > // Type restriction on the unary predicate
1573 inline void Column<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1574 {
1575  matrix_.erase( column(), begin(), end(), predicate );
1576 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1606 template< typename MT // Type of the sparse matrix
1607  , bool SF // Symmetry flag
1608  , size_t... CCAs > // Compile time column arguments
1609 template< typename Pred > // Type of the unary predicate
1610 inline void Column<MT,true,false,SF,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
1611 {
1612  matrix_.erase( column(), first, last, predicate );
1613 }
1615 //*************************************************************************************************
1616 
1617 
1618 
1619 
1620 //=================================================================================================
1621 //
1622 // LOOKUP FUNCTIONS
1623 //
1624 //=================================================================================================
1625 
1626 //*************************************************************************************************
1640 template< typename MT // Type of the sparse matrix
1641  , bool SF // Symmetry flag
1642  , size_t... CCAs > // Compile time column arguments
1643 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1644  Column<MT,true,false,SF,CCAs...>::find( size_t index )
1645 {
1646  return matrix_.find( index, column() );
1647 }
1649 //*************************************************************************************************
1650 
1651 
1652 //*************************************************************************************************
1666 template< typename MT // Type of the sparse matrix
1667  , bool SF // Symmetry flag
1668  , size_t... CCAs > // Compile time column arguments
1669 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
1670  Column<MT,true,false,SF,CCAs...>::find( size_t index ) const
1671 {
1672  return matrix_.find( index, column() );
1673 }
1675 //*************************************************************************************************
1676 
1677 
1678 //*************************************************************************************************
1691 template< typename MT // Type of the sparse matrix
1692  , bool SF // Symmetry flag
1693  , size_t... CCAs > // Compile time column arguments
1694 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1695  Column<MT,true,false,SF,CCAs...>::lowerBound( size_t index )
1696 {
1697  return matrix_.lowerBound( index, column() );
1698 }
1700 //*************************************************************************************************
1701 
1702 
1703 //*************************************************************************************************
1716 template< typename MT // Type of the sparse matrix
1717  , bool SF // Symmetry flag
1718  , size_t... CCAs > // Compile time column arguments
1719 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
1720  Column<MT,true,false,SF,CCAs...>::lowerBound( size_t index ) const
1721 {
1722  return matrix_.lowerBound( index, column() );
1723 }
1725 //*************************************************************************************************
1726 
1727 
1728 //*************************************************************************************************
1741 template< typename MT // Type of the sparse matrix
1742  , bool SF // Symmetry flag
1743  , size_t... CCAs > // Compile time column arguments
1744 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1745  Column<MT,true,false,SF,CCAs...>::upperBound( size_t index )
1746 {
1747  return matrix_.upperBound( index, column() );
1748 }
1750 //*************************************************************************************************
1751 
1752 
1753 //*************************************************************************************************
1766 template< typename MT // Type of the sparse matrix
1767  , bool SF // Symmetry flag
1768  , size_t... CCAs > // Compile time column arguments
1769 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
1770  Column<MT,true,false,SF,CCAs...>::upperBound( size_t index ) const
1771 {
1772  return matrix_.upperBound( index, column() );
1773 }
1775 //*************************************************************************************************
1776 
1777 
1778 
1779 
1780 //=================================================================================================
1781 //
1782 // NUMERIC FUNCTIONS
1783 //
1784 //=================================================================================================
1785 
1786 //*************************************************************************************************
1799 template< typename MT // Type of the sparse matrix
1800  , bool SF // Symmetry flag
1801  , size_t... CCAs > // Compile time column arguments
1802 template< typename Other > // Data type of the scalar value
1803 inline Column<MT,true,false,SF,CCAs...>&
1804  Column<MT,true,false,SF,CCAs...>::scale( const Other& scalar )
1805 {
1807 
1808  for( Iterator element=begin(); element!=end(); ++element )
1809  element->value() *= scalar;
1810  return *this;
1811 }
1813 //*************************************************************************************************
1814 
1815 
1816 
1817 
1818 //=================================================================================================
1819 //
1820 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1821 //
1822 //=================================================================================================
1823 
1824 //*************************************************************************************************
1835 template< typename MT // Type of the sparse matrix
1836  , bool SF // Symmetry flag
1837  , size_t... CCAs > // Compile time column arguments
1838 template< typename Other > // Data type of the foreign expression
1839 inline bool Column<MT,true,false,SF,CCAs...>::canAlias( const Other* alias ) const noexcept
1840 {
1841  return matrix_.isAliased( alias );
1842 }
1844 //*************************************************************************************************
1845 
1846 
1847 //*************************************************************************************************
1858 template< typename MT // Type of the sparse matrix
1859  , bool SF // Symmetry flag
1860  , size_t... CCAs > // Compile time column arguments
1861 template< typename Other > // Data type of the foreign expression
1862 inline bool Column<MT,true,false,SF,CCAs...>::isAliased( const Other* alias ) const noexcept
1863 {
1864  return matrix_.isAliased( alias );
1865 }
1867 //*************************************************************************************************
1868 
1869 
1870 //*************************************************************************************************
1882 template< typename MT // Type of the sparse matrix
1883  , bool SF // Symmetry flag
1884  , size_t... CCAs > // Compile time column arguments
1885 template< typename VT > // Type of the right-hand side dense vector
1886 inline void Column<MT,true,false,SF,CCAs...>::assign( const DenseVector<VT,false>& rhs )
1887 {
1888  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1889  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1890 
1891  for( size_t i=0UL; i<size(); ++i )
1892  {
1893  if( matrix_.nonZeros( column() ) == matrix_.capacity( column() ) )
1894  matrix_.reserve( column(), extendCapacity() );
1895 
1896  matrix_.append( i, column(), (~rhs)[i], true );
1897  }
1898 }
1900 //*************************************************************************************************
1901 
1902 
1903 //*************************************************************************************************
1915 template< typename MT // Type of the sparse matrix
1916  , bool SF // Symmetry flag
1917  , size_t... CCAs > // Compile time column arguments
1918 template< typename VT > // Type of the right-hand side sparse vector
1919 inline void Column<MT,true,false,SF,CCAs...>::assign( const SparseVector<VT,false>& rhs )
1920 {
1921  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1922  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1923 
1924  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1925  matrix_.append( element->index(), column(), element->value(), true );
1926  }
1927 }
1929 //*************************************************************************************************
1930 
1931 
1932 //*************************************************************************************************
1944 template< typename MT // Type of the sparse matrix
1945  , bool SF // Symmetry flag
1946  , size_t... CCAs > // Compile time column arguments
1947 template< typename VT > // Type of the right-hand side dense vector
1948 inline void Column<MT,true,false,SF,CCAs...>::addAssign( const DenseVector<VT,false>& rhs )
1949 {
1950  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1951 
1955 
1956  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1957 
1958  const AddType tmp( serial( *this + (~rhs) ) );
1959  matrix_.reset( column() );
1960  assign( tmp );
1961 }
1963 //*************************************************************************************************
1964 
1965 
1966 //*************************************************************************************************
1978 template< typename MT // Type of the sparse matrix
1979  , bool SF // Symmetry flag
1980  , size_t... CCAs > // Compile time column arguments
1981 template< typename VT > // Type of the right-hand side sparse vector
1982 inline void Column<MT,true,false,SF,CCAs...>::addAssign( const SparseVector<VT,false>& rhs )
1983 {
1984  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1985 
1989 
1990  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1991 
1992  const AddType tmp( serial( *this + (~rhs) ) );
1993  matrix_.reset( column() );
1994  matrix_.reserve( column(), tmp.nonZeros() );
1995  assign( tmp );
1996 }
1998 //*************************************************************************************************
1999 
2000 
2001 //*************************************************************************************************
2013 template< typename MT // Type of the sparse matrix
2014  , bool SF // Symmetry flag
2015  , size_t... CCAs > // Compile time column arguments
2016 template< typename VT > // Type of the right-hand side dense vector
2017 inline void Column<MT,true,false,SF,CCAs...>::subAssign( const DenseVector<VT,false>& rhs )
2018 {
2019  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2020 
2024 
2025  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2026 
2027  const SubType tmp( serial( *this - (~rhs) ) );
2028  matrix_.reset( column() );
2029  assign( tmp );
2030 }
2032 //*************************************************************************************************
2033 
2034 
2035 //*************************************************************************************************
2047 template< typename MT // Type of the sparse matrix
2048  , bool SF // Symmetry flag
2049  , size_t... CCAs > // Compile time column arguments
2050 template< typename VT > // Type of the right-hand side sparse vector
2051 inline void Column<MT,true,false,SF,CCAs...>::subAssign( const SparseVector<VT,false>& rhs )
2052 {
2053  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2054 
2058 
2059  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2060 
2061  const SubType tmp( serial( *this - (~rhs) ) );
2062  matrix_.reset( column() );
2063  matrix_.reserve( column(), tmp.nonZeros() );
2064  assign( tmp );
2065 }
2067 //*************************************************************************************************
2068 
2069 
2070 
2071 
2072 
2073 
2074 
2075 
2076 //=================================================================================================
2077 //
2078 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL ROW-MAJOR SPARSE MATRICES
2079 //
2080 //=================================================================================================
2081 
2082 //*************************************************************************************************
2090 template< typename MT // Type of the sparse matrix
2091  , size_t... CCAs > // Compile time column arguments
2092 class Column<MT,false,false,false,CCAs...>
2093  : public View< SparseVector< Column<MT,false,false,false,CCAs...>, false > >
2094  , private ColumnData<CCAs...>
2095 {
2096  private:
2097  //**Type definitions****************************************************************************
2098  using DataType = ColumnData<CCAs...>;
2099  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2100  //**********************************************************************************************
2101 
2102  public:
2103  //**Type definitions****************************************************************************
2105  using This = Column<MT,false,false,false,CCAs...>;
2106 
2107  using BaseType = SparseVector<This,false>;
2108  using ViewedType = MT;
2109  using ResultType = ColumnTrait_t<MT,CCAs...>;
2110  using TransposeType = TransposeType_t<ResultType>;
2111  using ElementType = ElementType_t<MT>;
2112  using ReturnType = ReturnType_t<MT>;
2113  using CompositeType = const Column&;
2114 
2116  using ConstReference = ConstReference_t<MT>;
2117 
2119  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2120  //**********************************************************************************************
2121 
2122  //**ColumnElement class definition**************************************************************
2125  template< typename MatrixType // Type of the sparse matrix
2126  , typename IteratorType > // Type of the sparse matrix iterator
2127  class ColumnElement
2128  : private SparseElement
2129  {
2130  public:
2131  //**Constructor******************************************************************************
2137  inline ColumnElement( IteratorType pos, size_t row )
2138  : pos_( pos ) // Iterator to the current position within the sparse column
2139  , row_( row ) // Index of the according row
2140  {}
2141  //*******************************************************************************************
2142 
2143  //**Assignment operator**********************************************************************
2149  template< typename T > inline ColumnElement& operator=( const T& v ) {
2150  *pos_ = v;
2151  return *this;
2152  }
2153  //*******************************************************************************************
2154 
2155  //**Addition assignment operator*************************************************************
2161  template< typename T > inline ColumnElement& operator+=( const T& v ) {
2162  *pos_ += v;
2163  return *this;
2164  }
2165  //*******************************************************************************************
2166 
2167  //**Subtraction assignment operator**********************************************************
2173  template< typename T > inline ColumnElement& operator-=( const T& v ) {
2174  *pos_ -= v;
2175  return *this;
2176  }
2177  //*******************************************************************************************
2178 
2179  //**Multiplication assignment operator*******************************************************
2185  template< typename T > inline ColumnElement& operator*=( const T& v ) {
2186  *pos_ *= v;
2187  return *this;
2188  }
2189  //*******************************************************************************************
2190 
2191  //**Division assignment operator*************************************************************
2197  template< typename T > inline ColumnElement& operator/=( const T& v ) {
2198  *pos_ /= v;
2199  return *this;
2200  }
2201  //*******************************************************************************************
2202 
2203  //**Element access operator******************************************************************
2208  inline const ColumnElement* operator->() const {
2209  return this;
2210  }
2211  //*******************************************************************************************
2212 
2213  //**Value function***************************************************************************
2218  inline decltype(auto) value() const {
2219  return pos_->value();
2220  }
2221  //*******************************************************************************************
2222 
2223  //**Index function***************************************************************************
2228  inline size_t index() const {
2229  return row_;
2230  }
2231  //*******************************************************************************************
2232 
2233  private:
2234  //**Member variables*************************************************************************
2235  IteratorType pos_;
2236  size_t row_;
2237  //*******************************************************************************************
2238  };
2239  //**********************************************************************************************
2240 
2241  //**ColumnIterator class definition*************************************************************
2244  template< typename MatrixType // Type of the sparse matrix
2245  , typename IteratorType > // Type of the sparse matrix iterator
2246  class ColumnIterator
2247  {
2248  public:
2249  //**Type definitions*************************************************************************
2250  using IteratorCategory = std::forward_iterator_tag;
2251  using ValueType = ColumnElement<MatrixType,IteratorType>;
2252  using PointerType = ValueType;
2253  using ReferenceType = ValueType;
2254  using DifferenceType = ptrdiff_t;
2255 
2256  // STL iterator requirements
2257  using iterator_category = IteratorCategory;
2258  using value_type = ValueType;
2259  using pointer = PointerType;
2260  using reference = ReferenceType;
2261  using difference_type = DifferenceType;
2262  //*******************************************************************************************
2263 
2264  //**Constructor******************************************************************************
2267  inline ColumnIterator()
2268  : matrix_( nullptr ) // The sparse matrix containing the column
2269  , row_ ( 0UL ) // The current row index
2270  , column_( 0UL ) // The current column index
2271  , pos_ () // Iterator to the current sparse element
2272  {}
2273  //*******************************************************************************************
2274 
2275  //**Constructor******************************************************************************
2282  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column )
2283  : matrix_( &matrix ) // The sparse matrix containing the column
2284  , row_ ( row ) // The current row index
2285  , column_( column ) // The current column index
2286  , pos_ () // Iterator to the current sparse element
2287  {
2288  for( ; row_<matrix_->rows(); ++row_ ) {
2289  pos_ = matrix_->find( row_, column_ );
2290  if( pos_ != matrix_->end( row_ ) ) break;
2291  }
2292  }
2293  //*******************************************************************************************
2294 
2295  //**Constructor******************************************************************************
2303  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column, IteratorType pos )
2304  : matrix_( &matrix ) // The sparse matrix containing the column
2305  , row_ ( row ) // The current row index
2306  , column_( column ) // The current column index
2307  , pos_ ( pos ) // Iterator to the current sparse element
2308  {
2309  BLAZE_INTERNAL_ASSERT( matrix.find( row, column ) == pos, "Invalid initial iterator position" );
2310  }
2311  //*******************************************************************************************
2312 
2313  //**Constructor******************************************************************************
2318  template< typename MatrixType2, typename IteratorType2 >
2319  inline ColumnIterator( const ColumnIterator<MatrixType2,IteratorType2>& it )
2320  : matrix_( it.matrix_ ) // The sparse matrix containing the column
2321  , row_ ( it.row_ ) // The current row index
2322  , column_( it.column_ ) // The current column index
2323  , pos_ ( it.pos_ ) // Iterator to the current sparse element
2324  {}
2325  //*******************************************************************************************
2326 
2327  //**Prefix increment operator****************************************************************
2332  inline ColumnIterator& operator++() {
2333  ++row_;
2334  for( ; row_<matrix_->rows(); ++row_ ) {
2335  pos_ = matrix_->find( row_, column_ );
2336  if( pos_ != matrix_->end( row_ ) ) break;
2337  }
2338 
2339  return *this;
2340  }
2341  //*******************************************************************************************
2342 
2343  //**Postfix increment operator***************************************************************
2348  inline const ColumnIterator operator++( int ) {
2349  const ColumnIterator tmp( *this );
2350  ++(*this);
2351  return tmp;
2352  }
2353  //*******************************************************************************************
2354 
2355  //**Element access operator******************************************************************
2360  inline ReferenceType operator*() const {
2361  return ReferenceType( pos_, row_ );
2362  }
2363  //*******************************************************************************************
2364 
2365  //**Element access operator******************************************************************
2370  inline PointerType operator->() const {
2371  return PointerType( pos_, row_ );
2372  }
2373  //*******************************************************************************************
2374 
2375  //**Equality operator************************************************************************
2381  template< typename MatrixType2, typename IteratorType2 >
2382  inline bool operator==( const ColumnIterator<MatrixType2,IteratorType2>& rhs ) const {
2383  return row_ == rhs.row_;
2384  }
2385  //*******************************************************************************************
2386 
2387  //**Inequality operator**********************************************************************
2393  template< typename MatrixType2, typename IteratorType2 >
2394  inline bool operator!=( const ColumnIterator<MatrixType2,IteratorType2>& rhs ) const {
2395  return !( *this == rhs );
2396  }
2397  //*******************************************************************************************
2398 
2399  //**Subtraction operator*********************************************************************
2405  inline DifferenceType operator-( const ColumnIterator& rhs ) const {
2406  size_t counter( 0UL );
2407  for( size_t i=rhs.row_; i<row_; ++i ) {
2408  if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2409  ++counter;
2410  }
2411  return counter;
2412  }
2413  //*******************************************************************************************
2414 
2415  private:
2416  //**Member variables*************************************************************************
2417  MatrixType* matrix_;
2418  size_t row_;
2419  size_t column_;
2420  IteratorType pos_;
2421  //*******************************************************************************************
2422 
2423  //**Friend declarations**********************************************************************
2424  template< typename MatrixType2, typename IteratorType2 > friend class ColumnIterator;
2425  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CCAs2 > friend class Column;
2426  //*******************************************************************************************
2427  };
2428  //**********************************************************************************************
2429 
2430  //**Type definitions****************************************************************************
2432  using ConstIterator = ColumnIterator< const MT, ConstIterator_t<MT> >;
2433 
2435  using Iterator = If_t< IsConst_v<MT>, ConstIterator, ColumnIterator< MT, Iterator_t<MT> > >;
2436  //**********************************************************************************************
2437 
2438  //**Compilation flags***************************************************************************
2440  static constexpr bool smpAssignable = false;
2441  //**********************************************************************************************
2442 
2443  //**Constructors********************************************************************************
2446  template< typename... RCAs >
2447  explicit inline Column( MT& matrix, RCAs... args );
2448 
2449  Column( const Column& ) = default;
2451  //**********************************************************************************************
2452 
2453  //**Destructor**********************************************************************************
2456  ~Column() = default;
2458  //**********************************************************************************************
2459 
2460  //**Data access functions***********************************************************************
2463  inline Reference operator[]( size_t index );
2464  inline ConstReference operator[]( size_t index ) const;
2465  inline Reference at( size_t index );
2466  inline ConstReference at( size_t index ) const;
2467  inline Iterator begin ();
2468  inline ConstIterator begin () const;
2469  inline ConstIterator cbegin() const;
2470  inline Iterator end ();
2471  inline ConstIterator end () const;
2472  inline ConstIterator cend () const;
2474  //**********************************************************************************************
2475 
2476  //**Assignment operators************************************************************************
2479  inline Column& operator=( initializer_list<ElementType> list );
2480  inline Column& operator=( const Column& rhs );
2481 
2482  template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
2483  template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
2484  template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
2485  template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
2486  template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
2487  template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
2489  //**********************************************************************************************
2490 
2491  //**Utility functions***************************************************************************
2494  using DataType::column;
2495 
2496  inline MT& operand() noexcept;
2497  inline const MT& operand() const noexcept;
2498 
2499  inline size_t size() const;
2500  inline size_t capacity() const;
2501  inline size_t nonZeros() const;
2502  inline void reset();
2503  inline void reserve( size_t n );
2505  //**********************************************************************************************
2506 
2507  //**Insertion functions*************************************************************************
2510  inline Iterator set ( size_t index, const ElementType& value );
2511  inline Iterator insert( size_t index, const ElementType& value );
2512  inline void append( size_t index, const ElementType& value, bool check=false );
2514  //**********************************************************************************************
2515 
2516  //**Erase functions*****************************************************************************
2519  inline void erase( size_t index );
2520  inline Iterator erase( Iterator pos );
2521  inline Iterator erase( Iterator first, Iterator last );
2522 
2523  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
2524  inline void erase( Pred predicate );
2525 
2526  template< typename Pred >
2527  inline void erase( Iterator first, Iterator last, Pred predicate );
2529  //**********************************************************************************************
2530 
2531  //**Lookup functions****************************************************************************
2534  inline Iterator find ( size_t index );
2535  inline ConstIterator find ( size_t index ) const;
2536  inline Iterator lowerBound( size_t index );
2537  inline ConstIterator lowerBound( size_t index ) const;
2538  inline Iterator upperBound( size_t index );
2539  inline ConstIterator upperBound( size_t index ) const;
2541  //**********************************************************************************************
2542 
2543  //**Numeric functions***************************************************************************
2546  template< typename Other > inline Column& scale( const Other& scalar );
2548  //**********************************************************************************************
2549 
2550  //**Expression template evaluation functions****************************************************
2553  template< typename Other > inline bool canAlias ( const Other* alias ) const;
2554  template< typename Other > inline bool isAliased( const Other* alias ) const;
2555 
2556  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
2557  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
2558  template< typename VT > inline void addAssign( const Vector<VT,false>& rhs );
2559  template< typename VT > inline void subAssign( const Vector<VT,false>& rhs );
2561  //**********************************************************************************************
2562 
2563  private:
2564  //**Member variables****************************************************************************
2567  Operand matrix_;
2568 
2569  //**********************************************************************************************
2570 
2571  //**Compile time checks*************************************************************************
2580  //**********************************************************************************************
2581 };
2583 //*************************************************************************************************
2584 
2585 
2586 
2587 
2588 //=================================================================================================
2589 //
2590 // CONSTRUCTORS
2591 //
2592 //=================================================================================================
2593 
2594 //*************************************************************************************************
2607 template< typename MT // Type of the sparse matrix
2608  , size_t... CCAs > // Compile time column arguments
2609 template< typename... RCAs > // Runtime column arguments
2610 inline Column<MT,false,false,false,CCAs...>::Column( MT& matrix, RCAs... args )
2611  : DataType( args... ) // Base class initialization
2612  , matrix_ ( matrix ) // The matrix containing the column
2613 {
2614  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
2615  if( matrix_.columns() <= column() ) {
2616  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
2617  }
2618  }
2619  else {
2620  BLAZE_USER_ASSERT( column() < matrix_.columns(), "Invalid column access index" );
2621  }
2622 }
2624 //*************************************************************************************************
2625 
2626 
2627 
2628 
2629 //=================================================================================================
2630 //
2631 // DATA ACCESS FUNCTIONS
2632 //
2633 //=================================================================================================
2634 
2635 //*************************************************************************************************
2645 template< typename MT // Type of the sparse matrix
2646  , size_t... CCAs > // Compile time column arguments
2647 inline typename Column<MT,false,false,false,CCAs...>::Reference
2648  Column<MT,false,false,false,CCAs...>::operator[]( size_t index )
2649 {
2650  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2651  return matrix_(index,column());
2652 }
2654 //*************************************************************************************************
2655 
2656 
2657 //*************************************************************************************************
2667 template< typename MT // Type of the sparse matrix
2668  , size_t... CCAs > // Compile time column arguments
2669 inline typename Column<MT,false,false,false,CCAs...>::ConstReference
2670  Column<MT,false,false,false,CCAs...>::operator[]( size_t index ) const
2671 {
2672  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2673  return const_cast<const MT&>( matrix_ )(index,column());
2674 }
2676 //*************************************************************************************************
2677 
2678 
2679 //*************************************************************************************************
2690 template< typename MT // Type of the sparse matrix
2691  , size_t... CCAs > // Compile time column arguments
2692 inline typename Column<MT,false,false,false,CCAs...>::Reference
2693  Column<MT,false,false,false,CCAs...>::at( size_t index )
2694 {
2695  if( index >= size() ) {
2696  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
2697  }
2698  return (*this)[index];
2699 }
2701 //*************************************************************************************************
2702 
2703 
2704 //*************************************************************************************************
2715 template< typename MT // Type of the sparse matrix
2716  , size_t... CCAs > // Compile time column arguments
2717 inline typename Column<MT,false,false,false,CCAs...>::ConstReference
2718  Column<MT,false,false,false,CCAs...>::at( size_t index ) const
2719 {
2720  if( index >= size() ) {
2721  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
2722  }
2723  return (*this)[index];
2724 }
2726 //*************************************************************************************************
2727 
2728 
2729 //*************************************************************************************************
2737 template< typename MT // Type of the sparse matrix
2738  , size_t... CCAs > // Compile time column arguments
2739 inline typename Column<MT,false,false,false,CCAs...>::Iterator
2741 {
2742  return Iterator( matrix_, 0UL, column() );
2743 }
2745 //*************************************************************************************************
2746 
2747 
2748 //*************************************************************************************************
2756 template< typename MT // Type of the sparse matrix
2757  , size_t... CCAs > // Compile time column arguments
2758 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2760 {
2761  return ConstIterator( matrix_, 0UL, column() );
2762 }
2764 //*************************************************************************************************
2765 
2766 
2767 //*************************************************************************************************
2775 template< typename MT // Type of the sparse matrix
2776  , size_t... CCAs > // Compile time column arguments
2777 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2779 {
2780  return ConstIterator( matrix_, 0UL, column() );
2781 }
2783 //*************************************************************************************************
2784 
2785 
2786 //*************************************************************************************************
2794 template< typename MT // Type of the sparse matrix
2795  , size_t... CCAs > // Compile time column arguments
2796 inline typename Column<MT,false,false,false,CCAs...>::Iterator
2798 {
2799  return Iterator( matrix_, size(), column() );
2800 }
2802 //*************************************************************************************************
2803 
2804 
2805 //*************************************************************************************************
2813 template< typename MT // Type of the sparse matrix
2814  , size_t... CCAs > // Compile time column arguments
2815 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2817 {
2818  return ConstIterator( matrix_, size(), column() );
2819 }
2821 //*************************************************************************************************
2822 
2823 
2824 //*************************************************************************************************
2832 template< typename MT // Type of the sparse matrix
2833  , size_t... CCAs > // Compile time column arguments
2834 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2836 {
2837  return ConstIterator( matrix_, size(), column() );
2838 }
2840 //*************************************************************************************************
2841 
2842 
2843 
2844 
2845 //=================================================================================================
2846 //
2847 // ASSIGNMENT OPERATORS
2848 //
2849 //=================================================================================================
2850 
2851 //*************************************************************************************************
2866 template< typename MT // Type of the sparse matrix
2867  , size_t... CCAs > // Compile time column arguments
2868 inline Column<MT,false,false,false,CCAs...>&
2869  Column<MT,false,false,false,CCAs...>::operator=( initializer_list<ElementType> list )
2870 {
2871  using blaze::assign;
2872 
2873  if( list.size() > size() ) {
2874  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to column" );
2875  }
2876 
2877  const InitializerVector<ElementType,false> tmp( list, size() );
2878 
2879  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
2880  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2881  }
2882 
2883  decltype(auto) left( derestrict( *this ) );
2884 
2885  assign( left, tmp );
2886 
2887  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2888 
2889  return *this;
2890 }
2892 //*************************************************************************************************
2893 
2894 
2895 //*************************************************************************************************
2909 template< typename MT // Type of the sparse matrix
2910  , size_t... CCAs > // Compile time column arguments
2911 inline Column<MT,false,false,false,CCAs...>&
2912  Column<MT,false,false,false,CCAs...>::operator=( const Column& rhs )
2913 {
2914  using blaze::assign;
2915 
2919 
2920  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
2921  return *this;
2922 
2923  if( size() != rhs.size() ) {
2924  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
2925  }
2926 
2927  if( !tryAssign( matrix_, rhs, 0UL, column() ) ) {
2928  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2929  }
2930 
2931  decltype(auto) left( derestrict( *this ) );
2932 
2933  if( rhs.canAlias( &matrix_ ) ) {
2934  const ResultType tmp( rhs );
2935  assign( left, tmp );
2936  }
2937  else {
2938  assign( left, rhs );
2939  }
2940 
2941  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2942 
2943  return *this;
2944 }
2946 //*************************************************************************************************
2947 
2948 
2949 //*************************************************************************************************
2963 template< typename MT // Type of the sparse matrix
2964  , size_t... CCAs > // Compile time column arguments
2965 template< typename VT > // Type of the right-hand side vector
2966 inline Column<MT,false,false,false,CCAs...>&
2967  Column<MT,false,false,false,CCAs...>::operator=( const Vector<VT,false>& rhs )
2968 {
2969  using blaze::assign;
2970 
2971  if( size() != (~rhs).size() ) {
2972  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
2973  }
2974 
2975  const CompositeType_t<VT> tmp( ~rhs );
2976 
2977  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
2978  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2979  }
2980 
2981  decltype(auto) left( derestrict( *this ) );
2982 
2983  assign( left, tmp );
2984 
2985  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2986 
2987  return *this;
2988 }
2990 //*************************************************************************************************
2991 
2992 
2993 //*************************************************************************************************
3007 template< typename MT // Type of the sparse matrix
3008  , size_t... CCAs > // Compile time column arguments
3009 template< typename VT > // Type of the right-hand side vector
3010 inline Column<MT,false,false,false,CCAs...>&
3011  Column<MT,false,false,false,CCAs...>::operator+=( const Vector<VT,false>& rhs )
3012 {
3013  using blaze::assign;
3014 
3018  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3020 
3021  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3022 
3025 
3026  if( size() != (~rhs).size() ) {
3027  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3028  }
3029 
3030  const AddType tmp( *this + (~rhs) );
3031 
3032  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3033  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3034  }
3035 
3036  decltype(auto) left( derestrict( *this ) );
3037 
3038  assign( left, tmp );
3039 
3040  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3041 
3042  return *this;
3043 }
3045 //*************************************************************************************************
3046 
3047 
3048 //*************************************************************************************************
3062 template< typename MT // Type of the sparse matrix
3063  , size_t... CCAs > // Compile time column arguments
3064 template< typename VT > // Type of the right-hand side vector
3065 inline Column<MT,false,false,false,CCAs...>&
3066  Column<MT,false,false,false,CCAs...>::operator-=( const Vector<VT,false>& rhs )
3067 {
3068  using blaze::assign;
3069 
3073  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3075 
3076  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3077 
3080 
3081  if( size() != (~rhs).size() ) {
3082  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3083  }
3084 
3085  const SubType tmp( *this - (~rhs) );
3086 
3087  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3088  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3089  }
3090 
3091  decltype(auto) left( derestrict( *this ) );
3092 
3093  assign( left, tmp );
3094 
3095  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3096 
3097  return *this;
3098 }
3100 //*************************************************************************************************
3101 
3102 
3103 //*************************************************************************************************
3116 template< typename MT // Type of the sparse matrix
3117  , size_t... CCAs > // Compile time column arguments
3118 template< typename VT > // Type of the right-hand side vector
3119 inline Column<MT,false,false,false,CCAs...>&
3120  Column<MT,false,false,false,CCAs...>::operator*=( const Vector<VT,false>& rhs )
3121 {
3122  using blaze::assign;
3123 
3127  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3129 
3130  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3131 
3134 
3135  if( size() != (~rhs).size() ) {
3136  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3137  }
3138 
3139  const MultType tmp( *this * (~rhs) );
3140 
3141  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3142  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3143  }
3144 
3145  decltype(auto) left( derestrict( *this ) );
3146 
3147  assign( left, tmp );
3148 
3149  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3150 
3151  return *this;
3152 }
3154 //*************************************************************************************************
3155 
3156 
3157 //*************************************************************************************************
3169 template< typename MT // Type of the sparse matrix
3170  , size_t... CCAs > // Compile time column arguments
3171 template< typename VT > // Type of the right-hand side vector
3172 inline Column<MT,false,false,false,CCAs...>&
3173  Column<MT,false,false,false,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
3174 {
3175  using blaze::assign;
3176 
3180  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
3181  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3183 
3184  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3185 
3189 
3190  if( size() != (~rhs).size() ) {
3191  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3192  }
3193 
3194  const DivType tmp( *this / (~rhs) );
3195 
3196  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3197  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3198  }
3199 
3200  decltype(auto) left( derestrict( *this ) );
3201 
3202  assign( left, tmp );
3203 
3204  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3205 
3206  return *this;
3207 }
3209 //*************************************************************************************************
3210 
3211 
3212 //*************************************************************************************************
3225 template< typename MT // Type of the sparse matrix
3226  , size_t... CCAs > // Compile time column arguments
3227 template< typename VT > // Type of the right-hand side vector
3228 inline Column<MT,false,false,false,CCAs...>&
3229  Column<MT,false,false,false,CCAs...>::operator%=( const Vector<VT,false>& rhs )
3230 {
3231  using blaze::assign;
3232 
3233  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3235 
3236  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3237 
3241 
3242  if( size() != 3UL || (~rhs).size() != 3UL ) {
3243  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
3244  }
3245 
3246  const CrossType tmp( *this % (~rhs) );
3247 
3248  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3249  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3250  }
3251 
3252  decltype(auto) left( derestrict( *this ) );
3253 
3254  assign( left, tmp );
3255 
3256  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3257 
3258  return *this;
3259 }
3261 //*************************************************************************************************
3262 
3263 
3264 
3265 
3266 //=================================================================================================
3267 //
3268 // UTILITY FUNCTIONS
3269 //
3270 //=================================================================================================
3271 
3272 //*************************************************************************************************
3278 template< typename MT // Type of the sparse matrix
3279  , size_t... CCAs > // Compile time column arguments
3280 inline MT& Column<MT,false,false,false,CCAs...>::operand() noexcept
3281 {
3282  return matrix_;
3283 }
3285 //*************************************************************************************************
3286 
3287 
3288 //*************************************************************************************************
3294 template< typename MT // Type of the sparse matrix
3295  , size_t... CCAs > // Compile time column arguments
3296 inline const MT& Column<MT,false,false,false,CCAs...>::operand() const noexcept
3297 {
3298  return matrix_;
3299 }
3301 //*************************************************************************************************
3302 
3303 
3304 //*************************************************************************************************
3310 template< typename MT // Type of the sparse matrix
3311  , size_t... CCAs > // Compile time column arguments
3312 inline size_t Column<MT,false,false,false,CCAs...>::size() const
3313 {
3314  return matrix_.rows();
3315 }
3317 //*************************************************************************************************
3318 
3319 
3320 //*************************************************************************************************
3326 template< typename MT // Type of the sparse matrix
3327  , size_t... CCAs > // Compile time column arguments
3329 {
3330  return matrix_.rows();
3331 }
3333 //*************************************************************************************************
3334 
3335 
3336 //*************************************************************************************************
3345 template< typename MT // Type of the sparse matrix
3346  , size_t... CCAs > // Compile time column arguments
3348 {
3349  size_t counter( 0UL );
3350  for( ConstIterator element=begin(); element!=end(); ++element ) {
3351  ++counter;
3352  }
3353  return counter;
3354 }
3356 //*************************************************************************************************
3357 
3358 
3359 //*************************************************************************************************
3365 template< typename MT // Type of the sparse matrix
3366  , size_t... CCAs > // Compile time column arguments
3368 {
3369  const size_t ibegin( ( IsLower_v<MT> )
3370  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3371  ?( column()+1UL )
3372  :( column() ) )
3373  :( 0UL ) );
3374  const size_t iend ( ( IsUpper_v<MT> )
3375  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3376  ?( column() )
3377  :( column()+1UL ) )
3378  :( size() ) );
3379 
3380  for( size_t i=ibegin; i<iend; ++i ) {
3381  matrix_.erase( i, column() );
3382  }
3383 }
3385 //*************************************************************************************************
3386 
3387 
3388 //*************************************************************************************************
3398 template< typename MT // Type of the sparse matrix
3399  , size_t... CCAs > // Compile time column arguments
3400 void Column<MT,false,false,false,CCAs...>::reserve( size_t n )
3401 {
3402  UNUSED_PARAMETER( n );
3403 
3404  return;
3405 }
3407 //*************************************************************************************************
3408 
3409 
3410 
3411 
3412 //=================================================================================================
3413 //
3414 // INSERTION FUNCTIONS
3415 //
3416 //=================================================================================================
3417 
3418 //*************************************************************************************************
3430 template< typename MT // Type of the sparse matrix
3431  , size_t... CCAs > // Compile time column arguments
3432 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3433  Column<MT,false,false,false,CCAs...>::set( size_t index, const ElementType& value )
3434 {
3435  return Iterator( matrix_, index, column(), matrix_.set( index, column(), value ) );
3436 }
3438 //*************************************************************************************************
3439 
3440 
3441 //*************************************************************************************************
3454 template< typename MT // Type of the sparse matrix
3455  , size_t... CCAs > // Compile time column arguments
3456 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3457  Column<MT,false,false,false,CCAs...>::insert( size_t index, const ElementType& value )
3458 {
3459  return Iterator( matrix_, index, column(), matrix_.insert( index, column(), value ) );
3460 }
3462 //*************************************************************************************************
3463 
3464 
3465 //*************************************************************************************************
3490 template< typename MT // Type of the sparse matrix
3491  , size_t... CCAs > // Compile time column arguments
3492 inline void Column<MT,false,false,false,CCAs...>::append( size_t index, const ElementType& value, bool check )
3493 {
3494  if( !check || !isDefault<strict>( value ) )
3495  matrix_.insert( index, column(), value );
3496 }
3498 //*************************************************************************************************
3499 
3500 
3501 
3502 
3503 //=================================================================================================
3504 //
3505 // ERASE FUNCTIONS
3506 //
3507 //=================================================================================================
3508 
3509 //*************************************************************************************************
3518 template< typename MT // Type of the sparse matrix
3519  , size_t... CCAs > // Compile time column arguments
3520 inline void Column<MT,false,false,false,CCAs...>::erase( size_t index )
3521 {
3522  matrix_.erase( index, column() );
3523 }
3525 //*************************************************************************************************
3526 
3527 
3528 //*************************************************************************************************
3537 template< typename MT // Type of the sparse matrix
3538  , size_t... CCAs > // Compile time column arguments
3539 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3540  Column<MT,false,false,false,CCAs...>::erase( Iterator pos )
3541 {
3542  const size_t row( pos.row_ );
3543 
3544  if( row == size() )
3545  return pos;
3546 
3547  matrix_.erase( row, pos.pos_ );
3548  return Iterator( matrix_, row+1UL, column() );
3549 }
3551 //*************************************************************************************************
3552 
3553 
3554 //*************************************************************************************************
3564 template< typename MT // Type of the sparse matrix
3565  , size_t... CCAs > // Compile time column arguments
3566 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3567  Column<MT,false,false,false,CCAs...>::erase( Iterator first, Iterator last )
3568 {
3569  for( ; first!=last; ++first ) {
3570  matrix_.erase( first.row_, first.pos_ );
3571  }
3572  return last;
3573 }
3575 //*************************************************************************************************
3576 
3577 
3578 //*************************************************************************************************
3601 template< typename MT // Type of the sparse matrix
3602  , size_t... CCAs > // Compile time column arguments
3603 template< typename Pred // Type of the unary predicate
3604  , typename > // Type restriction on the unary predicate
3605 inline void Column<MT,false,false,false,CCAs...>::erase( Pred predicate )
3606 {
3607  for( Iterator element=begin(); element!=end(); ++element ) {
3608  if( predicate( element->value() ) )
3609  matrix_.erase( element.row_, element.pos_ );
3610  }
3611 }
3613 //*************************************************************************************************
3614 
3615 
3616 //*************************************************************************************************
3642 template< typename MT // Type of the sparse matrix
3643  , size_t... CCAs > // Compile time column arguments
3644 template< typename Pred > // Type of the unary predicate
3645 inline void Column<MT,false,false,false,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
3646 {
3647  for( ; first!=last; ++first ) {
3648  if( predicate( first->value() ) )
3649  matrix_.erase( first.row_, first.pos_ );
3650  }
3651 }
3653 //*************************************************************************************************
3654 
3655 
3656 
3657 
3658 //=================================================================================================
3659 //
3660 // LOOKUP FUNCTIONS
3661 //
3662 //=================================================================================================
3663 
3664 //*************************************************************************************************
3678 template< typename MT // Type of the sparse matrix
3679  , size_t... CCAs > // Compile time column arguments
3680 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3681  Column<MT,false,false,false,CCAs...>::find( size_t index )
3682 {
3683  const Iterator_t<MT> pos( matrix_.find( index, column() ) );
3684 
3685  if( pos != matrix_.end( index ) )
3686  return Iterator( matrix_, index, column(), pos );
3687  else
3688  return end();
3689 }
3691 //*************************************************************************************************
3692 
3693 
3694 //*************************************************************************************************
3708 template< typename MT // Type of the sparse matrix
3709  , size_t... CCAs > // Compile time column arguments
3710 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
3711  Column<MT,false,false,false,CCAs...>::find( size_t index ) const
3712 {
3713  const ConstIterator_t<MT> pos( matrix_.find( index, column() ) );
3714 
3715  if( pos != matrix_.end( index ) )
3716  return ConstIterator( matrix_, index, column(), pos );
3717  else
3718  return end();
3719 }
3721 //*************************************************************************************************
3722 
3723 
3724 //*************************************************************************************************
3737 template< typename MT // Type of the sparse matrix
3738  , size_t... CCAs > // Compile time column arguments
3739 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3740  Column<MT,false,false,false,CCAs...>::lowerBound( size_t index )
3741 {
3742  for( size_t i=index; i<size(); ++i )
3743  {
3744  const Iterator_t<MT> pos( matrix_.find( i, column() ) );
3745 
3746  if( pos != matrix_.end( i ) )
3747  return Iterator( matrix_, i, column(), pos );
3748  }
3749 
3750  return end();
3751 }
3753 //*************************************************************************************************
3754 
3755 
3756 //*************************************************************************************************
3769 template< typename MT // Type of the sparse matrix
3770  , size_t... CCAs > // Compile time column arguments
3771 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
3772  Column<MT,false,false,false,CCAs...>::lowerBound( size_t index ) const
3773 {
3774  for( size_t i=index; i<size(); ++i )
3775  {
3776  const ConstIterator_t<MT> pos( matrix_.find( i, column() ) );
3777 
3778  if( pos != matrix_.end( i ) )
3779  return ConstIterator( matrix_, i, column(), pos );
3780  }
3781 
3782  return end();
3783 }
3785 //*************************************************************************************************
3786 
3787 
3788 //*************************************************************************************************
3801 template< typename MT // Type of the sparse matrix
3802  , size_t... CCAs > // Compile time column arguments
3803 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3804  Column<MT,false,false,false,CCAs...>::upperBound( size_t index )
3805 {
3806  for( size_t i=index+1UL; i<size(); ++i )
3807  {
3808  const Iterator_t<MT> pos( matrix_.find( i, column() ) );
3809 
3810  if( pos != matrix_.end( i ) )
3811  return Iterator( matrix_, i, column(), pos );
3812  }
3813 
3814  return end();
3815 }
3817 //*************************************************************************************************
3818 
3819 
3820 //*************************************************************************************************
3833 template< typename MT // Type of the sparse matrix
3834  , size_t... CCAs > // Compile time column arguments
3835 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
3836  Column<MT,false,false,false,CCAs...>::upperBound( size_t index ) const
3837 {
3838  for( size_t i=index+1UL; i<size(); ++i )
3839  {
3840  const ConstIterator_t<MT> pos( matrix_.find( i, column() ) );
3841 
3842  if( pos != matrix_.end( i ) )
3843  return ConstIterator( matrix_, i, column(), pos );
3844  }
3845 
3846  return end();
3847 }
3849 //*************************************************************************************************
3850 
3851 
3852 
3853 
3854 //=================================================================================================
3855 //
3856 // NUMERIC FUNCTIONS
3857 //
3858 //=================================================================================================
3859 
3860 //*************************************************************************************************
3873 template< typename MT // Type of the sparse matrix
3874  , size_t... CCAs > // Compile time column arguments
3875 template< typename Other > // Data type of the scalar value
3876 inline Column<MT,false,false,false,CCAs...>&
3877  Column<MT,false,false,false,CCAs...>::scale( const Other& scalar )
3878 {
3880 
3881  for( Iterator element=begin(); element!=end(); ++element )
3882  element->value() *= scalar;
3883  return *this;
3884 }
3886 //*************************************************************************************************
3887 
3888 
3889 
3890 
3891 //=================================================================================================
3892 //
3893 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3894 //
3895 //=================================================================================================
3896 
3897 //*************************************************************************************************
3908 template< typename MT // Type of the sparse matrix
3909  , size_t... CCAs > // Compile time column arguments
3910 template< typename Other > // Data type of the foreign expression
3911 inline bool Column<MT,false,false,false,CCAs...>::canAlias( const Other* alias ) const
3912 {
3913  return matrix_.isAliased( alias );
3914 }
3916 //*************************************************************************************************
3917 
3918 
3919 //*************************************************************************************************
3926 template< typename MT // Type of the sparse matrix
3927  , size_t... CCAs > // Compile time column arguments
3928 template< typename Other > // Data type of the foreign expression
3929 inline bool Column<MT,false,false,false,CCAs...>::isAliased( const Other* alias ) const
3930 {
3931  return matrix_.isAliased( alias );
3932 }
3934 //*************************************************************************************************
3935 
3936 
3937 //*************************************************************************************************
3949 template< typename MT // Type of the sparse matrix
3950  , size_t... CCAs > // Compile time column arguments
3951 template< typename VT > // Type of the right-hand side dense vector
3952 inline void Column<MT,false,false,false,CCAs...>::assign( const DenseVector<VT,false>& rhs )
3953 {
3954  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3955 
3956  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3957  matrix_(i,column()) = (~rhs)[i];
3958  }
3959 }
3961 //*************************************************************************************************
3962 
3963 
3964 //*************************************************************************************************
3976 template< typename MT // Type of the sparse matrix
3977  , size_t... CCAs > // Compile time column arguments
3978 template< typename VT > // Type of the right-hand side sparse vector
3979 inline void Column<MT,false,false,false,CCAs...>::assign( const SparseVector<VT,false>& rhs )
3980 {
3981  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3982 
3983  size_t i( 0UL );
3984 
3985  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3986  for( ; i<element->index(); ++i )
3987  matrix_.erase( i, column() );
3988  matrix_(i++,column()) = element->value();
3989  }
3990  for( ; i<size(); ++i ) {
3991  matrix_.erase( i, column() );
3992  }
3993 }
3995 //*************************************************************************************************
3996 
3997 
3998 //*************************************************************************************************
4010 template< typename MT // Type of the sparse matrix
4011  , size_t... CCAs > // Compile time column arguments
4012 template< typename VT > // Type of the right-hand side vector
4013 inline void Column<MT,false,false,false,CCAs...>::addAssign( const Vector<VT,false>& rhs )
4014 {
4015  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4016 
4019 
4020  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4021 
4022  const AddType tmp( serial( *this + (~rhs) ) );
4023  assign( tmp );
4024 }
4026 //*************************************************************************************************
4027 
4028 
4029 //*************************************************************************************************
4041 template< typename MT // Type of the sparse matrix
4042  , size_t... CCAs > // Compile time column arguments
4043 template< typename VT > // Type of the right-hand side vector
4044 inline void Column<MT,false,false,false,CCAs...>::subAssign( const Vector<VT,false>& rhs )
4045 {
4046  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4047 
4050 
4051  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4052 
4053  const SubType tmp( serial( *this - (~rhs) ) );
4054  assign( tmp );
4055 }
4057 //*************************************************************************************************
4058 
4059 
4060 
4061 
4062 
4063 
4064 
4065 
4066 //=================================================================================================
4067 //
4068 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC ROW-MAJOR SPARSE MATRICES
4069 //
4070 //=================================================================================================
4071 
4072 //*************************************************************************************************
4080 template< typename MT // Type of the sparse matrix
4081  , size_t... CCAs > // Compile time column arguments
4082 class Column<MT,false,false,true,CCAs...>
4083  : public View< SparseVector< Column<MT,false,false,true,CCAs...>, false > >
4084  , private ColumnData<CCAs...>
4085 {
4086  private:
4087  //**Type definitions****************************************************************************
4088  using DataType = ColumnData<CCAs...>;
4089  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4090  //**********************************************************************************************
4091 
4092  public:
4093  //**Type definitions****************************************************************************
4095  using This = Column<MT,false,false,true,CCAs...>;
4096 
4097  using BaseType = SparseVector<This,false>;
4098  using ViewedType = MT;
4099  using ResultType = ColumnTrait_t<MT,CCAs...>;
4100  using TransposeType = TransposeType_t<ResultType>;
4101  using ElementType = ElementType_t<MT>;
4102  using ReturnType = ReturnType_t<MT>;
4103  using CompositeType = const Column&;
4104 
4106  using ConstReference = ConstReference_t<MT>;
4107 
4109  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4110 
4112  using ConstIterator = ConstIterator_t<MT>;
4113 
4115  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4116  //**********************************************************************************************
4117 
4118  //**Compilation flags***************************************************************************
4120  static constexpr bool smpAssignable = false;
4121  //**********************************************************************************************
4122 
4123  //**Constructors********************************************************************************
4126  template< typename... RCAs >
4127  explicit inline Column( MT& matrix, RCAs... args );
4128 
4129  Column( const Column& ) = default;
4131  //**********************************************************************************************
4132 
4133  //**Destructor**********************************************************************************
4136  ~Column() = default;
4138  //**********************************************************************************************
4139 
4140  //**Data access functions***********************************************************************
4143  inline Reference operator[]( size_t index );
4144  inline ConstReference operator[]( size_t index ) const;
4145  inline Reference at( size_t index );
4146  inline ConstReference at( size_t index ) const;
4147  inline Iterator begin ();
4148  inline ConstIterator begin () const;
4149  inline ConstIterator cbegin() const;
4150  inline Iterator end ();
4151  inline ConstIterator end () const;
4152  inline ConstIterator cend () const;
4154  //**********************************************************************************************
4155 
4156  //**Assignment operators************************************************************************
4159  inline Column& operator=( initializer_list<ElementType> list );
4160  inline Column& operator=( const Column& rhs );
4161 
4162  template< typename VT > inline Column& operator= ( const DenseVector<VT,false>& rhs );
4163  template< typename VT > inline Column& operator= ( const SparseVector<VT,false>& rhs );
4164  template< typename VT > inline Column& operator+=( const DenseVector<VT,false>& rhs );
4165  template< typename VT > inline Column& operator+=( const SparseVector<VT,false>& rhs );
4166  template< typename VT > inline Column& operator-=( const DenseVector<VT,false>& rhs );
4167  template< typename VT > inline Column& operator-=( const SparseVector<VT,false>& rhs );
4168  template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
4169  template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
4170  template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
4172  //**********************************************************************************************
4173 
4174  //**Utility functions***************************************************************************
4177  using DataType::column;
4178 
4179  inline MT& operand() noexcept;
4180  inline const MT& operand() const noexcept;
4181 
4182  inline size_t size() const noexcept;
4183  inline size_t capacity() const noexcept;
4184  inline size_t nonZeros() const;
4185  inline void reset();
4186  inline void reserve( size_t n );
4188  //**********************************************************************************************
4189 
4190  //**Insertion functions*************************************************************************
4193  inline Iterator set ( size_t index, const ElementType& value );
4194  inline Iterator insert( size_t index, const ElementType& value );
4195  inline void append( size_t index, const ElementType& value, bool check=false );
4197  //**********************************************************************************************
4198 
4199  //**Erase functions*****************************************************************************
4202  inline void erase( size_t index );
4203  inline Iterator erase( Iterator pos );
4204  inline Iterator erase( Iterator first, Iterator last );
4205 
4206  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
4207  inline void erase( Pred predicate );
4208 
4209  template< typename Pred >
4210  inline void erase( Iterator first, Iterator last, Pred predicate );
4212  //**********************************************************************************************
4213 
4214  //**Lookup functions****************************************************************************
4217  inline Iterator find ( size_t index );
4218  inline ConstIterator find ( size_t index ) const;
4219  inline Iterator lowerBound( size_t index );
4220  inline ConstIterator lowerBound( size_t index ) const;
4221  inline Iterator upperBound( size_t index );
4222  inline ConstIterator upperBound( size_t index ) const;
4224  //**********************************************************************************************
4225 
4226  //**Numeric functions***************************************************************************
4229  template< typename Other > inline Column& scale( const Other& scalar );
4231  //**********************************************************************************************
4232 
4233  //**Expression template evaluation functions****************************************************
4236  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
4237  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
4238 
4239  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
4240  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
4241  template< typename VT > inline void addAssign( const DenseVector <VT,false>& rhs );
4242  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
4243  template< typename VT > inline void subAssign( const DenseVector <VT,false>& rhs );
4244  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
4246  //**********************************************************************************************
4247 
4248  private:
4249  //**Utility functions***************************************************************************
4252  inline size_t extendCapacity() const noexcept;
4254  //**********************************************************************************************
4255 
4256  //**Member variables****************************************************************************
4259  Operand matrix_;
4260 
4261  //**********************************************************************************************
4262 
4263  //**Compile time checks*************************************************************************
4272  //**********************************************************************************************
4273 };
4275 //*************************************************************************************************
4276 
4277 
4278 
4279 
4280 //=================================================================================================
4281 //
4282 // CONSTRUCTORS
4283 //
4284 //=================================================================================================
4285 
4286 //*************************************************************************************************
4299 template< typename MT // Type of the sparse matrix
4300  , size_t... CCAs > // Compile time column arguments
4301 template< typename... RCAs > // Runtime column arguments
4302 inline Column<MT,false,false,true,CCAs...>::Column( MT& matrix, RCAs... args )
4303  : DataType( args... ) // Base class initialization
4304  , matrix_ ( matrix ) // The matrix containing the column
4305 {
4306  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
4307  if( matrix_.columns() <= column() ) {
4308  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
4309  }
4310  }
4311  else {
4312  BLAZE_USER_ASSERT( column() < matrix_.columns(), "Invalid column access index" );
4313  }
4314 }
4316 //*************************************************************************************************
4317 
4318 
4319 
4320 
4321 //=================================================================================================
4322 //
4323 // DATA ACCESS FUNCTIONS
4324 //
4325 //=================================================================================================
4326 
4327 //*************************************************************************************************
4337 template< typename MT // Type of the sparse matrix
4338  , size_t... CCAs > // Compile time column arguments
4339 inline typename Column<MT,false,false,true,CCAs...>::Reference
4340  Column<MT,false,false,true,CCAs...>::operator[]( size_t index )
4341 {
4342  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4343  return matrix_(column(),index);
4344 }
4346 //*************************************************************************************************
4347 
4348 
4349 //*************************************************************************************************
4359 template< typename MT // Type of the sparse matrix
4360  , size_t... CCAs > // Compile time column arguments
4361 inline typename Column<MT,false,false,true,CCAs...>::ConstReference
4362  Column<MT,false,false,true,CCAs...>::operator[]( size_t index ) const
4363 {
4364  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4365  return const_cast<const MT&>( matrix_ )(column(),index);
4366 }
4368 //*************************************************************************************************
4369 
4370 
4371 //*************************************************************************************************
4382 template< typename MT // Type of the sparse matrix
4383  , size_t... CCAs > // Compile time column arguments
4384 inline typename Column<MT,false,false,true,CCAs...>::Reference
4385  Column<MT,false,false,true,CCAs...>::at( size_t index )
4386 {
4387  if( index >= size() ) {
4388  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4389  }
4390  return (*this)[index];
4391 }
4393 //*************************************************************************************************
4394 
4395 
4396 //*************************************************************************************************
4407 template< typename MT // Type of the sparse matrix
4408  , size_t... CCAs > // Compile time column arguments
4409 inline typename Column<MT,false,false,true,CCAs...>::ConstReference
4410  Column<MT,false,false,true,CCAs...>::at( size_t index ) const
4411 {
4412  if( index >= size() ) {
4413  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4414  }
4415  return (*this)[index];
4416 }
4418 //*************************************************************************************************
4419 
4420 
4421 //*************************************************************************************************
4429 template< typename MT // Type of the sparse matrix
4430  , size_t... CCAs > // Compile time column arguments
4431 inline typename Column<MT,false,false,true,CCAs...>::Iterator
4433 {
4434  return matrix_.begin( column() );
4435 }
4437 //*************************************************************************************************
4438 
4439 
4440 //*************************************************************************************************
4448 template< typename MT // Type of the sparse matrix
4449  , size_t... CCAs > // Compile time column arguments
4450 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4452 {
4453  return matrix_.cbegin( column() );
4454 }
4456 //*************************************************************************************************
4457 
4458 
4459 //*************************************************************************************************
4467 template< typename MT // Type of the sparse matrix
4468  , size_t... CCAs > // Compile time column arguments
4469 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4471 {
4472  return matrix_.cbegin( column() );
4473 }
4475 //*************************************************************************************************
4476 
4477 
4478 //*************************************************************************************************
4486 template< typename MT // Type of the sparse matrix
4487  , size_t... CCAs > // Compile time column arguments
4488 inline typename Column<MT,false,false,true,CCAs...>::Iterator
4490 {
4491  return matrix_.end( column() );
4492 }
4494 //*************************************************************************************************
4495 
4496 
4497 //*************************************************************************************************
4505 template< typename MT // Type of the sparse matrix
4506  , size_t... CCAs > // Compile time column arguments
4507 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4509 {
4510  return matrix_.cend( column() );
4511 }
4513 //*************************************************************************************************
4514 
4515 
4516 //*************************************************************************************************
4524 template< typename MT // Type of the sparse matrix
4525  , size_t... CCAs > // Compile time column arguments
4526 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4528 {
4529  return matrix_.cend( column() );
4530 }
4532 //*************************************************************************************************
4533 
4534 
4535 
4536 
4537 //=================================================================================================
4538 //
4539 // ASSIGNMENT OPERATORS
4540 //
4541 //=================================================================================================
4542 
4543 //*************************************************************************************************
4558 template< typename MT // Type of the sparse matrix
4559  , size_t... CCAs > // Compile time column arguments
4560 inline Column<MT,false,false,true,CCAs...>&
4561  Column<MT,false,false,true,CCAs...>::operator=( initializer_list<ElementType> list )
4562 {
4563  using blaze::assign;
4564 
4565  if( list.size() > size() ) {
4566  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to column" );
4567  }
4568 
4569  const InitializerVector<ElementType,false> tmp( list, size() );
4570 
4571  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4572  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4573  }
4574 
4575  decltype(auto) left( derestrict( *this ) );
4576 
4577  left.reset();
4578  assign( left, tmp );
4579 
4580  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4581 
4582  return *this;
4583 }
4585 //*************************************************************************************************
4586 
4587 
4588 //*************************************************************************************************
4602 template< typename MT // Type of the sparse matrix
4603  , size_t... CCAs > // Compile time column arguments
4604 inline Column<MT,false,false,true,CCAs...>&
4605  Column<MT,false,false,true,CCAs...>::operator=( const Column& rhs )
4606 {
4607  using blaze::assign;
4608 
4612 
4613  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
4614  return *this;
4615 
4616  if( size() != rhs.size() ) {
4617  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
4618  }
4619 
4620  if( !tryAssign( matrix_, rhs, 0UL, column() ) ) {
4621  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4622  }
4623 
4624  decltype(auto) left( derestrict( *this ) );
4625 
4626  if( rhs.canAlias( &matrix_ ) ) {
4627  const ResultType tmp( rhs );
4628  left.reset();
4629  left.reserve( tmp.nonZeros() );
4630  assign( left, tmp );
4631  }
4632  else {
4633  left.reset();
4634  left.reserve( rhs.nonZeros() );
4635  assign( left, rhs );
4636  }
4637 
4638  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4639 
4640  return *this;
4641 }
4643 //*************************************************************************************************
4644 
4645 
4646 //*************************************************************************************************
4660 template< typename MT // Type of the sparse matrix
4661  , size_t... CCAs > // Compile time column arguments
4662 template< typename VT > // Type of the right-hand side dense vector
4663 inline Column<MT,false,false,true,CCAs...>&
4664  Column<MT,false,false,true,CCAs...>::operator=( const DenseVector<VT,false>& rhs )
4665 {
4666  using blaze::assign;
4667 
4668  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4669  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4671 
4672  if( size() != (~rhs).size() ) {
4673  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4674  }
4675 
4676  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4677  Right right( ~rhs );
4678 
4679  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
4680  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4681  }
4682 
4683  decltype(auto) left( derestrict( *this ) );
4684 
4685  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4686  const ResultType_t<VT> tmp( right );
4687  left.reset();
4688  assign( left, tmp );
4689  }
4690  else {
4691  left.reset();
4692  assign( left, right );
4693  }
4694 
4695  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4696 
4697  return *this;
4698 }
4700 //*************************************************************************************************
4701 
4702 
4703 //*************************************************************************************************
4717 template< typename MT // Type of the sparse matrix
4718  , size_t... CCAs > // Compile time column arguments
4719 template< typename VT > // Type of the right-hand side sparse vector
4720 inline Column<MT,false,false,true,CCAs...>&
4721  Column<MT,false,false,true,CCAs...>::operator=( const SparseVector<VT,false>& rhs )
4722 {
4723  using blaze::assign;
4724 
4725  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4726  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4728 
4729  if( size() != (~rhs).size() ) {
4730  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4731  }
4732 
4733  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4734  Right right( ~rhs );
4735 
4736  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
4737  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4738  }
4739 
4740  decltype(auto) left( derestrict( *this ) );
4741 
4742  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4743  const ResultType_t<VT> tmp( right);
4744  left.reset();
4745  left.reserve( tmp.nonZeros() );
4746  assign( left, tmp );
4747  }
4748  else {
4749  left.reset();
4750  left.reserve( right.nonZeros() );
4751  assign( left, right );
4752  }
4753 
4754  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4755 
4756  return *this;
4757 }
4759 //*************************************************************************************************
4760 
4761 
4762 //*************************************************************************************************
4776 template< typename MT // Type of the sparse matrix
4777  , size_t... CCAs > // Compile time column arguments
4778 template< typename VT > // Type of the right-hand side dense vector
4779 inline Column<MT,false,false,true,CCAs...>&
4780  Column<MT,false,false,true,CCAs...>::operator+=( const DenseVector<VT,false>& rhs )
4781 {
4782  using blaze::assign;
4783 
4787  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4788  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4790 
4791  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4792 
4796 
4797  if( size() != (~rhs).size() ) {
4798  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4799  }
4800 
4801  const AddType tmp( *this + (~rhs) );
4802 
4803  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4804  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4805  }
4806 
4807  decltype(auto) left( derestrict( *this ) );
4808 
4809  left.reset();
4810  assign( left, tmp );
4811 
4812  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4813 
4814  return *this;
4815 }
4817 //*************************************************************************************************
4818 
4819 
4820 //*************************************************************************************************
4834 template< typename MT // Type of the sparse matrix
4835  , size_t... CCAs > // Compile time column arguments
4836 template< typename VT > // Type of the right-hand side sparse vector
4837 inline Column<MT,false,false,true,CCAs...>&
4838  Column<MT,false,false,true,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
4839 {
4840  using blaze::assign;
4841 
4845  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4846  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4848 
4849  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4850 
4854 
4855  if( size() != (~rhs).size() ) {
4856  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4857  }
4858 
4859  const AddType tmp( *this + (~rhs) );
4860 
4861  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4862  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4863  }
4864 
4865  decltype(auto) left( derestrict( *this ) );
4866 
4867  left.reset();
4868  left.reserve( tmp.nonZeros() );
4869  assign( left, tmp );
4870 
4871  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4872 
4873  return *this;
4874 }
4876 //*************************************************************************************************
4877 
4878 
4879 //*************************************************************************************************
4894 template< typename MT // Type of the sparse matrix
4895  , size_t... CCAs > // Compile time column arguments
4896 template< typename VT > // Type of the right-hand side dense vector
4897 inline Column<MT,false,false,true,CCAs...>&
4898  Column<MT,false,false,true,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
4899 {
4900  using blaze::assign;
4901 
4905  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4906  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4908 
4909  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4910 
4914 
4915  if( size() != (~rhs).size() ) {
4916  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4917  }
4918 
4919  const SubType tmp( *this - (~rhs) );
4920 
4921  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4922  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4923  }
4924 
4925  decltype(auto) left( derestrict( *this ) );
4926 
4927  left.reset();
4928  assign( left, tmp );
4929 
4930  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4931 
4932  return *this;
4933 }
4935 //*************************************************************************************************
4936 
4937 
4938 //*************************************************************************************************
4953 template< typename MT // Type of the sparse matrix
4954  , size_t... CCAs > // Compile time column arguments
4955 template< typename VT > // Type of the right-hand side sparse vector
4956 inline Column<MT,false,false,true,CCAs...>&
4957  Column<MT,false,false,true,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
4958 {
4959  using blaze::assign;
4960 
4964  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4965  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4967 
4968  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4969 
4973 
4974  if( size() != (~rhs).size() ) {
4975  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4976  }
4977 
4978  const SubType tmp( *this - (~rhs) );
4979 
4980  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4981  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4982  }
4983 
4984  decltype(auto) left( derestrict( *this ) );
4985 
4986  left.reset();
4987  left.reserve( tmp.nonZeros() );
4988  assign( left, tmp );
4989 
4990  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4991 
4992  return *this;
4993 }
4995 //*************************************************************************************************
4996 
4997 
4998 //*************************************************************************************************
5011 template< typename MT // Type of the sparse matrix
5012  , size_t... CCAs > // Compile time column arguments
5013 template< typename VT > // Type of the right-hand side vector
5014 inline Column<MT,false,false,true,CCAs...>&
5015  Column<MT,false,false,true,CCAs...>::operator*=( const Vector<VT,false>& rhs )
5016 {
5017  using blaze::assign;
5018 
5022  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
5024 
5025  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5026 
5029 
5030  if( size() != (~rhs).size() ) {
5031  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5032  }
5033 
5034  const MultType tmp( *this * (~rhs) );
5035 
5036  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
5037  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5038  }
5039 
5040  decltype(auto) left( derestrict( *this ) );
5041 
5042  left.reset();
5043  assign( left, tmp );
5044 
5045  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5046 
5047  return *this;
5048 }
5050 //*************************************************************************************************
5051 
5052 
5053 //*************************************************************************************************
5065 template< typename MT // Type of the sparse matrix
5066  , size_t... CCAs > // Compile time column arguments
5067 template< typename VT > // Type of the right-hand side vector
5068 inline Column<MT,false,false,true,CCAs...>&
5069  Column<MT,false,false,true,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
5070 {
5071  using blaze::assign;
5072 
5076  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
5077  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
5079 
5080  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5081 
5085 
5086  if( size() != (~rhs).size() ) {
5087  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5088  }
5089 
5090  const DivType tmp( *this / (~rhs) );
5091 
5092  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
5093  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5094  }
5095 
5096  decltype(auto) left( derestrict( *this ) );
5097 
5098  left.reset();
5099  assign( left, tmp );
5100 
5101  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5102 
5103  return *this;
5104 }
5106 //*************************************************************************************************
5107 
5108 
5109 //*************************************************************************************************
5122 template< typename MT // Type of the sparse matrix
5123  , size_t... CCAs > // Compile time column arguments
5124 template< typename VT > // Type of the right-hand side vector
5125 inline Column<MT,false,false,true,CCAs...>&
5126  Column<MT,false,false,true,CCAs...>::operator%=( const Vector<VT,false>& rhs )
5127 {
5128  using blaze::assign;
5129 
5130  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
5132 
5133  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5134 
5138 
5139  if( size() != 3UL || (~rhs).size() != 3UL ) {
5140  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5141  }
5142 
5143  const CrossType tmp( *this % (~rhs) );
5144 
5145  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
5146  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5147  }
5148 
5149  decltype(auto) left( derestrict( *this ) );
5150 
5151  left.reset();
5152  assign( left, tmp );
5153 
5154  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5155 
5156  return *this;
5157 }
5159 //*************************************************************************************************
5160 
5161 
5162 
5163 
5164 //=================================================================================================
5165 //
5166 // UTILITY FUNCTIONS
5167 //
5168 //=================================================================================================
5169 
5170 //*************************************************************************************************
5176 template< typename MT // Type of the sparse matrix
5177  , size_t... CCAs > // Compile time column arguments
5178 inline MT& Column<MT,false,false,true,CCAs...>::operand() noexcept
5179 {
5180  return matrix_;
5181 }
5183 //*************************************************************************************************
5184 
5185 
5186 //*************************************************************************************************
5192 template< typename MT // Type of the sparse matrix
5193  , size_t... CCAs > // Compile time column arguments
5194 inline const MT& Column<MT,false,false,true,CCAs...>::operand() const noexcept
5195 {
5196  return matrix_;
5197 }
5199 //*************************************************************************************************
5200 
5201 
5202 //*************************************************************************************************
5208 template< typename MT // Type of the sparse matrix
5209  , size_t... CCAs > // Compile time column arguments
5210 inline size_t Column<MT,false,false,true,CCAs...>::size() const noexcept
5211 {
5212  return matrix_.rows();
5213 }
5215 //*************************************************************************************************
5216 
5217 
5218 //*************************************************************************************************
5224 template< typename MT // Type of the sparse matrix
5225  , size_t... CCAs > // Compile time column arguments
5226 inline size_t Column<MT,false,false,true,CCAs...>::capacity() const noexcept
5227 {
5228  return matrix_.capacity( column() );
5229 }
5231 //*************************************************************************************************
5232 
5233 
5234 //*************************************************************************************************
5243 template< typename MT // Type of the sparse matrix
5244  , size_t... CCAs > // Compile time column arguments
5246 {
5247  return matrix_.nonZeros( column() );
5248 }
5250 //*************************************************************************************************
5251 
5252 
5253 //*************************************************************************************************
5259 template< typename MT // Type of the sparse matrix
5260  , size_t... CCAs > // Compile time column arguments
5262 {
5263  matrix_.reset( column() );
5264 }
5266 //*************************************************************************************************
5267 
5268 
5269 //*************************************************************************************************
5279 template< typename MT // Type of the sparse matrix
5280  , size_t... CCAs > // Compile time column arguments
5281 void Column<MT,false,false,true,CCAs...>::reserve( size_t n )
5282 {
5283  matrix_.reserve( column(), n );
5284 }
5286 //*************************************************************************************************
5287 
5288 
5289 //*************************************************************************************************
5298 template< typename MT // Type of the sparse matrix
5299  , size_t... CCAs > // Compile time column arguments
5300 inline size_t Column<MT,false,false,true,CCAs...>::extendCapacity() const noexcept
5301 {
5302  using blaze::max;
5303  using blaze::min;
5304 
5305  size_t nonzeros( 2UL*capacity()+1UL );
5306  nonzeros = max( nonzeros, 7UL );
5307  nonzeros = min( nonzeros, size() );
5308 
5309  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
5310 
5311  return nonzeros;
5312 }
5314 //*************************************************************************************************
5315 
5316 
5317 
5318 
5319 //=================================================================================================
5320 //
5321 // INSERTION FUNCTIONS
5322 //
5323 //=================================================================================================
5324 
5325 //*************************************************************************************************
5337 template< typename MT // Type of the sparse matrix
5338  , size_t... CCAs > // Compile time column arguments
5339 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5340  Column<MT,false,false,true,CCAs...>::set( size_t index, const ElementType& value )
5341 {
5342  return matrix_.set( column(), index, value );
5343 }
5345 //*************************************************************************************************
5346 
5347 
5348 //*************************************************************************************************
5361 template< typename MT // Type of the sparse matrix
5362  , size_t... CCAs > // Compile time column arguments
5363 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5364  Column<MT,false,false,true,CCAs...>::insert( size_t index, const ElementType& value )
5365 {
5366  return matrix_.insert( column(), index, value );
5367 }
5369 //*************************************************************************************************
5370 
5371 
5372 //*************************************************************************************************
5397 template< typename MT // Type of the sparse matrix
5398  , size_t... CCAs > // Compile time column arguments
5399 inline void Column<MT,false,false,true,CCAs...>::append( size_t index, const ElementType& value, bool check )
5400 {
5401  matrix_.append( column(), index, value, check );
5402 }
5404 //*************************************************************************************************
5405 
5406 
5407 
5408 
5409 //=================================================================================================
5410 //
5411 // ERASE FUNCTIONS
5412 //
5413 //=================================================================================================
5414 
5415 //*************************************************************************************************
5424 template< typename MT // Type of the sparse matrix
5425  , size_t... CCAs > // Compile time column arguments
5426 inline void Column<MT,false,false,true,CCAs...>::erase( size_t index )
5427 {
5428  matrix_.erase( column(), index );
5429 }
5431 //*************************************************************************************************
5432 
5433 
5434 //*************************************************************************************************
5443 template< typename MT // Type of the sparse matrix
5444  , size_t... CCAs > // Compile time column arguments
5445 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5446  Column<MT,false,false,true,CCAs...>::erase( Iterator pos )
5447 {
5448  return matrix_.erase( column(), pos );
5449 }
5451 //*************************************************************************************************
5452 
5453 
5454 //*************************************************************************************************
5464 template< typename MT // Type of the sparse matrix
5465  , size_t... CCAs > // Compile time column arguments
5466 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5467  Column<MT,false,false,true,CCAs...>::erase( Iterator first, Iterator last )
5468 {
5469  return matrix_.erase( column(), first, last );
5470 }
5472 //*************************************************************************************************
5473 
5474 
5475 //*************************************************************************************************
5498 template< typename MT // Type of the sparse matrix
5499  , size_t... CCAs > // Compile time column arguments
5500 template< typename Pred // Type of the unary predicate
5501  , typename > // Type restriction on the unary predicate
5502 inline void Column<MT,false,false,true,CCAs...>::erase( Pred predicate )
5503 {
5504  matrix_.erase( column(), begin(), end(), predicate );
5505 }
5507 //*************************************************************************************************
5508 
5509 
5510 //*************************************************************************************************
5535 template< typename MT // Type of the sparse matrix
5536  , size_t... CCAs > // Compile time column arguments
5537 template< typename Pred > // Type of the unary predicate
5538 inline void Column<MT,false,false,true,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
5539 {
5540  matrix_.erase( column(), first, last, predicate );
5541 }
5543 //*************************************************************************************************
5544 
5545 
5546 
5547 
5548 //=================================================================================================
5549 //
5550 // LOOKUP FUNCTIONS
5551 //
5552 //=================================================================================================
5553 
5554 //*************************************************************************************************
5568 template< typename MT // Type of the sparse matrix
5569  , size_t... CCAs > // Compile time column arguments
5570 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5571  Column<MT,false,false,true,CCAs...>::find( size_t index )
5572 {
5573  return matrix_.find( column(), index );
5574 }
5576 //*************************************************************************************************
5577 
5578 
5579 //*************************************************************************************************
5593 template< typename MT // Type of the sparse matrix
5594  , size_t... CCAs > // Compile time column arguments
5595 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
5596  Column<MT,false,false,true,CCAs...>::find( size_t index ) const
5597 {
5598  return matrix_.find( column(), index );
5599 }
5601 //*************************************************************************************************
5602 
5603 
5604 //*************************************************************************************************
5617 template< typename MT // Type of the sparse matrix
5618  , size_t... CCAs > // Compile time column arguments
5619 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5620  Column<MT,false,false,true,CCAs...>::lowerBound( size_t index )
5621 {
5622  return matrix_.lowerBound( column(), index );
5623 }
5625 //*************************************************************************************************
5626 
5627 
5628 //*************************************************************************************************
5641 template< typename MT // Type of the sparse matrix
5642  , size_t... CCAs > // Compile time column arguments
5643 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
5644  Column<MT,false,false,true,CCAs...>::lowerBound( size_t index ) const
5645 {
5646  return matrix_.lowerBound( column(), index );
5647 }
5649 //*************************************************************************************************
5650 
5651 
5652 //*************************************************************************************************
5665 template< typename MT // Type of the sparse matrix
5666  , size_t... CCAs > // Compile time column arguments
5667 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5668  Column<MT,false,false,true,CCAs...>::upperBound( size_t index )
5669 {
5670  return matrix_.upperBound( column(), index );
5671 }
5673 //*************************************************************************************************
5674 
5675 
5676 //*************************************************************************************************
5689 template< typename MT // Type of the sparse matrix
5690  , size_t... CCAs > // Compile time column arguments
5691 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
5692  Column<MT,false,false,true,CCAs...>::upperBound( size_t index ) const
5693 {
5694  return matrix_.upperBound( column(), index );
5695 }
5697 //*************************************************************************************************
5698 
5699 
5700 
5701 
5702 //=================================================================================================
5703 //
5704 // NUMERIC FUNCTIONS
5705 //
5706 //=================================================================================================
5707 
5708 //*************************************************************************************************
5721 template< typename MT // Type of the sparse matrix
5722  , size_t... CCAs > // Compile time column arguments
5723 template< typename Other > // Data type of the scalar value
5724 inline Column<MT,false,false,true,CCAs...>&
5725  Column<MT,false,false,true,CCAs...>::scale( const Other& scalar )
5726 {
5728 
5729  for( Iterator element=begin(); element!=end(); ++element )
5730  element->value() *= scalar;
5731  return *this;
5732 }
5734 //*************************************************************************************************
5735 
5736 
5737 
5738 
5739 //=================================================================================================
5740 //
5741 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5742 //
5743 //=================================================================================================
5744 
5745 //*************************************************************************************************
5756 template< typename MT // Type of the sparse matrix
5757  , size_t... CCAs > // Compile time column arguments
5758 template< typename Other > // Data type of the foreign expression
5759 inline bool Column<MT,false,false,true,CCAs...>::canAlias( const Other* alias ) const noexcept
5760 {
5761  return matrix_.isAliased( alias );
5762 }
5764 //*************************************************************************************************
5765 
5766 
5767 //*************************************************************************************************
5778 template< typename MT // Type of the sparse matrix
5779  , size_t... CCAs > // Compile time column arguments
5780 template< typename Other > // Data type of the foreign expression
5781 inline bool Column<MT,false,false,true,CCAs...>::isAliased( const Other* alias ) const noexcept
5782 {
5783  return matrix_.isAliased( alias );
5784 }
5786 //*************************************************************************************************
5787 
5788 
5789 //*************************************************************************************************
5801 template< typename MT // Type of the sparse matrix
5802  , size_t... CCAs > // Compile time column arguments
5803 template< typename VT > // Type of the right-hand side dense vector
5804 inline void Column<MT,false,false,true,CCAs...>::assign( const DenseVector<VT,false>& rhs )
5805 {
5806  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5807  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5808 
5809  for( size_t i=0UL; i<size(); ++i )
5810  {
5811  if( matrix_.nonZeros( column() ) == matrix_.capacity( column() ) )
5812  matrix_.reserve( column(), extendCapacity() );
5813 
5814  matrix_.append( column(), i, (~rhs)[i], true );
5815  }
5816 }
5818 //*************************************************************************************************
5819 
5820 
5821 //*************************************************************************************************
5833 template< typename MT // Type of the sparse matrix
5834  , size_t... CCAs > // Compile time column arguments
5835 template< typename VT > // Type of the right-hand side sparse vector
5836 inline void Column<MT,false,false,true,CCAs...>::assign( const SparseVector<VT,false>& rhs )
5837 {
5838  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5839  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5840 
5841  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5842  matrix_.append( column(), element->index(), element->value(), true );
5843  }
5844 }
5846 //*************************************************************************************************
5847 
5848 
5849 //*************************************************************************************************
5861 template< typename MT // Type of the sparse matrix
5862  , size_t... CCAs > // Compile time column arguments
5863 template< typename VT > // Type of the right-hand side dense vector
5864 inline void Column<MT,false,false,true,CCAs...>::addAssign( const DenseVector<VT,false>& rhs )
5865 {
5866  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5867 
5871 
5872  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5873 
5874  const AddType tmp( serial( *this + (~rhs) ) );
5875  matrix_.reset( column() );
5876  assign( tmp );
5877 }
5879 //*************************************************************************************************
5880 
5881 
5882 //*************************************************************************************************
5894 template< typename MT // Type of the sparse matrix
5895  , size_t... CCAs > // Compile time column arguments
5896 template< typename VT > // Type of the right-hand side sparse vector
5897 inline void Column<MT,false,false,true,CCAs...>::addAssign( const SparseVector<VT,false>& rhs )
5898 {
5899  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5900 
5904 
5905  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5906 
5907  const AddType tmp( serial( *this + (~rhs) ) );
5908  matrix_.reset( column() );
5909  matrix_.reserve( column(), tmp.nonZeros() );
5910  assign( tmp );
5911 }
5913 //*************************************************************************************************
5914 
5915 
5916 //*************************************************************************************************
5928 template< typename MT // Type of the sparse matrix
5929  , size_t... CCAs > // Compile time column arguments
5930 template< typename VT > // Type of the right-hand side dense vector
5931 inline void Column<MT,false,false,true,CCAs...>::subAssign( const DenseVector<VT,false>& rhs )
5932 {
5933  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5934 
5938 
5939  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5940 
5941  const SubType tmp( serial( *this - (~rhs) ) );
5942  matrix_.reset( column() );
5943  assign( tmp );
5944 }
5946 //*************************************************************************************************
5947 
5948 
5949 //*************************************************************************************************
5961 template< typename MT // Type of the sparse matrix
5962  , size_t... CCAs > // Compile time column arguments
5963 template< typename VT > // Type of the right-hand side sparse vector
5964 inline void Column<MT,false,false,true,CCAs...>::subAssign( const SparseVector<VT,false>& rhs )
5965 {
5966  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5967 
5971 
5972  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5973 
5974  const SubType tmp( serial( *this - (~rhs) ) );
5975  matrix_.reset( column() );
5976  matrix_.reserve( column(), tmp.nonZeros() );
5977  assign( tmp );
5978 }
5980 //*************************************************************************************************
5981 
5982 } // namespace blaze
5983 
5984 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
Header file for the SparseVector base class.
Header file for the View base class.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:61
Header file for the serial shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
Header file for the implementation of the Column base template.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the IsUniLower type trait.
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
Constraint on the data type.
Constraint on the transpose flag of vector types.
Constraint on the data type.
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_t
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_t alias declaration provid...
Definition: ColumnTrait.h:170
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the IsReference type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the implementation of the ColumnData class template.
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
Header file for the IsExpression type trait class.
Constraint on the data type.