DenseColumn.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
36 #define _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
56 #include <blaze/math/Intrinsics.h>
57 #include <blaze/math/shims/Clear.h>
83 #include <blaze/system/CacheSize.h>
84 #include <blaze/system/Inline.h>
87 #include <blaze/util/Assert.h>
91 #include <blaze/util/DisableIf.h>
92 #include <blaze/util/EnableIf.h>
93 #include <blaze/util/Exception.h>
95 #include <blaze/util/mpl/And.h>
96 #include <blaze/util/mpl/If.h>
97 #include <blaze/util/mpl/Not.h>
98 #include <blaze/util/mpl/Or.h>
99 #include <blaze/util/Null.h>
100 #include <blaze/util/Template.h>
101 #include <blaze/util/Types.h>
109 
110 
111 namespace blaze {
112 
113 //=================================================================================================
114 //
115 // CLASS DEFINITION
116 //
117 //=================================================================================================
118 
119 //*************************************************************************************************
339 template< typename MT // Type of the dense matrix
340  , bool SO = IsColumnMajorMatrix<MT>::value // Storage order
341  , bool SF = IsSymmetric<MT>::value > // Symmetry flag
342 class DenseColumn : public DenseVector< DenseColumn<MT,SO,SF>, false >
343  , private Column
344 {
345  private:
346  //**Type definitions****************************************************************************
348  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
349 
352  //**********************************************************************************************
353 
354  public:
355  //**Type definitions****************************************************************************
359  typedef typename MT::ElementType ElementType;
360  typedef typename IT::Type IntrinsicType;
361  typedef typename MT::ReturnType ReturnType;
362  typedef const DenseColumn& CompositeType;
363 
366 
368  typedef typename If< IsConst<MT>, ConstReference, typename MT::Reference >::Type Reference;
369 
371  typedef const ElementType* ConstPointer;
372 
375  , ConstPointer, ElementType* >::Type Pointer;
376 
379 
381  typedef typename If< IsConst<MT>, ConstIterator, typename MT::Iterator >::Type Iterator;
382  //**********************************************************************************************
383 
384  //**Compilation flags***************************************************************************
386  enum { vectorizable = MT::vectorizable };
387 
389  enum { smpAssignable = MT::smpAssignable };
390  //**********************************************************************************************
391 
392  //**Constructors********************************************************************************
395  explicit inline DenseColumn( MT& matrix, size_t index );
396  // No explicitly declared copy constructor.
398  //**********************************************************************************************
399 
400  //**Destructor**********************************************************************************
401  // No explicitly declared destructor.
402  //**********************************************************************************************
403 
404  //**Data access functions***********************************************************************
407  inline Reference operator[]( size_t index );
408  inline ConstReference operator[]( size_t index ) const;
409  inline Reference at( size_t index );
410  inline ConstReference at( size_t index ) const;
411  inline Pointer data ();
412  inline ConstPointer data () const;
413  inline Iterator begin ();
414  inline ConstIterator begin () const;
415  inline ConstIterator cbegin() const;
416  inline Iterator end ();
417  inline ConstIterator end () const;
418  inline ConstIterator cend () const;
420  //**********************************************************************************************
421 
422  //**Assignment operators************************************************************************
425  inline DenseColumn& operator=( const ElementType& rhs );
426  inline DenseColumn& operator=( const DenseColumn& rhs );
427 
428  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
429  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
430  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
431  template< typename VT > inline DenseColumn& operator*=( const DenseVector<VT,false>& rhs );
432  template< typename VT > inline DenseColumn& operator*=( const SparseVector<VT,false>& rhs );
433 
434  template< typename Other >
435  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
436  operator*=( Other rhs );
437 
438  template< typename Other >
439  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
440  operator/=( Other rhs );
442  //**********************************************************************************************
443 
444  //**Utility functions***************************************************************************
447  inline size_t size() const;
448  inline size_t capacity() const;
449  inline size_t nonZeros() const;
450  inline void reset();
451  template< typename Other > inline DenseColumn& scale( const Other& scalar );
453  //**********************************************************************************************
454 
455  private:
456  //**********************************************************************************************
458  template< typename VT >
460  struct VectorizedAssign {
461  enum { value = useOptimizedKernels &&
462  vectorizable && VT::vectorizable &&
463  IsSame<ElementType,typename VT::ElementType>::value };
464  };
466  //**********************************************************************************************
467 
468  //**********************************************************************************************
470  template< typename VT >
472  struct VectorizedAddAssign {
473  enum { value = useOptimizedKernels &&
474  vectorizable && VT::vectorizable &&
475  IsSame<ElementType,typename VT::ElementType>::value &&
476  IntrinsicTrait<ElementType>::addition };
477  };
479  //**********************************************************************************************
480 
481  //**********************************************************************************************
483  template< typename VT >
485  struct VectorizedSubAssign {
486  enum { value = useOptimizedKernels &&
487  vectorizable && VT::vectorizable &&
488  IsSame<ElementType,typename VT::ElementType>::value &&
489  IntrinsicTrait<ElementType>::subtraction };
490  };
492  //**********************************************************************************************
493 
494  //**********************************************************************************************
496  template< typename VT >
498  struct VectorizedMultAssign {
499  enum { value = useOptimizedKernels &&
500  vectorizable && VT::vectorizable &&
501  IsSame<ElementType,typename VT::ElementType>::value &&
502  IntrinsicTrait<ElementType>::multiplication };
503  };
505  //**********************************************************************************************
506 
507  public:
508  //**Expression template evaluation functions****************************************************
511  template< typename Other >
512  inline bool canAlias( const Other* alias ) const;
513 
514  template< typename MT2, bool SO2, bool SF2 >
515  inline bool canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const;
516 
517  template< typename Other >
518  inline bool isAliased( const Other* alias ) const;
519 
520  template< typename MT2, bool SO2, bool SF2 >
521  inline bool isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const;
522 
523  inline bool isAligned () const;
524  inline bool canSMPAssign() const;
525 
526  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
527  BLAZE_ALWAYS_INLINE IntrinsicType loada( size_t index ) const;
528  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
529 
530  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
531  BLAZE_ALWAYS_INLINE void storea( size_t index, const IntrinsicType& value );
532  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
533  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
534 
535  template< typename VT >
536  inline typename DisableIf< VectorizedAssign<VT> >::Type
537  assign( const DenseVector<VT,false>& rhs );
538 
539  template< typename VT >
540  inline typename EnableIf< VectorizedAssign<VT> >::Type
541  assign( const DenseVector<VT,false>& rhs );
542 
543  template< typename VT > inline void assign( const SparseVector<VT,false>& rhs );
544 
545  template< typename VT >
546  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
547  addAssign( const DenseVector<VT,false>& rhs );
548 
549  template< typename VT >
550  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
551  addAssign( const DenseVector<VT,false>& rhs );
552 
553  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
554 
555  template< typename VT >
556  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
557  subAssign( const DenseVector<VT,false>& rhs );
558 
559  template< typename VT >
560  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
561  subAssign( const DenseVector<VT,false>& rhs );
562 
563  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
564 
565  template< typename VT >
566  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
567  multAssign( const DenseVector<VT,false>& rhs );
568 
569  template< typename VT >
570  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
571  multAssign( const DenseVector<VT,false>& rhs );
572 
573  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
575  //**********************************************************************************************
576 
577  private:
578  //**Member variables****************************************************************************
581  Operand matrix_;
582  const size_t col_;
583 
584  //**********************************************************************************************
585 
586  //**Friend declarations*************************************************************************
588  template< typename MT2, bool SO2, bool SF2 > friend class DenseColumn;
589 
590  template< typename MT2, bool SO2, bool SF2 >
591  friend bool isIntact( const DenseColumn<MT2,SO2,SF2>& column );
592 
593  template< typename MT2, bool SO2, bool SF2 >
594  friend bool isSame( const DenseColumn<MT2,SO2,SF2>& a, const DenseColumn<MT2,SO2,SF2>& b );
595 
596  template< typename MT2, bool SO2, bool SF2, typename VT >
597  friend bool tryAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
598 
599  template< typename MT2, bool SO2, bool SF2, typename VT >
600  friend bool tryAddAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
601 
602  template< typename MT2, bool SO2, bool SF2, typename VT >
603  friend bool trySubAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
604 
605  template< typename MT2, bool SO2, bool SF2, typename VT >
606  friend bool tryMultAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
607 
608  template< typename MT2, bool SO2, bool SF2 >
609  friend typename DerestrictTrait< DenseColumn<MT2,SO2,SF2> >::Type
610  derestrict( DenseColumn<MT2,SO2,SF2>& dm );
612  //**********************************************************************************************
613 
614  //**Compile time checks*************************************************************************
623  //**********************************************************************************************
624 };
625 //*************************************************************************************************
626 
627 
628 
629 
630 //=================================================================================================
631 //
632 // CONSTRUCTOR
633 //
634 //=================================================================================================
635 
636 //*************************************************************************************************
643 template< typename MT // Type of the dense matrix
644  , bool SO // Storage order
645  , bool SF > // Symmetry flag
646 inline DenseColumn<MT,SO,SF>::DenseColumn( MT& matrix, size_t index )
647  : matrix_( matrix ) // The dense matrix containing the column
648  , col_ ( index ) // The index of the column in the matrix
649 {
650  if( matrix_.columns() <= index ) {
651  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
652  }
653 }
654 //*************************************************************************************************
655 
656 
657 
658 
659 //=================================================================================================
660 //
661 // DATA ACCESS FUNCTIONS
662 //
663 //=================================================================================================
664 
665 //*************************************************************************************************
674 template< typename MT // Type of the dense matrix
675  , bool SO // Storage order
676  , bool SF > // Symmetry flag
678 {
679  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
680  return matrix_(index,col_);
681 }
682 //*************************************************************************************************
683 
684 
685 //*************************************************************************************************
694 template< typename MT // Type of the dense matrix
695  , bool SO // Storage order
696  , bool SF > // Symmetry flag
698  DenseColumn<MT,SO,SF>::operator[]( size_t index ) const
699 {
700  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
701  return const_cast<const MT&>( matrix_ )(index,col_);
702 }
703 //*************************************************************************************************
704 
705 
706 //*************************************************************************************************
716 template< typename MT // Type of the dense matrix
717  , bool SO // Storage order
718  , bool SF > // Symmetry flag
720 {
721  if( index >= size() ) {
722  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
723  }
724  return (*this)[index];
725 }
726 //*************************************************************************************************
727 
728 
729 //*************************************************************************************************
739 template< typename MT // Type of the dense matrix
740  , bool SO // Storage order
741  , bool SF > // Symmetry flag
743  DenseColumn<MT,SO,SF>::at( size_t index ) const
744 {
745  if( index >= size() ) {
746  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
747  }
748  return (*this)[index];
749 }
750 //*************************************************************************************************
751 
752 
753 //*************************************************************************************************
761 template< typename MT // Type of the dense matrix
762  , bool SO // Storage order
763  , bool SF > // Symmetry flag
765 {
766  return matrix_.data( col_ );
767 }
768 //*************************************************************************************************
769 
770 
771 //*************************************************************************************************
779 template< typename MT // Type of the dense matrix
780  , bool SO // Storage order
781  , bool SF > // Symmetry flag
783 {
784  return matrix_.data( col_ );
785 }
786 //*************************************************************************************************
787 
788 
789 //*************************************************************************************************
796 template< typename MT // Type of the dense matrix
797  , bool SO // Storage order
798  , bool SF > // Symmetry flag
800 {
801  return matrix_.begin( col_ );
802 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
813 template< typename MT // Type of the dense matrix
814  , bool SO // Storage order
815  , bool SF > // Symmetry flag
817 {
818  return matrix_.cbegin( col_ );
819 }
820 //*************************************************************************************************
821 
822 
823 //*************************************************************************************************
830 template< typename MT // Type of the dense matrix
831  , bool SO // Storage order
832  , bool SF > // Symmetry flag
834 {
835  return matrix_.cbegin( col_ );
836 }
837 //*************************************************************************************************
838 
839 
840 //*************************************************************************************************
847 template< typename MT // Type of the dense matrix
848  , bool SO // Storage order
849  , bool SF > // Symmetry flag
851 {
852  return matrix_.end( col_ );
853 }
854 //*************************************************************************************************
855 
856 
857 //*************************************************************************************************
864 template< typename MT // Type of the dense matrix
865  , bool SO // Storage order
866  , bool SF > // Symmetry flag
868 {
869  return matrix_.cend( col_ );
870 }
871 //*************************************************************************************************
872 
873 
874 //*************************************************************************************************
881 template< typename MT // Type of the dense matrix
882  , bool SO // Storage order
883  , bool SF > // Symmetry flag
885 {
886  return matrix_.cend( col_ );
887 }
888 //*************************************************************************************************
889 
890 
891 
892 
893 //=================================================================================================
894 //
895 // ASSIGNMENT OPERATORS
896 //
897 //=================================================================================================
898 
899 //*************************************************************************************************
909 template< typename MT // Type of the dense matrix
910  , bool SO // Storage order
911  , bool SF > // Symmetry flag
913 {
914  const size_t ibegin( ( IsLower<MT>::value )
916  ?( col_+1UL )
917  :( col_ ) )
918  :( 0UL ) );
919  const size_t iend ( ( IsUpper<MT>::value )
921  ?( col_ )
922  :( col_+1UL ) )
923  :( size() ) );
924 
925  for( size_t i=ibegin; i<iend; ++i )
926  matrix_(i,col_) = rhs;
927 
928  return *this;
929 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
946 template< typename MT // Type of the dense matrix
947  , bool SO // Storage order
948  , bool SF > // Symmetry flag
950 {
951  if( &rhs == this ) return *this;
952 
953  if( size() != rhs.size() ) {
954  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
955  }
956 
957  if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
958  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
959  }
960 
961  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
962 
963  smpAssign( left, rhs );
964 
965  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
966 
967  return *this;
968 }
969 //*************************************************************************************************
970 
971 
972 //*************************************************************************************************
985 template< typename MT // Type of the dense matrix
986  , bool SO // Storage order
987  , bool SF > // Symmetry flag
988 template< typename VT > // Type of the right-hand side vector
990 {
993 
994  if( size() != (~rhs).size() ) {
995  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
996  }
997 
998  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
999  Right right( ~rhs );
1000 
1001  if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
1002  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1003  }
1004 
1005  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1006 
1007  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1008  const typename VT::ResultType tmp( right );
1009  smpAssign( left, tmp );
1010  }
1011  else {
1013  reset();
1014  smpAssign( left, right );
1015  }
1016 
1017  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1018 
1019  return *this;
1020 }
1021 //*************************************************************************************************
1022 
1023 
1024 //*************************************************************************************************
1037 template< typename MT // Type of the dense matrix
1038  , bool SO // Storage order
1039  , bool SF > // Symmetry flag
1040 template< typename VT > // Type of the right-hand side vector
1042 {
1045 
1046  if( size() != (~rhs).size() ) {
1047  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1048  }
1049 
1050  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1051  Right right( ~rhs );
1052 
1053  if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
1054  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1055  }
1056 
1057  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1058 
1059  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1060  const typename VT::ResultType tmp( right );
1061  smpAddAssign( left, tmp );
1062  }
1063  else {
1064  smpAddAssign( left, right );
1065  }
1066 
1067  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1068 
1069  return *this;
1070 }
1071 //*************************************************************************************************
1072 
1073 
1074 //*************************************************************************************************
1087 template< typename MT // Type of the dense matrix
1088  , bool SO // Storage order
1089  , bool SF > // Symmetry flag
1090 template< typename VT > // Type of the right-hand side vector
1092 {
1095 
1096  if( size() != (~rhs).size() ) {
1097  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1098  }
1099 
1100  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1101  Right right( ~rhs );
1102 
1103  if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
1104  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1105  }
1106 
1107  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1108 
1109  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1110  const typename VT::ResultType tmp( right );
1111  smpSubAssign( left, tmp );
1112  }
1113  else {
1114  smpSubAssign( left, right );
1115  }
1116 
1117  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1118 
1119  return *this;
1120 }
1121 //*************************************************************************************************
1122 
1123 
1124 //*************************************************************************************************
1136 template< typename MT // Type of the dense matrix
1137  , bool SO // Storage order
1138  , bool SF > // Symmetry flag
1139 template< typename VT > // Type of the right-hand side dense vector
1141 {
1144 
1145  if( size() != (~rhs).size() ) {
1146  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1147  }
1148 
1149  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1150  Right right( ~rhs );
1151 
1152  if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
1153  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1154  }
1155 
1156  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1157 
1158  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1159  const typename VT::ResultType tmp( right );
1160  smpMultAssign( left, tmp );
1161  }
1162  else {
1163  smpMultAssign( left, right );
1164  }
1165 
1166  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1167 
1168  return *this;
1169 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1185 template< typename MT // Type of the dense matrix
1186  , bool SO // Storage order
1187  , bool SF > // Symmetry flag
1188 template< typename VT > // Type of the right-hand side sparse vector
1190 {
1194 
1195  if( size() != (~rhs).size() ) {
1196  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1197  }
1198 
1199  const ResultType right( *this * (~rhs) );
1200 
1201  if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
1202  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
1203  }
1204 
1205  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1206 
1207  smpAssign( left, right );
1208 
1209  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
1210 
1211  return *this;
1212 }
1213 //*************************************************************************************************
1214 
1215 
1216 //*************************************************************************************************
1226 template< typename MT // Type of the dense matrix
1227  , bool SO // Storage order
1228  , bool SF > // Symmetry flag
1229 template< typename Other > // Data type of the right-hand side scalar
1230 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO,SF> >::Type&
1232 {
1234 
1235  return operator=( (*this) * rhs );
1236 }
1237 //*************************************************************************************************
1238 
1239 
1240 //*************************************************************************************************
1252 template< typename MT // Type of the dense matrix
1253  , bool SO // Storage order
1254  , bool SF > // Symmetry flag
1255 template< typename Other > // Data type of the right-hand side scalar
1256 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO,SF> >::Type&
1258 {
1260 
1261  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1262 
1263  return operator=( (*this) / rhs );
1264 }
1265 //*************************************************************************************************
1266 
1267 
1268 
1269 
1270 //=================================================================================================
1271 //
1272 // UTILITY FUNCTIONS
1273 //
1274 //=================================================================================================
1275 
1276 //*************************************************************************************************
1281 template< typename MT // Type of the dense matrix
1282  , bool SO // Storage order
1283  , bool SF > // Symmetry flag
1284 inline size_t DenseColumn<MT,SO,SF>::size() const
1285 {
1286  return matrix_.rows();
1287 }
1288 //*************************************************************************************************
1289 
1290 
1291 //*************************************************************************************************
1296 template< typename MT // Type of the dense matrix
1297  , bool SO // Storage order
1298  , bool SF > // Symmetry flag
1299 inline size_t DenseColumn<MT,SO,SF>::capacity() const
1300 {
1301  return matrix_.capacity( col_ );
1302 }
1303 //*************************************************************************************************
1304 
1305 
1306 //*************************************************************************************************
1314 template< typename MT // Type of the dense matrix
1315  , bool SO // Storage order
1316  , bool SF > // Symmetry flag
1317 inline size_t DenseColumn<MT,SO,SF>::nonZeros() const
1318 {
1319  return matrix_.nonZeros( col_ );
1320 }
1321 //*************************************************************************************************
1322 
1323 
1324 //*************************************************************************************************
1329 template< typename MT // Type of the dense matrix
1330  , bool SO // Storage order
1331  , bool SF > // Symmetry flag
1333 {
1334  matrix_.reset( col_ );
1335 }
1336 //*************************************************************************************************
1337 
1338 
1339 //*************************************************************************************************
1349 template< typename MT // Type of the dense matrix
1350  , bool SO // Storage order
1351  , bool SF > // Symmetry flag
1352 template< typename Other > // Data type of the scalar value
1354 {
1356 
1357  const size_t ibegin( ( IsLower<MT>::value )
1359  ?( col_+1UL )
1360  :( col_ ) )
1361  :( 0UL ) );
1362  const size_t iend ( ( IsUpper<MT>::value )
1364  ?( col_ )
1365  :( col_+1UL ) )
1366  :( size() ) );
1367 
1368  for( size_t i=ibegin; i<iend; ++i ) {
1369  matrix_(i,col_) *= scalar;
1370  }
1371 
1372  return *this;
1373 }
1374 //*************************************************************************************************
1375 
1376 
1377 
1378 
1379 //=================================================================================================
1380 //
1381 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1382 //
1383 //=================================================================================================
1384 
1385 //*************************************************************************************************
1395 template< typename MT // Type of the dense matrix
1396  , bool SO // Storage order
1397  , bool SF > // Symmetry flag
1398 template< typename Other > // Data type of the foreign expression
1399 inline bool DenseColumn<MT,SO,SF>::canAlias( const Other* alias ) const
1400 {
1401  return matrix_.isAliased( alias );
1402 }
1403 //*************************************************************************************************
1404 
1405 
1406 //*************************************************************************************************
1416 template< typename MT // Type of the dense matrix
1417  , bool SO // Storage order
1418  , bool SF > // Symmetry flag
1419 template< typename MT2 // Data type of the foreign dense column
1420  , bool SO2 // Storage order of the foreign dense column
1421  , bool SF2 > // Symmetry flag of the foreign dense column
1423 {
1424  return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
1425 }
1426 //*************************************************************************************************
1427 
1428 
1429 //*************************************************************************************************
1439 template< typename MT // Type of the dense matrix
1440  , bool SO // Storage order
1441  , bool SF > // Symmetry flag
1442 template< typename Other > // Data type of the foreign expression
1443 inline bool DenseColumn<MT,SO,SF>::isAliased( const Other* alias ) const
1444 {
1445  return matrix_.isAliased( alias );
1446 }
1447 //*************************************************************************************************
1448 
1449 
1450 //*************************************************************************************************
1460 template< typename MT // Type of the dense matrix
1461  , bool SO // Storage order
1462  , bool SF > // Symmetry flag
1463 template< typename MT2 // Data type of the foreign dense column
1464  , bool SO2 // Storage order of the foreign dense column
1465  , bool SF2 > // Symmetry flag of the foreign dense column
1467 {
1468  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
1469 }
1470 //*************************************************************************************************
1471 
1472 
1473 //*************************************************************************************************
1482 template< typename MT // Type of the dense matrix
1483  , bool SO // Storage order
1484  , bool SF > // Symmetry flag
1486 {
1487  return matrix_.isAligned();
1488 }
1489 //*************************************************************************************************
1490 
1491 
1492 //*************************************************************************************************
1502 template< typename MT // Type of the dense matrix
1503  , bool SO // Storage order
1504  , bool SF > // Symmetry flag
1506 {
1507  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1508 }
1509 //*************************************************************************************************
1510 
1511 
1512 //*************************************************************************************************
1524 template< typename MT // Type of the dense matrix
1525  , bool SO // Storage order
1526  , bool SF > // Symmetry flag
1528  DenseColumn<MT,SO,SF>::load( size_t index ) const
1529 {
1530  return matrix_.load( index, col_ );
1531 }
1532 //*************************************************************************************************
1533 
1534 
1535 //*************************************************************************************************
1547 template< typename MT // Type of the dense matrix
1548  , bool SO // Storage order
1549  , bool SF > // Symmetry flag
1551  DenseColumn<MT,SO,SF>::loada( size_t index ) const
1552 {
1553  return matrix_.loada( index, col_ );
1554 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1570 template< typename MT // Type of the dense matrix
1571  , bool SO // Storage order
1572  , bool SF > // Symmetry flag
1574  DenseColumn<MT,SO,SF>::loadu( size_t index ) const
1575 {
1576  return matrix_.loadu( index, col_ );
1577 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1594 template< typename MT // Type of the dense matrix
1595  , bool SO // Storage order
1596  , bool SF > // Symmetry flag
1598 {
1599  matrix_.store( index, col_, value );
1600 }
1601 //*************************************************************************************************
1602 
1603 
1604 //*************************************************************************************************
1617 template< typename MT // Type of the dense matrix
1618  , bool SO // Storage order
1619  , bool SF > // Symmetry flag
1621 {
1622  matrix_.storea( index, col_, value );
1623 }
1624 //*************************************************************************************************
1625 
1626 
1627 //*************************************************************************************************
1640 template< typename MT // Type of the dense matrix
1641  , bool SO // Storage order
1642  , bool SF > // Symmetry flag
1644 {
1645  matrix_.storeu( index, col_, value );
1646 }
1647 //*************************************************************************************************
1648 
1649 
1650 //*************************************************************************************************
1663 template< typename MT // Type of the dense matrix
1664  , bool SO // Storage order
1665  , bool SF > // Symmetry flag
1667 {
1668  matrix_.stream( index, col_, value );
1669 }
1670 //*************************************************************************************************
1671 
1672 
1673 //*************************************************************************************************
1684 template< typename MT // Type of the dense matrix
1685  , bool SO // Storage order
1686  , bool SF > // Symmetry flag
1687 template< typename VT > // Type of the right-hand side dense vector
1688 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1690 {
1691  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1692 
1693  const size_t ipos( (~rhs).size() & size_t(-2) );
1694  for( size_t i=0UL; i<ipos; i+=2UL ) {
1695  matrix_(i ,col_) = (~rhs)[i ];
1696  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1697  }
1698  if( ipos < (~rhs).size() )
1699  matrix_(ipos,col_) = (~rhs)[ipos];
1700 }
1701 //*************************************************************************************************
1702 
1703 
1704 //*************************************************************************************************
1715 template< typename MT // Type of the dense matrix
1716  , bool SO // Storage order
1717  , bool SF > // Symmetry flag
1718 template< typename VT > // Type of the right-hand side dense vector
1719 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1721 {
1723 
1724  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1725 
1726  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1727  const size_t rows( size() );
1728 
1729  const size_t ipos( ( remainder )?( rows & size_t(-IT::size) ):( rows ) );
1730  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (IT::size) ) ) == ipos, "Invalid end calculation" );
1731 
1732  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( this ) )
1733  {
1734  size_t i( 0UL );
1735 
1736  for( ; i<ipos; i+=IT::size ) {
1737  matrix_.stream( i, col_, (~rhs).load(i) );
1738  }
1739  for( ; remainder && i<rows; ++i ) {
1740  matrix_(i,col_) = (~rhs)[i];
1741  }
1742  }
1743  else
1744  {
1745  size_t i( 0UL );
1746  typename VT::ConstIterator it( (~rhs).begin() );
1747 
1748  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
1749  matrix_.store( i , col_, it.load() ); it+=IT::size;
1750  matrix_.store( i+IT::size , col_, it.load() ); it+=IT::size;
1751  matrix_.store( i+IT::size*2UL, col_, it.load() ); it+=IT::size;
1752  matrix_.store( i+IT::size*3UL, col_, it.load() ); it+=IT::size;
1753  }
1754  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
1755  matrix_.store( i, col_, it.load() );
1756  }
1757  for( ; remainder && i<rows; ++i, ++it ) {
1758  matrix_(i,col_) = *it;
1759  }
1760  }
1761 }
1762 //*************************************************************************************************
1763 
1764 
1765 //*************************************************************************************************
1776 template< typename MT // Type of the dense matrix
1777  , bool SO // Storage order
1778  , bool SF > // Symmetry flag
1779 template< typename VT > // Type of the right-hand side sparse vector
1781 {
1782  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1783 
1784  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1785  matrix_(element->index(),col_) = element->value();
1786 }
1787 //*************************************************************************************************
1788 
1789 
1790 //*************************************************************************************************
1801 template< typename MT // Type of the dense matrix
1802  , bool SO // Storage order
1803  , bool SF > // Symmetry flag
1804 template< typename VT > // Type of the right-hand side dense vector
1805 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1807 {
1808  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1809 
1810  const size_t ipos( (~rhs).size() & size_t(-2) );
1811  for( size_t i=0UL; i<ipos; i+=2UL ) {
1812  matrix_(i ,col_) += (~rhs)[i ];
1813  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1814  }
1815  if( ipos < (~rhs).size() )
1816  matrix_(ipos,col_) += (~rhs)[ipos];
1817 }
1818 //*************************************************************************************************
1819 
1820 
1821 //*************************************************************************************************
1832 template< typename MT // Type of the dense matrix
1833  , bool SO // Storage order
1834  , bool SF > // Symmetry flag
1835 template< typename VT > // Type of the right-hand side dense vector
1836 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1838 {
1840 
1841  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1842 
1843  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1844  const size_t rows( size() );
1845 
1846  const size_t ipos( ( remainder )?( rows & size_t(-IT::size) ):( rows ) );
1847  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (IT::size) ) ) == ipos, "Invalid end calculation" );
1848 
1849  size_t i( 0UL );
1850  typename VT::ConstIterator it( (~rhs).begin() );
1851 
1852  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
1853  matrix_.store( i , col_, matrix_.load(i ,col_) + it.load() ); it += IT::size;
1854  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) + it.load() ); it += IT::size;
1855  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) + it.load() ); it += IT::size;
1856  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) + it.load() ); it += IT::size;
1857  }
1858  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
1859  matrix_.store( i, col_, matrix_.load(i,col_) + it.load() );
1860  }
1861  for( ; remainder && i<rows; ++i, ++it ) {
1862  matrix_(i,col_) += *it;
1863  }
1864 }
1865 //*************************************************************************************************
1866 
1867 
1868 //*************************************************************************************************
1879 template< typename MT // Type of the dense matrix
1880  , bool SO // Storage order
1881  , bool SF > // Symmetry flag
1882 template< typename VT > // Type of the right-hand side sparse vector
1884 {
1885  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1886 
1887  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1888  matrix_(element->index(),col_) += element->value();
1889 }
1890 //*************************************************************************************************
1891 
1892 
1893 //*************************************************************************************************
1904 template< typename MT // Type of the dense matrix
1905  , bool SO // Storage order
1906  , bool SF > // Symmetry flag
1907 template< typename VT > // Type of the right-hand side dense vector
1908 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1910 {
1911  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1912 
1913  const size_t ipos( (~rhs).size() & size_t(-2) );
1914  for( size_t i=0UL; i<ipos; i+=2UL ) {
1915  matrix_(i ,col_) -= (~rhs)[i ];
1916  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1917  }
1918  if( ipos < (~rhs).size() )
1919  matrix_(ipos,col_) -= (~rhs)[ipos];
1920 }
1921 //*************************************************************************************************
1922 
1923 
1924 //*************************************************************************************************
1935 template< typename MT // Type of the dense matrix
1936  , bool SO // Storage order
1937  , bool SF > // Symmetry flag
1938 template< typename VT > // Type of the right-hand side dense vector
1939 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1941 {
1943 
1944  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1945 
1946  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1947  const size_t rows( size() );
1948 
1949  const size_t ipos( ( remainder )?( rows & size_t(-IT::size) ):( rows ) );
1950  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (IT::size) ) ) == ipos, "Invalid end calculation" );
1951 
1952  size_t i( 0UL );
1953  typename VT::ConstIterator it( (~rhs).begin() );
1954 
1955  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
1956  matrix_.store( i , col_, matrix_.load(i ,col_) - it.load() ); it += IT::size;
1957  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) - it.load() ); it += IT::size;
1958  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) - it.load() ); it += IT::size;
1959  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) - it.load() ); it += IT::size;
1960  }
1961  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
1962  matrix_.store( i, col_, matrix_.load(i,col_) - it.load() );
1963  }
1964  for( ; remainder && i<rows; ++i, ++it ) {
1965  matrix_(i,col_) -= *it;
1966  }
1967 }
1968 //*************************************************************************************************
1969 
1970 
1971 //*************************************************************************************************
1982 template< typename MT // Type of the dense matrix
1983  , bool SO // Storage order
1984  , bool SF > // Symmetry flag
1985 template< typename VT > // Type of the right-hand side sparse vector
1987 {
1988  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1989 
1990  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1991  matrix_(element->index(),col_) -= element->value();
1992 }
1993 //*************************************************************************************************
1994 
1995 
1996 //*************************************************************************************************
2007 template< typename MT // Type of the dense matrix
2008  , bool SO // Storage order
2009  , bool SF > // Symmetry flag
2010 template< typename VT > // Type of the right-hand side dense vector
2011 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2013 {
2014  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2015 
2016  const size_t ipos( (~rhs).size() & size_t(-2) );
2017  for( size_t i=0UL; i<ipos; i+=2UL ) {
2018  matrix_(i ,col_) *= (~rhs)[i ];
2019  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
2020  }
2021  if( ipos < (~rhs).size() )
2022  matrix_(ipos,col_) *= (~rhs)[ipos];
2023 }
2024 //*************************************************************************************************
2025 
2026 
2027 //*************************************************************************************************
2038 template< typename MT // Type of the dense matrix
2039  , bool SO // Storage order
2040  , bool SF > // Symmetry flag
2041 template< typename VT > // Type of the right-hand side dense vector
2042 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2044 {
2046 
2047  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2048 
2049  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
2050  const size_t rows( size() );
2051 
2052  const size_t ipos( ( remainder )?( rows & size_t(-IT::size) ):( rows ) );
2053  BLAZE_INTERNAL_ASSERT( !remainder || ( rows - ( rows % (IT::size) ) ) == ipos, "Invalid end calculation" );
2054 
2055  size_t i( 0UL );
2056  typename VT::ConstIterator it( (~rhs).begin() );
2057 
2058  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
2059  matrix_.store( i , col_, matrix_.load(i ,col_) * it.load() ); it += IT::size;
2060  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) * it.load() ); it += IT::size;
2061  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) * it.load() ); it += IT::size;
2062  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) * it.load() ); it += IT::size;
2063  }
2064  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
2065  matrix_.store( i, col_, matrix_.load(i,col_) * it.load() );
2066  }
2067  for( ; remainder && i<rows; ++i, ++it ) {
2068  matrix_(i,col_) *= *it;
2069  }
2070 }
2071 //*************************************************************************************************
2072 
2073 
2074 //*************************************************************************************************
2085 template< typename MT // Type of the dense matrix
2086  , bool SO // Storage order
2087  , bool SF > // Symmetry flag
2088 template< typename VT > // Type of the right-hand side sparse vector
2090 {
2091  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2092 
2093  const ResultType tmp( serial( *this ) );
2094 
2095  reset();
2096 
2097  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2098  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2099 }
2100 //*************************************************************************************************
2101 
2102 
2103 
2104 
2105 
2106 
2107 
2108 
2109 //=================================================================================================
2110 //
2111 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL ROW-MAJOR MATRICES
2112 //
2113 //=================================================================================================
2114 
2115 //*************************************************************************************************
2123 template< typename MT > // Type of the dense matrix
2124 class DenseColumn<MT,false,false> : public DenseVector< DenseColumn<MT,false,false>, false >
2125  , private Column
2126 {
2127  private:
2128  //**Type definitions****************************************************************************
2130  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
2131  //**********************************************************************************************
2132 
2133  public:
2134  //**Type definitions****************************************************************************
2136  typedef typename ColumnTrait<MT>::Type ResultType;
2137  typedef typename ResultType::TransposeType TransposeType;
2138  typedef typename MT::ElementType ElementType;
2139  typedef typename MT::ReturnType ReturnType;
2140  typedef const DenseColumn& CompositeType;
2141 
2143  typedef typename MT::ConstReference ConstReference;
2144 
2146  typedef typename If< IsConst<MT>, ConstReference, typename MT::Reference >::Type Reference;
2147 
2149  typedef const ElementType* ConstPointer;
2150 
2153  , ConstPointer, ElementType* >::Type Pointer;
2154  //**********************************************************************************************
2155 
2156  //**ColumnIterator class definition*************************************************************
2159  template< typename MatrixType > // Type of the dense matrix
2160  class ColumnIterator
2161  {
2162  private:
2163  //*******************************************************************************************
2165 
2170  enum { returnConst = IsConst<MatrixType>::value };
2171  //*******************************************************************************************
2172 
2173  public:
2174  //**Type definitions*************************************************************************
2176  typedef typename IfTrue< returnConst
2177  , typename MatrixType::ConstReference
2178  , typename MatrixType::Reference >::Type Reference;
2179 
2180  typedef std::random_access_iterator_tag IteratorCategory;
2181  typedef RemoveReference<Reference> ValueType;
2182  typedef ValueType* PointerType;
2183  typedef Reference ReferenceType;
2184  typedef ptrdiff_t DifferenceType;
2185 
2186  // STL iterator requirements
2187  typedef IteratorCategory iterator_category;
2188  typedef ValueType value_type;
2189  typedef PointerType pointer;
2190  typedef ReferenceType reference;
2191  typedef DifferenceType difference_type;
2192  //*******************************************************************************************
2193 
2194  //**Constructor******************************************************************************
2197  inline ColumnIterator()
2198  : matrix_( NULL ) // The dense matrix containing the column.
2199  , row_ ( 0UL ) // The current row index.
2200  , column_( 0UL ) // The current column index.
2201  {}
2202  //*******************************************************************************************
2203 
2204  //**Constructor******************************************************************************
2211  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column )
2212  : matrix_( &matrix ) // The dense matrix containing the column.
2213  , row_ ( row ) // The current row index.
2214  , column_( column ) // The current column index.
2215  {}
2216  //*******************************************************************************************
2217 
2218  //**Constructor******************************************************************************
2223  template< typename MatrixType2 >
2224  inline ColumnIterator( const ColumnIterator<MatrixType2>& it )
2225  : matrix_( it.matrix_ ) // The dense matrix containing the column.
2226  , row_ ( it.row_ ) // The current row index.
2227  , column_( it.column_ ) // The current column index.
2228  {}
2229  //*******************************************************************************************
2230 
2231  //**Addition assignment operator*************************************************************
2237  inline ColumnIterator& operator+=( size_t inc ) {
2238  row_ += inc;
2239  return *this;
2240  }
2241  //*******************************************************************************************
2242 
2243  //**Subtraction assignment operator**********************************************************
2249  inline ColumnIterator& operator-=( size_t dec ) {
2250  row_ -= dec;
2251  return *this;
2252  }
2253  //*******************************************************************************************
2254 
2255  //**Prefix increment operator****************************************************************
2260  inline ColumnIterator& operator++() {
2261  ++row_;
2262  return *this;
2263  }
2264  //*******************************************************************************************
2265 
2266  //**Postfix increment operator***************************************************************
2271  inline const ColumnIterator operator++( int ) {
2272  const ColumnIterator tmp( *this );
2273  ++(*this);
2274  return tmp;
2275  }
2276  //*******************************************************************************************
2277 
2278  //**Prefix decrement operator****************************************************************
2283  inline ColumnIterator& operator--() {
2284  --row_;
2285  return *this;
2286  }
2287  //*******************************************************************************************
2288 
2289  //**Postfix decrement operator***************************************************************
2294  inline const ColumnIterator operator--( int ) {
2295  const ColumnIterator tmp( *this );
2296  --(*this);
2297  return tmp;
2298  }
2299  //*******************************************************************************************
2300 
2301  //**Subscript operator***********************************************************************
2307  inline ReferenceType operator[]( size_t index ) const {
2308  return (*matrix_)(row_+index,column_);
2309  }
2310  //*******************************************************************************************
2311 
2312  //**Element access operator******************************************************************
2317  inline ReferenceType operator*() const {
2318  return (*matrix_)(row_,column_);
2319  }
2320  //*******************************************************************************************
2321 
2322  //**Element access operator******************************************************************
2327  inline PointerType operator->() const {
2328  return &(*matrix_)(row_,column_);
2329  }
2330  //*******************************************************************************************
2331 
2332  //**Equality operator************************************************************************
2338  template< typename MatrixType2 >
2339  inline bool operator==( const ColumnIterator<MatrixType2>& rhs ) const {
2340  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2341  }
2342  //*******************************************************************************************
2343 
2344  //**Inequality operator**********************************************************************
2350  template< typename MatrixType2 >
2351  inline bool operator!=( const ColumnIterator<MatrixType2>& rhs ) const {
2352  return !( *this == rhs );
2353  }
2354  //*******************************************************************************************
2355 
2356  //**Less-than operator***********************************************************************
2362  template< typename MatrixType2 >
2363  inline bool operator<( const ColumnIterator<MatrixType2>& rhs ) const {
2364  return ( matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
2365  }
2366  //*******************************************************************************************
2367 
2368  //**Greater-than operator********************************************************************
2374  template< typename MatrixType2 >
2375  inline bool operator>( const ColumnIterator<MatrixType2>& rhs ) const {
2376  return ( matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
2377  }
2378  //*******************************************************************************************
2379 
2380  //**Less-or-equal-than operator**************************************************************
2386  template< typename MatrixType2 >
2387  inline bool operator<=( const ColumnIterator<MatrixType2>& rhs ) const {
2388  return ( matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
2389  }
2390  //*******************************************************************************************
2391 
2392  //**Greater-or-equal-than operator***********************************************************
2398  template< typename MatrixType2 >
2399  inline bool operator>=( const ColumnIterator<MatrixType2>& rhs ) const {
2400  return ( matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
2401  }
2402  //*******************************************************************************************
2403 
2404  //**Subtraction operator*********************************************************************
2410  inline DifferenceType operator-( const ColumnIterator& rhs ) const {
2411  return row_ - rhs.row_;
2412  }
2413  //*******************************************************************************************
2414 
2415  //**Addition operator************************************************************************
2422  friend inline const ColumnIterator operator+( const ColumnIterator& it, size_t inc ) {
2423  return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2424  }
2425  //*******************************************************************************************
2426 
2427  //**Addition operator************************************************************************
2434  friend inline const ColumnIterator operator+( size_t inc, const ColumnIterator& it ) {
2435  return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2436  }
2437  //*******************************************************************************************
2438 
2439  //**Subtraction operator*********************************************************************
2446  friend inline const ColumnIterator operator-( const ColumnIterator& it, size_t dec ) {
2447  return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2448  }
2449  //*******************************************************************************************
2450 
2451  private:
2452  //**Member variables*************************************************************************
2453  MatrixType* matrix_;
2454  size_t row_;
2455  size_t column_;
2456  //*******************************************************************************************
2457 
2458  //**Friend declarations**********************************************************************
2459  template< typename MatrixType2 > friend class ColumnIterator;
2460  //*******************************************************************************************
2461  };
2462  //**********************************************************************************************
2463 
2464  //**Type definitions****************************************************************************
2466  typedef ColumnIterator<const MT> ConstIterator;
2467 
2469  typedef typename If< IsConst<MT>, ConstIterator, ColumnIterator<MT> >::Type Iterator;
2470  //**********************************************************************************************
2471 
2472  //**Compilation flags***************************************************************************
2474  enum { vectorizable = 0 };
2475 
2477  enum { smpAssignable = MT::smpAssignable };
2478  //**********************************************************************************************
2479 
2480  //**Constructors********************************************************************************
2483  explicit inline DenseColumn( MT& matrix, size_t index );
2484  // No explicitly declared copy constructor.
2486  //**********************************************************************************************
2487 
2488  //**Destructor**********************************************************************************
2489  // No explicitly declared destructor.
2490  //**********************************************************************************************
2491 
2492  //**Data access functions***********************************************************************
2495  inline Reference operator[]( size_t index );
2496  inline ConstReference operator[]( size_t index ) const;
2497  inline Reference at( size_t index );
2498  inline ConstReference at( size_t index ) const;
2499  inline Pointer data ();
2500  inline ConstPointer data () const;
2501  inline Iterator begin ();
2502  inline ConstIterator begin () const;
2503  inline ConstIterator cbegin() const;
2504  inline Iterator end ();
2505  inline ConstIterator end () const;
2506  inline ConstIterator cend () const;
2508  //**********************************************************************************************
2509 
2510  //**Assignment operators************************************************************************
2513  inline DenseColumn& operator= ( const ElementType& rhs );
2514  inline DenseColumn& operator= ( const DenseColumn& rhs );
2515 
2516  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
2517  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
2518  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
2519  template< typename VT > inline DenseColumn& operator*=( const DenseVector<VT,false>& rhs );
2520  template< typename VT > inline DenseColumn& operator*=( const SparseVector<VT,false>& rhs );
2521 
2522  template< typename Other >
2523  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
2524  operator*=( Other rhs );
2525 
2526  template< typename Other >
2527  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
2528  operator/=( Other rhs );
2530  //**********************************************************************************************
2531 
2532  //**Utility functions***************************************************************************
2535  inline size_t size() const;
2536  inline size_t capacity() const;
2537  inline size_t nonZeros() const;
2538  inline void reset();
2539  template< typename Other > inline DenseColumn& scale( const Other& scalar );
2541  //**********************************************************************************************
2542 
2543  public:
2544  //**Expression template evaluation functions****************************************************
2547  template< typename Other >
2548  inline bool canAlias ( const Other* alias ) const;
2549 
2550  template< typename MT2, bool SO2, bool SF2 >
2551  inline bool canAlias ( const DenseColumn<MT2,SO2,SF2>* alias ) const;
2552 
2553  template< typename Other >
2554  inline bool isAliased( const Other* alias ) const;
2555 
2556  template< typename MT2, bool SO2, bool SF2 >
2557  inline bool isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const;
2558 
2559  inline bool isAligned () const;
2560  inline bool canSMPAssign() 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 DenseVector <VT,false>& rhs );
2565  template< typename VT > inline void addAssign ( const SparseVector<VT,false>& rhs );
2566  template< typename VT > inline void subAssign ( const DenseVector <VT,false>& rhs );
2567  template< typename VT > inline void subAssign ( const SparseVector<VT,false>& rhs );
2568  template< typename VT > inline void multAssign( const DenseVector <VT,false>& rhs );
2569  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
2571  //**********************************************************************************************
2572 
2573  private:
2574  //**Member variables****************************************************************************
2577  Operand matrix_;
2578  const size_t col_;
2579 
2580  //**********************************************************************************************
2581 
2582  //**Friend declarations*************************************************************************
2583  template< typename MT2, bool SO2, bool SF2 > friend class DenseColumn;
2584 
2585  template< typename MT2, bool SO2, bool SF2 >
2586  friend bool isIntact( const DenseColumn<MT2,SO2,SF2>& column );
2587 
2588  template< typename MT2, bool SO2, bool SF2 >
2589  friend bool isSame( const DenseColumn<MT2,SO2,SF2>& a, const DenseColumn<MT2,SO2,SF2>& b );
2590 
2591  template< typename MT2, bool SO2, bool SF2, typename VT >
2592  friend bool tryAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
2593 
2594  template< typename MT2, bool SO2, bool SF2, typename VT >
2595  friend bool tryAddAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
2596 
2597  template< typename MT2, bool SO2, bool SF2, typename VT >
2598  friend bool trySubAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
2599 
2600  template< typename MT2, bool SO2, bool SF2, typename VT >
2601  friend bool tryMultAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
2602 
2603  template< typename MT2, bool SO2, bool SF2 >
2604  friend typename DerestrictTrait< DenseColumn<MT2,SO2,SF2> >::Type
2605  derestrict( DenseColumn<MT2,SO2,SF2>& dm );
2606  //**********************************************************************************************
2607 
2608  //**Compile time checks*************************************************************************
2616  //**********************************************************************************************
2617 };
2619 //*************************************************************************************************
2620 
2621 
2622 
2623 
2624 //=================================================================================================
2625 //
2626 // CONSTRUCTOR
2627 //
2628 //=================================================================================================
2629 
2630 //*************************************************************************************************
2638 template< typename MT > // Type of the dense matrix
2639 inline DenseColumn<MT,false,false>::DenseColumn( MT& matrix, size_t index )
2640  : matrix_( matrix ) // The dense matrix containing the column
2641  , col_ ( index ) // The index of the column in the matrix
2642 {
2643  if( matrix_.columns() <= index ) {
2644  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
2645  }
2646 }
2648 //*************************************************************************************************
2649 
2650 
2651 
2652 
2653 //=================================================================================================
2654 //
2655 // DATA ACCESS FUNCTIONS
2656 //
2657 //=================================================================================================
2658 
2659 //*************************************************************************************************
2669 template< typename MT > // Type of the dense matrix
2672 {
2673  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2674  return matrix_(index,col_);
2675 }
2677 //*************************************************************************************************
2678 
2679 
2680 //*************************************************************************************************
2690 template< typename MT > // Type of the dense matrix
2692  DenseColumn<MT,false,false>::operator[]( size_t index ) const
2693 {
2694  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2695  return const_cast<const MT&>( matrix_ )(index,col_);
2696 }
2698 //*************************************************************************************************
2699 
2700 
2701 //*************************************************************************************************
2712 template< typename MT > // Type of the dense matrix
2714  DenseColumn<MT,false,false>::at( size_t index )
2715 {
2716  if( index >= size() ) {
2717  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
2718  }
2719  return (*this)[index];
2720 }
2722 //*************************************************************************************************
2723 
2724 
2725 //*************************************************************************************************
2736 template< typename MT > // Type of the dense matrix
2738  DenseColumn<MT,false,false>::at( size_t index ) const
2739 {
2740  if( index >= size() ) {
2741  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
2742  }
2743  return (*this)[index];
2744 }
2746 //*************************************************************************************************
2747 
2748 
2749 //*************************************************************************************************
2758 template< typename MT > // Type of the dense matrix
2759 inline typename DenseColumn<MT,false,false>::Pointer DenseColumn<MT,false,false>::data()
2760 {
2761  return matrix_.data() + col_;
2762 }
2764 //*************************************************************************************************
2765 
2766 
2767 //*************************************************************************************************
2776 template< typename MT > // Type of the dense matrix
2777 inline typename DenseColumn<MT,false,false>::ConstPointer DenseColumn<MT,false,false>::data() const
2778 {
2779  return matrix_.data() + col_;
2780 }
2782 //*************************************************************************************************
2783 
2784 
2785 //*************************************************************************************************
2793 template< typename MT > // Type of the dense matrix
2795 {
2796  return Iterator( matrix_, 0UL, col_ );
2797 }
2799 //*************************************************************************************************
2800 
2801 
2802 //*************************************************************************************************
2810 template< typename MT > // Type of the dense matrix
2813 {
2814  return ConstIterator( matrix_, 0UL, col_ );
2815 }
2817 //*************************************************************************************************
2818 
2819 
2820 //*************************************************************************************************
2828 template< typename MT > // Type of the dense matrix
2831 {
2832  return ConstIterator( matrix_, 0UL, col_ );
2833 }
2835 //*************************************************************************************************
2836 
2837 
2838 //*************************************************************************************************
2846 template< typename MT > // Type of the dense matrix
2848 {
2849  return Iterator( matrix_, size(), col_ );
2850 }
2852 //*************************************************************************************************
2853 
2854 
2855 //*************************************************************************************************
2863 template< typename MT > // Type of the dense matrix
2866 {
2867  return ConstIterator( matrix_, size(), col_ );
2868 }
2870 //*************************************************************************************************
2871 
2872 
2873 //*************************************************************************************************
2881 template< typename MT > // Type of the dense matrix
2884 {
2885  return ConstIterator( matrix_, size(), col_ );
2886 }
2888 //*************************************************************************************************
2889 
2890 
2891 
2892 
2893 //=================================================================================================
2894 //
2895 // ASSIGNMENT OPERATORS
2896 //
2897 //=================================================================================================
2898 
2899 //*************************************************************************************************
2910 template< typename MT > // Type of the dense matrix
2911 inline DenseColumn<MT,false,false>&
2912  DenseColumn<MT,false,false>::operator=( const ElementType& rhs )
2913 {
2914  const size_t ibegin( ( IsLower<MT>::value )
2915  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2916  ?( col_+1UL )
2917  :( col_ ) )
2918  :( 0UL ) );
2919  const size_t iend ( ( IsUpper<MT>::value )
2920  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2921  ?( col_ )
2922  :( col_+1UL ) )
2923  :( size() ) );
2924 
2925  for( size_t i=ibegin; i<iend; ++i )
2926  matrix_(i,col_) = rhs;
2927 
2928  return *this;
2929 }
2931 //*************************************************************************************************
2932 
2933 
2934 //*************************************************************************************************
2948 template< typename MT > // Type of the dense matrix
2949 inline DenseColumn<MT,false,false>&
2950  DenseColumn<MT,false,false>::operator=( const DenseColumn& rhs )
2951 {
2952  if( &rhs == this ) return *this;
2953 
2954  if( size() != rhs.size() ) {
2955  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
2956  }
2957 
2958  if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
2959  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
2960  }
2961 
2962  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
2963 
2964  smpAssign( left, rhs );
2965 
2966  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
2967 
2968  return *this;
2969 }
2971 //*************************************************************************************************
2972 
2973 
2974 //*************************************************************************************************
2988 template< typename MT > // Type of the dense matrix
2989 template< typename VT > // Type of the right-hand side vector
2990 inline DenseColumn<MT,false,false>&
2991  DenseColumn<MT,false,false>::operator=( const Vector<VT,false>& rhs )
2992 {
2996 
2997  if( size() != (~rhs).size() ) {
2998  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
2999  }
3000 
3001  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3002  Right right( ~rhs );
3003 
3004  if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3005  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3006  }
3007 
3008  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3009 
3010  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3011  const ResultType tmp( right );
3012  smpAssign( left, tmp );
3013  }
3014  else {
3015  if( IsSparseVector<VT>::value )
3016  reset();
3017  smpAssign( left, right );
3018  }
3019 
3020  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3021 
3022  return *this;
3023 }
3025 //*************************************************************************************************
3026 
3027 
3028 //*************************************************************************************************
3042 template< typename MT > // Type of the dense matrix
3043 template< typename VT > // Type of the right-hand side vector
3044 inline DenseColumn<MT,false,false>&
3045  DenseColumn<MT,false,false>::operator+=( const Vector<VT,false>& rhs )
3046 {
3049 
3050  if( size() != (~rhs).size() ) {
3051  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3052  }
3053 
3054  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3055  Right right( ~rhs );
3056 
3057  if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
3058  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3059  }
3060 
3061  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3062 
3063  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3064  const typename VT::ResultType tmp( right );
3065  smpAddAssign( left, tmp );
3066  }
3067  else {
3068  smpAddAssign( left, right );
3069  }
3070 
3071  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3072 
3073  return *this;
3074 }
3076 //*************************************************************************************************
3077 
3078 
3079 //*************************************************************************************************
3093 template< typename MT > // Type of the dense matrix
3094 template< typename VT > // Type of the right-hand side vector
3095 inline DenseColumn<MT,false,false>&
3096  DenseColumn<MT,false,false>::operator-=( const Vector<VT,false>& rhs )
3097 {
3100 
3101  if( size() != (~rhs).size() ) {
3102  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3103  }
3104 
3105  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3106  Right right( ~rhs );
3107 
3108  if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
3109  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3110  }
3111 
3112  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3113 
3114  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3115  const typename VT::ResultType tmp( right );
3116  smpSubAssign( left, tmp );
3117  }
3118  else {
3119  smpSubAssign( left, right );
3120  }
3121 
3122  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3123 
3124  return *this;
3125 }
3127 //*************************************************************************************************
3128 
3129 
3130 //*************************************************************************************************
3143 template< typename MT > // Type of the dense matrix
3144 template< typename VT > // Type of the right-hand side dense vector
3145 inline DenseColumn<MT,false,false>&
3146  DenseColumn<MT,false,false>::operator*=( const DenseVector<VT,false>& rhs )
3147 {
3150 
3151  if( size() != (~rhs).size() ) {
3152  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3153  }
3154 
3155  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3156  Right right( ~rhs );
3157 
3158  if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
3159  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3160  }
3161 
3162  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3163 
3164  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3165  const typename VT::ResultType tmp( right );
3166  smpMultAssign( left, tmp );
3167  }
3168  else {
3169  smpMultAssign( left, right );
3170  }
3171 
3172  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3173 
3174  return *this;
3175 }
3177 //*************************************************************************************************
3178 
3179 
3180 //*************************************************************************************************
3193 template< typename MT > // Type of the dense matrix
3194 template< typename VT > // Type of the right-hand side sparse vector
3195 inline DenseColumn<MT,false,false>&
3196  DenseColumn<MT,false,false>::operator*=( const SparseVector<VT,false>& rhs )
3197 {
3201 
3202  if( size() != (~rhs).size() ) {
3203  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
3204  }
3205 
3206  const ResultType right( *this * (~rhs) );
3207 
3208  if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
3209  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
3210  }
3211 
3212  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3213 
3214  smpAssign( left, right );
3215 
3216  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
3217 
3218  return *this;
3219 }
3221 //*************************************************************************************************
3222 
3223 
3224 //*************************************************************************************************
3235 template< typename MT > // Type of the dense matrix
3236 template< typename Other > // Data type of the right-hand side scalar
3237 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,false> >::Type&
3238  DenseColumn<MT,false,false>::operator*=( Other rhs )
3239 {
3241 
3242  return operator=( (*this) * rhs );
3243 }
3245 //*************************************************************************************************
3246 
3247 
3248 //*************************************************************************************************
3261 template< typename MT > // Type of the dense matrix
3262 template< typename Other > // Data type of the right-hand side scalar
3263 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,false> >::Type&
3264  DenseColumn<MT,false,false>::operator/=( Other rhs )
3265 {
3267 
3268  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
3269 
3270  return operator=( (*this) / rhs );
3271 }
3273 //*************************************************************************************************
3274 
3275 
3276 
3277 
3278 //=================================================================================================
3279 //
3280 // UTILITY FUNCTIONS
3281 //
3282 //=================================================================================================
3283 
3284 //*************************************************************************************************
3290 template< typename MT > // Type of the dense matrix
3291 inline size_t DenseColumn<MT,false,false>::size() const
3292 {
3293  return matrix_.rows();
3294 }
3296 //*************************************************************************************************
3297 
3298 
3299 //*************************************************************************************************
3305 template< typename MT > // Type of the dense matrix
3306 inline size_t DenseColumn<MT,false,false>::capacity() const
3307 {
3308  return matrix_.rows();
3309 }
3311 //*************************************************************************************************
3312 
3313 
3314 //*************************************************************************************************
3323 template< typename MT > // Type of the dense matrix
3324 inline size_t DenseColumn<MT,false,false>::nonZeros() const
3325 {
3326  const size_t rows( size() );
3327  size_t nonzeros( 0UL );
3328 
3329  for( size_t i=0UL; i<rows; ++i )
3330  if( !isDefault( matrix_(i,col_) ) )
3331  ++nonzeros;
3332 
3333  return nonzeros;
3334 }
3336 //*************************************************************************************************
3337 
3338 
3339 //*************************************************************************************************
3345 template< typename MT > // Type of the dense matrix
3347 {
3348  using blaze::clear;
3349 
3350  const size_t ibegin( ( IsLower<MT>::value )
3351  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3352  ?( col_+1UL )
3353  :( col_ ) )
3354  :( 0UL ) );
3355  const size_t iend ( ( IsUpper<MT>::value )
3356  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3357  ?( col_ )
3358  :( col_+1UL ) )
3359  :( size() ) );
3360 
3361  for( size_t i=ibegin; i<iend; ++i )
3362  clear( matrix_(i,col_) );
3363 }
3365 //*************************************************************************************************
3366 
3367 
3368 //*************************************************************************************************
3379 template< typename MT > // Type of the dense matrix
3380 template< typename Other > // Data type of the scalar value
3381 inline DenseColumn<MT,false,false>& DenseColumn<MT,false,false>::scale( const Other& scalar )
3382 {
3384 
3385  const size_t ibegin( ( IsLower<MT>::value )
3386  ?( ( IsStrictlyLower<MT>::value )
3387  ?( col_+1UL )
3388  :( col_ ) )
3389  :( 0UL ) );
3390  const size_t iend ( ( IsUpper<MT>::value )
3391  ?( ( IsStrictlyUpper<MT>::value )
3392  ?( col_ )
3393  :( col_+1UL ) )
3394  :( size() ) );
3395 
3396  for( size_t i=ibegin; i<iend; ++i ) {
3397  matrix_(i,col_) *= scalar;
3398  }
3399 
3400  return *this;
3401 }
3403 //*************************************************************************************************
3404 
3405 
3406 
3407 
3408 //=================================================================================================
3409 //
3410 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3411 //
3412 //=================================================================================================
3413 
3414 //*************************************************************************************************
3425 template< typename MT > // Type of the dense matrix
3426 template< typename Other > // Data type of the foreign expression
3427 inline bool DenseColumn<MT,false,false>::canAlias( const Other* alias ) const
3428 {
3429  return matrix_.isAliased( alias );
3430 }
3432 //*************************************************************************************************
3433 
3434 
3435 //*************************************************************************************************
3446 template< typename MT > // Type of the dense matrix
3447 template< typename MT2 // Data type of the foreign dense column
3448  , bool SO2 // Storage order of the foreign dense column
3449  , bool SF2 > // Symmetry flag of the foreign dense column
3450 inline bool DenseColumn<MT,false,false>::canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const
3451 {
3452  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3453 }
3455 //*************************************************************************************************
3456 
3457 
3458 //*************************************************************************************************
3469 template< typename MT > // Type of the dense matrix
3470 template< typename Other > // Data type of the foreign expression
3471 inline bool DenseColumn<MT,false,false>::isAliased( const Other* alias ) const
3472 {
3473  return matrix_.isAliased( alias );
3474 }
3476 //*************************************************************************************************
3477 
3478 
3479 //*************************************************************************************************
3490 template< typename MT > // Type of the dense matrix
3491 template< typename MT2 // Data type of the foreign dense column
3492  , bool SO2 // Storage order of the foreign dense column
3493  , bool SF2 > // Symmetry flag of the foreign dense column
3494 inline bool DenseColumn<MT,false,false>::isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const
3495 {
3496  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3497 }
3499 //*************************************************************************************************
3500 
3501 
3502 //*************************************************************************************************
3512 template< typename MT > // Type of the dense matrix
3513 inline bool DenseColumn<MT,false,false>::isAligned() const
3514 {
3515  return false;
3516 }
3518 //*************************************************************************************************
3519 
3520 
3521 //*************************************************************************************************
3532 template< typename MT > // Type of the dense matrix
3534 {
3535  return ( size() > SMP_DVECASSIGN_THRESHOLD );
3536 }
3538 //*************************************************************************************************
3539 
3540 
3541 //*************************************************************************************************
3553 template< typename MT > // Type of the dense matrix
3554 template< typename VT > // Type of the right-hand side dense vector
3555 inline void DenseColumn<MT,false,false>::assign( const DenseVector<VT,false>& rhs )
3556 {
3557  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3558 
3559  const size_t ipos( (~rhs).size() & size_t(-2) );
3560  for( size_t i=0UL; i<ipos; i+=2UL ) {
3561  matrix_(i ,col_) = (~rhs)[i ];
3562  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
3563  }
3564  if( ipos < (~rhs).size() )
3565  matrix_(ipos,col_) = (~rhs)[ipos];
3566 }
3568 //*************************************************************************************************
3569 
3570 
3571 //*************************************************************************************************
3583 template< typename MT > // Type of the dense matrix
3584 template< typename VT > // Type of the right-hand side sparse vector
3585 inline void DenseColumn<MT,false,false>::assign( const SparseVector<VT,false>& rhs )
3586 {
3587  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3588 
3589  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3590  matrix_(element->index(),col_) = element->value();
3591 }
3593 //*************************************************************************************************
3594 
3595 
3596 //*************************************************************************************************
3608 template< typename MT > // Type of the dense matrix
3609 template< typename VT > // Type of the right-hand side dense vector
3610 inline void DenseColumn<MT,false,false>::addAssign( const DenseVector<VT,false>& rhs )
3611 {
3612  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3613 
3614  const size_t ipos( (~rhs).size() & size_t(-2) );
3615  for( size_t i=0UL; i<ipos; i+=2UL ) {
3616  matrix_(i ,col_) += (~rhs)[i ];
3617  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
3618  }
3619  if( ipos < (~rhs).size() )
3620  matrix_(ipos,col_) += (~rhs)[ipos];
3621 }
3623 //*************************************************************************************************
3624 
3625 
3626 //*************************************************************************************************
3638 template< typename MT > // Type of the dense matrix
3639 template< typename VT > // Type of the right-hand side sparse vector
3640 inline void DenseColumn<MT,false,false>::addAssign( const SparseVector<VT,false>& rhs )
3641 {
3642  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3643 
3644  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3645  matrix_(element->index(),col_) += element->value();
3646 }
3648 //*************************************************************************************************
3649 
3650 
3651 //*************************************************************************************************
3663 template< typename MT > // Type of the dense matrix
3664 template< typename VT > // Type of the right-hand side dense vector
3665 inline void DenseColumn<MT,false,false>::subAssign( const DenseVector<VT,false>& rhs )
3666 {
3667  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3668 
3669  const size_t ipos( (~rhs).size() & size_t(-2) );
3670  for( size_t i=0UL; i<ipos; i+=2UL ) {
3671  matrix_(i ,col_) -= (~rhs)[i ];
3672  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
3673  }
3674  if( ipos < (~rhs).size() )
3675  matrix_(ipos,col_) -= (~rhs)[ipos];
3676 }
3678 //*************************************************************************************************
3679 
3680 
3681 //*************************************************************************************************
3693 template< typename MT > // Type of the dense matrix
3694 template< typename VT > // Type of the right-hand side sparse vector
3695 inline void DenseColumn<MT,false,false>::subAssign( const SparseVector<VT,false>& rhs )
3696 {
3697  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3698 
3699  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3700  matrix_(element->index(),col_) -= element->value();
3701 }
3703 //*************************************************************************************************
3704 
3705 
3706 //*************************************************************************************************
3718 template< typename MT > // Type of the dense matrix
3719 template< typename VT > // Type of the right-hand side dense vector
3720 inline void DenseColumn<MT,false,false>::multAssign( const DenseVector<VT,false>& rhs )
3721 {
3722  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3723 
3724  const size_t ipos( (~rhs).size() & size_t(-2) );
3725  for( size_t i=0UL; i<ipos; i+=2UL ) {
3726  matrix_(i ,col_) *= (~rhs)[i ];
3727  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
3728  }
3729  if( ipos < (~rhs).size() )
3730  matrix_(ipos,col_) *= (~rhs)[ipos];
3731 }
3733 //*************************************************************************************************
3734 
3735 
3736 //*************************************************************************************************
3748 template< typename MT > // Type of the dense matrix
3749 template< typename VT > // Type of the right-hand side sparse vector
3750 inline void DenseColumn<MT,false,false>::multAssign( const SparseVector<VT,false>& rhs )
3751 {
3752  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3753 
3754  const ResultType tmp( serial( *this ) );
3755 
3756  reset();
3757 
3758  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3759  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
3760 }
3762 //*************************************************************************************************
3763 
3764 
3765 
3766 
3767 
3768 
3769 
3770 
3771 //=================================================================================================
3772 //
3773 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC ROW-MAJOR MATRICES
3774 //
3775 //=================================================================================================
3776 
3777 //*************************************************************************************************
3785 template< typename MT > // Type of the dense matrix
3786 class DenseColumn<MT,false,true> : public DenseVector< DenseColumn<MT,false,true>, false >
3787  , private Column
3788 {
3789  private:
3790  //**Type definitions****************************************************************************
3792  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
3793 
3795  typedef IntrinsicTrait<typename MT::ElementType> IT;
3796  //**********************************************************************************************
3797 
3798  public:
3799  //**Type definitions****************************************************************************
3800  typedef DenseColumn<MT,false,true> This;
3801  typedef typename ColumnTrait<MT>::Type ResultType;
3802  typedef typename ResultType::TransposeType TransposeType;
3803  typedef typename MT::ElementType ElementType;
3804  typedef typename IT::Type IntrinsicType;
3805  typedef typename MT::ReturnType ReturnType;
3806  typedef const DenseColumn& CompositeType;
3807 
3809  typedef typename MT::ConstReference ConstReference;
3810 
3812  typedef typename If< IsConst<MT>, ConstReference, typename MT::Reference >::Type Reference;
3813 
3815  typedef const ElementType* ConstPointer;
3816 
3818  typedef typename If< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >
3819  , ConstPointer, ElementType* >::Type Pointer;
3820 
3822  typedef typename MT::ConstIterator ConstIterator;
3823 
3825  typedef typename If< IsConst<MT>, ConstIterator, typename MT::Iterator >::Type Iterator;
3826  //**********************************************************************************************
3827 
3828  //**Compilation flags***************************************************************************
3830  enum { vectorizable = MT::vectorizable };
3831 
3833  enum { smpAssignable = MT::smpAssignable };
3834  //**********************************************************************************************
3835 
3836  //**Constructors********************************************************************************
3839  explicit inline DenseColumn( MT& matrix, size_t index );
3840  // No explicitly declared copy constructor.
3842  //**********************************************************************************************
3843 
3844  //**Destructor**********************************************************************************
3845  // No explicitly declared destructor.
3846  //**********************************************************************************************
3847 
3848  //**Data access functions***********************************************************************
3851  inline Reference operator[]( size_t index );
3852  inline ConstReference operator[]( size_t index ) const;
3853  inline Reference at( size_t index );
3854  inline ConstReference at( size_t index ) const;
3855  inline Pointer data ();
3856  inline ConstPointer data () const;
3857  inline Iterator begin ();
3858  inline ConstIterator begin () const;
3859  inline ConstIterator cbegin() const;
3860  inline Iterator end ();
3861  inline ConstIterator end () const;
3862  inline ConstIterator cend () const;
3864  //**********************************************************************************************
3865 
3866  //**Assignment operators************************************************************************
3869  inline DenseColumn& operator=( const ElementType& rhs );
3870  inline DenseColumn& operator=( const DenseColumn& rhs );
3871 
3872  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
3873  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
3874  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
3875  template< typename VT > inline DenseColumn& operator*=( const DenseVector<VT,false>& rhs );
3876  template< typename VT > inline DenseColumn& operator*=( const SparseVector<VT,false>& rhs );
3877 
3878  template< typename Other >
3879  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
3880  operator*=( Other rhs );
3881 
3882  template< typename Other >
3883  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
3884  operator/=( Other rhs );
3886  //**********************************************************************************************
3887 
3888  //**Utility functions***************************************************************************
3891  inline size_t size() const;
3892  inline size_t capacity() const;
3893  inline size_t nonZeros() const;
3894  inline void reset();
3895  template< typename Other > inline DenseColumn& scale( const Other& scalar );
3897  //**********************************************************************************************
3898 
3899  private:
3900  //**********************************************************************************************
3902  template< typename VT >
3903  struct VectorizedAssign {
3904  enum { value = useOptimizedKernels &&
3905  vectorizable && VT::vectorizable &&
3906  IsSame<ElementType,typename VT::ElementType>::value };
3907  };
3908  //**********************************************************************************************
3909 
3910  //**********************************************************************************************
3912  template< typename VT >
3913  struct VectorizedAddAssign {
3914  enum { value = useOptimizedKernels &&
3915  vectorizable && VT::vectorizable &&
3916  IsSame<ElementType,typename VT::ElementType>::value &&
3917  IntrinsicTrait<ElementType>::addition };
3918  };
3919  //**********************************************************************************************
3920 
3921  //**********************************************************************************************
3923  template< typename VT >
3924  struct VectorizedSubAssign {
3925  enum { value = useOptimizedKernels &&
3926  vectorizable && VT::vectorizable &&
3927  IsSame<ElementType,typename VT::ElementType>::value &&
3928  IntrinsicTrait<ElementType>::subtraction };
3929  };
3930  //**********************************************************************************************
3931 
3932  //**********************************************************************************************
3934  template< typename VT >
3935  struct VectorizedMultAssign {
3936  enum { value = useOptimizedKernels &&
3937  vectorizable && VT::vectorizable &&
3938  IsSame<ElementType,typename VT::ElementType>::value &&
3939  IntrinsicTrait<ElementType>::multiplication };
3940  };
3941  //**********************************************************************************************
3942 
3943  public:
3944  //**Expression template evaluation functions****************************************************
3947  template< typename Other >
3948  inline bool canAlias( const Other* alias ) const;
3949 
3950  template< typename MT2, bool SO2, bool SF2 >
3951  inline bool canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const;
3952 
3953  template< typename Other >
3954  inline bool isAliased( const Other* alias ) const;
3955 
3956  template< typename MT2, bool SO2, bool SF2 >
3957  inline bool isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const;
3958 
3959  inline bool isAligned () const;
3960  inline bool canSMPAssign() const;
3961 
3962  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
3963  BLAZE_ALWAYS_INLINE IntrinsicType loada( size_t index ) const;
3964  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
3965 
3966  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
3967  BLAZE_ALWAYS_INLINE void storea( size_t index, const IntrinsicType& value );
3968  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
3969  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
3970 
3971  template< typename VT >
3972  inline typename DisableIf< VectorizedAssign<VT> >::Type
3973  assign( const DenseVector<VT,false>& rhs );
3974 
3975  template< typename VT >
3976  inline typename EnableIf< VectorizedAssign<VT> >::Type
3977  assign( const DenseVector<VT,false>& rhs );
3978 
3979  template< typename VT > inline void assign( const SparseVector<VT,false>& rhs );
3980 
3981  template< typename VT >
3982  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
3983  addAssign( const DenseVector<VT,false>& rhs );
3984 
3985  template< typename VT >
3986  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
3987  addAssign( const DenseVector<VT,false>& rhs );
3988 
3989  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
3990 
3991  template< typename VT >
3992  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
3993  subAssign( const DenseVector<VT,false>& rhs );
3994 
3995  template< typename VT >
3996  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
3997  subAssign( const DenseVector<VT,false>& rhs );
3998 
3999  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
4000 
4001  template< typename VT >
4002  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
4003  multAssign( const DenseVector<VT,false>& rhs );
4004 
4005  template< typename VT >
4006  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
4007  multAssign( const DenseVector<VT,false>& rhs );
4008 
4009  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
4011  //**********************************************************************************************
4012 
4013  private:
4014  //**Member variables****************************************************************************
4017  Operand matrix_;
4018  const size_t col_;
4019 
4020  //**********************************************************************************************
4021 
4022  //**Friend declarations*************************************************************************
4023  template< typename MT2, bool SO2, bool SF2 > friend class DenseColumn;
4024 
4025  template< typename MT2, bool SO2, bool SF2 >
4026  friend bool isIntact( const DenseColumn<MT2,SO2,SF2>& column );
4027 
4028  template< typename MT2, bool SO2, bool SF2 >
4029  friend bool isSame( const DenseColumn<MT2,SO2,SF2>& a, const DenseColumn<MT2,SO2,SF2>& b );
4030 
4031  template< typename MT2, bool SO2, bool SF2, typename VT >
4032  friend bool tryAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
4033 
4034  template< typename MT2, bool SO2, bool SF2, typename VT >
4035  friend bool tryAddAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
4036 
4037  template< typename MT2, bool SO2, bool SF2, typename VT >
4038  friend bool trySubAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
4039 
4040  template< typename MT2, bool SO2, bool SF2, typename VT >
4041  friend bool tryMultAssign( const DenseColumn<MT2,SO2,SF2>& lhs, const Vector<VT,false>& rhs, size_t index );
4042 
4043  template< typename MT2, bool SO2, bool SF2 >
4044  friend typename DerestrictTrait< DenseColumn<MT2,SO2,SF2> >::Type
4045  derestrict( DenseColumn<MT2,SO2,SF2>& dm );
4046  //**********************************************************************************************
4047 
4048  //**Compile time checks*************************************************************************
4056  //**********************************************************************************************
4057 };
4059 //*************************************************************************************************
4060 
4061 
4062 
4063 
4064 //=================================================================================================
4065 //
4066 // CONSTRUCTOR
4067 //
4068 //=================================================================================================
4069 
4070 //*************************************************************************************************
4078 template< typename MT > // Type of the dense matrix
4079 inline DenseColumn<MT,false,true>::DenseColumn( MT& matrix, size_t index )
4080  : matrix_( matrix ) // The dense matrix containing the column
4081  , col_ ( index ) // The index of the column in the matrix
4082 {
4083  if( matrix_.columns() <= index ) {
4084  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
4085  }
4086 }
4088 //*************************************************************************************************
4089 
4090 
4091 
4092 
4093 //=================================================================================================
4094 //
4095 // DATA ACCESS FUNCTIONS
4096 //
4097 //=================================================================================================
4098 
4099 //*************************************************************************************************
4109 template< typename MT > // Type of the dense matrix
4112 {
4113  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4114  return matrix_(col_,index);
4115 }
4117 //*************************************************************************************************
4118 
4119 
4120 //*************************************************************************************************
4130 template< typename MT > // Type of the dense matrix
4132  DenseColumn<MT,false,true>::operator[]( size_t index ) const
4133 {
4134  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4135  return const_cast<const MT&>( matrix_ )(index,col_);
4136 }
4138 //*************************************************************************************************
4139 
4140 
4141 //*************************************************************************************************
4152 template< typename MT > // Type of the dense matrix
4154  DenseColumn<MT,false,true>::at( size_t index )
4155 {
4156  if( index >= size() ) {
4157  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4158  }
4159  return (*this)[index];
4160 }
4162 //*************************************************************************************************
4163 
4164 
4165 //*************************************************************************************************
4176 template< typename MT > // Type of the dense matrix
4178  DenseColumn<MT,false,true>::at( size_t index ) const
4179 {
4180  if( index >= size() ) {
4181  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4182  }
4183  return (*this)[index];
4184 }
4186 //*************************************************************************************************
4187 
4188 
4189 //*************************************************************************************************
4198 template< typename MT > // Type of the dense matrix
4199 inline typename DenseColumn<MT,false,true>::Pointer DenseColumn<MT,false,true>::data()
4200 {
4201  return matrix_.data( col_ );
4202 }
4204 //*************************************************************************************************
4205 
4206 
4207 //*************************************************************************************************
4216 template< typename MT > // Type of the dense matrix
4217 inline typename DenseColumn<MT,false,true>::ConstPointer DenseColumn<MT,false,true>::data() const
4218 {
4219  return matrix_.data( col_ );
4220 }
4222 //*************************************************************************************************
4223 
4224 
4225 //*************************************************************************************************
4233 template< typename MT > // Type of the dense matrix
4235 {
4236  return matrix_.begin( col_ );
4237 }
4239 //*************************************************************************************************
4240 
4241 
4242 //*************************************************************************************************
4250 template< typename MT > // Type of the dense matrix
4252 {
4253  return matrix_.cbegin( col_ );
4254 }
4256 //*************************************************************************************************
4257 
4258 
4259 //*************************************************************************************************
4267 template< typename MT > // Type of the dense matrix
4269 {
4270  return matrix_.cbegin( col_ );
4271 }
4273 //*************************************************************************************************
4274 
4275 
4276 //*************************************************************************************************
4284 template< typename MT > // Type of the dense matrix
4286 {
4287  return matrix_.end( col_ );
4288 }
4290 //*************************************************************************************************
4291 
4292 
4293 //*************************************************************************************************
4301 template< typename MT > // Type of the dense matrix
4303 {
4304  return matrix_.cend( col_ );
4305 }
4307 //*************************************************************************************************
4308 
4309 
4310 //*************************************************************************************************
4318 template< typename MT > // Type of the dense matrix
4320 {
4321  return matrix_.cend( col_ );
4322 }
4324 //*************************************************************************************************
4325 
4326 
4327 
4328 
4329 //=================================================================================================
4330 //
4331 // ASSIGNMENT OPERATORS
4332 //
4333 //=================================================================================================
4334 
4335 //*************************************************************************************************
4342 template< typename MT > // Type of the dense matrix
4343 inline DenseColumn<MT,false,true>& DenseColumn<MT,false,true>::operator=( const ElementType& rhs )
4344 {
4345  const size_t jbegin( ( IsUpper<MT>::value )
4346  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4347  ?( col_+1UL )
4348  :( col_ ) )
4349  :( 0UL ) );
4350  const size_t jend ( ( IsLower<MT>::value )
4351  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4352  ?( col_ )
4353  :( col_+1UL ) )
4354  :( size() ) );
4355 
4356  for( size_t j=jbegin; j<jend; ++j )
4357  matrix_(col_,j) = rhs;
4358 
4359  return *this;
4360 }
4362 //*************************************************************************************************
4363 
4364 
4365 //*************************************************************************************************
4379 template< typename MT > // Type of the dense matrix
4380 inline DenseColumn<MT,false,true>& DenseColumn<MT,false,true>::operator=( const DenseColumn& rhs )
4381 {
4382  if( &rhs == this ) return *this;
4383 
4384  if( size() != rhs.size() ) {
4385  BLAZE_THROW_INVALID_ARGUMENT( "Column sizes do not match" );
4386  }
4387 
4388  if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4389  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4390  }
4391 
4392  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4393 
4394  smpAssign( left, rhs );
4395 
4396  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4397 
4398  return *this;
4399 }
4401 //*************************************************************************************************
4402 
4403 
4404 //*************************************************************************************************
4418 template< typename MT > // Type of the dense matrix
4419 template< typename VT > // Type of the right-hand side vector
4420 inline DenseColumn<MT,false,true>&
4421  DenseColumn<MT,false,true>::operator=( const Vector<VT,false>& rhs )
4422 {
4425 
4426  if( size() != (~rhs).size() ) {
4427  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4428  }
4429 
4430  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4431  Right right( ~rhs );
4432 
4433  if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4434  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4435  }
4436 
4437  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4438 
4439  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4440  const typename VT::ResultType tmp( right );
4441  smpAssign( left, tmp );
4442  }
4443  else {
4444  if( IsSparseVector<VT>::value )
4445  reset();
4446  smpAssign( left, right );
4447  }
4448 
4449  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4450 
4451  return *this;
4452 }
4454 //*************************************************************************************************
4455 
4456 
4457 //*************************************************************************************************
4471 template< typename MT > // Type of the dense matrix
4472 template< typename VT > // Type of the right-hand side vector
4473 inline DenseColumn<MT,false,true>&
4474  DenseColumn<MT,false,true>::operator+=( const Vector<VT,false>& rhs )
4475 {
4478 
4479  if( size() != (~rhs).size() ) {
4480  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4481  }
4482 
4483  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4484  Right right( ~rhs );
4485 
4486  if( !tryAddAssign( matrix_, right, 0UL, col_ ) ) {
4487  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4488  }
4489 
4490  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4491 
4492  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4493  const typename VT::ResultType tmp( right );
4494  smpAddAssign( left, tmp );
4495  }
4496  else {
4497  smpAddAssign( left, right );
4498  }
4499 
4500  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4501 
4502  return *this;
4503 }
4505 //*************************************************************************************************
4506 
4507 
4508 //*************************************************************************************************
4522 template< typename MT > // Type of the dense matrix
4523 template< typename VT > // Type of the right-hand side vector
4524 inline DenseColumn<MT,false,true>&
4525  DenseColumn<MT,false,true>::operator-=( const Vector<VT,false>& rhs )
4526 {
4529 
4530  if( size() != (~rhs).size() ) {
4531  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4532  }
4533 
4534  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4535  Right right( ~rhs );
4536 
4537  if( !trySubAssign( matrix_, right, 0UL, col_ ) ) {
4538  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4539  }
4540 
4541  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4542 
4543  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4544  const typename VT::ResultType tmp( right );
4545  smpSubAssign( left, tmp );
4546  }
4547  else {
4548  smpSubAssign( left, right );
4549  }
4550 
4551  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4552 
4553  return *this;
4554 }
4556 //*************************************************************************************************
4557 
4558 
4559 //*************************************************************************************************
4572 template< typename MT > // Type of the dense matrix
4573 template< typename VT > // Type of the right-hand side dense vector
4574 inline DenseColumn<MT,false,true>&
4575  DenseColumn<MT,false,true>::operator*=( const DenseVector<VT,false>& rhs )
4576 {
4579 
4580  if( size() != (~rhs).size() ) {
4581  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4582  }
4583 
4584  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4585  Right right( ~rhs );
4586 
4587  if( !tryMultAssign( matrix_, right, 0UL, col_ ) ) {
4588  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4589  }
4590 
4591  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4592 
4593  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4594  const typename VT::ResultType tmp( right );
4595  smpMultAssign( left, tmp );
4596  }
4597  else {
4598  smpMultAssign( left, right );
4599  }
4600 
4601  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4602 
4603  return *this;
4604 }
4606 //*************************************************************************************************
4607 
4608 
4609 //*************************************************************************************************
4622 template< typename MT > // Type of the dense matrix
4623 template< typename VT > // Type of the right-hand side sparse vector
4624 inline DenseColumn<MT,false,true>&
4625  DenseColumn<MT,false,true>::operator*=( const SparseVector<VT,false>& rhs )
4626 {
4630 
4631  if( size() != (~rhs).size() ) {
4632  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
4633  }
4634 
4635  const ResultType right( *this * (~rhs) );
4636 
4637  if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4638  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to restricted matrix" );
4639  }
4640 
4641  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4642 
4643  smpAssign( left, right );
4644 
4645  BLAZE_INTERNAL_ASSERT( isIntact( matrix_ ), "Invariant violation detected" );
4646 
4647  return *this;
4648 }
4650 //*************************************************************************************************
4651 
4652 
4653 //*************************************************************************************************
4664 template< typename MT > // Type of the dense matrix
4665 template< typename Other > // Data type of the right-hand side scalar
4666 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,true> >::Type&
4667  DenseColumn<MT,false,true>::operator*=( Other rhs )
4668 {
4670 
4671  return operator=( (*this) * rhs );
4672 }
4674 //*************************************************************************************************
4675 
4676 
4677 //*************************************************************************************************
4690 template< typename MT > // Type of the dense matrix
4691 template< typename Other > // Data type of the right-hand side scalar
4692 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,true> >::Type&
4693  DenseColumn<MT,false,true>::operator/=( Other rhs )
4694 {
4696 
4697  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
4698 
4699  return operator=( (*this) / rhs );
4700 }
4702 //*************************************************************************************************
4703 
4704 
4705 
4706 
4707 //=================================================================================================
4708 //
4709 // UTILITY FUNCTIONS
4710 //
4711 //=================================================================================================
4712 
4713 //*************************************************************************************************
4719 template< typename MT > // Type of the dense matrix
4720 inline size_t DenseColumn<MT,false,true>::size() const
4721 {
4722  return matrix_.rows();
4723 }
4725 //*************************************************************************************************
4726 
4727 
4728 //*************************************************************************************************
4734 template< typename MT > // Type of the dense matrix
4735 inline size_t DenseColumn<MT,false,true>::capacity() const
4736 {
4737  return matrix_.capacity( col_ );
4738 }
4740 //*************************************************************************************************
4741 
4742 
4743 //*************************************************************************************************
4752 template< typename MT > // Type of the dense matrix
4753 inline size_t DenseColumn<MT,false,true>::nonZeros() const
4754 {
4755  return matrix_.nonZeros( col_ );
4756 }
4758 //*************************************************************************************************
4759 
4760 
4761 //*************************************************************************************************
4767 template< typename MT > // Type of the dense matrix
4769 {
4770  matrix_.reset( col_ );
4771 }
4773 //*************************************************************************************************
4774 
4775 
4776 //*************************************************************************************************
4787 template< typename MT > // Type of the dense matrix
4788 template< typename Other > // Data type of the scalar value
4789 inline DenseColumn<MT,false,true>& DenseColumn<MT,false,true>::scale( const Other& scalar )
4790 {
4792 
4793  const size_t jbegin( ( IsUpper<MT>::value )
4794  ?( ( IsStrictlyUpper<MT>::value )
4795  ?( col_+1UL )
4796  :( col_ ) )
4797  :( 0UL ) );
4798  const size_t jend ( ( IsLower<MT>::value )
4799  ?( ( IsStrictlyLower<MT>::value )
4800  ?( col_ )
4801  :( col_+1UL ) )
4802  :( size() ) );
4803 
4804  for( size_t j=jbegin; j<jend; ++j ) {
4805  matrix_(col_,j) *= scalar;
4806  }
4807 
4808  return *this;
4809 }
4811 //*************************************************************************************************
4812 
4813 
4814 
4815 
4816 //=================================================================================================
4817 //
4818 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
4819 //
4820 //=================================================================================================
4821 
4822 //*************************************************************************************************
4833 template< typename MT > // Type of the dense matrix
4834 template< typename Other > // Data type of the foreign expression
4835 inline bool DenseColumn<MT,false,true>::canAlias( const Other* alias ) const
4836 {
4837  return matrix_.isAliased( alias );
4838 }
4840 //*************************************************************************************************
4841 
4842 
4843 //*************************************************************************************************
4854 template< typename MT > // Type of the dense matrix
4855 template< typename MT2 // Data type of the foreign dense column
4856  , bool SO2 // Storage order of the foreign dense column
4857  , bool SF2 > // Symmetry flag of the foreign dense column
4858 inline bool DenseColumn<MT,false,true>::canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const
4859 {
4860  return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
4861 }
4863 //*************************************************************************************************
4864 
4865 
4866 //*************************************************************************************************
4877 template< typename MT > // Type of the dense matrix
4878 template< typename Other > // Data type of the foreign expression
4879 inline bool DenseColumn<MT,false,true>::isAliased( const Other* alias ) const
4880 {
4881  return matrix_.isAliased( alias );
4882 }
4884 //*************************************************************************************************
4885 
4886 
4887 //*************************************************************************************************
4898 template< typename MT > // Type of the dense matrix
4899 template< typename MT2 // Data type of the foreign dense column
4900  , bool SO2 // Storage order of the foreign dense column
4901  , bool SF2 > // Symmetry flag of the foreign dense column
4902 inline bool DenseColumn<MT,false,true>::isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const
4903 {
4904  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
4905 }
4907 //*************************************************************************************************
4908 
4909 
4910 //*************************************************************************************************
4920 template< typename MT > // Type of the dense matrix
4921 inline bool DenseColumn<MT,false,true>::isAligned() const
4922 {
4923  return matrix_.isAligned();
4924 }
4926 //*************************************************************************************************
4927 
4928 
4929 //*************************************************************************************************
4940 template< typename MT > // Type of the dense matrix
4941 inline bool DenseColumn<MT,false,true>::canSMPAssign() const
4942 {
4943  return ( size() > SMP_DVECASSIGN_THRESHOLD );
4944 }
4946 //*************************************************************************************************
4947 
4948 
4949 //*************************************************************************************************
4962 template< typename MT > // Type of the dense matrix
4963 BLAZE_ALWAYS_INLINE typename DenseColumn<MT,false,true>::IntrinsicType
4964  DenseColumn<MT,false,true>::load( size_t index ) const
4965 {
4966  return matrix_.load( col_, index );
4967 }
4969 //*************************************************************************************************
4970 
4971 
4972 //*************************************************************************************************
4985 template< typename MT > // Type of the dense matrix
4986 BLAZE_ALWAYS_INLINE typename DenseColumn<MT,false,true>::IntrinsicType
4987  DenseColumn<MT,false,true>::loada( size_t index ) const
4988 {
4989  return matrix_.loada( col_, index );
4990 }
4992 //*************************************************************************************************
4993 
4994 
4995 //*************************************************************************************************
5008 template< typename MT > // Type of the dense matrix
5009 BLAZE_ALWAYS_INLINE typename DenseColumn<MT,false,true>::IntrinsicType
5010  DenseColumn<MT,false,true>::loadu( size_t index ) const
5011 {
5012  return matrix_.loadu( col_, index );
5013 }
5015 //*************************************************************************************************
5016 
5017 
5018 //*************************************************************************************************
5032 template< typename MT > // Type of the dense matrix
5033 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::store( size_t index, const IntrinsicType& value )
5034 {
5035  matrix_.store( col_, index, value );
5036 }
5038 //*************************************************************************************************
5039 
5040 
5041 //*************************************************************************************************
5055 template< typename MT > // Type of the dense matrix
5056 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::storea( size_t index, const IntrinsicType& value )
5057 {
5058  matrix_.storea( col_, index, value );
5059 }
5061 //*************************************************************************************************
5062 
5063 
5064 //*************************************************************************************************
5078 template< typename MT > // Type of the dense matrix
5079 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::storeu( size_t index, const IntrinsicType& value )
5080 {
5081  matrix_.storeu( col_, index, value );
5082 }
5084 //*************************************************************************************************
5085 
5086 
5087 //*************************************************************************************************
5101 template< typename MT > // Type of the dense matrix
5102 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::stream( size_t index, const IntrinsicType& value )
5103 {
5104  matrix_.stream( col_, index, value );
5105 }
5107 //*************************************************************************************************
5108 
5109 
5110 //*************************************************************************************************
5122 template< typename MT > // Type of the dense matrix
5123 template< typename VT > // Type of the right-hand side dense vector
5124 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5125  DenseColumn<MT,false,true>::assign( const DenseVector<VT,false>& rhs )
5126 {
5127  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5128 
5129  const size_t jpos( (~rhs).size() & size_t(-2) );
5130  for( size_t j=0UL; j<jpos; j+=2UL ) {
5131  matrix_(col_,j ) = (~rhs)[j ];
5132  matrix_(col_,j+1UL) = (~rhs)[j+1UL];
5133  }
5134  if( jpos < (~rhs).size() )
5135  matrix_(col_,jpos) = (~rhs)[jpos];
5136 }
5138 //*************************************************************************************************
5139 
5140 
5141 //*************************************************************************************************
5153 template< typename MT > // Type of the dense matrix
5154 template< typename VT > // Type of the right-hand side dense vector
5155 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5156  DenseColumn<MT,false,true>::assign( const DenseVector<VT,false>& rhs )
5157 {
5159 
5160  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5161 
5162  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5163  const size_t columns( size() );
5164 
5165  const size_t jpos( ( remainder )?( columns & size_t(-IT::size) ):( columns ) );
5166  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (IT::size) ) ) == jpos, "Invalid end calculation" );
5167 
5168  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( this ) )
5169  {
5170  size_t j( 0UL );
5171 
5172  for( ; j<jpos; j+=IT::size ) {
5173  matrix_.stream( col_, j, (~rhs).load(j) );
5174  }
5175  for( ; remainder && j<columns; ++j ) {
5176  matrix_(col_,j) = (~rhs)[j];
5177  }
5178  }
5179  else
5180  {
5181  size_t j( 0UL );
5182  typename VT::ConstIterator it( (~rhs).begin() );
5183 
5184  for( ; (j+IT::size*3UL) < jpos; j+=IT::size*4UL ) {
5185  matrix_.store( col_, j , it.load() ); it+=IT::size;
5186  matrix_.store( col_, j+IT::size , it.load() ); it+=IT::size;
5187  matrix_.store( col_, j+IT::size*2UL, it.load() ); it+=IT::size;
5188  matrix_.store( col_, j+IT::size*3UL, it.load() ); it+=IT::size;
5189  }
5190  for( ; j<jpos; j+=IT::size, it+=IT::size ) {
5191  matrix_.store( col_, j, it.load() );
5192  }
5193  for( ; remainder && j<columns; ++j, ++it ) {
5194  matrix_(col_,j) = *it;
5195  }
5196  }
5197 }
5199 //*************************************************************************************************
5200 
5201 
5202 //*************************************************************************************************
5214 template< typename MT > // Type of the dense matrix
5215 template< typename VT > // Type of the right-hand side sparse vector
5216 inline void DenseColumn<MT,false,true>::assign( const SparseVector<VT,false>& rhs )
5217 {
5218  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5219 
5220  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5221  matrix_(col_,element->index()) = element->value();
5222 }
5224 //*************************************************************************************************
5225 
5226 
5227 //*************************************************************************************************
5239 template< typename MT > // Type of the dense matrix
5240 template< typename VT > // Type of the right-hand side dense vector
5241 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5242  DenseColumn<MT,false,true>::addAssign( const DenseVector<VT,false>& rhs )
5243 {
5244  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5245 
5246  const size_t jpos( (~rhs).size() & size_t(-2) );
5247  for( size_t j=0UL; j<jpos; j+=2UL ) {
5248  matrix_(col_,j ) += (~rhs)[j ];
5249  matrix_(col_,j+1UL) += (~rhs)[j+1UL];
5250  }
5251  if( jpos < (~rhs).size() )
5252  matrix_(col_,jpos) += (~rhs)[jpos];
5253 }
5255 //*************************************************************************************************
5256 
5257 
5258 //*************************************************************************************************
5270 template< typename MT > // Type of the dense matrix
5271 template< typename VT > // Type of the right-hand side dense vector
5272 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5273  DenseColumn<MT,false,true>::addAssign( const DenseVector<VT,false>& rhs )
5274 {
5276 
5277  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5278 
5279  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5280  const size_t columns( size() );
5281 
5282  const size_t jpos( ( remainder )?( columns & size_t(-IT::size) ):( columns ) );
5283  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (IT::size) ) ) == jpos, "Invalid end calculation" );
5284 
5285  size_t j( 0UL );
5286  typename VT::ConstIterator it( (~rhs).begin() );
5287 
5288  for( ; (j+IT::size*3UL) < jpos; j+=IT::size*4UL ) {
5289  matrix_.store( col_, j , matrix_.load(col_,j ) + it.load() ); it += IT::size;
5290  matrix_.store( col_, j+IT::size , matrix_.load(col_,j+IT::size ) + it.load() ); it += IT::size;
5291  matrix_.store( col_, j+IT::size*2UL, matrix_.load(col_,j+IT::size*2UL) + it.load() ); it += IT::size;
5292  matrix_.store( col_, j+IT::size*3UL, matrix_.load(col_,j+IT::size*3UL) + it.load() ); it += IT::size;
5293  }
5294  for( ; j<jpos; j+=IT::size, it+=IT::size ) {
5295  matrix_.store( col_, j, matrix_.load(col_,j) + it.load() );
5296  }
5297  for( ; remainder && j<columns; ++j, ++it ) {
5298  matrix_(col_,j) += *it;
5299  }
5300 }
5302 //*************************************************************************************************
5303 
5304 
5305 //*************************************************************************************************
5317 template< typename MT > // Type of the dense matrix
5318 template< typename VT > // Type of the right-hand side sparse vector
5319 inline void DenseColumn<MT,false,true>::addAssign( const SparseVector<VT,false>& rhs )
5320 {
5321  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5322 
5323  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5324  matrix_(col_,element->index()) += element->value();
5325 }
5327 //*************************************************************************************************
5328 
5329 
5330 //*************************************************************************************************
5342 template< typename MT > // Type of the dense matrix
5343 template< typename VT > // Type of the right-hand side dense vector
5344 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5345  DenseColumn<MT,false,true>::subAssign( const DenseVector<VT,false>& rhs )
5346 {
5347  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5348 
5349  const size_t jpos( (~rhs).size() & size_t(-2) );
5350  for( size_t j=0UL; j<jpos; j+=2UL ) {
5351  matrix_(col_,j ) -= (~rhs)[j ];
5352  matrix_(col_,j+1UL) -= (~rhs)[j+1UL];
5353  }
5354  if( jpos < (~rhs).size() )
5355  matrix_(col_,jpos) -= (~rhs)[jpos];
5356 }
5358 //*************************************************************************************************
5359 
5360 
5361 //*************************************************************************************************
5373 template< typename MT > // Type of the dense matrix
5374 template< typename VT > // Type of the right-hand side dense vector
5375 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5376  DenseColumn<MT,false,true>::subAssign( const DenseVector<VT,false>& rhs )
5377 {
5379 
5380  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5381 
5382  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5383  const size_t columns( size() );
5384 
5385  const size_t jpos( ( remainder )?( columns & size_t(-IT::size) ):( columns ) );
5386  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (IT::size) ) ) == jpos, "Invalid end calculation" );
5387 
5388  size_t j( 0UL );
5389  typename VT::ConstIterator it( (~rhs).begin() );
5390 
5391  for( ; (j+IT::size*3UL) < jpos; j+=IT::size*4UL ) {
5392  matrix_.store( col_, j , matrix_.load(col_,j ) - it.load() ); it += IT::size;
5393  matrix_.store( col_, j+IT::size , matrix_.load(col_,j+IT::size ) - it.load() ); it += IT::size;
5394  matrix_.store( col_, j+IT::size*2UL, matrix_.load(col_,j+IT::size*2UL) - it.load() ); it += IT::size;
5395  matrix_.store( col_, j+IT::size*3UL, matrix_.load(col_,j+IT::size*3UL) - it.load() ); it += IT::size;
5396  }
5397  for( ; j<jpos; j+=IT::size, it+=IT::size ) {
5398  matrix_.store( col_, j, matrix_.load(col_,j) - it.load() );
5399  }
5400  for( ; remainder && j<columns; ++j, ++it ) {
5401  matrix_(col_,j) -= *it;
5402  }
5403 }
5405 //*************************************************************************************************
5406 
5407 
5408 //*************************************************************************************************
5420 template< typename MT > // Type of the dense matrix
5421 template< typename VT > // Type of the right-hand side sparse vector
5422 inline void DenseColumn<MT,false,true>::subAssign( const SparseVector<VT,false>& rhs )
5423 {
5424  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5425 
5426  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5427  matrix_(col_,element->index()) -= element->value();
5428 }
5430 //*************************************************************************************************
5431 
5432 
5433 //*************************************************************************************************
5445 template< typename MT > // Type of the dense matrix
5446 template< typename VT > // Type of the right-hand side dense vector
5447 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5448  DenseColumn<MT,false,true>::multAssign( const DenseVector<VT,false>& rhs )
5449 {
5450  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5451 
5452  const size_t jpos( (~rhs).size() & size_t(-2) );
5453  for( size_t j=0UL; j<jpos; j+=2UL ) {
5454  matrix_(col_,j ) *= (~rhs)[j ];
5455  matrix_(col_,j+1UL) *= (~rhs)[j+1UL];
5456  }
5457  if( jpos < (~rhs).size() )
5458  matrix_(col_,jpos) *= (~rhs)[jpos];
5459 }
5461 //*************************************************************************************************
5462 
5463 
5464 //*************************************************************************************************
5476 template< typename MT > // Type of the dense matrix
5477 template< typename VT > // Type of the right-hand side dense vector
5478 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5479  DenseColumn<MT,false,true>::multAssign( const DenseVector<VT,false>& rhs )
5480 {
5482 
5483  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5484 
5485  const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5486  const size_t columns( size() );
5487 
5488  const size_t jpos( ( remainder )?( columns & size_t(-IT::size) ):( columns ) );
5489  BLAZE_INTERNAL_ASSERT( !remainder || ( columns - ( columns % (IT::size) ) ) == jpos, "Invalid end calculation" );
5490 
5491  size_t j( 0UL );
5492  typename VT::ConstIterator it( (~rhs).begin() );
5493 
5494  for( ; (j+IT::size*3UL) < jpos; j+=IT::size*4UL ) {
5495  matrix_.store( col_, j , matrix_.load(col_,j ) * it.load() ); it += IT::size;
5496  matrix_.store( col_, j+IT::size , matrix_.load(col_,j+IT::size ) * it.load() ); it += IT::size;
5497  matrix_.store( col_, j+IT::size*2UL, matrix_.load(col_,j+IT::size*2UL) * it.load() ); it += IT::size;
5498  matrix_.store( col_, j+IT::size*3UL, matrix_.load(col_,j+IT::size*3UL) * it.load() ); it += IT::size;
5499  }
5500  for( ; j<jpos; j+=IT::size, it+=IT::size ) {
5501  matrix_.store( col_, j, matrix_.load(col_,j) * it.load() );
5502  }
5503  for( ; remainder && j<columns; ++j, ++it ) {
5504  matrix_(col_,j) *= *it;
5505  }
5506 }
5508 //*************************************************************************************************
5509 
5510 
5511 //*************************************************************************************************
5523 template< typename MT > // Type of the dense matrix
5524 template< typename VT > // Type of the right-hand side sparse vector
5525 inline void DenseColumn<MT,false,true>::multAssign( const SparseVector<VT,false>& rhs )
5526 {
5527  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5528 
5529  const ResultType tmp( serial( *this ) );
5530 
5531  reset();
5532 
5533  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5534  matrix_(col_,element->index()) = tmp[element->index()] * element->value();
5535 }
5537 //*************************************************************************************************
5538 
5539 
5540 
5541 
5542 
5543 
5544 
5545 
5546 //=================================================================================================
5547 //
5548 // DENSECOLUMN OPERATORS
5549 //
5550 //=================================================================================================
5551 
5552 //*************************************************************************************************
5555 template< typename MT, bool SO, bool SF >
5556 inline void reset( DenseColumn<MT,SO,SF>& column );
5557 
5558 template< typename MT, bool SO, bool SF >
5559 inline void clear( DenseColumn<MT,SO,SF>& column );
5560 
5561 template< typename MT, bool SO, bool SF >
5562 inline bool isDefault( const DenseColumn<MT,SO,SF>& column );
5563 
5564 template< typename MT, bool SO, bool SF >
5565 inline bool isIntact( const DenseColumn<MT,SO,SF>& column );
5566 
5567 template< typename MT, bool SO, bool SF >
5568 inline bool isSame( const DenseColumn<MT,SO,SF>& a, const DenseColumn<MT,SO,SF>& b );
5570 //*************************************************************************************************
5571 
5572 
5573 //*************************************************************************************************
5580 template< typename MT // Type of the dense matrix
5581  , bool SO // Storage order
5582  , bool SF > // Symmetry flag
5584 {
5585  column.reset();
5586 }
5587 //*************************************************************************************************
5588 
5589 
5590 //*************************************************************************************************
5599 template< typename MT // Type of the dense matrix
5600  , bool SO // Storage order
5601  , bool SF > // Symmetry flag
5603 {
5604  column.reset();
5605 }
5606 //*************************************************************************************************
5607 
5608 
5609 //*************************************************************************************************
5627 template< typename MT // Type of the dense matrix
5628  , bool SO // Storage order
5629  , bool SF > // Symmetry flag
5631 {
5632  for( size_t i=0UL; i<column.size(); ++i )
5633  if( !isDefault( column[i] ) ) return false;
5634  return true;
5635 }
5636 //*************************************************************************************************
5637 
5638 
5639 //*************************************************************************************************
5657 template< typename MT // Type of the dense matrix
5658  , bool SO // Storage order
5659  , bool SF > // Symmetry flag
5661 {
5662  return ( column.col_ <= column.matrix_.columns() &&
5663  isIntact( column.matrix_ ) );
5664 }
5665 //*************************************************************************************************
5666 
5667 
5668 //*************************************************************************************************
5680 template< typename MT // Type of the dense matrix
5681  , bool SO // Storage order
5682  , bool SF > // Symmetry flag
5683 inline bool isSame( const DenseColumn<MT,SO,SF>& a, const DenseColumn<MT,SO,SF>& b )
5684 {
5685  return ( isSame( a.matrix_, b.matrix_ ) && ( a.col_ == b.col_ ) );
5686 }
5687 //*************************************************************************************************
5688 
5689 
5690 //*************************************************************************************************
5705 template< typename MT // Type of the dense matrix
5706  , bool SO // Storage order
5707  , bool SF // Symmetry flag
5708  , typename VT > // Type of the right-hand side vector
5709 inline bool tryAssign( const DenseColumn<MT,SO,SF>& lhs, const Vector<VT,false>& rhs, size_t index )
5710 {
5711  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
5712  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
5713 
5714  return tryAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5715 }
5717 //*************************************************************************************************
5718 
5719 
5720 //*************************************************************************************************
5735 template< typename MT // Type of the dense matrix
5736  , bool SO // Storage order
5737  , bool SF // Symmetry flag
5738  , typename VT > // Type of the right-hand side vector
5739 inline bool tryAddAssign( const DenseColumn<MT,SO,SF>& lhs, const Vector<VT,false>& rhs, size_t index )
5740 {
5741  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
5742  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
5743 
5744  return tryAddAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5745 }
5747 //*************************************************************************************************
5748 
5749 
5750 //*************************************************************************************************
5765 template< typename MT // Type of the dense matrix
5766  , bool SO // Storage order
5767  , bool SF // Symmetry flag
5768  , typename VT > // Type of the right-hand side vector
5769 inline bool trySubAssign( const DenseColumn<MT,SO,SF>& lhs, const Vector<VT,false>& rhs, size_t index )
5770 {
5771  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
5772  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
5773 
5774  return trySubAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5775 }
5777 //*************************************************************************************************
5778 
5779 
5780 //*************************************************************************************************
5795 template< typename MT // Type of the dense matrix
5796  , bool SO // Storage order
5797  , bool SF // Symmetry flag
5798  , typename VT > // Type of the right-hand side vector
5799 inline bool tryMultAssign( const DenseColumn<MT,SO,SF>& lhs, const Vector<VT,false>& rhs, size_t index )
5800 {
5801  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
5802  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
5803 
5804  return tryMultAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5805 }
5807 //*************************************************************************************************
5808 
5809 
5810 //*************************************************************************************************
5825 template< typename MT // Type of the dense matrix
5826  , bool SO // Storage order
5827  , bool SF > // Symmetry flag
5828 inline typename DerestrictTrait< DenseColumn<MT,SO,SF> >::Type
5829  derestrict( DenseColumn<MT,SO,SF>& column )
5830 {
5831  typedef typename DerestrictTrait< DenseColumn<MT,SO,SF> >::Type ReturnType;
5832  return ReturnType( derestrict( column.matrix_ ), column.col_ );
5833 }
5835 //*************************************************************************************************
5836 
5837 
5838 
5839 
5840 //=================================================================================================
5841 //
5842 // ISRESTRICTED SPECIALIZATIONS
5843 //
5844 //=================================================================================================
5845 
5846 //*************************************************************************************************
5848 template< typename MT, bool SO, bool SF >
5849 struct IsRestricted< DenseColumn<MT,SO,SF> > : public IsTrue< IsRestricted<MT>::value >
5850 {};
5852 //*************************************************************************************************
5853 
5854 
5855 
5856 
5857 //=================================================================================================
5858 //
5859 // DERESTRICTTRAIT SPECIALIZATIONS
5860 //
5861 //=================================================================================================
5862 
5863 //*************************************************************************************************
5865 template< typename MT, bool SO, bool SF >
5866 struct DerestrictTrait< DenseColumn<MT,SO,SF> >
5867 {
5868  typedef DenseColumn< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type > Type;
5869 };
5871 //*************************************************************************************************
5872 
5873 
5874 
5875 
5876 //=================================================================================================
5877 //
5878 // HASCONSTDATAACCESS SPECIALIZATIONS
5879 //
5880 //=================================================================================================
5881 
5882 //*************************************************************************************************
5884 template< typename MT, bool SO, bool SF >
5885 struct HasConstDataAccess< DenseColumn<MT,SO,SF> >
5886  : public IsTrue< HasConstDataAccess<MT>::value >
5887 {};
5889 //*************************************************************************************************
5890 
5891 
5892 
5893 
5894 //=================================================================================================
5895 //
5896 // HASMUTABLEDATAACCESS SPECIALIZATIONS
5897 //
5898 //=================================================================================================
5899 
5900 //*************************************************************************************************
5902 template< typename MT, bool SO, bool SF >
5903 struct HasMutableDataAccess< DenseColumn<MT,SO,SF> >
5904  : public IsTrue< HasMutableDataAccess<MT>::value >
5905 {};
5907 //*************************************************************************************************
5908 
5909 
5910 
5911 
5912 //=================================================================================================
5913 //
5914 // ISALIGNED SPECIALIZATIONS
5915 //
5916 //=================================================================================================
5917 
5918 //*************************************************************************************************
5920 template< typename MT, bool SO, bool SF >
5921 struct IsAligned< DenseColumn<MT,SO,SF> >
5922  : public IsTrue< And< IsAligned<MT>, Or< IsColumnMajorMatrix<MT>, IsSymmetric<MT> > >::value >
5923 {};
5925 //*************************************************************************************************
5926 
5927 
5928 
5929 
5930 //=================================================================================================
5931 //
5932 // ISPADDED SPECIALIZATIONS
5933 //
5934 //=================================================================================================
5935 
5936 //*************************************************************************************************
5938 template< typename MT, bool SO, bool SF >
5939 struct IsPadded< DenseColumn<MT,SO,SF> >
5940  : public IsTrue< And< IsPadded<MT>, Or< IsColumnMajorMatrix<MT>, IsSymmetric<MT> > >::value >
5941 {};
5943 //*************************************************************************************************
5944 
5945 
5946 
5947 
5948 //=================================================================================================
5949 //
5950 // ADDTRAIT SPECIALIZATIONS
5951 //
5952 //=================================================================================================
5953 
5954 //*************************************************************************************************
5956 template< typename MT, bool SO, bool SF, typename T >
5957 struct AddTrait< DenseColumn<MT,SO,SF>, T >
5958 {
5959  typedef typename AddTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5960 };
5961 
5962 template< typename T, typename MT, bool SO, bool SF >
5963 struct AddTrait< T, DenseColumn<MT,SO,SF> >
5964 {
5965  typedef typename AddTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5966 };
5968 //*************************************************************************************************
5969 
5970 
5971 
5972 
5973 //=================================================================================================
5974 //
5975 // SUBTRAIT SPECIALIZATIONS
5976 //
5977 //=================================================================================================
5978 
5979 //*************************************************************************************************
5981 template< typename MT, bool SO, bool SF, typename T >
5982 struct SubTrait< DenseColumn<MT,SO,SF>, T >
5983 {
5984  typedef typename SubTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5985 };
5986 
5987 template< typename T, typename MT, bool SO, bool SF >
5988 struct SubTrait< T, DenseColumn<MT,SO,SF> >
5989 {
5990  typedef typename SubTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5991 };
5993 //*************************************************************************************************
5994 
5995 
5996 
5997 
5998 //=================================================================================================
5999 //
6000 // MULTTRAIT SPECIALIZATIONS
6001 //
6002 //=================================================================================================
6003 
6004 //*************************************************************************************************
6006 template< typename MT, bool SO, bool SF, typename T >
6007 struct MultTrait< DenseColumn<MT,SO,SF>, T >
6008 {
6009  typedef typename MultTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
6010 };
6011 
6012 template< typename T, typename MT, bool SO, bool SF >
6013 struct MultTrait< T, DenseColumn<MT,SO,SF> >
6014 {
6015  typedef typename MultTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
6016 };
6018 //*************************************************************************************************
6019 
6020 
6021 
6022 
6023 //=================================================================================================
6024 //
6025 // CROSSTRAIT SPECIALIZATIONS
6026 //
6027 //=================================================================================================
6028 
6029 //*************************************************************************************************
6031 template< typename MT, bool SO, bool SF, typename T >
6032 struct CrossTrait< DenseColumn<MT,SO,SF>, T >
6033 {
6034  typedef typename CrossTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
6035 };
6036 
6037 template< typename T, typename MT, bool SO, bool SF >
6038 struct CrossTrait< T, DenseColumn<MT,SO,SF> >
6039 {
6040  typedef typename CrossTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
6041 };
6043 //*************************************************************************************************
6044 
6045 
6046 
6047 
6048 //=================================================================================================
6049 //
6050 // DIVTRAIT SPECIALIZATIONS
6051 //
6052 //=================================================================================================
6053 
6054 //*************************************************************************************************
6056 template< typename MT, bool SO, bool SF, typename T >
6057 struct DivTrait< DenseColumn<MT,SO,SF>, T >
6058 {
6059  typedef typename DivTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
6060 };
6061 
6062 template< typename T, typename MT, bool SO, bool SF >
6063 struct DivTrait< T, DenseColumn<MT,SO,SF> >
6064 {
6065  typedef typename DivTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
6066 };
6068 //*************************************************************************************************
6069 
6070 
6071 
6072 
6073 //=================================================================================================
6074 //
6075 // SUBVECTORTRAIT SPECIALIZATIONS
6076 //
6077 //=================================================================================================
6078 
6079 //*************************************************************************************************
6081 template< typename MT, bool SO, bool SF >
6082 struct SubvectorTrait< DenseColumn<MT,SO,SF> >
6083 {
6084  typedef typename SubvectorTrait< typename DenseColumn<MT,SO,SF>::ResultType >::Type Type;
6085 };
6087 //*************************************************************************************************
6088 
6089 } // namespace blaze
6090 
6091 #endif
Constraint on the data type.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the IsUniUpper type trait.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7820
Header file for the subtraction trait.
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:250
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:115
#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:79
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
Header file for the IsDiagonal type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the column element type.
Definition: DenseColumn.h:351
#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:118
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
Pointer data()
Low-level data access to the column elements.
Definition: DenseColumn.h:764
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:647
Header file for the IsSame and IsStrictlySame type traits.
DenseColumn(MT &matrix, size_t index)
The constructor for DenseColumn.
Definition: DenseColumn.h:646
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Iterator begin()
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:799
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:107
Header file for the And class template.
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
Header file for the DenseVector base class.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
#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:118
bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:442
bool canSMPAssign() const
Returns whether the dense column can be used in SMP assignments.
Definition: DenseColumn.h:1505
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
#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:78
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
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:118
System settings for performance optimizations.
Reference at(size_t index)
Checked access to the column elements.
Definition: DenseColumn.h:719
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1597
Header file for the IsUniLower type trait.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Header file for the column base class.
Constraint on the transpose flag of vector types.
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: DenseColumn.h:365
Constraint on the data type.
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:85
const ElementType * ConstPointer
Pointer to a constant column value.
Definition: DenseColumn.h:371
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
IT::Type IntrinsicType
Intrinsic type of the column elements.
Definition: DenseColumn.h:360
Header file for the IsFloatingPoint type trait.
#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:79
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseColumn.h:378
const DenseColumn & CompositeType
Data type for composite expression templates.
Definition: DenseColumn.h:362
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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:116
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:75
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseColumn.h:348
Header file for the Or class template.
size_t capacity() const
Returns the maximum capacity of the dense column.
Definition: DenseColumn.h:1299
Reference to a specific column of a dense matrix.The DenseColumn template represents a reference to a...
Definition: DenseColumn.h:342
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:610
bool isAligned() const
Returns whether the dense column is properly aligned in memory.
Definition: DenseColumn.h:1485
Base class for all columns.The Column class serves as a tag for all columns (i.e. dense and sparse co...
Definition: Column.h:64
Header file for the Not class template.
BLAZE_ALWAYS_INLINE void storea(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1620
Header file for the subvector trait.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Compile time check for sparse vector types.This type trait tests whether or not the given template pa...
Definition: IsSparseVector.h:103
If< IsConst< MT >, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:381
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1666
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1528
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:642
Constraint on the data type.
DenseColumn & operator=(const ElementType &rhs)
Homogenous assignment to all column elements.
Definition: DenseColumn.h:912
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:79
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: DenseColumn.h:677
Operand matrix_
The dense matrix containing the column.
Definition: DenseColumn.h:581
Constraint on the data type.
DenseColumn< MT, SO, SF > This
Type of this DenseColumn instance.
Definition: DenseColumn.h:356
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:187
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
ConstIterator cbegin() const
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:833
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
bool canAlias(const Other *alias) const
Returns whether the dense column can alias with the given address alias.
Definition: DenseColumn.h:1399
Header file for the IsPadded type trait.
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:85
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:107
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1643
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: DenseColumn.h:1317
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
#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:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the IsConst type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseColumn.h:358
Header file for the addition trait.
If< IsConst< MT >, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: DenseColumn.h:368
Header file for the cross product trait.
Header file for the division trait.
Iterator end()
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:850
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
const bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1574
Header file for the cache size of the target architecture.
Compile time type negation.The Not class template negates the given compile time condition. In case the given condition would evaluate to true, the nested member enumeration is set to false and vice versa:
Definition: Not.h:70
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:116
void reset()
Reset to the default initial values.
Definition: DenseColumn.h:1332
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
Header file for the HasMutableDataAccess type trait.
If< Or< IsConst< MT >, Not< HasMutableDataAccess< MT > > >, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant column value.
Definition: DenseColumn.h:375
#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:118
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Header file for the IsReference type trait.
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
Header file for all intrinsic functionality.
bool isAliased(const Other *alias) const
Returns whether the dense column is aliased with the given address alias.
Definition: DenseColumn.h:1443
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
#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:79
const size_t col_
The index of the column in the matrix.
Definition: DenseColumn.h:582
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:258
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
size_t size() const
Returns the current size/dimension of the column.
Definition: DenseColumn.h:1284
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
MT::ElementType ElementType
Type of the column elements.
Definition: DenseColumn.h:359
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:94
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseColumn.h:361
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Header file for the IsUpper type trait.
Header file for exception macros.
BLAZE_ALWAYS_INLINE IntrinsicType loada(size_t index) const
Aligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1551
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseColumn.h:357
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
Header file for the IsRestricted type trait.
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:884
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
Header file for a safe C++ NULL pointer implementation.