All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DenseColumn.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
23 #define _BLAZE_MATH_VIEWS_DENSECOLUMN_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <iterator>
31 #include <stdexcept>
39 #include <blaze/math/Forward.h>
40 #include <blaze/math/Intrinsics.h>
41 #include <blaze/math/shims/Reset.h>
60 #include <blaze/util/Assert.h>
62 #include <blaze/util/DisableIf.h>
63 #include <blaze/util/EnableIf.h>
65 #include <blaze/util/Template.h>
66 #include <blaze/util/Types.h>
71 
72 
73 namespace blaze {
74 
75 //=================================================================================================
76 //
77 // CLASS DEFINITION
78 //
79 //=================================================================================================
80 
81 //*************************************************************************************************
288 template< typename MT // Type of the dense matrix
289  , bool SO = IsColumnMajorMatrix<MT>::value > // Storage order
290 class DenseColumn : public DenseVector< DenseColumn<MT,SO>, false >
291  , private Expression
292 {
293  private:
294  //**Type definitions****************************************************************************
296  //**********************************************************************************************
297 
298  //**********************************************************************************************
300 
306  enum { useConst = IsConst<MT>::value };
307  //**********************************************************************************************
308 
309  public:
310  //**Type definitions****************************************************************************
313  typedef typename ResultType::TransposeType TransposeType;
314  typedef typename MT::ElementType ElementType;
315  typedef typename IT::Type IntrinsicType;
316  typedef typename MT::ReturnType ReturnType;
317  typedef const DenseColumn& CompositeType;
318 
320  typedef typename MT::ConstReference ConstReference;
321 
324 
326  typedef const ElementType* ConstPointer;
327 
330 
332  typedef typename MT::ConstIterator ConstIterator;
333 
336  //**********************************************************************************************
337 
338  //**Compilation flags***************************************************************************
340  enum { vectorizable = MT::vectorizable };
341  //**********************************************************************************************
342 
343  //**Constructors********************************************************************************
346  explicit inline DenseColumn( MT& matrix, size_t index );
347  // No explicitly declared copy constructor.
349  //**********************************************************************************************
350 
351  //**Destructor**********************************************************************************
352  // No explicitly declared destructor.
353  //**********************************************************************************************
354 
355  //**Data access functions***********************************************************************
358  inline Reference operator[]( size_t index );
359  inline ConstReference operator[]( size_t index ) const;
360  inline Pointer data ();
361  inline ConstPointer data () const;
362  inline Iterator begin ();
363  inline ConstIterator begin () const;
364  inline ConstIterator cbegin() const;
365  inline Iterator end ();
366  inline ConstIterator end () const;
367  inline ConstIterator cend () const;
369  //**********************************************************************************************
370 
371  //**Assignment operators************************************************************************
374  inline DenseColumn& operator= ( const ElementType& rhs );
375  inline DenseColumn& operator= ( const DenseColumn& rhs );
376  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
377  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
378  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
379  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
380 
381  template< typename Other >
382  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
383  operator*=( Other rhs );
384 
385  template< typename Other >
386  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
387  operator/=( Other rhs );
389  //**********************************************************************************************
390 
391  //**Utility functions***************************************************************************
394  inline size_t size() const;
395  inline size_t capacity() const;
396  inline size_t nonZeros() const;
397  inline void reset();
398  template< typename Other > inline DenseColumn& scale( const Other& scalar );
400  //**********************************************************************************************
401 
402  private:
403  //**********************************************************************************************
405 
406  template< typename VT >
407  struct VectorizedAssign {
408  enum { value = vectorizable && VT::vectorizable &&
410  };
412  //**********************************************************************************************
413 
414  //**********************************************************************************************
416 
417  template< typename VT >
418  struct VectorizedAddAssign {
419  enum { value = vectorizable && VT::vectorizable &&
420  IsSame<ElementType,typename VT::ElementType>::value &&
421  IntrinsicTrait<ElementType>::addition };
422  };
424  //**********************************************************************************************
425 
426  //**********************************************************************************************
428 
429  template< typename VT >
430  struct VectorizedSubAssign {
431  enum { value = vectorizable && VT::vectorizable &&
432  IsSame<ElementType,typename VT::ElementType>::value &&
433  IntrinsicTrait<ElementType>::subtraction };
434  };
436  //**********************************************************************************************
437 
438  //**********************************************************************************************
440 
441  template< typename VT >
442  struct VectorizedMultAssign {
443  enum { value = vectorizable && VT::vectorizable &&
444  IsSame<ElementType,typename VT::ElementType>::value &&
445  IntrinsicTrait<ElementType>::multiplication };
446  };
448  //**********************************************************************************************
449 
450  public:
451  //**Expression template evaluation functions****************************************************
454  template< typename Other > inline bool canAlias ( const Other* alias ) const;
455  template< typename Other > inline bool isAliased( const Other* alias ) const;
456  inline IntrinsicType get ( size_t index ) const;
457 
458  template< typename VT >
459  inline typename DisableIf< VectorizedAssign<VT> >::Type
460  assign( const DenseVector<VT,false>& rhs );
461 
462  template< typename VT >
463  inline typename EnableIf< VectorizedAssign<VT> >::Type
464  assign( const DenseVector<VT,false>& rhs );
465 
466  template< typename VT > inline void assign( const SparseVector<VT,false>& rhs );
467 
468  template< typename VT >
469  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
470  addAssign( const DenseVector<VT,false>& rhs );
471 
472  template< typename VT >
473  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
474  addAssign( const DenseVector<VT,false>& rhs );
475 
476  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
477 
478  template< typename VT >
479  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
480  subAssign( const DenseVector<VT,false>& rhs );
481 
482  template< typename VT >
483  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
484  subAssign( const DenseVector<VT,false>& rhs );
485 
486  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
487 
488  template< typename VT >
489  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
490  multAssign( const DenseVector<VT,false>& rhs );
491 
492  template< typename VT >
493  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
494  multAssign( const DenseVector<VT,false>& rhs );
495 
496  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
498  //**********************************************************************************************
499 
500  private:
501  //**Member variables****************************************************************************
504  MT& matrix_;
505  const size_t col_;
506 
507  //**********************************************************************************************
508 
509  //**Compile time checks*************************************************************************
515  //**********************************************************************************************
516 };
517 //*************************************************************************************************
518 
519 
520 
521 
522 //=================================================================================================
523 //
524 // CONSTRUCTOR
525 //
526 //=================================================================================================
527 
528 //*************************************************************************************************
535 template< typename MT // Type of the dense matrix
536  , bool SO > // Storage order
537 inline DenseColumn<MT,SO>::DenseColumn( MT& matrix, size_t index )
538  : matrix_( matrix ) // The dense matrix containing the column
539  , col_ ( index ) // The index of the column in the matrix
540 {
541  if( matrix_.columns() <= index )
542  throw std::invalid_argument( "Invalid column access index" );
543 }
544 //*************************************************************************************************
545 
546 
547 
548 
549 //=================================================================================================
550 //
551 // DATA ACCESS FUNCTIONS
552 //
553 //=================================================================================================
554 
555 //*************************************************************************************************
561 template< typename MT // Type of the dense matrix
562  , bool SO > // Storage order
564 {
565  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
566  return matrix_(index,col_);
567 }
568 //*************************************************************************************************
569 
570 
571 //*************************************************************************************************
577 template< typename MT // Type of the dense matrix
578  , bool SO > // Storage order
580 {
581  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
582  return matrix_(index,col_);
583 }
584 //*************************************************************************************************
585 
586 
587 //*************************************************************************************************
592 template< typename MT // Type of the dense matrix
593  , bool SO > // Storage order
595 {
596  return matrix_.data( col_ );
597 }
598 //*************************************************************************************************
599 
600 
601 //*************************************************************************************************
606 template< typename MT // Type of the dense matrix
607  , bool SO > // Storage order
609 {
610  return matrix_.data( col_ );
611 }
612 //*************************************************************************************************
613 
614 
615 //*************************************************************************************************
622 template< typename MT // Type of the dense matrix
623  , bool SO > // Storage order
625 {
626  return matrix_.begin( col_ );
627 }
628 //*************************************************************************************************
629 
630 
631 //*************************************************************************************************
638 template< typename MT // Type of the dense matrix
639  , bool SO > // Storage order
641 {
642  return matrix_.begin( col_ );
643 }
644 //*************************************************************************************************
645 
646 
647 //*************************************************************************************************
654 template< typename MT // Type of the dense matrix
655  , bool SO > // Storage order
657 {
658  return matrix_.begin( col_ );
659 }
660 //*************************************************************************************************
661 
662 
663 //*************************************************************************************************
670 template< typename MT // Type of the dense matrix
671  , bool SO > // Storage order
673 {
674  return matrix_.end( col_ );
675 }
676 //*************************************************************************************************
677 
678 
679 //*************************************************************************************************
686 template< typename MT // Type of the dense matrix
687  , bool SO > // Storage order
689 {
690  return matrix_.end( col_ );
691 }
692 //*************************************************************************************************
693 
694 
695 //*************************************************************************************************
702 template< typename MT // Type of the dense matrix
703  , bool SO > // Storage order
705 {
706  return matrix_.end( col_ );
707 }
708 //*************************************************************************************************
709 
710 
711 
712 
713 //=================================================================================================
714 //
715 // ASSIGNMENT OPERATORS
716 //
717 //=================================================================================================
718 
719 //*************************************************************************************************
725 template< typename MT // Type of the dense matrix
726  , bool SO > // Storage order
728 {
729  const size_t rows( size() );
730 
731  for( size_t i=0UL; i<rows; ++i )
732  matrix_(i,col_) = rhs;
733 
734  return *this;
735 }
736 //*************************************************************************************************
737 
738 
739 //*************************************************************************************************
749 template< typename MT // Type of the dense matrix
750  , bool SO > // Storage order
752 {
753  if( &rhs == this ) return *this;
754 
755  if( size() != rhs.size() )
756  throw std::invalid_argument( "Column sizes do not match" );
757 
758  const size_t rows( size() );
759 
760  for( size_t i=0UL; i<rows; ++i )
761  matrix_(i,col_) = rhs[i];
762 
763  return *this;
764 }
765 //*************************************************************************************************
766 
767 
768 //*************************************************************************************************
778 template< typename MT // Type of the dense matrix
779  , bool SO > // Storage order
780 template< typename VT > // Type of the right-hand side vector
782 {
783  using blaze::assign;
784 
785  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
786  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
787 
788  if( size() != (~rhs).size() )
789  throw std::invalid_argument( "Vector sizes do not match" );
790 
791  if( (~rhs).canAlias( this ) ) {
792  const typename VT::ResultType tmp( ~rhs );
793  assign( *this, tmp );
794  }
795  else {
797  reset();
798  assign( *this, ~rhs );
799  }
800 
801  return *this;
802 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
816 template< typename MT // Type of the dense matrix
817  , bool SO > // Storage order
818 template< typename VT > // Type of the right-hand side vector
820 {
821  using blaze::addAssign;
822 
823  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
824  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
825 
826  if( size() != (~rhs).size() )
827  throw std::invalid_argument( "Vector sizes do not match" );
828 
829  if( (~rhs).canAlias( this ) ) {
830  const typename VT::ResultType tmp( ~rhs );
831  addAssign( *this, tmp );
832  }
833  else {
834  addAssign( *this, ~rhs );
835  }
836 
837  return *this;
838 }
839 //*************************************************************************************************
840 
841 
842 //*************************************************************************************************
852 template< typename MT // Type of the dense matrix
853  , bool SO > // Storage order
854 template< typename VT > // Type of the right-hand side vector
856 {
857  using blaze::subAssign;
858 
859  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
860  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
861 
862  if( size() != (~rhs).size() )
863  throw std::invalid_argument( "Vector sizes do not match" );
864 
865  if( (~rhs).canAlias( this ) ) {
866  const typename VT::ResultType tmp( ~rhs );
867  subAssign( *this, tmp );
868  }
869  else {
870  subAssign( *this, ~rhs );
871  }
872 
873  return *this;
874 }
875 //*************************************************************************************************
876 
877 
878 //*************************************************************************************************
889 template< typename MT // Type of the dense matrix
890  , bool SO > // Storage order
891 template< typename VT > // Type of the right-hand side vector
893 {
894  using blaze::multAssign;
895 
896  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
897  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
898 
899  if( size() != (~rhs).size() )
900  throw std::invalid_argument( "Vector sizes do not match" );
901 
902  if( (~rhs).canAlias( this ) || IsSparseVector<VT>::value ) {
903  const typename VT::ResultType tmp( ~rhs );
904  multAssign( *this, tmp );
905  }
906  else {
907  multAssign( *this, ~rhs );
908  }
909 
910  return *this;
911 }
912 //*************************************************************************************************
913 
914 
915 //*************************************************************************************************
922 template< typename MT // Type of the dense matrix
923  , bool SO > // Storage order
924 template< typename Other > // Data type of the right-hand side scalar
925 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO> >::Type&
927 {
928  return operator=( (*this) * rhs );
929 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
942 template< typename MT // Type of the dense matrix
943  , bool SO > // Storage order
944 template< typename Other > // Data type of the right-hand side scalar
945 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO> >::Type&
947 {
948  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
949 
950  return operator=( (*this) / rhs );
951 }
952 //*************************************************************************************************
953 
954 
955 
956 
957 //=================================================================================================
958 //
959 // UTILITY FUNCTIONS
960 //
961 //=================================================================================================
962 
963 //*************************************************************************************************
968 template< typename MT // Type of the dense matrix
969  , bool SO > // Storage order
970 inline size_t DenseColumn<MT,SO>::size() const
971 {
972  return matrix_.rows();
973 }
974 //*************************************************************************************************
975 
976 
977 //*************************************************************************************************
982 template< typename MT // Type of the dense matrix
983  , bool SO > // Storage order
984 inline size_t DenseColumn<MT,SO>::capacity() const
985 {
986  return matrix_.capacity( col_ );
987 }
988 //*************************************************************************************************
989 
990 
991 //*************************************************************************************************
999 template< typename MT // Type of the dense matrix
1000  , bool SO > // Storage order
1001 inline size_t DenseColumn<MT,SO>::nonZeros() const
1002 {
1003  return matrix_.nonZeros( col_ );
1004 }
1005 //*************************************************************************************************
1006 
1007 
1008 //*************************************************************************************************
1013 template< typename MT // Type of the dense matrix
1014  , bool SO > // Storage order
1016 {
1017  matrix_.reset( col_ );
1018 }
1019 //*************************************************************************************************
1020 
1021 
1022 //*************************************************************************************************
1028 template< typename MT // Type of the dense matrix
1029  , bool SO > // Storage order
1030 template< typename Other > // Data type of the scalar value
1031 inline DenseColumn<MT,SO>& DenseColumn<MT,SO>::scale( const Other& scalar )
1032 {
1033  for( size_t j=0UL; j<size(); ++j ) {
1034  matrix_(j,col_) *= scalar;
1035  }
1036  return *this;
1037 }
1038 //*************************************************************************************************
1039 
1040 
1041 
1042 
1043 //=================================================================================================
1044 //
1045 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1046 //
1047 //=================================================================================================
1048 
1049 //*************************************************************************************************
1059 template< typename MT // Type of the dense matrix
1060  , bool SO > // Storage order
1061 template< typename Other > // Data type of the foreign expression
1062 inline bool DenseColumn<MT,SO>::canAlias( const Other* alias ) const
1063 {
1064  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
1065 }
1066 //*************************************************************************************************
1067 
1068 
1069 //*************************************************************************************************
1079 template< typename MT // Type of the dense matrix
1080  , bool SO > // Storage order
1081 template< typename Other > // Data type of the foreign expression
1082 inline bool DenseColumn<MT,SO>::isAliased( const Other* alias ) const
1083 {
1084  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
1085 }
1086 //*************************************************************************************************
1087 
1088 
1089 //*************************************************************************************************
1100 template< typename MT // Type of the dense matrix
1101  , bool SO > // Storage order
1102 inline typename DenseColumn<MT,SO>::IntrinsicType DenseColumn<MT,SO>::get( size_t index ) const
1103 {
1104  return matrix_.get( index, col_ );
1105 }
1106 //*************************************************************************************************
1107 
1108 
1109 //*************************************************************************************************
1120 template< typename MT // Type of the dense matrix
1121  , bool SO > // Storage order
1122 template< typename VT > // Type of the right-hand side dense vector
1123 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1125 {
1126  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1127 
1128  const size_t iend( (~rhs).size() & size_t(-2) );
1129  for( size_t i=0UL; i<iend; i+=2UL ) {
1130  matrix_(i ,col_) = (~rhs)[i ];
1131  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1132  }
1133  if( iend < (~rhs).size() )
1134  matrix_(iend,col_) = (~rhs)[iend];
1135 }
1136 //*************************************************************************************************
1137 
1138 
1139 //*************************************************************************************************
1150 template< typename MT // Type of the dense matrix
1151  , bool SO > // Storage order
1152 template< typename VT > // Type of the right-hand side dense vector
1153 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1155 {
1156  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1157 
1159 
1160  const size_t rows( size() );
1161 
1162  if( rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( this ) )
1163  {
1164  for( size_t i=0UL; i<rows; i+=IT::size ) {
1165  stream( &matrix_(i,col_), (~rhs).get(i) );
1166  }
1167  }
1168  else
1169  {
1170  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows & size_t(-IT::size*4) ), "Invalid end calculation" );
1171  const size_t iend( rows & size_t(-IT::size*4) );
1172 
1173  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1174  store( &matrix_(i ,col_), (~rhs).get(i ) );
1175  store( &matrix_(i+IT::size ,col_), (~rhs).get(i+IT::size ) );
1176  store( &matrix_(i+IT::size*2UL,col_), (~rhs).get(i+IT::size*2UL) );
1177  store( &matrix_(i+IT::size*3UL,col_), (~rhs).get(i+IT::size*3UL) );
1178  }
1179  for( size_t i=iend; i<rows; i+=IT::size ) {
1180  store( &matrix_(i,col_), (~rhs).get(i) );
1181  }
1182  }
1183 }
1184 //*************************************************************************************************
1185 
1186 
1187 //*************************************************************************************************
1198 template< typename MT // Type of the dense matrix
1199  , bool SO > // Storage order
1200 template< typename VT > // Type of the right-hand side sparse vector
1202 {
1203  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1204 
1205  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1206  matrix_(element->index(),col_) = element->value();
1207 }
1208 //*************************************************************************************************
1209 
1210 
1211 //*************************************************************************************************
1222 template< typename MT // Type of the dense matrix
1223  , bool SO > // Storage order
1224 template< typename VT > // Type of the right-hand side dense vector
1225 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1227 {
1228  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1229 
1230  const size_t iend( (~rhs).size() & size_t(-2) );
1231  for( size_t i=0UL; i<iend; i+=2UL ) {
1232  matrix_(i ,col_) += (~rhs)[i ];
1233  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1234  }
1235  if( iend < (~rhs).size() )
1236  matrix_(iend,col_) += (~rhs)[iend];
1237 }
1238 //*************************************************************************************************
1239 
1240 
1241 //*************************************************************************************************
1252 template< typename MT // Type of the dense matrix
1253  , bool SO > // Storage order
1254 template< typename VT > // Type of the right-hand side dense vector
1255 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1257 {
1258  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1259 
1261 
1262  const size_t rows( size() );
1263 
1264  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows & size_t(-IT::size*4) ), "Invalid end calculation" );
1265  const size_t iend( rows & size_t(-IT::size*4) );
1266 
1267  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1268  store( &matrix_(i ,col_), load( &matrix_(i ,col_) ) + (~rhs).get(i ) );
1269  store( &matrix_(i+IT::size ,col_), load( &matrix_(i+IT::size ,col_) ) + (~rhs).get(i+IT::size ) );
1270  store( &matrix_(i+IT::size*2UL,col_), load( &matrix_(i+IT::size*2UL,col_) ) + (~rhs).get(i+IT::size*2UL) );
1271  store( &matrix_(i+IT::size*3UL,col_), load( &matrix_(i+IT::size*3UL,col_) ) + (~rhs).get(i+IT::size*3UL) );
1272  }
1273  for( size_t i=iend; i<rows; i+=IT::size ) {
1274  store( &matrix_(i,col_), load( &matrix_(i,col_) ) + (~rhs).get(i) );
1275  }
1276 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1291 template< typename MT // Type of the dense matrix
1292  , bool SO > // Storage order
1293 template< typename VT > // Type of the right-hand side sparse vector
1295 {
1296  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1297 
1298  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1299  matrix_(element->index(),col_) += element->value();
1300 }
1301 //*************************************************************************************************
1302 
1303 
1304 //*************************************************************************************************
1315 template< typename MT // Type of the dense matrix
1316  , bool SO > // Storage order
1317 template< typename VT > // Type of the right-hand side dense vector
1318 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1320 {
1321  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1322 
1323  const size_t iend( (~rhs).size() & size_t(-2) );
1324  for( size_t i=0UL; i<iend; i+=2UL ) {
1325  matrix_(i ,col_) -= (~rhs)[i ];
1326  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1327  }
1328  if( iend < (~rhs).size() )
1329  matrix_(iend,col_) -= (~rhs)[iend];
1330 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1345 template< typename MT // Type of the dense matrix
1346  , bool SO > // Storage order
1347 template< typename VT > // Type of the right-hand side dense vector
1348 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1350 {
1351  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1352 
1354 
1355  const size_t rows( size() );
1356 
1357  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows & size_t(-IT::size*4) ), "Invalid end calculation" );
1358  const size_t iend( rows & size_t(-IT::size*4) );
1359 
1360  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1361  store( &matrix_(i ,col_), load( &matrix_(i ,col_) ) - (~rhs).get(i ) );
1362  store( &matrix_(i+IT::size ,col_), load( &matrix_(i+IT::size ,col_) ) - (~rhs).get(i+IT::size ) );
1363  store( &matrix_(i+IT::size*2UL,col_), load( &matrix_(i+IT::size*2UL,col_) ) - (~rhs).get(i+IT::size*2UL) );
1364  store( &matrix_(i+IT::size*3UL,col_), load( &matrix_(i+IT::size*3UL,col_) ) - (~rhs).get(i+IT::size*3UL) );
1365  }
1366  for( size_t i=iend; i<rows; i+=IT::size ) {
1367  store( &matrix_(i,col_), load( &matrix_(i,col_) ) - (~rhs).get(i) );
1368  }
1369 }
1370 //*************************************************************************************************
1371 
1372 
1373 //*************************************************************************************************
1384 template< typename MT // Type of the dense matrix
1385  , bool SO > // Storage order
1386 template< typename VT > // Type of the right-hand side sparse vector
1388 {
1389  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1390 
1391  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1392  matrix_(element->index(),col_) -= element->value();
1393 }
1394 //*************************************************************************************************
1395 
1396 
1397 //*************************************************************************************************
1408 template< typename MT // Type of the dense matrix
1409  , bool SO > // Storage order
1410 template< typename VT > // Type of the right-hand side dense vector
1411 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1413 {
1414  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1415 
1416  const size_t iend( (~rhs).size() & size_t(-2) );
1417  for( size_t i=0UL; i<iend; i+=2UL ) {
1418  matrix_(i ,col_) *= (~rhs)[i ];
1419  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
1420  }
1421  if( iend < (~rhs).size() )
1422  matrix_(iend,col_) *= (~rhs)[iend];
1423 }
1424 //*************************************************************************************************
1425 
1426 
1427 //*************************************************************************************************
1438 template< typename MT // Type of the dense matrix
1439  , bool SO > // Storage order
1440 template< typename VT > // Type of the right-hand side dense vector
1441 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1443 {
1444  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1445 
1447 
1448  const size_t rows( size() );
1449 
1450  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ( rows & size_t(-IT::size*4) ), "Invalid end calculation" );
1451  const size_t iend( rows & size_t(-IT::size*4) );
1452 
1453  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1454  store( &matrix_(i ,col_), load( &matrix_(i ,col_) ) * (~rhs).get(i ) );
1455  store( &matrix_(i+IT::size ,col_), load( &matrix_(i+IT::size ,col_) ) * (~rhs).get(i+IT::size ) );
1456  store( &matrix_(i+IT::size*2UL,col_), load( &matrix_(i+IT::size*2UL,col_) ) * (~rhs).get(i+IT::size*2UL) );
1457  store( &matrix_(i+IT::size*3UL,col_), load( &matrix_(i+IT::size*3UL,col_) ) * (~rhs).get(i+IT::size*3UL) );
1458  }
1459  for( size_t i=iend; i<rows; i+=IT::size ) {
1460  store( &matrix_(i,col_), load( &matrix_(i,col_) ) * (~rhs).get(i) );
1461  }
1462 }
1463 //*************************************************************************************************
1464 
1465 
1466 //*************************************************************************************************
1477 template< typename MT // Type of the dense matrix
1478  , bool SO > // Storage order
1479 template< typename VT > // Type of the right-hand side sparse vector
1481 {
1482  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1483 
1484  const ResultType tmp( *this );
1485 
1486  reset();
1487 
1488  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1489  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
1490 }
1491 //*************************************************************************************************
1492 
1493 
1494 
1495 
1496 
1497 
1498 
1499 
1500 //=================================================================================================
1501 //
1502 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR MATRICES
1503 //
1504 //=================================================================================================
1505 
1506 //*************************************************************************************************
1514 template< typename MT > // Type of the dense matrix
1515 class DenseColumn<MT,false> : public DenseVector< DenseColumn<MT,false>, false >
1516  , private Expression
1517 {
1518  private:
1519  //**********************************************************************************************
1521 
1527  enum { useConst = IsConst<MT>::value };
1528  //**********************************************************************************************
1529 
1530  public:
1531  //**Type definitions****************************************************************************
1532  typedef DenseColumn<MT,false> This;
1533  typedef typename ColumnTrait<MT>::Type ResultType;
1534  typedef typename ResultType::TransposeType TransposeType;
1535  typedef typename MT::ElementType ElementType;
1536  typedef typename MT::ReturnType ReturnType;
1537  typedef const ResultType CompositeType;
1538 
1540  typedef typename MT::ConstReference ConstReference;
1541 
1543  typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference;
1544  //**********************************************************************************************
1545 
1546  //**ColumnIterator class definition*************************************************************
1549  template< typename MatrixType > // Type of the dense matrix
1550  class ColumnIterator
1551  {
1552  private:
1553  //*******************************************************************************************
1555 
1560  enum { returnConst = IsConst<MatrixType>::value };
1561  //*******************************************************************************************
1562 
1563  public:
1564  //**Type definitions*************************************************************************
1566  typedef typename SelectType< returnConst, typename MT::ConstReference, typename MT::Reference >::Type Reference;
1567 
1568  typedef std::forward_iterator_tag IteratorCategory;
1569  typedef RemoveReference<Reference> ValueType;
1570  typedef ValueType* PointerType;
1571  typedef Reference ReferenceType;
1572  typedef ptrdiff_t DifferenceType;
1573 
1574  // STL iterator requirements
1575  typedef IteratorCategory iterator_category;
1576  typedef ValueType value_type;
1577  typedef PointerType pointer;
1578  typedef ReferenceType reference;
1579  typedef DifferenceType difference_type;
1580  //*******************************************************************************************
1581 
1582  //**Constructor******************************************************************************
1589  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column )
1590  : matrix_( matrix ) // The dense matrix containing the column.
1591  , row_ ( row ) // The current row index.
1592  , column_( column ) // The current column index.
1593  {}
1594  //*******************************************************************************************
1595 
1596  //**Constructor******************************************************************************
1601  template< typename MatrixType2 >
1602  inline ColumnIterator( const ColumnIterator<MatrixType2>& it )
1603  : matrix_( it.matrix_ ) // The dense matrix containing the column.
1604  , row_ ( it.row_ ) // The current row index.
1605  , column_( it.column_ ) // The current column index.
1606  {}
1607  //*******************************************************************************************
1608 
1609  //**Prefix increment operator****************************************************************
1614  inline ColumnIterator& operator++() {
1615  ++row_;
1616  return *this;
1617  }
1618  //*******************************************************************************************
1619 
1620  //**Postfix increment operator***************************************************************
1625  inline const ColumnIterator operator++( int ) {
1626  const ColumnIterator tmp( *this );
1627  ++(*this);
1628  return tmp;
1629  }
1630  //*******************************************************************************************
1631 
1632  //**Element access operator******************************************************************
1637  inline ReferenceType operator*() const {
1638  return matrix_(row_,column_);
1639  }
1640  //*******************************************************************************************
1641 
1642  //**Element access operator******************************************************************
1647  inline PointerType operator->() const {
1648  return &matrix_(row_,column_);
1649  }
1650  //*******************************************************************************************
1651 
1652  //**Equality operator************************************************************************
1658  template< typename MatrixType2 >
1659  inline bool operator==( const ColumnIterator<MatrixType2>& rhs ) const {
1660  return ( &matrix_ == &rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1661  }
1662  //*******************************************************************************************
1663 
1664  //**Inequality operator**********************************************************************
1670  template< typename MatrixType2 >
1671  inline bool operator!=( const ColumnIterator<MatrixType2>& rhs ) const {
1672  return !( *this == rhs );
1673  }
1674  //*******************************************************************************************
1675 
1676  //**Subtraction operator*********************************************************************
1682  inline DifferenceType operator-( const ColumnIterator& rhs ) const {
1683  return row_ - rhs.row_;
1684  }
1685  //*******************************************************************************************
1686 
1687  private:
1688  //**Member variables*************************************************************************
1689  MatrixType& matrix_;
1690  size_t row_;
1691  size_t column_;
1692  //*******************************************************************************************
1693 
1694  //**Friend declarations**********************************************************************
1696  template< typename MatrixType2 > friend class ColumnIterator;
1698  //*******************************************************************************************
1699  };
1700  //**********************************************************************************************
1701 
1702  //**Type definitions****************************************************************************
1704  typedef ColumnIterator<const MT> ConstIterator;
1705 
1707  typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT> >::Type Iterator;
1708  //**********************************************************************************************
1709 
1710  //**Compilation flags***************************************************************************
1712  enum { vectorizable = 0 };
1713  //**********************************************************************************************
1714 
1715  //**Constructors********************************************************************************
1718  explicit inline DenseColumn( MT& matrix, size_t index );
1719  // No explicitly declared copy constructor.
1721  //**********************************************************************************************
1722 
1723  //**Destructor**********************************************************************************
1724  // No explicitly declared destructor.
1725  //**********************************************************************************************
1726 
1727  //**Data access functions***********************************************************************
1730  inline Reference operator[]( size_t index );
1731  inline ConstReference operator[]( size_t index ) const;
1732  inline Iterator begin ();
1733  inline ConstIterator begin () const;
1734  inline ConstIterator cbegin() const;
1735  inline Iterator end ();
1736  inline ConstIterator end () const;
1737  inline ConstIterator cend () const;
1739  //**********************************************************************************************
1740 
1741  //**Assignment operators************************************************************************
1744  inline DenseColumn& operator= ( const ElementType& rhs );
1745  inline DenseColumn& operator= ( const DenseColumn& rhs );
1746  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
1747  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
1748  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
1749  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
1750 
1751  template< typename Other >
1752  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
1753  operator*=( Other rhs );
1754 
1755  template< typename Other >
1756  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
1757  operator/=( Other rhs );
1759  //**********************************************************************************************
1760 
1761  //**Utility functions***************************************************************************
1764  inline size_t size() const;
1765  inline size_t capacity() const;
1766  inline size_t nonZeros() const;
1767  inline void reset();
1768  template< typename Other > inline DenseColumn& scale( const Other& scalar );
1770  //**********************************************************************************************
1771 
1772  public:
1773  //**Expression template evaluation functions****************************************************
1776  template< typename Other > inline bool canAlias ( const Other* alias ) const;
1777  template< typename Other > inline bool isAliased ( const Other* alias ) const;
1778  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
1779  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
1780  template< typename VT > inline void addAssign ( const DenseVector <VT,false>& rhs );
1781  template< typename VT > inline void addAssign ( const SparseVector<VT,false>& rhs );
1782  template< typename VT > inline void subAssign ( const DenseVector <VT,false>& rhs );
1783  template< typename VT > inline void subAssign ( const SparseVector<VT,false>& rhs );
1784  template< typename VT > inline void multAssign( const DenseVector <VT,false>& rhs );
1785  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
1787  //**********************************************************************************************
1788 
1789  private:
1790  //**Member variables****************************************************************************
1793  MT& matrix_;
1794  const size_t col_;
1795 
1796  //**********************************************************************************************
1797 
1798  //**Compile time checks*************************************************************************
1804  //**********************************************************************************************
1805 };
1807 //*************************************************************************************************
1808 
1809 
1810 
1811 
1812 //=================================================================================================
1813 //
1814 // CONSTRUCTOR
1815 //
1816 //=================================================================================================
1817 
1818 //*************************************************************************************************
1826 template< typename MT > // Type of the dense matrix
1827 inline DenseColumn<MT,false>::DenseColumn( MT& matrix, size_t index )
1828  : matrix_( matrix ) // The dense matrix containing the column
1829  , col_ ( index ) // The index of the column in the matrix
1830 {
1831  if( matrix_.columns() <= index )
1832  throw std::invalid_argument( "Invalid column access index" );
1833 }
1835 //*************************************************************************************************
1836 
1837 
1838 
1839 
1840 //=================================================================================================
1841 //
1842 // DATA ACCESS FUNCTIONS
1843 //
1844 //=================================================================================================
1845 
1846 //*************************************************************************************************
1853 template< typename MT > // Type of the dense matrix
1854 inline typename DenseColumn<MT,false>::Reference DenseColumn<MT,false>::operator[]( size_t index )
1855 {
1856  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
1857  return matrix_(index,col_);
1858 }
1860 //*************************************************************************************************
1861 
1862 
1863 //*************************************************************************************************
1870 template< typename MT > // Type of the dense matrix
1871 inline typename DenseColumn<MT,false>::ConstReference DenseColumn<MT,false>::operator[]( size_t index ) const
1872 {
1873  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
1874  return matrix_(index,col_);
1875 }
1877 //*************************************************************************************************
1878 
1879 
1880 //*************************************************************************************************
1888 template< typename MT > // Type of the dense matrix
1889 inline typename DenseColumn<MT,false>::Iterator DenseColumn<MT,false>::begin()
1890 {
1891  return Iterator( matrix_, 0UL, col_ );
1892 }
1894 //*************************************************************************************************
1895 
1896 
1897 //*************************************************************************************************
1905 template< typename MT > // Type of the dense matrix
1906 inline typename DenseColumn<MT,false>::ConstIterator DenseColumn<MT,false>::begin() const
1907 {
1908  return ConstIterator( matrix_, 0UL, col_ );
1909 }
1911 //*************************************************************************************************
1912 
1913 
1914 //*************************************************************************************************
1922 template< typename MT > // Type of the dense matrix
1923 inline typename DenseColumn<MT,false>::ConstIterator DenseColumn<MT,false>::cbegin() const
1924 {
1925  return ConstIterator( matrix_, 0UL, col_ );
1926 }
1928 //*************************************************************************************************
1929 
1930 
1931 //*************************************************************************************************
1939 template< typename MT > // Type of the dense matrix
1940 inline typename DenseColumn<MT,false>::Iterator DenseColumn<MT,false>::end()
1941 {
1942  return Iterator( matrix_, size(), col_ );
1943 }
1945 //*************************************************************************************************
1946 
1947 
1948 //*************************************************************************************************
1956 template< typename MT > // Type of the dense matrix
1957 inline typename DenseColumn<MT,false>::ConstIterator DenseColumn<MT,false>::end() const
1958 {
1959  return ConstIterator( matrix_, size(), col_ );
1960 }
1962 //*************************************************************************************************
1963 
1964 
1965 //*************************************************************************************************
1973 template< typename MT > // Type of the dense matrix
1974 inline typename DenseColumn<MT,false>::ConstIterator DenseColumn<MT,false>::cend() const
1975 {
1976  return ConstIterator( matrix_, size(), col_ );
1977 }
1979 //*************************************************************************************************
1980 
1981 
1982 
1983 
1984 //=================================================================================================
1985 //
1986 // ASSIGNMENT OPERATORS
1987 //
1988 //=================================================================================================
1989 
1990 //*************************************************************************************************
1997 template< typename MT > // Type of the dense matrix
1998 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator=( const ElementType& rhs )
1999 {
2000  const size_t rows( size() );
2001 
2002  for( size_t i=0UL; i<rows; ++i )
2003  matrix_(i,col_) = rhs;
2004 
2005  return *this;
2006 }
2008 //*************************************************************************************************
2009 
2010 
2011 //*************************************************************************************************
2022 template< typename MT > // Type of the dense matrix
2023 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator=( const DenseColumn& rhs )
2024 {
2025  if( &rhs == this ) return *this;
2026 
2027  if( size() != rhs.size() )
2028  throw std::invalid_argument( "Column sizes do not match" );
2029 
2030  const size_t rows( size() );
2031 
2032  for( size_t i=0UL; i<rows; ++i )
2033  matrix_(i,col_) = rhs[i];
2034 
2035  return *this;
2036 }
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2052 template< typename MT > // Type of the dense matrix
2053 template< typename VT > // Type of the right-hand side vector
2054 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator=( const Vector<VT,false>& rhs )
2055 {
2056  using blaze::assign;
2057 
2058  if( size() != (~rhs).size() )
2059  throw std::invalid_argument( "Vector sizes do not match" );
2060 
2061  if( (~rhs).canAlias( this ) ) {
2062  const ResultType tmp( ~rhs );
2063  assign( *this, tmp );
2064  }
2065  else {
2066  if( IsSparseVector<VT>::value )
2067  reset();
2068  assign( *this, ~rhs );
2069  }
2070 
2071  return *this;
2072 }
2074 //*************************************************************************************************
2075 
2076 
2077 //*************************************************************************************************
2088 template< typename MT > // Type of the dense matrix
2089 template< typename VT > // Type of the right-hand side vector
2090 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator+=( const Vector<VT,false>& rhs )
2091 {
2092  using blaze::addAssign;
2093 
2094  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
2095  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
2096 
2097  if( size() != (~rhs).size() )
2098  throw std::invalid_argument( "Vector sizes do not match" );
2099 
2100  if( (~rhs).canAlias( this ) ) {
2101  const typename VT::ResultType tmp( ~rhs );
2102  addAssign( *this, tmp );
2103  }
2104  else {
2105  addAssign( *this, ~rhs );
2106  }
2107 
2108  return *this;
2109 }
2111 //*************************************************************************************************
2112 
2113 
2114 //*************************************************************************************************
2125 template< typename MT > // Type of the dense matrix
2126 template< typename VT > // Type of the right-hand side vector
2127 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator-=( const Vector<VT,false>& rhs )
2128 {
2129  using blaze::subAssign;
2130 
2131  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
2132  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
2133 
2134  if( size() != (~rhs).size() )
2135  throw std::invalid_argument( "Vector sizes do not match" );
2136 
2137  if( (~rhs).canAlias( this ) ) {
2138  const typename VT::ResultType tmp( ~rhs );
2139  subAssign( *this, tmp );
2140  }
2141  else {
2142  subAssign( *this, ~rhs );
2143  }
2144 
2145  return *this;
2146 }
2148 //*************************************************************************************************
2149 
2150 
2151 //*************************************************************************************************
2163 template< typename MT > // Type of the dense matrix
2164 template< typename VT > // Type of the right-hand side vector
2165 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator*=( const Vector<VT,false>& rhs )
2166 {
2167  using blaze::multAssign;
2168 
2169  BLAZE_CONSTRAINT_MUST_BE_NONTRANSPOSE_VECTOR_TYPE( typename VT::ResultType );
2170  BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION ( typename VT::ResultType );
2171 
2172  if( size() != (~rhs).size() )
2173  throw std::invalid_argument( "Vector sizes do not match" );
2174 
2175  if( (~rhs).canAlias( this ) || IsSparseVector<VT>::value ) {
2176  const typename VT::ResultType tmp( ~rhs );
2177  multAssign( *this, tmp );
2178  }
2179  else {
2180  multAssign( *this, ~rhs );
2181  }
2182 
2183  return *this;
2184 }
2186 //*************************************************************************************************
2187 
2188 
2189 //*************************************************************************************************
2197 template< typename MT > // Type of the dense matrix
2198 template< typename Other > // Data type of the right-hand side scalar
2199 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2200  DenseColumn<MT,false>::operator*=( Other rhs )
2201 {
2202  return operator=( (*this) * rhs );
2203 }
2205 //*************************************************************************************************
2206 
2207 
2208 //*************************************************************************************************
2218 template< typename MT > // Type of the dense matrix
2219 template< typename Other > // Data type of the right-hand side scalar
2220 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2221  DenseColumn<MT,false>::operator/=( Other rhs )
2222 {
2223  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2224 
2225  return operator=( (*this) / rhs );
2226 }
2228 //*************************************************************************************************
2229 
2230 
2231 
2232 
2233 //=================================================================================================
2234 //
2235 // UTILITY FUNCTIONS
2236 //
2237 //=================================================================================================
2238 
2239 //*************************************************************************************************
2245 template< typename MT > // Type of the dense matrix
2246 inline size_t DenseColumn<MT,false>::size() const
2247 {
2248  return matrix_.rows();
2249 }
2251 //*************************************************************************************************
2252 
2253 
2254 //*************************************************************************************************
2260 template< typename MT > // Type of the dense matrix
2261 inline size_t DenseColumn<MT,false>::capacity() const
2262 {
2263  return matrix_.rows();
2264 }
2266 //*************************************************************************************************
2267 
2268 
2269 //*************************************************************************************************
2278 template< typename MT > // Type of the dense matrix
2279 inline size_t DenseColumn<MT,false>::nonZeros() const
2280 {
2281  const size_t rows( size() );
2282  size_t nonzeros( 0UL );
2283 
2284  for( size_t i=0UL; i<rows; ++i )
2285  if( !isDefault( matrix_(i,col_) ) )
2286  ++nonzeros;
2287 
2288  return nonzeros;
2289 }
2291 //*************************************************************************************************
2292 
2293 
2294 //*************************************************************************************************
2300 template< typename MT > // Type of the dense matrix
2301 inline void DenseColumn<MT,false>::reset()
2302 {
2303  using blaze::reset;
2304  const size_t rows( size() );
2305  for( size_t i=0UL; i<rows; ++i )
2306  reset( matrix_(i,col_) );
2307 }
2309 //*************************************************************************************************
2310 
2311 
2312 //*************************************************************************************************
2319 template< typename MT > // Type of the dense matrix
2320 template< typename Other > // Data type of the scalar value
2321 inline DenseColumn<MT,false>& DenseColumn<MT,false>::scale( const Other& scalar )
2322 {
2323  for( size_t i=0UL; i<size(); ++i ) {
2324  matrix_(i,col_) *= scalar;
2325  }
2326  return *this;
2327 }
2329 //*************************************************************************************************
2330 
2331 
2332 
2333 
2334 //=================================================================================================
2335 //
2336 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2337 //
2338 //=================================================================================================
2339 
2340 //*************************************************************************************************
2351 template< typename MT > // Type of the dense matrix
2352 template< typename Other > // Data type of the foreign expression
2353 inline bool DenseColumn<MT,false>::canAlias( const Other* alias ) const
2354 {
2355  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
2356 }
2358 //*************************************************************************************************
2359 
2360 
2361 //*************************************************************************************************
2372 template< typename MT > // Type of the dense matrix
2373 template< typename Other > // Data type of the foreign expression
2374 inline bool DenseColumn<MT,false>::isAliased( const Other* alias ) const
2375 {
2376  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
2377 }
2379 //*************************************************************************************************
2380 
2381 
2382 //*************************************************************************************************
2394 template< typename MT > // Type of the dense matrix
2395 template< typename VT > // Type of the right-hand side dense vector
2396 inline void DenseColumn<MT,false>::assign( const DenseVector<VT,false>& rhs )
2397 {
2398  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2399 
2400  const size_t iend( (~rhs).size() & size_t(-2) );
2401  for( size_t i=0UL; i<iend; i+=2UL ) {
2402  matrix_(i ,col_) = (~rhs)[i ];
2403  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
2404  }
2405  if( iend < (~rhs).size() )
2406  matrix_(iend,col_) = (~rhs)[iend];
2407 }
2409 //*************************************************************************************************
2410 
2411 
2412 //*************************************************************************************************
2424 template< typename MT > // Type of the dense matrix
2425 template< typename VT > // Type of the right-hand side sparse vector
2426 inline void DenseColumn<MT,false>::assign( const SparseVector<VT,false>& rhs )
2427 {
2428  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2429 
2430  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2431  matrix_(element->index(),col_) = element->value();
2432 }
2434 //*************************************************************************************************
2435 
2436 
2437 //*************************************************************************************************
2449 template< typename MT > // Type of the dense matrix
2450 template< typename VT > // Type of the right-hand side dense vector
2451 inline void DenseColumn<MT,false>::addAssign( const DenseVector<VT,false>& rhs )
2452 {
2453  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2454 
2455  const size_t iend( (~rhs).size() & size_t(-2) );
2456  for( size_t i=0UL; i<iend; i+=2UL ) {
2457  matrix_(i ,col_) += (~rhs)[i ];
2458  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
2459  }
2460  if( iend < (~rhs).size() )
2461  matrix_(iend,col_) += (~rhs)[iend];
2462 }
2464 //*************************************************************************************************
2465 
2466 
2467 //*************************************************************************************************
2479 template< typename MT > // Type of the dense matrix
2480 template< typename VT > // Type of the right-hand side sparse vector
2481 inline void DenseColumn<MT,false>::addAssign( const SparseVector<VT,false>& rhs )
2482 {
2483  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2484 
2485  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2486  matrix_(element->index(),col_) += element->value();
2487 }
2489 //*************************************************************************************************
2490 
2491 
2492 //*************************************************************************************************
2504 template< typename MT > // Type of the dense matrix
2505 template< typename VT > // Type of the right-hand side dense vector
2506 inline void DenseColumn<MT,false>::subAssign( const DenseVector<VT,false>& rhs )
2507 {
2508  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2509 
2510  const size_t iend( (~rhs).size() & size_t(-2) );
2511  for( size_t i=0UL; i<iend; i+=2UL ) {
2512  matrix_(i ,col_) -= (~rhs)[i ];
2513  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
2514  }
2515  if( iend < (~rhs).size() )
2516  matrix_(iend,col_) -= (~rhs)[iend];
2517 }
2519 //*************************************************************************************************
2520 
2521 
2522 //*************************************************************************************************
2534 template< typename MT > // Type of the dense matrix
2535 template< typename VT > // Type of the right-hand side sparse vector
2536 inline void DenseColumn<MT,false>::subAssign( const SparseVector<VT,false>& rhs )
2537 {
2538  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2539 
2540  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2541  matrix_(element->index(),col_) -= element->value();
2542 }
2544 //*************************************************************************************************
2545 
2546 
2547 //*************************************************************************************************
2559 template< typename MT > // Type of the dense matrix
2560 template< typename VT > // Type of the right-hand side dense vector
2561 inline void DenseColumn<MT,false>::multAssign( const DenseVector<VT,false>& rhs )
2562 {
2563  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2564 
2565  const size_t iend( (~rhs).size() & size_t(-2) );
2566  for( size_t i=0UL; i<iend; i+=2UL ) {
2567  matrix_(i ,col_) *= (~rhs)[i ];
2568  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
2569  }
2570  if( iend < (~rhs).size() )
2571  matrix_(iend,col_) *= (~rhs)[iend];
2572 }
2574 //*************************************************************************************************
2575 
2576 
2577 //*************************************************************************************************
2589 template< typename MT > // Type of the dense matrix
2590 template< typename VT > // Type of the right-hand side sparse vector
2591 inline void DenseColumn<MT,false>::multAssign( const SparseVector<VT,false>& rhs )
2592 {
2593  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2594 
2595  const ResultType tmp( *this );
2596 
2597  reset();
2598 
2599  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2600  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2601 }
2603 //*************************************************************************************************
2604 
2605 
2606 
2607 
2608 
2609 
2610 
2611 
2612 //=================================================================================================
2613 //
2614 // DENSECOLUMN OPERATORS
2615 //
2616 //=================================================================================================
2617 
2618 //*************************************************************************************************
2621 template< typename MT, bool SO >
2622 inline void reset( DenseColumn<MT,SO>& column );
2623 
2624 template< typename MT, bool SO >
2625 inline void clear( DenseColumn<MT,SO>& column );
2626 
2627 template< typename MT, bool SO >
2628 inline bool isnan( const DenseColumn<MT,SO>& column );
2629 
2630 template< typename MT, bool SO >
2631 inline bool isDefault( const DenseColumn<MT,SO>& column );
2633 //*************************************************************************************************
2634 
2635 
2636 //*************************************************************************************************
2643 template< typename MT // Type of the dense matrix
2644  , bool SO > // Storage order
2646 {
2647  column.reset();
2648 }
2649 //*************************************************************************************************
2650 
2651 
2652 //*************************************************************************************************
2659 template< typename MT // Type of the dense matrix
2660  , bool SO > // Storage order
2662 {
2663  column.reset();
2664 }
2665 //*************************************************************************************************
2666 
2667 
2668 //*************************************************************************************************
2684 template< typename MT // Type of the dense matrix
2685  , bool SO > // Storage order
2686 inline bool isnan( const DenseColumn<MT,SO>& column )
2687 {
2688  for( size_t i=0UL; i<column.size(); ++i ) {
2689  if( isnan( column[i] ) ) return true;
2690  }
2691  return false;
2692 }
2693 //*************************************************************************************************
2694 
2695 
2696 //*************************************************************************************************
2714 template< typename MT // Type of the dense matrix
2715  , bool SO > // Storage order
2716 inline bool isDefault( const DenseColumn<MT,SO>& column )
2717 {
2718  for( size_t i=0UL; i<column.size(); ++i )
2719  if( !isDefault( column[i] ) ) return false;
2720  return true;
2721 }
2722 //*************************************************************************************************
2723 
2724 
2725 
2726 
2727 //=================================================================================================
2728 //
2729 // GLOBAL OPERATORS
2730 //
2731 //=================================================================================================
2732 
2733 //*************************************************************************************************
2752 template< typename MT // Type of the dense matrix
2753  , bool SO > // Storage order
2754 inline typename DisableIf< IsExpression<MT>, DenseColumn<MT> >::Type
2755  column( DenseMatrix<MT,SO>& dm, size_t index )
2756 {
2758 
2759  return DenseColumn<MT>( ~dm, index );
2760 }
2761 //*************************************************************************************************
2762 
2763 
2764 //*************************************************************************************************
2783 template< typename MT // Type of the dense matrix
2784  , bool SO > // Storage order
2785 inline typename DisableIf< IsExpression<MT>, DenseColumn<const MT> >::Type
2786  column( const DenseMatrix<MT,SO>& dm, size_t index )
2787 {
2789 
2790  return DenseColumn<const MT>( ~dm, index );
2791 }
2792 //*************************************************************************************************
2793 
2794 
2795 
2796 
2797 //=================================================================================================
2798 //
2799 // GLOBAL RESTRUCTURING OPERATORS
2800 //
2801 //=================================================================================================
2802 
2803 //*************************************************************************************************
2815 template< typename MT // Type of the dense matrix
2816  , bool SO > // Storage order
2817 inline typename EnableIf< IsMatMatAddExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2818  column( const DenseMatrix<MT,SO>& dm, size_t index )
2819 {
2821 
2822  return column( (~dm).leftOperand(), index ) + column( (~dm).rightOperand(), index );
2823 }
2825 //*************************************************************************************************
2826 
2827 
2828 //*************************************************************************************************
2840 template< typename MT // Type of the dense matrix
2841  , bool SO > // Storage order
2842 inline typename EnableIf< IsMatMatSubExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2843  column( const DenseMatrix<MT,SO>& dm, size_t index )
2844 {
2846 
2847  return column( (~dm).leftOperand(), index ) - column( (~dm).rightOperand(), index );
2848 }
2850 //*************************************************************************************************
2851 
2852 
2853 //*************************************************************************************************
2865 template< typename MT // Type of the dense matrix
2866  , bool SO > // Storage order
2867 inline typename EnableIf< IsMatMatMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2868  column( const DenseMatrix<MT,SO>& dm, size_t index )
2869 {
2871 
2872  return (~dm).leftOperand() * column( (~dm).rightOperand(), index );
2873 }
2875 //*************************************************************************************************
2876 
2877 
2878 //*************************************************************************************************
2890 template< typename MT // Type of the dense matrix
2891  , bool SO > // Storage order
2892 inline typename EnableIf< IsVecTVecMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2893  column( const DenseMatrix<MT,SO>& dm, size_t index )
2894 {
2896 
2897  return (~dm).leftOperand() * (~dm).rightOperand()[index];
2898 }
2900 //*************************************************************************************************
2901 
2902 
2903 //*************************************************************************************************
2915 template< typename MT // Type of the dense matrix
2916  , bool SO > // Storage order
2917 inline typename EnableIf< IsMatScalarMultExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2918  column( const DenseMatrix<MT,SO>& dm, size_t index )
2919 {
2921 
2922  return column( (~dm).leftOperand(), index ) * (~dm).rightOperand();
2923 }
2925 //*************************************************************************************************
2926 
2927 
2928 //*************************************************************************************************
2940 template< typename MT // Type of the dense matrix
2941  , bool SO > // Storage order
2942 inline typename EnableIf< IsMatScalarDivExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2943  column( const DenseMatrix<MT,SO>& dm, size_t index )
2944 {
2946 
2947  return column( (~dm).leftOperand(), index ) / (~dm).rightOperand();
2948 }
2950 //*************************************************************************************************
2951 
2952 
2953 //*************************************************************************************************
2965 template< typename MT // Type of the dense matrix
2966  , bool SO > // Storage order
2967 inline typename EnableIf< IsMatAbsExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2968  column( const DenseMatrix<MT,SO>& dm, size_t index )
2969 {
2971 
2972  return abs( column( (~dm).operand(), index ) );
2973 }
2975 //*************************************************************************************************
2976 
2977 
2978 //*************************************************************************************************
2990 template< typename MT // Type of the dense matrix
2991  , bool SO > // Storage order
2992 inline typename EnableIf< IsMatEvalExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
2993  column( const DenseMatrix<MT,SO>& dm, size_t index )
2994 {
2996 
2997  return eval( column( (~dm).operand(), index ) );
2998 }
3000 //*************************************************************************************************
3001 
3002 
3003 //*************************************************************************************************
3015 template< typename MT // Type of the dense matrix
3016  , bool SO > // Storage order
3017 inline typename EnableIf< IsMatTransExpr<MT>, typename ColumnExprTrait<MT>::Type >::Type
3018  column( const DenseMatrix<MT,SO>& dm, size_t index )
3019 {
3021 
3022  return trans( row( (~dm).operand(), index ) );
3023 }
3025 //*************************************************************************************************
3026 
3027 
3028 
3029 
3030 //=================================================================================================
3031 //
3032 // ADDTRAIT SPECIALIZATIONS
3033 //
3034 //=================================================================================================
3035 
3036 //*************************************************************************************************
3038 template< typename T1, bool SO, typename T2, size_t N >
3039 struct AddTrait< DenseColumn<T1,SO>, StaticVector<T2,N,false> >
3040 {
3041  typedef typename AddTrait< typename DenseColumn<T1,SO>::ResultType,
3042  StaticVector<T2,N,false> >::Type Type;
3043 };
3044 
3045 template< typename T1, size_t N, typename T2, bool SO >
3046 struct AddTrait< StaticVector<T1,N,false>, DenseColumn<T2,SO> >
3047 {
3048  typedef typename AddTrait< StaticVector<T1,N,false>,
3049  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3050 };
3051 
3052 template< typename T1, bool SO, typename T2 >
3053 struct AddTrait< DenseColumn<T1,SO>, DynamicVector<T2,false> >
3054 {
3055  typedef typename AddTrait< typename DenseColumn<T1,SO>::ResultType,
3056  DynamicVector<T2,false> >::Type Type;
3057 };
3058 
3059 template< typename T1, typename T2, bool SO >
3060 struct AddTrait< DynamicVector<T1,false>, DenseColumn<T2,SO> >
3061 {
3062  typedef typename AddTrait< DynamicVector<T1,false>,
3063  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3064 };
3065 
3066 template< typename T1, bool SO, typename T2 >
3067 struct AddTrait< DenseColumn<T1,SO>, CompressedVector<T2,false> >
3068 {
3069  typedef typename AddTrait< typename DenseColumn<T1,SO>::ResultType,
3070  CompressedVector<T2,false> >::Type Type;
3071 };
3072 
3073 template< typename T1, typename T2, bool SO >
3074 struct AddTrait< CompressedVector<T1,false>, DenseColumn<T2,SO> >
3075 {
3076  typedef typename AddTrait< CompressedVector<T1,false>,
3077  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3078 };
3079 
3080 template< typename T1, bool SO1, typename T2, bool SO2 >
3081 struct AddTrait< DenseColumn<T1,SO1>, DenseColumn<T2,SO2> >
3082 {
3083  typedef typename AddTrait< typename DenseColumn<T1,SO1>::ResultType,
3084  typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3085 };
3087 //*************************************************************************************************
3088 
3089 
3090 
3091 
3092 //=================================================================================================
3093 //
3094 // SUBTRAIT SPECIALIZATIONS
3095 //
3096 //=================================================================================================
3097 
3098 //*************************************************************************************************
3100 template< typename T1, bool SO, typename T2, size_t N >
3101 struct SubTrait< DenseColumn<T1,SO>, StaticVector<T2,N,false> >
3102 {
3103  typedef typename SubTrait< typename DenseColumn<T1,SO>::ResultType,
3104  StaticVector<T2,N,false> >::Type Type;
3105 };
3106 
3107 template< typename T1, size_t N, typename T2, bool SO >
3108 struct SubTrait< StaticVector<T1,N,false>, DenseColumn<T2,SO> >
3109 {
3110  typedef typename SubTrait< StaticVector<T1,N,false>,
3111  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3112 };
3113 
3114 template< typename T1, bool SO, typename T2 >
3115 struct SubTrait< DenseColumn<T1,SO>, DynamicVector<T2,false> >
3116 {
3117  typedef typename SubTrait< typename DenseColumn<T1,SO>::ResultType,
3118  DynamicVector<T2,false> >::Type Type;
3119 };
3120 
3121 template< typename T1, typename T2, bool SO >
3122 struct SubTrait< DynamicVector<T1,false>, DenseColumn<T2,SO> >
3123 {
3124  typedef typename SubTrait< DynamicVector<T1,false>,
3125  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3126 };
3127 
3128 template< typename T1, bool SO, typename T2 >
3129 struct SubTrait< DenseColumn<T1,SO>, CompressedVector<T2,false> >
3130 {
3131  typedef typename SubTrait< typename DenseColumn<T1,SO>::ResultType,
3132  CompressedVector<T2,false> >::Type Type;
3133 };
3134 
3135 template< typename T1, typename T2, bool SO >
3136 struct SubTrait< CompressedVector<T1,false>, DenseColumn<T2,SO> >
3137 {
3138  typedef typename SubTrait< CompressedVector<T1,false>,
3139  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3140 };
3141 
3142 template< typename T1, bool SO1, typename T2, bool SO2 >
3143 struct SubTrait< DenseColumn<T1,SO1>, DenseColumn<T2,SO2> >
3144 {
3145  typedef typename SubTrait< typename DenseColumn<T1,SO1>::ResultType,
3146  typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3147 };
3149 //*************************************************************************************************
3150 
3151 
3152 
3153 
3154 //=================================================================================================
3155 //
3156 // MULTTRAIT SPECIALIZATIONS
3157 //
3158 //=================================================================================================
3159 
3160 //*************************************************************************************************
3162 template< typename T1, bool SO, typename T2 >
3163 struct MultTrait< DenseColumn<T1,SO>, T2 >
3164 {
3165  typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType, T2 >::Type Type;
3167 };
3168 
3169 template< typename T1, typename T2, bool SO >
3170 struct MultTrait< T1, DenseColumn<T2,SO> >
3171 {
3172  typedef typename MultTrait< T1, typename DenseColumn<T2,SO>::ResultType >::Type Type;
3174 };
3175 
3176 template< typename T1, bool SO, typename T2, size_t N, bool TF >
3177 struct MultTrait< DenseColumn<T1,SO>, StaticVector<T2,N,TF> >
3178 {
3179  typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType,
3180  StaticVector<T2,N,TF> >::Type Type;
3181 };
3182 
3183 template< typename T1, size_t N, bool TF, typename T2, bool SO >
3184 struct MultTrait< StaticVector<T1,N,TF>, DenseColumn<T2,SO> >
3185 {
3186  typedef typename MultTrait< StaticVector<T1,N,TF>,
3187  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3188 };
3189 
3190 template< typename T1, bool SO, typename T2, bool TF >
3191 struct MultTrait< DenseColumn<T1,SO>, DynamicVector<T2,TF> >
3192 {
3193  typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType,
3194  DynamicVector<T2,TF> >::Type Type;
3195 };
3196 
3197 template< typename T1, bool TF, typename T2, bool SO >
3198 struct MultTrait< DynamicVector<T1,TF>, DenseColumn<T2,SO> >
3199 {
3200  typedef typename MultTrait< DynamicVector<T1,TF>,
3201  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3202 };
3203 
3204 template< typename T1, bool SO, typename T2, bool TF >
3205 struct MultTrait< DenseColumn<T1,SO>, CompressedVector<T2,TF> >
3206 {
3207  typedef typename MultTrait< typename DenseColumn<T1,SO>::ResultType,
3208  CompressedVector<T2,TF> >::Type Type;
3209 };
3210 
3211 template< typename T1, bool TF, typename T2, bool SO >
3212 struct MultTrait< CompressedVector<T1,TF>, DenseColumn<T2,SO> >
3213 {
3214  typedef typename MultTrait< CompressedVector<T1,TF>,
3215  typename DenseColumn<T2,SO>::ResultType >::Type Type;
3216 };
3217 
3218 template< typename T1, bool SO1, typename T2, bool SO2 >
3219 struct MultTrait< DenseColumn<T1,SO1>, DenseColumn<T2,SO2> >
3220 {
3221  typedef typename MultTrait< typename DenseColumn<T1,SO1>::ResultType,
3222  typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3223 };
3224 
3225 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
3226 struct MultTrait< StaticMatrix<T1,M,N,SO1>, DenseColumn<T2,SO2> >
3227 {
3228  typedef typename MultTrait< StaticMatrix<T1,M,N,SO1>,
3229  typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3230 };
3231 
3232 template< typename T1, bool SO1, typename T2, bool SO2 >
3233 struct MultTrait< DynamicMatrix<T1,SO1>, DenseColumn<T2,SO2> >
3234 {
3235  typedef typename MultTrait< DynamicMatrix<T1,SO1>,
3236  typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3237 };
3238 
3239 template< typename T1, bool SO1, typename T2, bool SO2 >
3240 struct MultTrait< CompressedMatrix<T1,SO1>, DenseColumn<T2,SO2> >
3241 {
3242  typedef typename MultTrait< CompressedMatrix<T1,SO1>,
3243  typename DenseColumn<T2,SO2>::ResultType >::Type Type;
3244 };
3246 //*************************************************************************************************
3247 
3248 
3249 
3250 
3251 //=================================================================================================
3252 //
3253 // DIVTRAIT SPECIALIZATIONS
3254 //
3255 //=================================================================================================
3256 
3257 //*************************************************************************************************
3259 template< typename T1, bool SO, typename T2 >
3260 struct DivTrait< DenseColumn<T1,SO>, T2 >
3261 {
3262  typedef typename DivTrait< typename DenseColumn<T1,SO>::ResultType, T2 >::Type Type;
3264 };
3266 //*************************************************************************************************
3267 
3268 } // namespace blaze
3269 
3270 #endif