Blaze  3.6
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/MaybeUnused.h>
90 #include <blaze/util/mpl/If.h>
91 #include <blaze/util/TypeList.h>
92 #include <blaze/util/Types.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // CLASS TEMPLATE SPECIALIZATION FOR 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 
158  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
159  //**********************************************************************************************
160 
161  //**Constructors********************************************************************************
164  template< typename... RCAs >
165  explicit inline Column( MT& matrix, RCAs... args );
166 
167  Column( const Column& ) = default;
169  //**********************************************************************************************
170 
171  //**Destructor**********************************************************************************
174  ~Column() = default;
176  //**********************************************************************************************
177 
178  //**Data access functions***********************************************************************
181  inline Reference operator[]( size_t index );
182  inline ConstReference operator[]( size_t index ) const;
183  inline Reference at( size_t index );
184  inline ConstReference at( size_t index ) const;
185  inline Iterator begin ();
186  inline ConstIterator begin () const;
187  inline ConstIterator cbegin() const;
188  inline Iterator end ();
189  inline ConstIterator end () const;
190  inline ConstIterator cend () const;
192  //**********************************************************************************************
193 
194  //**Assignment operators************************************************************************
197  inline Column& operator=( initializer_list<ElementType> list );
198  inline Column& operator=( const Column& rhs );
199 
200  template< typename VT > inline Column& operator= ( const DenseVector<VT,false>& rhs );
201  template< typename VT > inline Column& operator= ( const SparseVector<VT,false>& rhs );
202  template< typename VT > inline Column& operator+=( const DenseVector<VT,false>& rhs );
203  template< typename VT > inline Column& operator+=( const SparseVector<VT,false>& rhs );
204  template< typename VT > inline Column& operator-=( const DenseVector<VT,false>& rhs );
205  template< typename VT > inline Column& operator-=( const SparseVector<VT,false>& rhs );
206  template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
207  template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
208  template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
210  //**********************************************************************************************
211 
212  //**Utility functions***************************************************************************
215  using DataType::column;
216 
217  inline MT& operand() noexcept;
218  inline const MT& operand() const noexcept;
219 
220  inline size_t size() const noexcept;
221  inline size_t capacity() const noexcept;
222  inline size_t nonZeros() const;
223  inline void reset();
224  inline void reserve( size_t n );
226  //**********************************************************************************************
227 
228  //**Insertion functions*************************************************************************
231  inline Iterator set ( size_t index, const ElementType& value );
232  inline Iterator insert( size_t index, const ElementType& value );
233  inline void append( size_t index, const ElementType& value, bool check=false );
235  //**********************************************************************************************
236 
237  //**Erase functions*****************************************************************************
240  inline void erase( size_t index );
241  inline Iterator erase( Iterator pos );
242  inline Iterator erase( Iterator first, Iterator last );
243 
244  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
245  inline void erase( Pred predicate );
246 
247  template< typename Pred >
248  inline void erase( Iterator first, Iterator last, Pred predicate );
250  //**********************************************************************************************
251 
252  //**Lookup functions****************************************************************************
255  inline Iterator find ( size_t index );
256  inline ConstIterator find ( size_t index ) const;
257  inline Iterator lowerBound( size_t index );
258  inline ConstIterator lowerBound( size_t index ) const;
259  inline Iterator upperBound( size_t index );
260  inline ConstIterator upperBound( size_t index ) const;
262  //**********************************************************************************************
263 
264  //**Numeric functions***************************************************************************
267  template< typename Other > inline Column& scale( const Other& scalar );
269  //**********************************************************************************************
270 
271  //**Expression template evaluation functions****************************************************
274  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
275  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
276 
277  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
278  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
279  template< typename VT > inline void addAssign( const DenseVector <VT,false>& rhs );
280  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
281  template< typename VT > inline void subAssign( const DenseVector <VT,false>& rhs );
282  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
284  //**********************************************************************************************
285 
286  private:
287  //**Utility functions***************************************************************************
290  inline size_t extendCapacity() const noexcept;
292  //**********************************************************************************************
293 
294  //**Member variables****************************************************************************
297  Operand matrix_;
298 
299  //**********************************************************************************************
300 
301  //**Compile time checks*************************************************************************
309  //**********************************************************************************************
310 };
312 //*************************************************************************************************
313 
314 
315 
316 
317 //=================================================================================================
318 //
319 // CONSTRUCTORS
320 //
321 //=================================================================================================
322 
323 //*************************************************************************************************
336 template< typename MT // Type of the sparse matrix
337  , bool SF // Symmetry flag
338  , size_t... CCAs > // Compile time column arguments
339 template< typename... RCAs > // Runtime column arguments
340 inline Column<MT,true,false,SF,CCAs...>::Column( MT& matrix, RCAs... args )
341  : DataType( args... ) // Base class initialization
342  , matrix_ ( matrix ) // The matrix containing the column
343 {
344  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
345  if( matrix_.columns() <= column() ) {
346  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
347  }
348  }
349  else {
350  BLAZE_USER_ASSERT( column() < matrix_.columns(), "Invalid column access index" );
351  }
352 }
354 //*************************************************************************************************
355 
356 
357 
358 
359 //=================================================================================================
360 //
361 // DATA ACCESS FUNCTIONS
362 //
363 //=================================================================================================
364 
365 //*************************************************************************************************
375 template< typename MT // Type of the sparse matrix
376  , bool SF // Symmetry flag
377  , size_t... CCAs > // Compile time column arguments
378 inline typename Column<MT,true,false,SF,CCAs...>::Reference
379  Column<MT,true,false,SF,CCAs...>::operator[]( size_t index )
380 {
381  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
382  return matrix_(index,column());
383 }
385 //*************************************************************************************************
386 
387 
388 //*************************************************************************************************
398 template< typename MT // Type of the sparse matrix
399  , bool SF // Symmetry flag
400  , size_t... CCAs > // Compile time column arguments
401 inline typename Column<MT,true,false,SF,CCAs...>::ConstReference
402  Column<MT,true,false,SF,CCAs...>::operator[]( size_t index ) const
403 {
404  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
405  return const_cast<const MT&>( matrix_ )(index,column());
406 }
408 //*************************************************************************************************
409 
410 
411 //*************************************************************************************************
422 template< typename MT // Type of the sparse matrix
423  , bool SF // Symmetry flag
424  , size_t... CCAs > // Compile time column arguments
425 inline typename Column<MT,true,false,SF,CCAs...>::Reference
426  Column<MT,true,false,SF,CCAs...>::at( size_t index )
427 {
428  if( index >= size() ) {
429  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
430  }
431  return (*this)[index];
432 }
434 //*************************************************************************************************
435 
436 
437 //*************************************************************************************************
448 template< typename MT // Type of the sparse matrix
449  , bool SF // Symmetry flag
450  , size_t... CCAs > // Compile time column arguments
451 inline typename Column<MT,true,false,SF,CCAs...>::ConstReference
452  Column<MT,true,false,SF,CCAs...>::at( size_t index ) const
453 {
454  if( index >= size() ) {
455  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
456  }
457  return (*this)[index];
458 }
460 //*************************************************************************************************
461 
462 
463 //*************************************************************************************************
471 template< typename MT // Type of the sparse matrix
472  , bool SF // Symmetry flag
473  , size_t... CCAs > // Compile time column arguments
474 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
476 {
477  return matrix_.begin( column() );
478 }
480 //*************************************************************************************************
481 
482 
483 //*************************************************************************************************
491 template< typename MT // Type of the sparse matrix
492  , bool SF // Symmetry flag
493  , size_t... CCAs > // Compile time column arguments
494 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
496 {
497  return matrix_.cbegin( column() );
498 }
500 //*************************************************************************************************
501 
502 
503 //*************************************************************************************************
511 template< typename MT // Type of the sparse matrix
512  , bool SF // Symmetry flag
513  , size_t... CCAs > // Compile time column arguments
514 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
516 {
517  return matrix_.cbegin( column() );
518 }
520 //*************************************************************************************************
521 
522 
523 //*************************************************************************************************
531 template< typename MT // Type of the sparse matrix
532  , bool SF // Symmetry flag
533  , size_t... CCAs > // Compile time column arguments
534 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
536 {
537  return matrix_.end( column() );
538 }
540 //*************************************************************************************************
541 
542 
543 //*************************************************************************************************
551 template< typename MT // Type of the sparse matrix
552  , bool SF // Symmetry flag
553  , size_t... CCAs > // Compile time column arguments
554 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
556 {
557  return matrix_.cend( column() );
558 }
560 //*************************************************************************************************
561 
562 
563 //*************************************************************************************************
571 template< typename MT // Type of the sparse matrix
572  , bool SF // Symmetry flag
573  , size_t... CCAs > // Compile time column arguments
574 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
576 {
577  return matrix_.cend( column() );
578 }
580 //*************************************************************************************************
581 
582 
583 
584 
585 //=================================================================================================
586 //
587 // ASSIGNMENT OPERATORS
588 //
589 //=================================================================================================
590 
591 //*************************************************************************************************
606 template< typename MT // Type of the sparse matrix
607  , bool SF // Symmetry flag
608  , size_t... CCAs > // Compile time column arguments
609 inline Column<MT,true,false,SF,CCAs...>&
610  Column<MT,true,false,SF,CCAs...>::operator=( initializer_list<ElementType> list )
611 {
612  using blaze::assign;
613 
614  if( list.size() > size() ) {
615  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to column" );
616  }
617 
618  const InitializerVector<ElementType,false> tmp( list, size() );
619 
620  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
621  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
622  }
623 
624  decltype(auto) left( derestrict( *this ) );
625 
626  left.reset();
627  assign( left, tmp );
628 
629  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
630 
631  return *this;
632 }
634 //*************************************************************************************************
635 
636 
637 //*************************************************************************************************
651 template< typename MT // Type of the sparse matrix
652  , bool SF // Symmetry flag
653  , size_t... CCAs > // Compile time column arguments
654 inline Column<MT,true,false,SF,CCAs...>&
655  Column<MT,true,false,SF,CCAs...>::operator=( const Column& rhs )
656 {
657  using blaze::assign;
658 
662 
663  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
664  return *this;
665 
666  if( size() != rhs.size() ) {
667  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
668  }
669 
670  if( !tryAssign( matrix_, rhs, 0UL, column() ) ) {
671  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
672  }
673 
674  decltype(auto) left( derestrict( *this ) );
675 
676  if( rhs.canAlias( &matrix_ ) ) {
677  const ResultType tmp( rhs );
678  left.reset();
679  left.reserve( tmp.nonZeros() );
680  assign( left, tmp );
681  }
682  else {
683  left.reset();
684  left.reserve( rhs.nonZeros() );
685  assign( left, rhs );
686  }
687 
688  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
689 
690  return *this;
691 }
693 //*************************************************************************************************
694 
695 
696 //*************************************************************************************************
710 template< typename MT // Type of the sparse matrix
711  , bool SF // Symmetry flag
712  , size_t... CCAs > // Compile time column arguments
713 template< typename VT > // Type of the right-hand side dense vector
714 inline Column<MT,true,false,SF,CCAs...>&
715  Column<MT,true,false,SF,CCAs...>::operator=( const DenseVector<VT,false>& rhs )
716 {
717  using blaze::assign;
718 
719  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
720  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
722 
723  if( size() != (~rhs).size() ) {
724  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
725  }
726 
727  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
728  Right right( ~rhs );
729 
730  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
731  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
732  }
733 
734  decltype(auto) left( derestrict( *this ) );
735 
736  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
737  const ResultType_t<VT> tmp( right );
738  left.reset();
739  assign( left, tmp );
740  }
741  else {
742  left.reset();
743  assign( left, right );
744  }
745 
746  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
747 
748  return *this;
749 }
751 //*************************************************************************************************
752 
753 
754 //*************************************************************************************************
768 template< typename MT // Type of the sparse matrix
769  , bool SF // Symmetry flag
770  , size_t... CCAs > // Compile time column arguments
771 template< typename VT > // Type of the right-hand side sparse vector
772 inline Column<MT,true,false,SF,CCAs...>&
773  Column<MT,true,false,SF,CCAs...>::operator=( const SparseVector<VT,false>& rhs )
774 {
775  using blaze::assign;
776 
777  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
778  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
780 
781  if( size() != (~rhs).size() ) {
782  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
783  }
784 
785  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
786  Right right( ~rhs );
787 
788  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
789  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
790  }
791 
792  decltype(auto) left( derestrict( *this ) );
793 
794  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
795  const ResultType_t<VT> tmp( right );
796  left.reset();
797  left.reserve( tmp.nonZeros() );
798  assign( left, tmp );
799  }
800  else {
801  left.reset();
802  left.reserve( right.nonZeros() );
803  assign( left, right );
804  }
805 
806  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
807 
808  return *this;
809 }
811 //*************************************************************************************************
812 
813 
814 //*************************************************************************************************
828 template< typename MT // Type of the sparse matrix
829  , bool SF // Symmetry flag
830  , size_t... CCAs > // Compile time column arguments
831 template< typename VT > // Type of the right-hand side dense vector
832 inline Column<MT,true,false,SF,CCAs...>&
833  Column<MT,true,false,SF,CCAs...>::operator+=( const DenseVector<VT,false>& rhs )
834 {
835  using blaze::assign;
836 
840  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
841  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
843 
844  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
845 
849 
850  if( size() != (~rhs).size() ) {
851  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
852  }
853 
854  const AddType tmp( *this + (~rhs) );
855 
856  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
857  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
858  }
859 
860  decltype(auto) left( derestrict( *this ) );
861 
862  left.reset();
863  assign( left, tmp );
864 
865  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
866 
867  return *this;
868 }
870 //*************************************************************************************************
871 
872 
873 //*************************************************************************************************
887 template< typename MT // Type of the sparse matrix
888  , bool SF // Symmetry flag
889  , size_t... CCAs > // Compile time column arguments
890 template< typename VT > // Type of the right-hand side sparse vector
891 inline Column<MT,true,false,SF,CCAs...>&
892  Column<MT,true,false,SF,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
893 {
894  using blaze::assign;
895 
899  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
900  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
902 
903  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
904 
908 
909  if( size() != (~rhs).size() ) {
910  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
911  }
912 
913  const AddType tmp( *this + (~rhs) );
914 
915  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
916  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
917  }
918 
919  decltype(auto) left( derestrict( *this ) );
920 
921  left.reset();
922  left.reserve( tmp.nonZeros() );
923  assign( left, tmp );
924 
925  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
926 
927  return *this;
928 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
948 template< typename MT // Type of the sparse matrix
949  , bool SF // Symmetry flag
950  , size_t... CCAs > // Compile time column arguments
951 template< typename VT > // Type of the right-hand side dense vector
952 inline Column<MT,true,false,SF,CCAs...>&
953  Column<MT,true,false,SF,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
954 {
955  using blaze::assign;
956 
960  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
961  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
963 
964  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
965 
969 
970  if( size() != (~rhs).size() ) {
971  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
972  }
973 
974  const SubType tmp( *this - (~rhs) );
975 
976  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
977  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
978  }
979 
980  decltype(auto) left( derestrict( *this ) );
981 
982  left.reset();
983  assign( left, tmp );
984 
985  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
986 
987  return *this;
988 }
990 //*************************************************************************************************
991 
992 
993 //*************************************************************************************************
1008 template< typename MT // Type of the sparse matrix
1009  , bool SF // Symmetry flag
1010  , size_t... CCAs > // Compile time column arguments
1011 template< typename VT > // Type of the right-hand side sparse vector
1012 inline Column<MT,true,false,SF,CCAs...>&
1013  Column<MT,true,false,SF,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
1014 {
1015  using blaze::assign;
1016 
1020  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
1021  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1023 
1024  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1025 
1029 
1030  if( size() != (~rhs).size() ) {
1031  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1032  }
1033 
1034  const SubType tmp( *this - (~rhs) );
1035 
1036  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1037  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1038  }
1039 
1040  decltype(auto) left( derestrict( *this ) );
1041 
1042  left.reset();
1043  left.reserve( tmp.nonZeros() );
1044  assign( left, tmp );
1045 
1046  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1047 
1048  return *this;
1049 }
1051 //*************************************************************************************************
1052 
1053 
1054 //*************************************************************************************************
1067 template< typename MT // Type of the sparse matrix
1068  , bool SF // Symmetry flag
1069  , size_t... CCAs > // Compile time column arguments
1070 template< typename VT > // Type of the right-hand side vector
1071 inline Column<MT,true,false,SF,CCAs...>&
1072  Column<MT,true,false,SF,CCAs...>::operator*=( const Vector<VT,false>& rhs )
1073 {
1074  using blaze::assign;
1075 
1079  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1081 
1082  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1083 
1086 
1087  if( size() != (~rhs).size() ) {
1088  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1089  }
1090 
1091  const MultType tmp( *this * (~rhs) );
1092 
1093  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1094  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1095  }
1096 
1097  decltype(auto) left( derestrict( *this ) );
1098 
1099  left.reset();
1100  assign( left, tmp );
1101 
1102  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1103 
1104  return *this;
1105 }
1107 //*************************************************************************************************
1108 
1109 
1110 //*************************************************************************************************
1122 template< typename MT // Type of the sparse matrix
1123  , bool SF // Symmetry flag
1124  , size_t... CCAs > // Compile time column arguments
1125 template< typename VT > // Type of the right-hand side vector
1126 inline Column<MT,true,false,SF,CCAs...>&
1127  Column<MT,true,false,SF,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
1128 {
1129  using blaze::assign;
1130 
1134  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
1135  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1137 
1138  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1139 
1143 
1144  if( size() != (~rhs).size() ) {
1145  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1146  }
1147 
1148  const DivType tmp( *this / (~rhs) );
1149 
1150  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1151  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1152  }
1153 
1154  decltype(auto) left( derestrict( *this ) );
1155 
1156  left.reset();
1157  assign( left, tmp );
1158 
1159  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1160 
1161  return *this;
1162 }
1164 //*************************************************************************************************
1165 
1166 
1167 //*************************************************************************************************
1180 template< typename MT // Type of the sparse matrix
1181  , bool SF // Symmetry flag
1182  , size_t... CCAs > // Compile time column arguments
1183 template< typename VT > // Type of the right-hand side vector
1184 inline Column<MT,true,false,SF,CCAs...>&
1185  Column<MT,true,false,SF,CCAs...>::operator%=( const Vector<VT,false>& rhs )
1186 {
1187  using blaze::assign;
1188 
1189  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
1191 
1192  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1193 
1197 
1198  if( size() != 3UL || (~rhs).size() != 3UL ) {
1199  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1200  }
1201 
1202  const CrossType tmp( *this % (~rhs) );
1203 
1204  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
1205  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1206  }
1207 
1208  decltype(auto) left( derestrict( *this ) );
1209 
1210  left.reset();
1211  assign( left, tmp );
1212 
1213  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1214 
1215  return *this;
1216 }
1218 //*************************************************************************************************
1219 
1220 
1221 
1222 
1223 //=================================================================================================
1224 //
1225 // UTILITY FUNCTIONS
1226 //
1227 //=================================================================================================
1228 
1229 //*************************************************************************************************
1235 template< typename MT // Type of the sparse matrix
1236  , bool SF // Symmetry flag
1237  , size_t... CCAs > // Compile time column arguments
1238 inline MT& Column<MT,true,false,SF,CCAs...>::operand() noexcept
1239 {
1240  return matrix_;
1241 }
1243 //*************************************************************************************************
1244 
1245 
1246 //*************************************************************************************************
1252 template< typename MT // Type of the sparse matrix
1253  , bool SF // Symmetry flag
1254  , size_t... CCAs > // Compile time column arguments
1255 inline const MT& Column<MT,true,false,SF,CCAs...>::operand() const noexcept
1256 {
1257  return matrix_;
1258 }
1260 //*************************************************************************************************
1261 
1262 
1263 //*************************************************************************************************
1269 template< typename MT // Type of the sparse matrix
1270  , bool SF // Symmetry flag
1271  , size_t... CCAs > // Compile time column arguments
1272 inline size_t Column<MT,true,false,SF,CCAs...>::size() const noexcept
1273 {
1274  return matrix_.rows();
1275 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1286 template< typename MT // Type of the sparse matrix
1287  , bool SF // Symmetry flag
1288  , size_t... CCAs > // Compile time column arguments
1289 inline size_t Column<MT,true,false,SF,CCAs...>::capacity() const noexcept
1290 {
1291  return matrix_.capacity( column() );
1292 }
1294 //*************************************************************************************************
1295 
1296 
1297 //*************************************************************************************************
1306 template< typename MT // Type of the sparse matrix
1307  , bool SF // Symmetry flag
1308  , size_t... CCAs > // Compile time column arguments
1309 inline size_t Column<MT,true,false,SF,CCAs...>::nonZeros() const
1310 {
1311  return matrix_.nonZeros( column() );
1312 }
1314 //*************************************************************************************************
1315 
1316 
1317 //*************************************************************************************************
1323 template< typename MT // Type of the sparse matrix
1324  , bool SF // Symmetry flag
1325  , size_t... CCAs > // Compile time column arguments
1327 {
1328  matrix_.reset( column() );
1329 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1344 template< typename MT // Type of the sparse matrix
1345  , bool SF // Symmetry flag
1346  , size_t... CCAs > // Compile time column arguments
1347 void Column<MT,true,false,SF,CCAs...>::reserve( size_t n )
1348 {
1349  matrix_.reserve( column(), n );
1350 }
1352 //*************************************************************************************************
1353 
1354 
1355 //*************************************************************************************************
1364 template< typename MT // Type of the sparse matrix
1365  , bool SF // Symmetry flag
1366  , size_t... CCAs > // Compile time column arguments
1367 inline size_t Column<MT,true,false,SF,CCAs...>::extendCapacity() const noexcept
1368 {
1369  using blaze::max;
1370  using blaze::min;
1371 
1372  size_t nonzeros( 2UL*capacity()+1UL );
1373  nonzeros = max( nonzeros, 7UL );
1374  nonzeros = min( nonzeros, size() );
1375 
1376  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
1377 
1378  return nonzeros;
1379 }
1381 //*************************************************************************************************
1382 
1383 
1384 
1385 
1386 //=================================================================================================
1387 //
1388 // INSERTION FUNCTIONS
1389 //
1390 //=================================================================================================
1391 
1392 //*************************************************************************************************
1404 template< typename MT // Type of the sparse matrix
1405  , bool SF // Symmetry flag
1406  , size_t... CCAs > // Compile time column arguments
1407 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1408  Column<MT,true,false,SF,CCAs...>::set( size_t index, const ElementType& value )
1409 {
1410  return matrix_.set( index, column(), value );
1411 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1429 template< typename MT // Type of the sparse matrix
1430  , bool SF // Symmetry flag
1431  , size_t... CCAs > // Compile time column arguments
1432 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1433  Column<MT,true,false,SF,CCAs...>::insert( size_t index, const ElementType& value )
1434 {
1435  return matrix_.insert( index, column(), value );
1436 }
1438 //*************************************************************************************************
1439 
1440 
1441 //*************************************************************************************************
1466 template< typename MT // Type of the sparse matrix
1467  , bool SF // Symmetry flag
1468  , size_t... CCAs > // Compile time column arguments
1469 inline void Column<MT,true,false,SF,CCAs...>::append( size_t index, const ElementType& value, bool check )
1470 {
1471  matrix_.append( index, column(), value, check );
1472 }
1474 //*************************************************************************************************
1475 
1476 
1477 
1478 
1479 //=================================================================================================
1480 //
1481 // ERASE FUNCTIONS
1482 //
1483 //=================================================================================================
1484 
1485 //*************************************************************************************************
1494 template< typename MT // Type of the sparse matrix
1495  , bool SF // Symmetry flag
1496  , size_t... CCAs > // Compile time column arguments
1497 inline void Column<MT,true,false,SF,CCAs...>::erase( size_t index )
1498 {
1499  matrix_.erase( index, column() );
1500 }
1502 //*************************************************************************************************
1503 
1504 
1505 //*************************************************************************************************
1514 template< typename MT // Type of the sparse matrix
1515  , bool SF // Symmetry flag
1516  , size_t... CCAs > // Compile time column arguments
1517 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1518  Column<MT,true,false,SF,CCAs...>::erase( Iterator pos )
1519 {
1520  return matrix_.erase( column(), pos );
1521 }
1523 //*************************************************************************************************
1524 
1525 
1526 //*************************************************************************************************
1536 template< typename MT // Type of the sparse matrix
1537  , bool SF // Symmetry flag
1538  , size_t... CCAs > // Compile time column arguments
1539 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1540  Column<MT,true,false,SF,CCAs...>::erase( Iterator first, Iterator last )
1541 {
1542  return matrix_.erase( column(), first, last );
1543 }
1545 //*************************************************************************************************
1546 
1547 
1548 //*************************************************************************************************
1571 template< typename MT // Type of the sparse matrix
1572  , bool SF // Symmetry flag
1573  , size_t... CCAs > // Compile time column arguments
1574 template< typename Pred // Type of the unary predicate
1575  , typename > // Type restriction on the unary predicate
1576 inline void Column<MT,true,false,SF,CCAs...>::erase( Pred predicate )
1577 {
1578  matrix_.erase( column(), begin(), end(), predicate );
1579 }
1581 //*************************************************************************************************
1582 
1583 
1584 //*************************************************************************************************
1609 template< typename MT // Type of the sparse matrix
1610  , bool SF // Symmetry flag
1611  , size_t... CCAs > // Compile time column arguments
1612 template< typename Pred > // Type of the unary predicate
1613 inline void Column<MT,true,false,SF,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
1614 {
1615  matrix_.erase( column(), first, last, predicate );
1616 }
1618 //*************************************************************************************************
1619 
1620 
1621 
1622 
1623 //=================================================================================================
1624 //
1625 // LOOKUP FUNCTIONS
1626 //
1627 //=================================================================================================
1628 
1629 //*************************************************************************************************
1643 template< typename MT // Type of the sparse matrix
1644  , bool SF // Symmetry flag
1645  , size_t... CCAs > // Compile time column arguments
1646 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1647  Column<MT,true,false,SF,CCAs...>::find( size_t index )
1648 {
1649  return matrix_.find( index, column() );
1650 }
1652 //*************************************************************************************************
1653 
1654 
1655 //*************************************************************************************************
1669 template< typename MT // Type of the sparse matrix
1670  , bool SF // Symmetry flag
1671  , size_t... CCAs > // Compile time column arguments
1672 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
1673  Column<MT,true,false,SF,CCAs...>::find( size_t index ) const
1674 {
1675  return matrix_.find( index, column() );
1676 }
1678 //*************************************************************************************************
1679 
1680 
1681 //*************************************************************************************************
1694 template< typename MT // Type of the sparse matrix
1695  , bool SF // Symmetry flag
1696  , size_t... CCAs > // Compile time column arguments
1697 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1698  Column<MT,true,false,SF,CCAs...>::lowerBound( size_t index )
1699 {
1700  return matrix_.lowerBound( index, column() );
1701 }
1703 //*************************************************************************************************
1704 
1705 
1706 //*************************************************************************************************
1719 template< typename MT // Type of the sparse matrix
1720  , bool SF // Symmetry flag
1721  , size_t... CCAs > // Compile time column arguments
1722 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
1723  Column<MT,true,false,SF,CCAs...>::lowerBound( size_t index ) const
1724 {
1725  return matrix_.lowerBound( index, column() );
1726 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1744 template< typename MT // Type of the sparse matrix
1745  , bool SF // Symmetry flag
1746  , size_t... CCAs > // Compile time column arguments
1747 inline typename Column<MT,true,false,SF,CCAs...>::Iterator
1748  Column<MT,true,false,SF,CCAs...>::upperBound( size_t index )
1749 {
1750  return matrix_.upperBound( index, column() );
1751 }
1753 //*************************************************************************************************
1754 
1755 
1756 //*************************************************************************************************
1769 template< typename MT // Type of the sparse matrix
1770  , bool SF // Symmetry flag
1771  , size_t... CCAs > // Compile time column arguments
1772 inline typename Column<MT,true,false,SF,CCAs...>::ConstIterator
1773  Column<MT,true,false,SF,CCAs...>::upperBound( size_t index ) const
1774 {
1775  return matrix_.upperBound( index, column() );
1776 }
1778 //*************************************************************************************************
1779 
1780 
1781 
1782 
1783 //=================================================================================================
1784 //
1785 // NUMERIC FUNCTIONS
1786 //
1787 //=================================================================================================
1788 
1789 //*************************************************************************************************
1802 template< typename MT // Type of the sparse matrix
1803  , bool SF // Symmetry flag
1804  , size_t... CCAs > // Compile time column arguments
1805 template< typename Other > // Data type of the scalar value
1806 inline Column<MT,true,false,SF,CCAs...>&
1807  Column<MT,true,false,SF,CCAs...>::scale( const Other& scalar )
1808 {
1810 
1811  for( Iterator element=begin(); element!=end(); ++element )
1812  element->value() *= scalar;
1813  return *this;
1814 }
1816 //*************************************************************************************************
1817 
1818 
1819 
1820 
1821 //=================================================================================================
1822 //
1823 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1824 //
1825 //=================================================================================================
1826 
1827 //*************************************************************************************************
1838 template< typename MT // Type of the sparse matrix
1839  , bool SF // Symmetry flag
1840  , size_t... CCAs > // Compile time column arguments
1841 template< typename Other > // Data type of the foreign expression
1842 inline bool Column<MT,true,false,SF,CCAs...>::canAlias( const Other* alias ) const noexcept
1843 {
1844  return matrix_.isAliased( alias );
1845 }
1847 //*************************************************************************************************
1848 
1849 
1850 //*************************************************************************************************
1861 template< typename MT // Type of the sparse matrix
1862  , bool SF // Symmetry flag
1863  , size_t... CCAs > // Compile time column arguments
1864 template< typename Other > // Data type of the foreign expression
1865 inline bool Column<MT,true,false,SF,CCAs...>::isAliased( const Other* alias ) const noexcept
1866 {
1867  return matrix_.isAliased( alias );
1868 }
1870 //*************************************************************************************************
1871 
1872 
1873 //*************************************************************************************************
1885 template< typename MT // Type of the sparse matrix
1886  , bool SF // Symmetry flag
1887  , size_t... CCAs > // Compile time column arguments
1888 template< typename VT > // Type of the right-hand side dense vector
1889 inline void Column<MT,true,false,SF,CCAs...>::assign( const DenseVector<VT,false>& rhs )
1890 {
1891  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1892  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1893 
1894  for( size_t i=0UL; i<size(); ++i )
1895  {
1896  if( matrix_.nonZeros( column() ) == matrix_.capacity( column() ) )
1897  matrix_.reserve( column(), extendCapacity() );
1898 
1899  matrix_.append( i, column(), (~rhs)[i], true );
1900  }
1901 }
1903 //*************************************************************************************************
1904 
1905 
1906 //*************************************************************************************************
1918 template< typename MT // Type of the sparse matrix
1919  , bool SF // Symmetry flag
1920  , size_t... CCAs > // Compile time column arguments
1921 template< typename VT > // Type of the right-hand side sparse vector
1922 inline void Column<MT,true,false,SF,CCAs...>::assign( const SparseVector<VT,false>& rhs )
1923 {
1924  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1925  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
1926 
1927  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1928  matrix_.append( element->index(), column(), element->value(), true );
1929  }
1930 }
1932 //*************************************************************************************************
1933 
1934 
1935 //*************************************************************************************************
1947 template< typename MT // Type of the sparse matrix
1948  , bool SF // Symmetry flag
1949  , size_t... CCAs > // Compile time column arguments
1950 template< typename VT > // Type of the right-hand side dense vector
1951 inline void Column<MT,true,false,SF,CCAs...>::addAssign( const DenseVector<VT,false>& rhs )
1952 {
1953  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1954 
1958 
1959  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1960 
1961  const AddType tmp( serial( *this + (~rhs) ) );
1962  matrix_.reset( column() );
1963  assign( tmp );
1964 }
1966 //*************************************************************************************************
1967 
1968 
1969 //*************************************************************************************************
1981 template< typename MT // Type of the sparse matrix
1982  , bool SF // Symmetry flag
1983  , size_t... CCAs > // Compile time column arguments
1984 template< typename VT > // Type of the right-hand side sparse vector
1985 inline void Column<MT,true,false,SF,CCAs...>::addAssign( const SparseVector<VT,false>& rhs )
1986 {
1987  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1988 
1992 
1993  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1994 
1995  const AddType tmp( serial( *this + (~rhs) ) );
1996  matrix_.reset( column() );
1997  matrix_.reserve( column(), tmp.nonZeros() );
1998  assign( tmp );
1999 }
2001 //*************************************************************************************************
2002 
2003 
2004 //*************************************************************************************************
2016 template< typename MT // Type of the sparse matrix
2017  , bool SF // Symmetry flag
2018  , size_t... CCAs > // Compile time column arguments
2019 template< typename VT > // Type of the right-hand side dense vector
2020 inline void Column<MT,true,false,SF,CCAs...>::subAssign( const DenseVector<VT,false>& rhs )
2021 {
2022  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2023 
2027 
2028  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2029 
2030  const SubType tmp( serial( *this - (~rhs) ) );
2031  matrix_.reset( column() );
2032  assign( tmp );
2033 }
2035 //*************************************************************************************************
2036 
2037 
2038 //*************************************************************************************************
2050 template< typename MT // Type of the sparse matrix
2051  , bool SF // Symmetry flag
2052  , size_t... CCAs > // Compile time column arguments
2053 template< typename VT > // Type of the right-hand side sparse vector
2054 inline void Column<MT,true,false,SF,CCAs...>::subAssign( const SparseVector<VT,false>& rhs )
2055 {
2056  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2057 
2061 
2062  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2063 
2064  const SubType tmp( serial( *this - (~rhs) ) );
2065  matrix_.reset( column() );
2066  matrix_.reserve( column(), tmp.nonZeros() );
2067  assign( tmp );
2068 }
2070 //*************************************************************************************************
2071 
2072 
2073 
2074 
2075 
2076 
2077 
2078 
2079 //=================================================================================================
2080 //
2081 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL ROW-MAJOR SPARSE MATRICES
2082 //
2083 //=================================================================================================
2084 
2085 //*************************************************************************************************
2093 template< typename MT // Type of the sparse matrix
2094  , size_t... CCAs > // Compile time column arguments
2095 class Column<MT,false,false,false,CCAs...>
2096  : public View< SparseVector< Column<MT,false,false,false,CCAs...>, false > >
2097  , private ColumnData<CCAs...>
2098 {
2099  private:
2100  //**Type definitions****************************************************************************
2101  using DataType = ColumnData<CCAs...>;
2102  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2103  //**********************************************************************************************
2104 
2105  public:
2106  //**Type definitions****************************************************************************
2108  using This = Column<MT,false,false,false,CCAs...>;
2109 
2110  using BaseType = SparseVector<This,false>;
2111  using ViewedType = MT;
2112  using ResultType = ColumnTrait_t<MT,CCAs...>;
2113  using TransposeType = TransposeType_t<ResultType>;
2114  using ElementType = ElementType_t<MT>;
2115  using ReturnType = ReturnType_t<MT>;
2116  using CompositeType = const Column&;
2117 
2119  using ConstReference = ConstReference_t<MT>;
2120 
2122  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2123  //**********************************************************************************************
2124 
2125  //**ColumnElement class definition**************************************************************
2128  template< typename MatrixType // Type of the sparse matrix
2129  , typename IteratorType > // Type of the sparse matrix iterator
2130  class ColumnElement
2131  : private SparseElement
2132  {
2133  public:
2134  //**Constructor******************************************************************************
2140  inline ColumnElement( IteratorType pos, size_t row )
2141  : pos_( pos ) // Iterator to the current position within the sparse column
2142  , row_( row ) // Index of the according row
2143  {}
2144  //*******************************************************************************************
2145 
2146  //**Assignment operator**********************************************************************
2152  template< typename T > inline ColumnElement& operator=( const T& v ) {
2153  *pos_ = v;
2154  return *this;
2155  }
2156  //*******************************************************************************************
2157 
2158  //**Addition assignment operator*************************************************************
2164  template< typename T > inline ColumnElement& operator+=( const T& v ) {
2165  *pos_ += v;
2166  return *this;
2167  }
2168  //*******************************************************************************************
2169 
2170  //**Subtraction assignment operator**********************************************************
2176  template< typename T > inline ColumnElement& operator-=( const T& v ) {
2177  *pos_ -= v;
2178  return *this;
2179  }
2180  //*******************************************************************************************
2181 
2182  //**Multiplication assignment operator*******************************************************
2188  template< typename T > inline ColumnElement& operator*=( const T& v ) {
2189  *pos_ *= v;
2190  return *this;
2191  }
2192  //*******************************************************************************************
2193 
2194  //**Division assignment operator*************************************************************
2200  template< typename T > inline ColumnElement& operator/=( const T& v ) {
2201  *pos_ /= v;
2202  return *this;
2203  }
2204  //*******************************************************************************************
2205 
2206  //**Element access operator******************************************************************
2211  inline const ColumnElement* operator->() const {
2212  return this;
2213  }
2214  //*******************************************************************************************
2215 
2216  //**Value function***************************************************************************
2221  inline decltype(auto) value() const {
2222  return pos_->value();
2223  }
2224  //*******************************************************************************************
2225 
2226  //**Index function***************************************************************************
2231  inline size_t index() const {
2232  return row_;
2233  }
2234  //*******************************************************************************************
2235 
2236  private:
2237  //**Member variables*************************************************************************
2238  IteratorType pos_;
2239  size_t row_;
2240  //*******************************************************************************************
2241  };
2242  //**********************************************************************************************
2243 
2244  //**ColumnIterator class definition*************************************************************
2247  template< typename MatrixType // Type of the sparse matrix
2248  , typename IteratorType > // Type of the sparse matrix iterator
2249  class ColumnIterator
2250  {
2251  public:
2252  //**Type definitions*************************************************************************
2253  using IteratorCategory = std::forward_iterator_tag;
2254  using ValueType = ColumnElement<MatrixType,IteratorType>;
2255  using PointerType = ValueType;
2256  using ReferenceType = ValueType;
2257  using DifferenceType = ptrdiff_t;
2258 
2259  // STL iterator requirements
2260  using iterator_category = IteratorCategory;
2261  using value_type = ValueType;
2262  using pointer = PointerType;
2263  using reference = ReferenceType;
2264  using difference_type = DifferenceType;
2265  //*******************************************************************************************
2266 
2267  //**Constructor******************************************************************************
2270  inline ColumnIterator()
2271  : matrix_( nullptr ) // The sparse matrix containing the column
2272  , row_ ( 0UL ) // The current row index
2273  , column_( 0UL ) // The current column index
2274  , pos_ () // Iterator to the current sparse element
2275  {}
2276  //*******************************************************************************************
2277 
2278  //**Constructor******************************************************************************
2285  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column )
2286  : matrix_( &matrix ) // The sparse matrix containing the column
2287  , row_ ( row ) // The current row index
2288  , column_( column ) // The current column index
2289  , pos_ () // Iterator to the current sparse element
2290  {
2291  for( ; row_<matrix_->rows(); ++row_ ) {
2292  pos_ = matrix_->find( row_, column_ );
2293  if( pos_ != matrix_->end( row_ ) ) break;
2294  }
2295  }
2296  //*******************************************************************************************
2297 
2298  //**Constructor******************************************************************************
2306  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column, IteratorType pos )
2307  : matrix_( &matrix ) // The sparse matrix containing the column
2308  , row_ ( row ) // The current row index
2309  , column_( column ) // The current column index
2310  , pos_ ( pos ) // Iterator to the current sparse element
2311  {
2312  BLAZE_INTERNAL_ASSERT( matrix.find( row, column ) == pos, "Invalid initial iterator position" );
2313  }
2314  //*******************************************************************************************
2315 
2316  //**Constructor******************************************************************************
2321  template< typename MatrixType2, typename IteratorType2 >
2322  inline ColumnIterator( const ColumnIterator<MatrixType2,IteratorType2>& it )
2323  : matrix_( it.matrix_ ) // The sparse matrix containing the column
2324  , row_ ( it.row_ ) // The current row index
2325  , column_( it.column_ ) // The current column index
2326  , pos_ ( it.pos_ ) // Iterator to the current sparse element
2327  {}
2328  //*******************************************************************************************
2329 
2330  //**Prefix increment operator****************************************************************
2335  inline ColumnIterator& operator++() {
2336  ++row_;
2337  for( ; row_<matrix_->rows(); ++row_ ) {
2338  pos_ = matrix_->find( row_, column_ );
2339  if( pos_ != matrix_->end( row_ ) ) break;
2340  }
2341 
2342  return *this;
2343  }
2344  //*******************************************************************************************
2345 
2346  //**Postfix increment operator***************************************************************
2351  inline const ColumnIterator operator++( int ) {
2352  const ColumnIterator tmp( *this );
2353  ++(*this);
2354  return tmp;
2355  }
2356  //*******************************************************************************************
2357 
2358  //**Element access operator******************************************************************
2363  inline ReferenceType operator*() const {
2364  return ReferenceType( pos_, row_ );
2365  }
2366  //*******************************************************************************************
2367 
2368  //**Element access operator******************************************************************
2373  inline PointerType operator->() const {
2374  return PointerType( pos_, row_ );
2375  }
2376  //*******************************************************************************************
2377 
2378  //**Equality operator************************************************************************
2384  template< typename MatrixType2, typename IteratorType2 >
2385  inline bool operator==( const ColumnIterator<MatrixType2,IteratorType2>& rhs ) const {
2386  return row_ == rhs.row_;
2387  }
2388  //*******************************************************************************************
2389 
2390  //**Inequality operator**********************************************************************
2396  template< typename MatrixType2, typename IteratorType2 >
2397  inline bool operator!=( const ColumnIterator<MatrixType2,IteratorType2>& rhs ) const {
2398  return !( *this == rhs );
2399  }
2400  //*******************************************************************************************
2401 
2402  //**Subtraction operator*********************************************************************
2408  inline DifferenceType operator-( const ColumnIterator& rhs ) const {
2409  size_t counter( 0UL );
2410  for( size_t i=rhs.row_; i<row_; ++i ) {
2411  if( matrix_->find( i, column_ ) != matrix_->end( i ) )
2412  ++counter;
2413  }
2414  return counter;
2415  }
2416  //*******************************************************************************************
2417 
2418  private:
2419  //**Member variables*************************************************************************
2420  MatrixType* matrix_;
2421  size_t row_;
2422  size_t column_;
2423  IteratorType pos_;
2424  //*******************************************************************************************
2425 
2426  //**Friend declarations**********************************************************************
2427  template< typename MatrixType2, typename IteratorType2 > friend class ColumnIterator;
2428  template< typename MT2, bool SO2, bool DF2, bool SF2, size_t... CCAs2 > friend class Column;
2429  //*******************************************************************************************
2430  };
2431  //**********************************************************************************************
2432 
2433  //**Type definitions****************************************************************************
2435  using ConstIterator = ColumnIterator< const MT, ConstIterator_t<MT> >;
2436 
2438  using Iterator = If_t< IsConst_v<MT>, ConstIterator, ColumnIterator< MT, Iterator_t<MT> > >;
2439  //**********************************************************************************************
2440 
2441  //**Compilation flags***************************************************************************
2443  static constexpr bool smpAssignable = false;
2444 
2446  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2447  //**********************************************************************************************
2448 
2449  //**Constructors********************************************************************************
2452  template< typename... RCAs >
2453  explicit inline Column( MT& matrix, RCAs... args );
2454 
2455  Column( const Column& ) = default;
2457  //**********************************************************************************************
2458 
2459  //**Destructor**********************************************************************************
2462  ~Column() = default;
2464  //**********************************************************************************************
2465 
2466  //**Data access functions***********************************************************************
2469  inline Reference operator[]( size_t index );
2470  inline ConstReference operator[]( size_t index ) const;
2471  inline Reference at( size_t index );
2472  inline ConstReference at( size_t index ) const;
2473  inline Iterator begin ();
2474  inline ConstIterator begin () const;
2475  inline ConstIterator cbegin() const;
2476  inline Iterator end ();
2477  inline ConstIterator end () const;
2478  inline ConstIterator cend () const;
2480  //**********************************************************************************************
2481 
2482  //**Assignment operators************************************************************************
2485  inline Column& operator=( initializer_list<ElementType> list );
2486  inline Column& operator=( const Column& rhs );
2487 
2488  template< typename VT > inline Column& operator= ( const Vector<VT,false>& rhs );
2489  template< typename VT > inline Column& operator+=( const Vector<VT,false>& rhs );
2490  template< typename VT > inline Column& operator-=( const Vector<VT,false>& rhs );
2491  template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
2492  template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
2493  template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
2495  //**********************************************************************************************
2496 
2497  //**Utility functions***************************************************************************
2500  using DataType::column;
2501 
2502  inline MT& operand() noexcept;
2503  inline const MT& operand() const noexcept;
2504 
2505  inline size_t size() const;
2506  inline size_t capacity() const;
2507  inline size_t nonZeros() const;
2508  inline void reset();
2509  inline void reserve( size_t n );
2511  //**********************************************************************************************
2512 
2513  //**Insertion functions*************************************************************************
2516  inline Iterator set ( size_t index, const ElementType& value );
2517  inline Iterator insert( size_t index, const ElementType& value );
2518  inline void append( size_t index, const ElementType& value, bool check=false );
2520  //**********************************************************************************************
2521 
2522  //**Erase functions*****************************************************************************
2525  inline void erase( size_t index );
2526  inline Iterator erase( Iterator pos );
2527  inline Iterator erase( Iterator first, Iterator last );
2528 
2529  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
2530  inline void erase( Pred predicate );
2531 
2532  template< typename Pred >
2533  inline void erase( Iterator first, Iterator last, Pred predicate );
2535  //**********************************************************************************************
2536 
2537  //**Lookup functions****************************************************************************
2540  inline Iterator find ( size_t index );
2541  inline ConstIterator find ( size_t index ) const;
2542  inline Iterator lowerBound( size_t index );
2543  inline ConstIterator lowerBound( size_t index ) const;
2544  inline Iterator upperBound( size_t index );
2545  inline ConstIterator upperBound( size_t index ) const;
2547  //**********************************************************************************************
2548 
2549  //**Numeric functions***************************************************************************
2552  template< typename Other > inline Column& scale( const Other& scalar );
2554  //**********************************************************************************************
2555 
2556  //**Expression template evaluation functions****************************************************
2559  template< typename Other > inline bool canAlias ( const Other* alias ) const;
2560  template< typename Other > inline bool isAliased( const Other* alias ) const;
2561 
2562  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
2563  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
2564  template< typename VT > inline void addAssign( const Vector<VT,false>& rhs );
2565  template< typename VT > inline void subAssign( const Vector<VT,false>& rhs );
2567  //**********************************************************************************************
2568 
2569  private:
2570  //**Member variables****************************************************************************
2573  Operand matrix_;
2574 
2575  //**********************************************************************************************
2576 
2577  //**Compile time checks*************************************************************************
2586  //**********************************************************************************************
2587 };
2589 //*************************************************************************************************
2590 
2591 
2592 
2593 
2594 //=================================================================================================
2595 //
2596 // CONSTRUCTORS
2597 //
2598 //=================================================================================================
2599 
2600 //*************************************************************************************************
2613 template< typename MT // Type of the sparse matrix
2614  , size_t... CCAs > // Compile time column arguments
2615 template< typename... RCAs > // Runtime column arguments
2616 inline Column<MT,false,false,false,CCAs...>::Column( MT& matrix, RCAs... args )
2617  : DataType( args... ) // Base class initialization
2618  , matrix_ ( matrix ) // The matrix containing the column
2619 {
2620  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
2621  if( matrix_.columns() <= column() ) {
2622  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
2623  }
2624  }
2625  else {
2626  BLAZE_USER_ASSERT( column() < matrix_.columns(), "Invalid column access index" );
2627  }
2628 }
2630 //*************************************************************************************************
2631 
2632 
2633 
2634 
2635 //=================================================================================================
2636 //
2637 // DATA ACCESS FUNCTIONS
2638 //
2639 //=================================================================================================
2640 
2641 //*************************************************************************************************
2651 template< typename MT // Type of the sparse matrix
2652  , size_t... CCAs > // Compile time column arguments
2653 inline typename Column<MT,false,false,false,CCAs...>::Reference
2654  Column<MT,false,false,false,CCAs...>::operator[]( size_t index )
2655 {
2656  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2657  return matrix_(index,column());
2658 }
2660 //*************************************************************************************************
2661 
2662 
2663 //*************************************************************************************************
2673 template< typename MT // Type of the sparse matrix
2674  , size_t... CCAs > // Compile time column arguments
2675 inline typename Column<MT,false,false,false,CCAs...>::ConstReference
2676  Column<MT,false,false,false,CCAs...>::operator[]( size_t index ) const
2677 {
2678  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2679  return const_cast<const MT&>( matrix_ )(index,column());
2680 }
2682 //*************************************************************************************************
2683 
2684 
2685 //*************************************************************************************************
2696 template< typename MT // Type of the sparse matrix
2697  , size_t... CCAs > // Compile time column arguments
2698 inline typename Column<MT,false,false,false,CCAs...>::Reference
2699  Column<MT,false,false,false,CCAs...>::at( size_t index )
2700 {
2701  if( index >= size() ) {
2702  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
2703  }
2704  return (*this)[index];
2705 }
2707 //*************************************************************************************************
2708 
2709 
2710 //*************************************************************************************************
2721 template< typename MT // Type of the sparse matrix
2722  , size_t... CCAs > // Compile time column arguments
2723 inline typename Column<MT,false,false,false,CCAs...>::ConstReference
2724  Column<MT,false,false,false,CCAs...>::at( size_t index ) const
2725 {
2726  if( index >= size() ) {
2727  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
2728  }
2729  return (*this)[index];
2730 }
2732 //*************************************************************************************************
2733 
2734 
2735 //*************************************************************************************************
2743 template< typename MT // Type of the sparse matrix
2744  , size_t... CCAs > // Compile time column arguments
2745 inline typename Column<MT,false,false,false,CCAs...>::Iterator
2747 {
2748  return Iterator( matrix_, 0UL, column() );
2749 }
2751 //*************************************************************************************************
2752 
2753 
2754 //*************************************************************************************************
2762 template< typename MT // Type of the sparse matrix
2763  , size_t... CCAs > // Compile time column arguments
2764 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2766 {
2767  return ConstIterator( matrix_, 0UL, column() );
2768 }
2770 //*************************************************************************************************
2771 
2772 
2773 //*************************************************************************************************
2781 template< typename MT // Type of the sparse matrix
2782  , size_t... CCAs > // Compile time column arguments
2783 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2785 {
2786  return ConstIterator( matrix_, 0UL, column() );
2787 }
2789 //*************************************************************************************************
2790 
2791 
2792 //*************************************************************************************************
2800 template< typename MT // Type of the sparse matrix
2801  , size_t... CCAs > // Compile time column arguments
2802 inline typename Column<MT,false,false,false,CCAs...>::Iterator
2804 {
2805  return Iterator( matrix_, size(), column() );
2806 }
2808 //*************************************************************************************************
2809 
2810 
2811 //*************************************************************************************************
2819 template< typename MT // Type of the sparse matrix
2820  , size_t... CCAs > // Compile time column arguments
2821 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2823 {
2824  return ConstIterator( matrix_, size(), column() );
2825 }
2827 //*************************************************************************************************
2828 
2829 
2830 //*************************************************************************************************
2838 template< typename MT // Type of the sparse matrix
2839  , size_t... CCAs > // Compile time column arguments
2840 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
2842 {
2843  return ConstIterator( matrix_, size(), column() );
2844 }
2846 //*************************************************************************************************
2847 
2848 
2849 
2850 
2851 //=================================================================================================
2852 //
2853 // ASSIGNMENT OPERATORS
2854 //
2855 //=================================================================================================
2856 
2857 //*************************************************************************************************
2872 template< typename MT // Type of the sparse matrix
2873  , size_t... CCAs > // Compile time column arguments
2874 inline Column<MT,false,false,false,CCAs...>&
2875  Column<MT,false,false,false,CCAs...>::operator=( initializer_list<ElementType> list )
2876 {
2877  using blaze::assign;
2878 
2879  if( list.size() > size() ) {
2880  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to column" );
2881  }
2882 
2883  const InitializerVector<ElementType,false> tmp( list, size() );
2884 
2885  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
2886  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2887  }
2888 
2889  decltype(auto) left( derestrict( *this ) );
2890 
2891  assign( left, tmp );
2892 
2893  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2894 
2895  return *this;
2896 }
2898 //*************************************************************************************************
2899 
2900 
2901 //*************************************************************************************************
2915 template< typename MT // Type of the sparse matrix
2916  , size_t... CCAs > // Compile time column arguments
2917 inline Column<MT,false,false,false,CCAs...>&
2918  Column<MT,false,false,false,CCAs...>::operator=( const Column& rhs )
2919 {
2920  using blaze::assign;
2921 
2925 
2926  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
2927  return *this;
2928 
2929  if( size() != rhs.size() ) {
2930  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
2931  }
2932 
2933  if( !tryAssign( matrix_, rhs, 0UL, column() ) ) {
2934  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2935  }
2936 
2937  decltype(auto) left( derestrict( *this ) );
2938 
2939  if( rhs.canAlias( &matrix_ ) ) {
2940  const ResultType tmp( rhs );
2941  assign( left, tmp );
2942  }
2943  else {
2944  assign( left, rhs );
2945  }
2946 
2947  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2948 
2949  return *this;
2950 }
2952 //*************************************************************************************************
2953 
2954 
2955 //*************************************************************************************************
2969 template< typename MT // Type of the sparse matrix
2970  , size_t... CCAs > // Compile time column arguments
2971 template< typename VT > // Type of the right-hand side vector
2972 inline Column<MT,false,false,false,CCAs...>&
2973  Column<MT,false,false,false,CCAs...>::operator=( const Vector<VT,false>& rhs )
2974 {
2975  using blaze::assign;
2976 
2977  if( size() != (~rhs).size() ) {
2978  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
2979  }
2980 
2981  const CompositeType_t<VT> tmp( ~rhs );
2982 
2983  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
2984  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2985  }
2986 
2987  decltype(auto) left( derestrict( *this ) );
2988 
2989  assign( left, tmp );
2990 
2991  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2992 
2993  return *this;
2994 }
2996 //*************************************************************************************************
2997 
2998 
2999 //*************************************************************************************************
3013 template< typename MT // Type of the sparse matrix
3014  , size_t... CCAs > // Compile time column arguments
3015 template< typename VT > // Type of the right-hand side vector
3016 inline Column<MT,false,false,false,CCAs...>&
3017  Column<MT,false,false,false,CCAs...>::operator+=( const Vector<VT,false>& rhs )
3018 {
3019  using blaze::assign;
3020 
3024  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3026 
3027  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3028 
3031 
3032  if( size() != (~rhs).size() ) {
3033  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3034  }
3035 
3036  const AddType tmp( *this + (~rhs) );
3037 
3038  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3039  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3040  }
3041 
3042  decltype(auto) left( derestrict( *this ) );
3043 
3044  assign( left, tmp );
3045 
3046  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3047 
3048  return *this;
3049 }
3051 //*************************************************************************************************
3052 
3053 
3054 //*************************************************************************************************
3068 template< typename MT // Type of the sparse matrix
3069  , size_t... CCAs > // Compile time column arguments
3070 template< typename VT > // Type of the right-hand side vector
3071 inline Column<MT,false,false,false,CCAs...>&
3072  Column<MT,false,false,false,CCAs...>::operator-=( const Vector<VT,false>& rhs )
3073 {
3074  using blaze::assign;
3075 
3079  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3081 
3082  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3083 
3086 
3087  if( size() != (~rhs).size() ) {
3088  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3089  }
3090 
3091  const SubType tmp( *this - (~rhs) );
3092 
3093  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3094  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3095  }
3096 
3097  decltype(auto) left( derestrict( *this ) );
3098 
3099  assign( left, tmp );
3100 
3101  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3102 
3103  return *this;
3104 }
3106 //*************************************************************************************************
3107 
3108 
3109 //*************************************************************************************************
3122 template< typename MT // Type of the sparse matrix
3123  , size_t... CCAs > // Compile time column arguments
3124 template< typename VT > // Type of the right-hand side vector
3125 inline Column<MT,false,false,false,CCAs...>&
3126  Column<MT,false,false,false,CCAs...>::operator*=( const Vector<VT,false>& rhs )
3127 {
3128  using blaze::assign;
3129 
3133  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3135 
3136  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3137 
3140 
3141  if( size() != (~rhs).size() ) {
3142  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3143  }
3144 
3145  const MultType tmp( *this * (~rhs) );
3146 
3147  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3148  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3149  }
3150 
3151  decltype(auto) left( derestrict( *this ) );
3152 
3153  assign( left, tmp );
3154 
3155  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3156 
3157  return *this;
3158 }
3160 //*************************************************************************************************
3161 
3162 
3163 //*************************************************************************************************
3175 template< typename MT // Type of the sparse matrix
3176  , size_t... CCAs > // Compile time column arguments
3177 template< typename VT > // Type of the right-hand side vector
3178 inline Column<MT,false,false,false,CCAs...>&
3179  Column<MT,false,false,false,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
3180 {
3181  using blaze::assign;
3182 
3186  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
3187  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3189 
3190  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3191 
3195 
3196  if( size() != (~rhs).size() ) {
3197  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3198  }
3199 
3200  const DivType tmp( *this / (~rhs) );
3201 
3202  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3203  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3204  }
3205 
3206  decltype(auto) left( derestrict( *this ) );
3207 
3208  assign( left, tmp );
3209 
3210  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3211 
3212  return *this;
3213 }
3215 //*************************************************************************************************
3216 
3217 
3218 //*************************************************************************************************
3231 template< typename MT // Type of the sparse matrix
3232  , size_t... CCAs > // Compile time column arguments
3233 template< typename VT > // Type of the right-hand side vector
3234 inline Column<MT,false,false,false,CCAs...>&
3235  Column<MT,false,false,false,CCAs...>::operator%=( const Vector<VT,false>& rhs )
3236 {
3237  using blaze::assign;
3238 
3239  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
3241 
3242  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3243 
3247 
3248  if( size() != 3UL || (~rhs).size() != 3UL ) {
3249  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
3250  }
3251 
3252  const CrossType tmp( *this % (~rhs) );
3253 
3254  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
3255  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3256  }
3257 
3258  decltype(auto) left( derestrict( *this ) );
3259 
3260  assign( left, tmp );
3261 
3262  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3263 
3264  return *this;
3265 }
3267 //*************************************************************************************************
3268 
3269 
3270 
3271 
3272 //=================================================================================================
3273 //
3274 // UTILITY FUNCTIONS
3275 //
3276 //=================================================================================================
3277 
3278 //*************************************************************************************************
3284 template< typename MT // Type of the sparse matrix
3285  , size_t... CCAs > // Compile time column arguments
3286 inline MT& Column<MT,false,false,false,CCAs...>::operand() noexcept
3287 {
3288  return matrix_;
3289 }
3291 //*************************************************************************************************
3292 
3293 
3294 //*************************************************************************************************
3300 template< typename MT // Type of the sparse matrix
3301  , size_t... CCAs > // Compile time column arguments
3302 inline const MT& Column<MT,false,false,false,CCAs...>::operand() const noexcept
3303 {
3304  return matrix_;
3305 }
3307 //*************************************************************************************************
3308 
3309 
3310 //*************************************************************************************************
3316 template< typename MT // Type of the sparse matrix
3317  , size_t... CCAs > // Compile time column arguments
3318 inline size_t Column<MT,false,false,false,CCAs...>::size() const
3319 {
3320  return matrix_.rows();
3321 }
3323 //*************************************************************************************************
3324 
3325 
3326 //*************************************************************************************************
3332 template< typename MT // Type of the sparse matrix
3333  , size_t... CCAs > // Compile time column arguments
3335 {
3336  return matrix_.rows();
3337 }
3339 //*************************************************************************************************
3340 
3341 
3342 //*************************************************************************************************
3351 template< typename MT // Type of the sparse matrix
3352  , size_t... CCAs > // Compile time column arguments
3354 {
3355  size_t counter( 0UL );
3356  for( ConstIterator element=begin(); element!=end(); ++element ) {
3357  ++counter;
3358  }
3359  return counter;
3360 }
3362 //*************************************************************************************************
3363 
3364 
3365 //*************************************************************************************************
3371 template< typename MT // Type of the sparse matrix
3372  , size_t... CCAs > // Compile time column arguments
3374 {
3375  const size_t ibegin( ( IsLower_v<MT> )
3376  ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3377  ?( column()+1UL )
3378  :( column() ) )
3379  :( 0UL ) );
3380  const size_t iend ( ( IsUpper_v<MT> )
3381  ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3382  ?( column() )
3383  :( column()+1UL ) )
3384  :( size() ) );
3385 
3386  for( size_t i=ibegin; i<iend; ++i ) {
3387  matrix_.erase( i, column() );
3388  }
3389 }
3391 //*************************************************************************************************
3392 
3393 
3394 //*************************************************************************************************
3404 template< typename MT // Type of the sparse matrix
3405  , size_t... CCAs > // Compile time column arguments
3406 void Column<MT,false,false,false,CCAs...>::reserve( size_t n )
3407 {
3408  MAYBE_UNUSED( n );
3409 
3410  return;
3411 }
3413 //*************************************************************************************************
3414 
3415 
3416 
3417 
3418 //=================================================================================================
3419 //
3420 // INSERTION FUNCTIONS
3421 //
3422 //=================================================================================================
3423 
3424 //*************************************************************************************************
3436 template< typename MT // Type of the sparse matrix
3437  , size_t... CCAs > // Compile time column arguments
3438 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3439  Column<MT,false,false,false,CCAs...>::set( size_t index, const ElementType& value )
3440 {
3441  return Iterator( matrix_, index, column(), matrix_.set( index, column(), value ) );
3442 }
3444 //*************************************************************************************************
3445 
3446 
3447 //*************************************************************************************************
3460 template< typename MT // Type of the sparse matrix
3461  , size_t... CCAs > // Compile time column arguments
3462 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3463  Column<MT,false,false,false,CCAs...>::insert( size_t index, const ElementType& value )
3464 {
3465  return Iterator( matrix_, index, column(), matrix_.insert( index, column(), value ) );
3466 }
3468 //*************************************************************************************************
3469 
3470 
3471 //*************************************************************************************************
3496 template< typename MT // Type of the sparse matrix
3497  , size_t... CCAs > // Compile time column arguments
3498 inline void Column<MT,false,false,false,CCAs...>::append( size_t index, const ElementType& value, bool check )
3499 {
3500  if( !check || !isDefault<strict>( value ) )
3501  matrix_.insert( index, column(), value );
3502 }
3504 //*************************************************************************************************
3505 
3506 
3507 
3508 
3509 //=================================================================================================
3510 //
3511 // ERASE FUNCTIONS
3512 //
3513 //=================================================================================================
3514 
3515 //*************************************************************************************************
3524 template< typename MT // Type of the sparse matrix
3525  , size_t... CCAs > // Compile time column arguments
3526 inline void Column<MT,false,false,false,CCAs...>::erase( size_t index )
3527 {
3528  matrix_.erase( index, column() );
3529 }
3531 //*************************************************************************************************
3532 
3533 
3534 //*************************************************************************************************
3543 template< typename MT // Type of the sparse matrix
3544  , size_t... CCAs > // Compile time column arguments
3545 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3546  Column<MT,false,false,false,CCAs...>::erase( Iterator pos )
3547 {
3548  const size_t row( pos.row_ );
3549 
3550  if( row == size() )
3551  return pos;
3552 
3553  matrix_.erase( row, pos.pos_ );
3554  return Iterator( matrix_, row+1UL, column() );
3555 }
3557 //*************************************************************************************************
3558 
3559 
3560 //*************************************************************************************************
3570 template< typename MT // Type of the sparse matrix
3571  , size_t... CCAs > // Compile time column arguments
3572 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3573  Column<MT,false,false,false,CCAs...>::erase( Iterator first, Iterator last )
3574 {
3575  for( ; first!=last; ++first ) {
3576  matrix_.erase( first.row_, first.pos_ );
3577  }
3578  return last;
3579 }
3581 //*************************************************************************************************
3582 
3583 
3584 //*************************************************************************************************
3607 template< typename MT // Type of the sparse matrix
3608  , size_t... CCAs > // Compile time column arguments
3609 template< typename Pred // Type of the unary predicate
3610  , typename > // Type restriction on the unary predicate
3611 inline void Column<MT,false,false,false,CCAs...>::erase( Pred predicate )
3612 {
3613  for( Iterator element=begin(); element!=end(); ++element ) {
3614  if( predicate( element->value() ) )
3615  matrix_.erase( element.row_, element.pos_ );
3616  }
3617 }
3619 //*************************************************************************************************
3620 
3621 
3622 //*************************************************************************************************
3648 template< typename MT // Type of the sparse matrix
3649  , size_t... CCAs > // Compile time column arguments
3650 template< typename Pred > // Type of the unary predicate
3651 inline void Column<MT,false,false,false,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
3652 {
3653  for( ; first!=last; ++first ) {
3654  if( predicate( first->value() ) )
3655  matrix_.erase( first.row_, first.pos_ );
3656  }
3657 }
3659 //*************************************************************************************************
3660 
3661 
3662 
3663 
3664 //=================================================================================================
3665 //
3666 // LOOKUP FUNCTIONS
3667 //
3668 //=================================================================================================
3669 
3670 //*************************************************************************************************
3684 template< typename MT // Type of the sparse matrix
3685  , size_t... CCAs > // Compile time column arguments
3686 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3687  Column<MT,false,false,false,CCAs...>::find( size_t index )
3688 {
3689  const Iterator_t<MT> pos( matrix_.find( index, column() ) );
3690 
3691  if( pos != matrix_.end( index ) )
3692  return Iterator( matrix_, index, column(), pos );
3693  else
3694  return end();
3695 }
3697 //*************************************************************************************************
3698 
3699 
3700 //*************************************************************************************************
3714 template< typename MT // Type of the sparse matrix
3715  , size_t... CCAs > // Compile time column arguments
3716 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
3717  Column<MT,false,false,false,CCAs...>::find( size_t index ) const
3718 {
3719  const ConstIterator_t<MT> pos( matrix_.find( index, column() ) );
3720 
3721  if( pos != matrix_.end( index ) )
3722  return ConstIterator( matrix_, index, column(), pos );
3723  else
3724  return end();
3725 }
3727 //*************************************************************************************************
3728 
3729 
3730 //*************************************************************************************************
3743 template< typename MT // Type of the sparse matrix
3744  , size_t... CCAs > // Compile time column arguments
3745 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3746  Column<MT,false,false,false,CCAs...>::lowerBound( size_t index )
3747 {
3748  for( size_t i=index; i<size(); ++i )
3749  {
3750  const Iterator_t<MT> pos( matrix_.find( i, column() ) );
3751 
3752  if( pos != matrix_.end( i ) )
3753  return Iterator( matrix_, i, column(), pos );
3754  }
3755 
3756  return end();
3757 }
3759 //*************************************************************************************************
3760 
3761 
3762 //*************************************************************************************************
3775 template< typename MT // Type of the sparse matrix
3776  , size_t... CCAs > // Compile time column arguments
3777 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
3778  Column<MT,false,false,false,CCAs...>::lowerBound( size_t index ) const
3779 {
3780  for( size_t i=index; i<size(); ++i )
3781  {
3782  const ConstIterator_t<MT> pos( matrix_.find( i, column() ) );
3783 
3784  if( pos != matrix_.end( i ) )
3785  return ConstIterator( matrix_, i, column(), pos );
3786  }
3787 
3788  return end();
3789 }
3791 //*************************************************************************************************
3792 
3793 
3794 //*************************************************************************************************
3807 template< typename MT // Type of the sparse matrix
3808  , size_t... CCAs > // Compile time column arguments
3809 inline typename Column<MT,false,false,false,CCAs...>::Iterator
3810  Column<MT,false,false,false,CCAs...>::upperBound( size_t index )
3811 {
3812  for( size_t i=index+1UL; i<size(); ++i )
3813  {
3814  const Iterator_t<MT> pos( matrix_.find( i, column() ) );
3815 
3816  if( pos != matrix_.end( i ) )
3817  return Iterator( matrix_, i, column(), pos );
3818  }
3819 
3820  return end();
3821 }
3823 //*************************************************************************************************
3824 
3825 
3826 //*************************************************************************************************
3839 template< typename MT // Type of the sparse matrix
3840  , size_t... CCAs > // Compile time column arguments
3841 inline typename Column<MT,false,false,false,CCAs...>::ConstIterator
3842  Column<MT,false,false,false,CCAs...>::upperBound( size_t index ) const
3843 {
3844  for( size_t i=index+1UL; i<size(); ++i )
3845  {
3846  const ConstIterator_t<MT> pos( matrix_.find( i, column() ) );
3847 
3848  if( pos != matrix_.end( i ) )
3849  return ConstIterator( matrix_, i, column(), pos );
3850  }
3851 
3852  return end();
3853 }
3855 //*************************************************************************************************
3856 
3857 
3858 
3859 
3860 //=================================================================================================
3861 //
3862 // NUMERIC FUNCTIONS
3863 //
3864 //=================================================================================================
3865 
3866 //*************************************************************************************************
3879 template< typename MT // Type of the sparse matrix
3880  , size_t... CCAs > // Compile time column arguments
3881 template< typename Other > // Data type of the scalar value
3882 inline Column<MT,false,false,false,CCAs...>&
3883  Column<MT,false,false,false,CCAs...>::scale( const Other& scalar )
3884 {
3886 
3887  for( Iterator element=begin(); element!=end(); ++element )
3888  element->value() *= scalar;
3889  return *this;
3890 }
3892 //*************************************************************************************************
3893 
3894 
3895 
3896 
3897 //=================================================================================================
3898 //
3899 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3900 //
3901 //=================================================================================================
3902 
3903 //*************************************************************************************************
3914 template< typename MT // Type of the sparse matrix
3915  , size_t... CCAs > // Compile time column arguments
3916 template< typename Other > // Data type of the foreign expression
3917 inline bool Column<MT,false,false,false,CCAs...>::canAlias( const Other* alias ) const
3918 {
3919  return matrix_.isAliased( alias );
3920 }
3922 //*************************************************************************************************
3923 
3924 
3925 //*************************************************************************************************
3932 template< typename MT // Type of the sparse matrix
3933  , size_t... CCAs > // Compile time column arguments
3934 template< typename Other > // Data type of the foreign expression
3935 inline bool Column<MT,false,false,false,CCAs...>::isAliased( const Other* alias ) const
3936 {
3937  return matrix_.isAliased( alias );
3938 }
3940 //*************************************************************************************************
3941 
3942 
3943 //*************************************************************************************************
3955 template< typename MT // Type of the sparse matrix
3956  , size_t... CCAs > // Compile time column arguments
3957 template< typename VT > // Type of the right-hand side dense vector
3958 inline void Column<MT,false,false,false,CCAs...>::assign( const DenseVector<VT,false>& rhs )
3959 {
3960  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3961 
3962  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3963  matrix_(i,column()) = (~rhs)[i];
3964  }
3965 }
3967 //*************************************************************************************************
3968 
3969 
3970 //*************************************************************************************************
3982 template< typename MT // Type of the sparse matrix
3983  , size_t... CCAs > // Compile time column arguments
3984 template< typename VT > // Type of the right-hand side sparse vector
3985 inline void Column<MT,false,false,false,CCAs...>::assign( const SparseVector<VT,false>& rhs )
3986 {
3987  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3988 
3989  size_t i( 0UL );
3990 
3991  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3992  for( ; i<element->index(); ++i )
3993  matrix_.erase( i, column() );
3994  matrix_(i++,column()) = element->value();
3995  }
3996  for( ; i<size(); ++i ) {
3997  matrix_.erase( i, column() );
3998  }
3999 }
4001 //*************************************************************************************************
4002 
4003 
4004 //*************************************************************************************************
4016 template< typename MT // Type of the sparse matrix
4017  , size_t... CCAs > // Compile time column arguments
4018 template< typename VT > // Type of the right-hand side vector
4019 inline void Column<MT,false,false,false,CCAs...>::addAssign( const Vector<VT,false>& rhs )
4020 {
4021  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4022 
4025 
4026  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4027 
4028  const AddType tmp( serial( *this + (~rhs) ) );
4029  assign( tmp );
4030 }
4032 //*************************************************************************************************
4033 
4034 
4035 //*************************************************************************************************
4047 template< typename MT // Type of the sparse matrix
4048  , size_t... CCAs > // Compile time column arguments
4049 template< typename VT > // Type of the right-hand side vector
4050 inline void Column<MT,false,false,false,CCAs...>::subAssign( const Vector<VT,false>& rhs )
4051 {
4052  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4053 
4056 
4057  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4058 
4059  const SubType tmp( serial( *this - (~rhs) ) );
4060  assign( tmp );
4061 }
4063 //*************************************************************************************************
4064 
4065 
4066 
4067 
4068 
4069 
4070 
4071 
4072 //=================================================================================================
4073 //
4074 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC ROW-MAJOR SPARSE MATRICES
4075 //
4076 //=================================================================================================
4077 
4078 //*************************************************************************************************
4086 template< typename MT // Type of the sparse matrix
4087  , size_t... CCAs > // Compile time column arguments
4088 class Column<MT,false,false,true,CCAs...>
4089  : public View< SparseVector< Column<MT,false,false,true,CCAs...>, false > >
4090  , private ColumnData<CCAs...>
4091 {
4092  private:
4093  //**Type definitions****************************************************************************
4094  using DataType = ColumnData<CCAs...>;
4095  using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4096  //**********************************************************************************************
4097 
4098  public:
4099  //**Type definitions****************************************************************************
4101  using This = Column<MT,false,false,true,CCAs...>;
4102 
4103  using BaseType = SparseVector<This,false>;
4104  using ViewedType = MT;
4105  using ResultType = ColumnTrait_t<MT,CCAs...>;
4106  using TransposeType = TransposeType_t<ResultType>;
4107  using ElementType = ElementType_t<MT>;
4108  using ReturnType = ReturnType_t<MT>;
4109  using CompositeType = const Column&;
4110 
4112  using ConstReference = ConstReference_t<MT>;
4113 
4115  using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4116 
4118  using ConstIterator = ConstIterator_t<MT>;
4119 
4121  using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4122  //**********************************************************************************************
4123 
4124  //**Compilation flags***************************************************************************
4126  static constexpr bool smpAssignable = false;
4127 
4129  static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4130  //**********************************************************************************************
4131 
4132  //**Constructors********************************************************************************
4135  template< typename... RCAs >
4136  explicit inline Column( MT& matrix, RCAs... args );
4137 
4138  Column( const Column& ) = default;
4140  //**********************************************************************************************
4141 
4142  //**Destructor**********************************************************************************
4145  ~Column() = default;
4147  //**********************************************************************************************
4148 
4149  //**Data access functions***********************************************************************
4152  inline Reference operator[]( size_t index );
4153  inline ConstReference operator[]( size_t index ) const;
4154  inline Reference at( size_t index );
4155  inline ConstReference at( size_t index ) const;
4156  inline Iterator begin ();
4157  inline ConstIterator begin () const;
4158  inline ConstIterator cbegin() const;
4159  inline Iterator end ();
4160  inline ConstIterator end () const;
4161  inline ConstIterator cend () const;
4163  //**********************************************************************************************
4164 
4165  //**Assignment operators************************************************************************
4168  inline Column& operator=( initializer_list<ElementType> list );
4169  inline Column& operator=( const Column& rhs );
4170 
4171  template< typename VT > inline Column& operator= ( const DenseVector<VT,false>& rhs );
4172  template< typename VT > inline Column& operator= ( const SparseVector<VT,false>& rhs );
4173  template< typename VT > inline Column& operator+=( const DenseVector<VT,false>& rhs );
4174  template< typename VT > inline Column& operator+=( const SparseVector<VT,false>& rhs );
4175  template< typename VT > inline Column& operator-=( const DenseVector<VT,false>& rhs );
4176  template< typename VT > inline Column& operator-=( const SparseVector<VT,false>& rhs );
4177  template< typename VT > inline Column& operator*=( const Vector<VT,false>& rhs );
4178  template< typename VT > inline Column& operator/=( const DenseVector<VT,false>& rhs );
4179  template< typename VT > inline Column& operator%=( const Vector<VT,false>& rhs );
4181  //**********************************************************************************************
4182 
4183  //**Utility functions***************************************************************************
4186  using DataType::column;
4187 
4188  inline MT& operand() noexcept;
4189  inline const MT& operand() const noexcept;
4190 
4191  inline size_t size() const noexcept;
4192  inline size_t capacity() const noexcept;
4193  inline size_t nonZeros() const;
4194  inline void reset();
4195  inline void reserve( size_t n );
4197  //**********************************************************************************************
4198 
4199  //**Insertion functions*************************************************************************
4202  inline Iterator set ( size_t index, const ElementType& value );
4203  inline Iterator insert( size_t index, const ElementType& value );
4204  inline void append( size_t index, const ElementType& value, bool check=false );
4206  //**********************************************************************************************
4207 
4208  //**Erase functions*****************************************************************************
4211  inline void erase( size_t index );
4212  inline Iterator erase( Iterator pos );
4213  inline Iterator erase( Iterator first, Iterator last );
4214 
4215  template< typename Pred, typename = DisableIf_t< IsIntegral_v<Pred> > >
4216  inline void erase( Pred predicate );
4217 
4218  template< typename Pred >
4219  inline void erase( Iterator first, Iterator last, Pred predicate );
4221  //**********************************************************************************************
4222 
4223  //**Lookup functions****************************************************************************
4226  inline Iterator find ( size_t index );
4227  inline ConstIterator find ( size_t index ) const;
4228  inline Iterator lowerBound( size_t index );
4229  inline ConstIterator lowerBound( size_t index ) const;
4230  inline Iterator upperBound( size_t index );
4231  inline ConstIterator upperBound( size_t index ) const;
4233  //**********************************************************************************************
4234 
4235  //**Numeric functions***************************************************************************
4238  template< typename Other > inline Column& scale( const Other& scalar );
4240  //**********************************************************************************************
4241 
4242  //**Expression template evaluation functions****************************************************
4245  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
4246  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
4247 
4248  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
4249  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
4250  template< typename VT > inline void addAssign( const DenseVector <VT,false>& rhs );
4251  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
4252  template< typename VT > inline void subAssign( const DenseVector <VT,false>& rhs );
4253  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
4255  //**********************************************************************************************
4256 
4257  private:
4258  //**Utility functions***************************************************************************
4261  inline size_t extendCapacity() const noexcept;
4263  //**********************************************************************************************
4264 
4265  //**Member variables****************************************************************************
4268  Operand matrix_;
4269 
4270  //**********************************************************************************************
4271 
4272  //**Compile time checks*************************************************************************
4281  //**********************************************************************************************
4282 };
4284 //*************************************************************************************************
4285 
4286 
4287 
4288 
4289 //=================================================================================================
4290 //
4291 // CONSTRUCTORS
4292 //
4293 //=================================================================================================
4294 
4295 //*************************************************************************************************
4308 template< typename MT // Type of the sparse matrix
4309  , size_t... CCAs > // Compile time column arguments
4310 template< typename... RCAs > // Runtime column arguments
4311 inline Column<MT,false,false,true,CCAs...>::Column( MT& matrix, RCAs... args )
4312  : DataType( args... ) // Base class initialization
4313  , matrix_ ( matrix ) // The matrix containing the column
4314 {
4315  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
4316  if( matrix_.columns() <= column() ) {
4317  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
4318  }
4319  }
4320  else {
4321  BLAZE_USER_ASSERT( column() < matrix_.columns(), "Invalid column access index" );
4322  }
4323 }
4325 //*************************************************************************************************
4326 
4327 
4328 
4329 
4330 //=================================================================================================
4331 //
4332 // DATA ACCESS FUNCTIONS
4333 //
4334 //=================================================================================================
4335 
4336 //*************************************************************************************************
4346 template< typename MT // Type of the sparse matrix
4347  , size_t... CCAs > // Compile time column arguments
4348 inline typename Column<MT,false,false,true,CCAs...>::Reference
4349  Column<MT,false,false,true,CCAs...>::operator[]( size_t index )
4350 {
4351  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4352  return matrix_(column(),index);
4353 }
4355 //*************************************************************************************************
4356 
4357 
4358 //*************************************************************************************************
4368 template< typename MT // Type of the sparse matrix
4369  , size_t... CCAs > // Compile time column arguments
4370 inline typename Column<MT,false,false,true,CCAs...>::ConstReference
4371  Column<MT,false,false,true,CCAs...>::operator[]( size_t index ) const
4372 {
4373  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4374  return const_cast<const MT&>( matrix_ )(column(),index);
4375 }
4377 //*************************************************************************************************
4378 
4379 
4380 //*************************************************************************************************
4391 template< typename MT // Type of the sparse matrix
4392  , size_t... CCAs > // Compile time column arguments
4393 inline typename Column<MT,false,false,true,CCAs...>::Reference
4394  Column<MT,false,false,true,CCAs...>::at( size_t index )
4395 {
4396  if( index >= size() ) {
4397  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4398  }
4399  return (*this)[index];
4400 }
4402 //*************************************************************************************************
4403 
4404 
4405 //*************************************************************************************************
4416 template< typename MT // Type of the sparse matrix
4417  , size_t... CCAs > // Compile time column arguments
4418 inline typename Column<MT,false,false,true,CCAs...>::ConstReference
4419  Column<MT,false,false,true,CCAs...>::at( size_t index ) const
4420 {
4421  if( index >= size() ) {
4422  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4423  }
4424  return (*this)[index];
4425 }
4427 //*************************************************************************************************
4428 
4429 
4430 //*************************************************************************************************
4438 template< typename MT // Type of the sparse matrix
4439  , size_t... CCAs > // Compile time column arguments
4440 inline typename Column<MT,false,false,true,CCAs...>::Iterator
4442 {
4443  return matrix_.begin( column() );
4444 }
4446 //*************************************************************************************************
4447 
4448 
4449 //*************************************************************************************************
4457 template< typename MT // Type of the sparse matrix
4458  , size_t... CCAs > // Compile time column arguments
4459 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4461 {
4462  return matrix_.cbegin( column() );
4463 }
4465 //*************************************************************************************************
4466 
4467 
4468 //*************************************************************************************************
4476 template< typename MT // Type of the sparse matrix
4477  , size_t... CCAs > // Compile time column arguments
4478 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4480 {
4481  return matrix_.cbegin( column() );
4482 }
4484 //*************************************************************************************************
4485 
4486 
4487 //*************************************************************************************************
4495 template< typename MT // Type of the sparse matrix
4496  , size_t... CCAs > // Compile time column arguments
4497 inline typename Column<MT,false,false,true,CCAs...>::Iterator
4499 {
4500  return matrix_.end( column() );
4501 }
4503 //*************************************************************************************************
4504 
4505 
4506 //*************************************************************************************************
4514 template< typename MT // Type of the sparse matrix
4515  , size_t... CCAs > // Compile time column arguments
4516 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4518 {
4519  return matrix_.cend( column() );
4520 }
4522 //*************************************************************************************************
4523 
4524 
4525 //*************************************************************************************************
4533 template< typename MT // Type of the sparse matrix
4534  , size_t... CCAs > // Compile time column arguments
4535 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
4537 {
4538  return matrix_.cend( column() );
4539 }
4541 //*************************************************************************************************
4542 
4543 
4544 
4545 
4546 //=================================================================================================
4547 //
4548 // ASSIGNMENT OPERATORS
4549 //
4550 //=================================================================================================
4551 
4552 //*************************************************************************************************
4567 template< typename MT // Type of the sparse matrix
4568  , size_t... CCAs > // Compile time column arguments
4569 inline Column<MT,false,false,true,CCAs...>&
4570  Column<MT,false,false,true,CCAs...>::operator=( initializer_list<ElementType> list )
4571 {
4572  using blaze::assign;
4573 
4574  if( list.size() > size() ) {
4575  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to column" );
4576  }
4577 
4578  const InitializerVector<ElementType,false> tmp( list, size() );
4579 
4580  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4581  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4582  }
4583 
4584  decltype(auto) left( derestrict( *this ) );
4585 
4586  left.reset();
4587  assign( left, tmp );
4588 
4589  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4590 
4591  return *this;
4592 }
4594 //*************************************************************************************************
4595 
4596 
4597 //*************************************************************************************************
4611 template< typename MT // Type of the sparse matrix
4612  , size_t... CCAs > // Compile time column arguments
4613 inline Column<MT,false,false,true,CCAs...>&
4614  Column<MT,false,false,true,CCAs...>::operator=( const Column& rhs )
4615 {
4616  using blaze::assign;
4617 
4621 
4622  if( this == &rhs || ( &matrix_ == &rhs.matrix_ && column() == rhs.column() ) )
4623  return *this;
4624 
4625  if( size() != rhs.size() ) {
4626  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
4627  }
4628 
4629  if( !tryAssign( matrix_, rhs, 0UL, column() ) ) {
4630  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4631  }
4632 
4633  decltype(auto) left( derestrict( *this ) );
4634 
4635  if( rhs.canAlias( &matrix_ ) ) {
4636  const ResultType tmp( rhs );
4637  left.reset();
4638  left.reserve( tmp.nonZeros() );
4639  assign( left, tmp );
4640  }
4641  else {
4642  left.reset();
4643  left.reserve( rhs.nonZeros() );
4644  assign( left, rhs );
4645  }
4646 
4647  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4648 
4649  return *this;
4650 }
4652 //*************************************************************************************************
4653 
4654 
4655 //*************************************************************************************************
4669 template< typename MT // Type of the sparse matrix
4670  , size_t... CCAs > // Compile time column arguments
4671 template< typename VT > // Type of the right-hand side dense vector
4672 inline Column<MT,false,false,true,CCAs...>&
4673  Column<MT,false,false,true,CCAs...>::operator=( const DenseVector<VT,false>& rhs )
4674 {
4675  using blaze::assign;
4676 
4677  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4678  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4680 
4681  if( size() != (~rhs).size() ) {
4682  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4683  }
4684 
4685  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4686  Right right( ~rhs );
4687 
4688  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
4689  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4690  }
4691 
4692  decltype(auto) left( derestrict( *this ) );
4693 
4694  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4695  const ResultType_t<VT> tmp( right );
4696  left.reset();
4697  assign( left, tmp );
4698  }
4699  else {
4700  left.reset();
4701  assign( left, right );
4702  }
4703 
4704  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4705 
4706  return *this;
4707 }
4709 //*************************************************************************************************
4710 
4711 
4712 //*************************************************************************************************
4726 template< typename MT // Type of the sparse matrix
4727  , size_t... CCAs > // Compile time column arguments
4728 template< typename VT > // Type of the right-hand side sparse vector
4729 inline Column<MT,false,false,true,CCAs...>&
4730  Column<MT,false,false,true,CCAs...>::operator=( const SparseVector<VT,false>& rhs )
4731 {
4732  using blaze::assign;
4733 
4734  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4735  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4737 
4738  if( size() != (~rhs).size() ) {
4739  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4740  }
4741 
4742  using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>, const VT& >;
4743  Right right( ~rhs );
4744 
4745  if( !tryAssign( matrix_, right, 0UL, column() ) ) {
4746  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4747  }
4748 
4749  decltype(auto) left( derestrict( *this ) );
4750 
4751  if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4752  const ResultType_t<VT> tmp( right);
4753  left.reset();
4754  left.reserve( tmp.nonZeros() );
4755  assign( left, tmp );
4756  }
4757  else {
4758  left.reset();
4759  left.reserve( right.nonZeros() );
4760  assign( left, right );
4761  }
4762 
4763  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4764 
4765  return *this;
4766 }
4768 //*************************************************************************************************
4769 
4770 
4771 //*************************************************************************************************
4785 template< typename MT // Type of the sparse matrix
4786  , size_t... CCAs > // Compile time column arguments
4787 template< typename VT > // Type of the right-hand side dense vector
4788 inline Column<MT,false,false,true,CCAs...>&
4789  Column<MT,false,false,true,CCAs...>::operator+=( const DenseVector<VT,false>& rhs )
4790 {
4791  using blaze::assign;
4792 
4796  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4797  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4799 
4800  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4801 
4805 
4806  if( size() != (~rhs).size() ) {
4807  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4808  }
4809 
4810  const AddType tmp( *this + (~rhs) );
4811 
4812  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4813  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4814  }
4815 
4816  decltype(auto) left( derestrict( *this ) );
4817 
4818  left.reset();
4819  assign( left, tmp );
4820 
4821  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4822 
4823  return *this;
4824 }
4826 //*************************************************************************************************
4827 
4828 
4829 //*************************************************************************************************
4843 template< typename MT // Type of the sparse matrix
4844  , size_t... CCAs > // Compile time column arguments
4845 template< typename VT > // Type of the right-hand side sparse vector
4846 inline Column<MT,false,false,true,CCAs...>&
4847  Column<MT,false,false,true,CCAs...>::operator+=( const SparseVector<VT,false>& rhs )
4848 {
4849  using blaze::assign;
4850 
4854  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4855  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4857 
4858  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4859 
4863 
4864  if( size() != (~rhs).size() ) {
4865  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4866  }
4867 
4868  const AddType tmp( *this + (~rhs) );
4869 
4870  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4871  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4872  }
4873 
4874  decltype(auto) left( derestrict( *this ) );
4875 
4876  left.reset();
4877  left.reserve( tmp.nonZeros() );
4878  assign( left, tmp );
4879 
4880  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4881 
4882  return *this;
4883 }
4885 //*************************************************************************************************
4886 
4887 
4888 //*************************************************************************************************
4903 template< typename MT // Type of the sparse matrix
4904  , size_t... CCAs > // Compile time column arguments
4905 template< typename VT > // Type of the right-hand side dense vector
4906 inline Column<MT,false,false,true,CCAs...>&
4907  Column<MT,false,false,true,CCAs...>::operator-=( const DenseVector<VT,false>& rhs )
4908 {
4909  using blaze::assign;
4910 
4914  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
4915  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4917 
4918  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4919 
4923 
4924  if( size() != (~rhs).size() ) {
4925  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4926  }
4927 
4928  const SubType tmp( *this - (~rhs) );
4929 
4930  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4931  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4932  }
4933 
4934  decltype(auto) left( derestrict( *this ) );
4935 
4936  left.reset();
4937  assign( left, tmp );
4938 
4939  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4940 
4941  return *this;
4942 }
4944 //*************************************************************************************************
4945 
4946 
4947 //*************************************************************************************************
4962 template< typename MT // Type of the sparse matrix
4963  , size_t... CCAs > // Compile time column arguments
4964 template< typename VT > // Type of the right-hand side sparse vector
4965 inline Column<MT,false,false,true,CCAs...>&
4966  Column<MT,false,false,true,CCAs...>::operator-=( const SparseVector<VT,false>& rhs )
4967 {
4968  using blaze::assign;
4969 
4973  BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE ( ResultType_t<VT> );
4974  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
4976 
4977  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4978 
4982 
4983  if( size() != (~rhs).size() ) {
4984  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4985  }
4986 
4987  const SubType tmp( *this - (~rhs) );
4988 
4989  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
4990  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4991  }
4992 
4993  decltype(auto) left( derestrict( *this ) );
4994 
4995  left.reset();
4996  left.reserve( tmp.nonZeros() );
4997  assign( left, tmp );
4998 
4999  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5000 
5001  return *this;
5002 }
5004 //*************************************************************************************************
5005 
5006 
5007 //*************************************************************************************************
5020 template< typename MT // Type of the sparse matrix
5021  , size_t... CCAs > // Compile time column arguments
5022 template< typename VT > // Type of the right-hand side vector
5023 inline Column<MT,false,false,true,CCAs...>&
5024  Column<MT,false,false,true,CCAs...>::operator*=( const Vector<VT,false>& rhs )
5025 {
5026  using blaze::assign;
5027 
5031  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
5033 
5034  using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5035 
5038 
5039  if( size() != (~rhs).size() ) {
5040  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5041  }
5042 
5043  const MultType tmp( *this * (~rhs) );
5044 
5045  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
5046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5047  }
5048 
5049  decltype(auto) left( derestrict( *this ) );
5050 
5051  left.reset();
5052  assign( left, tmp );
5053 
5054  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5055 
5056  return *this;
5057 }
5059 //*************************************************************************************************
5060 
5061 
5062 //*************************************************************************************************
5074 template< typename MT // Type of the sparse matrix
5075  , size_t... CCAs > // Compile time column arguments
5076 template< typename VT > // Type of the right-hand side vector
5077 inline Column<MT,false,false,true,CCAs...>&
5078  Column<MT,false,false,true,CCAs...>::operator/=( const DenseVector<VT,false>& rhs )
5079 {
5080  using blaze::assign;
5081 
5085  BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE ( ResultType_t<VT> );
5086  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
5088 
5089  using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5090 
5094 
5095  if( size() != (~rhs).size() ) {
5096  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
5097  }
5098 
5099  const DivType tmp( *this / (~rhs) );
5100 
5101  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
5102  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5103  }
5104 
5105  decltype(auto) left( derestrict( *this ) );
5106 
5107  left.reset();
5108  assign( left, tmp );
5109 
5110  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5111 
5112  return *this;
5113 }
5115 //*************************************************************************************************
5116 
5117 
5118 //*************************************************************************************************
5131 template< typename MT // Type of the sparse matrix
5132  , size_t... CCAs > // Compile time column arguments
5133 template< typename VT > // Type of the right-hand side vector
5134 inline Column<MT,false,false,true,CCAs...>&
5135  Column<MT,false,false,true,CCAs...>::operator%=( const Vector<VT,false>& rhs )
5136 {
5137  using blaze::assign;
5138 
5139  BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE ( ResultType_t<VT> );
5141 
5142  using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5143 
5147 
5148  if( size() != 3UL || (~rhs).size() != 3UL ) {
5149  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
5150  }
5151 
5152  const CrossType tmp( *this % (~rhs) );
5153 
5154  if( !tryAssign( matrix_, tmp, 0UL, column() ) ) {
5155  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
5156  }
5157 
5158  decltype(auto) left( derestrict( *this ) );
5159 
5160  left.reset();
5161  assign( left, tmp );
5162 
5163  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
5164 
5165  return *this;
5166 }
5168 //*************************************************************************************************
5169 
5170 
5171 
5172 
5173 //=================================================================================================
5174 //
5175 // UTILITY FUNCTIONS
5176 //
5177 //=================================================================================================
5178 
5179 //*************************************************************************************************
5185 template< typename MT // Type of the sparse matrix
5186  , size_t... CCAs > // Compile time column arguments
5187 inline MT& Column<MT,false,false,true,CCAs...>::operand() noexcept
5188 {
5189  return matrix_;
5190 }
5192 //*************************************************************************************************
5193 
5194 
5195 //*************************************************************************************************
5201 template< typename MT // Type of the sparse matrix
5202  , size_t... CCAs > // Compile time column arguments
5203 inline const MT& Column<MT,false,false,true,CCAs...>::operand() const noexcept
5204 {
5205  return matrix_;
5206 }
5208 //*************************************************************************************************
5209 
5210 
5211 //*************************************************************************************************
5217 template< typename MT // Type of the sparse matrix
5218  , size_t... CCAs > // Compile time column arguments
5219 inline size_t Column<MT,false,false,true,CCAs...>::size() const noexcept
5220 {
5221  return matrix_.rows();
5222 }
5224 //*************************************************************************************************
5225 
5226 
5227 //*************************************************************************************************
5233 template< typename MT // Type of the sparse matrix
5234  , size_t... CCAs > // Compile time column arguments
5235 inline size_t Column<MT,false,false,true,CCAs...>::capacity() const noexcept
5236 {
5237  return matrix_.capacity( column() );
5238 }
5240 //*************************************************************************************************
5241 
5242 
5243 //*************************************************************************************************
5252 template< typename MT // Type of the sparse matrix
5253  , size_t... CCAs > // Compile time column arguments
5255 {
5256  return matrix_.nonZeros( column() );
5257 }
5259 //*************************************************************************************************
5260 
5261 
5262 //*************************************************************************************************
5268 template< typename MT // Type of the sparse matrix
5269  , size_t... CCAs > // Compile time column arguments
5271 {
5272  matrix_.reset( column() );
5273 }
5275 //*************************************************************************************************
5276 
5277 
5278 //*************************************************************************************************
5288 template< typename MT // Type of the sparse matrix
5289  , size_t... CCAs > // Compile time column arguments
5290 void Column<MT,false,false,true,CCAs...>::reserve( size_t n )
5291 {
5292  matrix_.reserve( column(), n );
5293 }
5295 //*************************************************************************************************
5296 
5297 
5298 //*************************************************************************************************
5307 template< typename MT // Type of the sparse matrix
5308  , size_t... CCAs > // Compile time column arguments
5309 inline size_t Column<MT,false,false,true,CCAs...>::extendCapacity() const noexcept
5310 {
5311  using blaze::max;
5312  using blaze::min;
5313 
5314  size_t nonzeros( 2UL*capacity()+1UL );
5315  nonzeros = max( nonzeros, 7UL );
5316  nonzeros = min( nonzeros, size() );
5317 
5318  BLAZE_INTERNAL_ASSERT( nonzeros > capacity(), "Invalid capacity value" );
5319 
5320  return nonzeros;
5321 }
5323 //*************************************************************************************************
5324 
5325 
5326 
5327 
5328 //=================================================================================================
5329 //
5330 // INSERTION FUNCTIONS
5331 //
5332 //=================================================================================================
5333 
5334 //*************************************************************************************************
5346 template< typename MT // Type of the sparse matrix
5347  , size_t... CCAs > // Compile time column arguments
5348 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5349  Column<MT,false,false,true,CCAs...>::set( size_t index, const ElementType& value )
5350 {
5351  return matrix_.set( column(), index, value );
5352 }
5354 //*************************************************************************************************
5355 
5356 
5357 //*************************************************************************************************
5370 template< typename MT // Type of the sparse matrix
5371  , size_t... CCAs > // Compile time column arguments
5372 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5373  Column<MT,false,false,true,CCAs...>::insert( size_t index, const ElementType& value )
5374 {
5375  return matrix_.insert( column(), index, value );
5376 }
5378 //*************************************************************************************************
5379 
5380 
5381 //*************************************************************************************************
5406 template< typename MT // Type of the sparse matrix
5407  , size_t... CCAs > // Compile time column arguments
5408 inline void Column<MT,false,false,true,CCAs...>::append( size_t index, const ElementType& value, bool check )
5409 {
5410  matrix_.append( column(), index, value, check );
5411 }
5413 //*************************************************************************************************
5414 
5415 
5416 
5417 
5418 //=================================================================================================
5419 //
5420 // ERASE FUNCTIONS
5421 //
5422 //=================================================================================================
5423 
5424 //*************************************************************************************************
5433 template< typename MT // Type of the sparse matrix
5434  , size_t... CCAs > // Compile time column arguments
5435 inline void Column<MT,false,false,true,CCAs...>::erase( size_t index )
5436 {
5437  matrix_.erase( column(), index );
5438 }
5440 //*************************************************************************************************
5441 
5442 
5443 //*************************************************************************************************
5452 template< typename MT // Type of the sparse matrix
5453  , size_t... CCAs > // Compile time column arguments
5454 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5455  Column<MT,false,false,true,CCAs...>::erase( Iterator pos )
5456 {
5457  return matrix_.erase( column(), pos );
5458 }
5460 //*************************************************************************************************
5461 
5462 
5463 //*************************************************************************************************
5473 template< typename MT // Type of the sparse matrix
5474  , size_t... CCAs > // Compile time column arguments
5475 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5476  Column<MT,false,false,true,CCAs...>::erase( Iterator first, Iterator last )
5477 {
5478  return matrix_.erase( column(), first, last );
5479 }
5481 //*************************************************************************************************
5482 
5483 
5484 //*************************************************************************************************
5507 template< typename MT // Type of the sparse matrix
5508  , size_t... CCAs > // Compile time column arguments
5509 template< typename Pred // Type of the unary predicate
5510  , typename > // Type restriction on the unary predicate
5511 inline void Column<MT,false,false,true,CCAs...>::erase( Pred predicate )
5512 {
5513  matrix_.erase( column(), begin(), end(), predicate );
5514 }
5516 //*************************************************************************************************
5517 
5518 
5519 //*************************************************************************************************
5544 template< typename MT // Type of the sparse matrix
5545  , size_t... CCAs > // Compile time column arguments
5546 template< typename Pred > // Type of the unary predicate
5547 inline void Column<MT,false,false,true,CCAs...>::erase( Iterator first, Iterator last, Pred predicate )
5548 {
5549  matrix_.erase( column(), first, last, predicate );
5550 }
5552 //*************************************************************************************************
5553 
5554 
5555 
5556 
5557 //=================================================================================================
5558 //
5559 // LOOKUP FUNCTIONS
5560 //
5561 //=================================================================================================
5562 
5563 //*************************************************************************************************
5577 template< typename MT // Type of the sparse matrix
5578  , size_t... CCAs > // Compile time column arguments
5579 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5580  Column<MT,false,false,true,CCAs...>::find( size_t index )
5581 {
5582  return matrix_.find( column(), index );
5583 }
5585 //*************************************************************************************************
5586 
5587 
5588 //*************************************************************************************************
5602 template< typename MT // Type of the sparse matrix
5603  , size_t... CCAs > // Compile time column arguments
5604 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
5605  Column<MT,false,false,true,CCAs...>::find( size_t index ) const
5606 {
5607  return matrix_.find( column(), index );
5608 }
5610 //*************************************************************************************************
5611 
5612 
5613 //*************************************************************************************************
5626 template< typename MT // Type of the sparse matrix
5627  , size_t... CCAs > // Compile time column arguments
5628 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5629  Column<MT,false,false,true,CCAs...>::lowerBound( size_t index )
5630 {
5631  return matrix_.lowerBound( column(), index );
5632 }
5634 //*************************************************************************************************
5635 
5636 
5637 //*************************************************************************************************
5650 template< typename MT // Type of the sparse matrix
5651  , size_t... CCAs > // Compile time column arguments
5652 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
5653  Column<MT,false,false,true,CCAs...>::lowerBound( size_t index ) const
5654 {
5655  return matrix_.lowerBound( column(), index );
5656 }
5658 //*************************************************************************************************
5659 
5660 
5661 //*************************************************************************************************
5674 template< typename MT // Type of the sparse matrix
5675  , size_t... CCAs > // Compile time column arguments
5676 inline typename Column<MT,false,false,true,CCAs...>::Iterator
5677  Column<MT,false,false,true,CCAs...>::upperBound( size_t index )
5678 {
5679  return matrix_.upperBound( column(), index );
5680 }
5682 //*************************************************************************************************
5683 
5684 
5685 //*************************************************************************************************
5698 template< typename MT // Type of the sparse matrix
5699  , size_t... CCAs > // Compile time column arguments
5700 inline typename Column<MT,false,false,true,CCAs...>::ConstIterator
5701  Column<MT,false,false,true,CCAs...>::upperBound( size_t index ) const
5702 {
5703  return matrix_.upperBound( column(), index );
5704 }
5706 //*************************************************************************************************
5707 
5708 
5709 
5710 
5711 //=================================================================================================
5712 //
5713 // NUMERIC FUNCTIONS
5714 //
5715 //=================================================================================================
5716 
5717 //*************************************************************************************************
5730 template< typename MT // Type of the sparse matrix
5731  , size_t... CCAs > // Compile time column arguments
5732 template< typename Other > // Data type of the scalar value
5733 inline Column<MT,false,false,true,CCAs...>&
5734  Column<MT,false,false,true,CCAs...>::scale( const Other& scalar )
5735 {
5737 
5738  for( Iterator element=begin(); element!=end(); ++element )
5739  element->value() *= scalar;
5740  return *this;
5741 }
5743 //*************************************************************************************************
5744 
5745 
5746 
5747 
5748 //=================================================================================================
5749 //
5750 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5751 //
5752 //=================================================================================================
5753 
5754 //*************************************************************************************************
5765 template< typename MT // Type of the sparse matrix
5766  , size_t... CCAs > // Compile time column arguments
5767 template< typename Other > // Data type of the foreign expression
5768 inline bool Column<MT,false,false,true,CCAs...>::canAlias( const Other* alias ) const noexcept
5769 {
5770  return matrix_.isAliased( alias );
5771 }
5773 //*************************************************************************************************
5774 
5775 
5776 //*************************************************************************************************
5787 template< typename MT // Type of the sparse matrix
5788  , size_t... CCAs > // Compile time column arguments
5789 template< typename Other > // Data type of the foreign expression
5790 inline bool Column<MT,false,false,true,CCAs...>::isAliased( const Other* alias ) const noexcept
5791 {
5792  return matrix_.isAliased( alias );
5793 }
5795 //*************************************************************************************************
5796 
5797 
5798 //*************************************************************************************************
5810 template< typename MT // Type of the sparse matrix
5811  , size_t... CCAs > // Compile time column arguments
5812 template< typename VT > // Type of the right-hand side dense vector
5813 inline void Column<MT,false,false,true,CCAs...>::assign( const DenseVector<VT,false>& rhs )
5814 {
5815  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5816  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5817 
5818  for( size_t i=0UL; i<size(); ++i )
5819  {
5820  if( matrix_.nonZeros( column() ) == matrix_.capacity( column() ) )
5821  matrix_.reserve( column(), extendCapacity() );
5822 
5823  matrix_.append( column(), i, (~rhs)[i], true );
5824  }
5825 }
5827 //*************************************************************************************************
5828 
5829 
5830 //*************************************************************************************************
5842 template< typename MT // Type of the sparse matrix
5843  , size_t... CCAs > // Compile time column arguments
5844 template< typename VT > // Type of the right-hand side sparse vector
5845 inline void Column<MT,false,false,true,CCAs...>::assign( const SparseVector<VT,false>& rhs )
5846 {
5847  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5848  BLAZE_INTERNAL_ASSERT( nonZeros() == 0UL, "Invalid non-zero elements detected" );
5849 
5850  for( ConstIterator_t<VT> element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5851  matrix_.append( column(), element->index(), element->value(), true );
5852  }
5853 }
5855 //*************************************************************************************************
5856 
5857 
5858 //*************************************************************************************************
5870 template< typename MT // Type of the sparse matrix
5871  , size_t... CCAs > // Compile time column arguments
5872 template< typename VT > // Type of the right-hand side dense vector
5873 inline void Column<MT,false,false,true,CCAs...>::addAssign( const DenseVector<VT,false>& rhs )
5874 {
5875  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5876 
5880 
5881  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5882 
5883  const AddType tmp( serial( *this + (~rhs) ) );
5884  matrix_.reset( column() );
5885  assign( tmp );
5886 }
5888 //*************************************************************************************************
5889 
5890 
5891 //*************************************************************************************************
5903 template< typename MT // Type of the sparse matrix
5904  , size_t... CCAs > // Compile time column arguments
5905 template< typename VT > // Type of the right-hand side sparse vector
5906 inline void Column<MT,false,false,true,CCAs...>::addAssign( const SparseVector<VT,false>& rhs )
5907 {
5908  using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5909 
5913 
5914  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5915 
5916  const AddType tmp( serial( *this + (~rhs) ) );
5917  matrix_.reset( column() );
5918  matrix_.reserve( column(), tmp.nonZeros() );
5919  assign( tmp );
5920 }
5922 //*************************************************************************************************
5923 
5924 
5925 //*************************************************************************************************
5937 template< typename MT // Type of the sparse matrix
5938  , size_t... CCAs > // Compile time column arguments
5939 template< typename VT > // Type of the right-hand side dense vector
5940 inline void Column<MT,false,false,true,CCAs...>::subAssign( const DenseVector<VT,false>& rhs )
5941 {
5942  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5943 
5947 
5948  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5949 
5950  const SubType tmp( serial( *this - (~rhs) ) );
5951  matrix_.reset( column() );
5952  assign( tmp );
5953 }
5955 //*************************************************************************************************
5956 
5957 
5958 //*************************************************************************************************
5970 template< typename MT // Type of the sparse matrix
5971  , size_t... CCAs > // Compile time column arguments
5972 template< typename VT > // Type of the right-hand side sparse vector
5973 inline void Column<MT,false,false,true,CCAs...>::subAssign( const SparseVector<VT,false>& rhs )
5974 {
5975  using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5976 
5980 
5981  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5982 
5983  const SubType tmp( serial( *this - (~rhs) ) );
5984  matrix_.reset( column() );
5985  matrix_.reserve( column(), tmp.nonZeros() );
5986  assign( tmp );
5987 }
5989 //*************************************************************************************************
5990 
5991 } // namespace blaze
5992 
5993 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
Header file for the SparseVector base class.
Header file for the View base class.
#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
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
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:595
Header file for the IsIntegral type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e....
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
Header file for the MAYBE_UNUSED function template.
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type,...
Definition: Symmetric.h:60
Header file for the reset shim.
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i....
Definition: TransExpr.h:81
Header file for the IsUniLower type trait.
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
Constraint on the data type.
Constraint on the 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.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
decltype(auto) operator *(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9091
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type,...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:558
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type,...
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the IsConst type trait.
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance,...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type,...
Definition: Reference.h:79
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.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type,...
Definition: DenseVector.h:61
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
auto operator *=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:494
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the 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,...
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.