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>
44 #include <stdexcept>
57 #include <blaze/math/Intrinsics.h>
58 #include <blaze/math/shims/Clear.h>
60 #include <blaze/math/shims/IsOne.h>
80 #include <blaze/system/CacheSize.h>
81 #include <blaze/system/Inline.h>
82 #include <blaze/system/Streaming.h>
84 #include <blaze/util/Assert.h>
88 #include <blaze/util/DisableIf.h>
89 #include <blaze/util/EnableIf.h>
91 #include <blaze/util/mpl/And.h>
92 #include <blaze/util/mpl/If.h>
93 #include <blaze/util/mpl/Or.h>
94 #include <blaze/util/Null.h>
96 #include <blaze/util/Template.h>
97 #include <blaze/util/Types.h>
104 #include <blaze/util/Unused.h>
105 
106 
107 namespace blaze {
108 
109 //=================================================================================================
110 //
111 // CLASS DEFINITION
112 //
113 //=================================================================================================
114 
115 //*************************************************************************************************
335 template< typename MT // Type of the dense matrix
336  , bool SO = IsColumnMajorMatrix<MT>::value // Storage order
337  , bool SF = IsSymmetric<MT>::value > // Symmetry flag
338 class DenseColumn : public DenseVector< DenseColumn<MT,SO,SF>, false >
339  , private Column
340 {
341  private:
342  //**Type definitions****************************************************************************
344  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
345 
348  //**********************************************************************************************
349 
350  //**********************************************************************************************
352 
358  enum { useConst = IsConst<MT>::value };
359  //**********************************************************************************************
360 
361  public:
362  //**Type definitions****************************************************************************
366  typedef typename MT::ElementType ElementType;
367  typedef typename IT::Type IntrinsicType;
368  typedef typename MT::ReturnType ReturnType;
369  typedef const DenseColumn& CompositeType;
370 
373 
376 
378  typedef const ElementType* ConstPointer;
379 
382 
385 
388  //**********************************************************************************************
389 
390  //**Compilation flags***************************************************************************
392  enum { vectorizable = MT::vectorizable };
393 
395  enum { smpAssignable = MT::smpAssignable };
396  //**********************************************************************************************
397 
398  //**Constructors********************************************************************************
401  explicit inline DenseColumn( MT& matrix, size_t index );
402  // No explicitly declared copy constructor.
404  //**********************************************************************************************
405 
406  //**Destructor**********************************************************************************
407  // No explicitly declared destructor.
408  //**********************************************************************************************
409 
410  //**Data access functions***********************************************************************
413  inline Reference operator[]( size_t index );
414  inline ConstReference operator[]( size_t index ) const;
415  inline Pointer data ();
416  inline ConstPointer data () const;
417  inline Iterator begin ();
418  inline ConstIterator begin () const;
419  inline ConstIterator cbegin() const;
420  inline Iterator end ();
421  inline ConstIterator end () const;
422  inline ConstIterator cend () const;
424  //**********************************************************************************************
425 
426  //**Assignment operators************************************************************************
429  inline DenseColumn& operator=( const ElementType& rhs );
430  inline DenseColumn& operator=( const DenseColumn& rhs );
431 
432  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
433  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
434  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
435  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
436 
437  template< typename Other >
438  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
439  operator*=( Other rhs );
440 
441  template< typename Other >
442  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
443  operator/=( Other rhs );
445  //**********************************************************************************************
446 
447  //**Utility functions***************************************************************************
450  inline size_t size() const;
451  inline size_t capacity() const;
452  inline size_t nonZeros() const;
453  inline void reset();
454  template< typename Other > inline DenseColumn& scale( const Other& scalar );
456  //**********************************************************************************************
457 
458  private:
459  //**********************************************************************************************
461  template< typename VT >
463  struct VectorizedAssign {
464  enum { value = vectorizable && VT::vectorizable &&
465  IsSame<ElementType,typename VT::ElementType>::value };
466  };
468  //**********************************************************************************************
469 
470  //**********************************************************************************************
472  template< typename VT >
474  struct VectorizedAddAssign {
475  enum { value = vectorizable && VT::vectorizable &&
476  IsSame<ElementType,typename VT::ElementType>::value &&
477  IntrinsicTrait<ElementType>::addition };
478  };
480  //**********************************************************************************************
481 
482  //**********************************************************************************************
484  template< typename VT >
486  struct VectorizedSubAssign {
487  enum { value = 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 = vectorizable && VT::vectorizable &&
500  IsSame<ElementType,typename VT::ElementType>::value &&
501  IntrinsicTrait<ElementType>::multiplication };
502  };
504  //**********************************************************************************************
505 
506  public:
507  //**Expression template evaluation functions****************************************************
510  template< typename Other >
511  inline bool canAlias( const Other* alias ) const;
512 
513  template< typename MT2, bool SO2, bool SF2 >
514  inline bool canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const;
515 
516  template< typename Other >
517  inline bool isAliased( const Other* alias ) const;
518 
519  template< typename MT2, bool SO2, bool SF2 >
520  inline bool isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const;
521 
522  inline bool isAligned () const;
523  inline bool canSMPAssign() const;
524 
525  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
526  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
527 
528  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
529  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
530  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
531 
532  template< typename VT >
533  inline typename DisableIf< VectorizedAssign<VT> >::Type
534  assign( const DenseVector<VT,false>& rhs );
535 
536  template< typename VT >
537  inline typename EnableIf< VectorizedAssign<VT> >::Type
538  assign( const DenseVector<VT,false>& rhs );
539 
540  template< typename VT > inline void assign( const SparseVector<VT,false>& rhs );
541 
542  template< typename VT >
543  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
544  addAssign( const DenseVector<VT,false>& rhs );
545 
546  template< typename VT >
547  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
548  addAssign( const DenseVector<VT,false>& rhs );
549 
550  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
551 
552  template< typename VT >
553  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
554  subAssign( const DenseVector<VT,false>& rhs );
555 
556  template< typename VT >
557  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
558  subAssign( const DenseVector<VT,false>& rhs );
559 
560  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
561 
562  template< typename VT >
563  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
564  multAssign( const DenseVector<VT,false>& rhs );
565 
566  template< typename VT >
567  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
568  multAssign( const DenseVector<VT,false>& rhs );
569 
570  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
572  //**********************************************************************************************
573 
574  private:
575  //**Utility functions***************************************************************************
578  template< typename MT2, bool SO2, typename VT >
579  inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
580  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,false>& rhs );
581 
582  template< typename MT2, bool SO2, typename VT >
583  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
584  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
585 
586  template< typename MT2, bool SO2, typename VT >
587  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
588  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
589 
590  template< typename MT2, bool SO2, typename VT >
591  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
592  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
593 
594  template< typename MT2, bool SO2, typename VT >
595  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
596  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
597 
598  template< typename MT2, bool SO2, typename VT >
599  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
600  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
601 
602  template< typename MT2, bool SO2, typename VT >
603  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
604  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
606  //**********************************************************************************************
607 
608  //**Member variables****************************************************************************
611  Operand matrix_;
612  const size_t col_;
613 
614  //**********************************************************************************************
615 
616  //**Friend declarations*************************************************************************
618  template< typename MT2, bool SO2, bool SF2 > friend class DenseColumn;
619 
620  template< typename MT2, bool SO2, bool SF2 >
621  friend bool isSame( const DenseColumn<MT2,SO2,SF2>& a, const DenseColumn<MT2,SO2,SF2>& b );
622 
623  template< typename MT2, bool SO2, bool SF2 >
624  friend typename DerestrictTrait< DenseColumn<MT2,SO2,SF2> >::Type
625  derestrict( DenseColumn<MT2,SO2,SF2>& dm );
627  //**********************************************************************************************
628 
629  //**Compile time checks*************************************************************************
639  //**********************************************************************************************
640 };
641 //*************************************************************************************************
642 
643 
644 
645 
646 //=================================================================================================
647 //
648 // CONSTRUCTOR
649 //
650 //=================================================================================================
651 
652 //*************************************************************************************************
659 template< typename MT // Type of the dense matrix
660  , bool SO // Storage order
661  , bool SF > // Symmetry flag
662 inline DenseColumn<MT,SO,SF>::DenseColumn( MT& matrix, size_t index )
663  : matrix_( matrix ) // The dense matrix containing the column
664  , col_ ( index ) // The index of the column in the matrix
665 {
666  if( matrix_.columns() <= index )
667  throw std::invalid_argument( "Invalid column access index" );
668 }
669 //*************************************************************************************************
670 
671 
672 
673 
674 //=================================================================================================
675 //
676 // DATA ACCESS FUNCTIONS
677 //
678 //=================================================================================================
679 
680 //*************************************************************************************************
686 template< typename MT // Type of the dense matrix
687  , bool SO // Storage order
688  , bool SF > // Symmetry flag
690 {
691  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
692  return matrix_(index,col_);
693 }
694 //*************************************************************************************************
695 
696 
697 //*************************************************************************************************
703 template< typename MT // Type of the dense matrix
704  , bool SO // Storage order
705  , bool SF > // Symmetry flag
707  DenseColumn<MT,SO,SF>::operator[]( size_t index ) const
708 {
709  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
710  return matrix_(index,col_);
711 }
712 //*************************************************************************************************
713 
714 
715 //*************************************************************************************************
722 template< typename MT // Type of the dense matrix
723  , bool SO // Storage order
724  , bool SF > // Symmetry flag
726 {
727  return matrix_.data( col_ );
728 }
729 //*************************************************************************************************
730 
731 
732 //*************************************************************************************************
739 template< typename MT // Type of the dense matrix
740  , bool SO // Storage order
741  , bool SF > // Symmetry flag
743 {
744  return matrix_.data( col_ );
745 }
746 //*************************************************************************************************
747 
748 
749 //*************************************************************************************************
756 template< typename MT // Type of the dense matrix
757  , bool SO // Storage order
758  , bool SF > // Symmetry flag
760 {
761  return matrix_.begin( col_ );
762 }
763 //*************************************************************************************************
764 
765 
766 //*************************************************************************************************
773 template< typename MT // Type of the dense matrix
774  , bool SO // Storage order
775  , bool SF > // Symmetry flag
777 {
778  return matrix_.cbegin( col_ );
779 }
780 //*************************************************************************************************
781 
782 
783 //*************************************************************************************************
790 template< typename MT // Type of the dense matrix
791  , bool SO // Storage order
792  , bool SF > // Symmetry flag
794 {
795  return matrix_.cbegin( col_ );
796 }
797 //*************************************************************************************************
798 
799 
800 //*************************************************************************************************
807 template< typename MT // Type of the dense matrix
808  , bool SO // Storage order
809  , bool SF > // Symmetry flag
811 {
812  return matrix_.end( col_ );
813 }
814 //*************************************************************************************************
815 
816 
817 //*************************************************************************************************
824 template< typename MT // Type of the dense matrix
825  , bool SO // Storage order
826  , bool SF > // Symmetry flag
828 {
829  return matrix_.cend( col_ );
830 }
831 //*************************************************************************************************
832 
833 
834 //*************************************************************************************************
841 template< typename MT // Type of the dense matrix
842  , bool SO // Storage order
843  , bool SF > // Symmetry flag
845 {
846  return matrix_.cend( col_ );
847 }
848 //*************************************************************************************************
849 
850 
851 
852 
853 //=================================================================================================
854 //
855 // ASSIGNMENT OPERATORS
856 //
857 //=================================================================================================
858 
859 //*************************************************************************************************
869 template< typename MT // Type of the dense matrix
870  , bool SO // Storage order
871  , bool SF > // Symmetry flag
873 {
874  const size_t ibegin( ( IsLower<MT>::value )
876  ?( col_+1UL )
877  :( col_ ) )
878  :( 0UL ) );
879  const size_t iend ( ( IsUpper<MT>::value )
881  ?( col_ )
882  :( col_+1UL ) )
883  :( size() ) );
884 
885  for( size_t i=ibegin; i<iend; ++i )
886  matrix_(i,col_) = rhs;
887 
888  return *this;
889 }
890 //*************************************************************************************************
891 
892 
893 //*************************************************************************************************
906 template< typename MT // Type of the dense matrix
907  , bool SO // Storage order
908  , bool SF > // Symmetry flag
910 {
911  if( &rhs == this ) return *this;
912 
913  if( size() != rhs.size() )
914  throw std::invalid_argument( "Column sizes do not match" );
915 
916  if( !preservesInvariant( matrix_, rhs ) )
917  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
918 
919  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
920 
921  smpAssign( left, rhs );
922 
923  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
924  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
925 
926  return *this;
927 }
928 //*************************************************************************************************
929 
930 
931 //*************************************************************************************************
944 template< typename MT // Type of the dense matrix
945  , bool SO // Storage order
946  , bool SF > // Symmetry flag
947 template< typename VT > // Type of the right-hand side vector
949 {
952 
953  if( size() != (~rhs).size() )
954  throw std::invalid_argument( "Vector sizes do not match" );
955 
956  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
957  Right right( ~rhs );
958 
959  if( !preservesInvariant( matrix_, right ) )
960  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
961 
963  reset();
964 
965  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
966 
967  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
968  const typename VT::ResultType tmp( right );
969  smpAssign( left, tmp );
970  }
971  else {
972  smpAssign( left, right );
973  }
974 
975  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
976  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
977 
978  return *this;
979 }
980 //*************************************************************************************************
981 
982 
983 //*************************************************************************************************
996 template< typename MT // Type of the dense matrix
997  , bool SO // Storage order
998  , bool SF > // Symmetry flag
999 template< typename VT > // Type of the right-hand side vector
1001 {
1004 
1005  if( size() != (~rhs).size() )
1006  throw std::invalid_argument( "Vector sizes do not match" );
1007 
1008  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1009  Right right( ~rhs );
1010 
1011  if( !preservesInvariant( matrix_, right ) )
1012  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
1013 
1014  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1015 
1016  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1017  const typename VT::ResultType tmp( right );
1018  smpAddAssign( left, tmp );
1019  }
1020  else {
1021  smpAddAssign( left, right );
1022  }
1023 
1024  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
1025  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
1026 
1027  return *this;
1028 }
1029 //*************************************************************************************************
1030 
1031 
1032 //*************************************************************************************************
1045 template< typename MT // Type of the dense matrix
1046  , bool SO // Storage order
1047  , bool SF > // Symmetry flag
1048 template< typename VT > // Type of the right-hand side vector
1050 {
1053 
1054  if( size() != (~rhs).size() )
1055  throw std::invalid_argument( "Vector sizes do not match" );
1056 
1057  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1058  Right right( ~rhs );
1059 
1060  if( !preservesInvariant( matrix_, right ) )
1061  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
1062 
1063  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1064 
1065  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1066  const typename VT::ResultType tmp( right );
1067  smpSubAssign( left, tmp );
1068  }
1069  else {
1070  smpSubAssign( left, right );
1071  }
1072 
1073  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
1074  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
1075 
1076  return *this;
1077 }
1078 //*************************************************************************************************
1079 
1080 
1081 //*************************************************************************************************
1092 template< typename MT // Type of the dense matrix
1093  , bool SO // Storage order
1094  , bool SF > // Symmetry flag
1095 template< typename VT > // Type of the right-hand side vector
1097 {
1100 
1101  if( size() != (~rhs).size() )
1102  throw std::invalid_argument( "Vector sizes do not match" );
1103 
1104  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1105 
1106  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
1107  const ResultType tmp( *this * (~rhs) );
1108  smpAssign( left, tmp );
1109  }
1110  else {
1111  smpMultAssign( left, ~rhs );
1112  }
1113 
1114  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
1115  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
1116 
1117  return *this;
1118 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1132 template< typename MT // Type of the dense matrix
1133  , bool SO // Storage order
1134  , bool SF > // Symmetry flag
1135 template< typename Other > // Data type of the right-hand side scalar
1136 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO,SF> >::Type&
1138 {
1140 
1141  return operator=( (*this) * rhs );
1142 }
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1158 template< typename MT // Type of the dense matrix
1159  , bool SO // Storage order
1160  , bool SF > // Symmetry flag
1161 template< typename Other > // Data type of the right-hand side scalar
1162 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO,SF> >::Type&
1164 {
1166 
1167  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1168 
1169  return operator=( (*this) / rhs );
1170 }
1171 //*************************************************************************************************
1172 
1173 
1174 
1175 
1176 //=================================================================================================
1177 //
1178 // UTILITY FUNCTIONS
1179 //
1180 //=================================================================================================
1181 
1182 //*************************************************************************************************
1187 template< typename MT // Type of the dense matrix
1188  , bool SO // Storage order
1189  , bool SF > // Symmetry flag
1190 inline size_t DenseColumn<MT,SO,SF>::size() const
1191 {
1192  return matrix_.rows();
1193 }
1194 //*************************************************************************************************
1195 
1196 
1197 //*************************************************************************************************
1202 template< typename MT // Type of the dense matrix
1203  , bool SO // Storage order
1204  , bool SF > // Symmetry flag
1205 inline size_t DenseColumn<MT,SO,SF>::capacity() const
1206 {
1207  return matrix_.capacity( col_ );
1208 }
1209 //*************************************************************************************************
1210 
1211 
1212 //*************************************************************************************************
1220 template< typename MT // Type of the dense matrix
1221  , bool SO // Storage order
1222  , bool SF > // Symmetry flag
1223 inline size_t DenseColumn<MT,SO,SF>::nonZeros() const
1224 {
1225  return matrix_.nonZeros( col_ );
1226 }
1227 //*************************************************************************************************
1228 
1229 
1230 //*************************************************************************************************
1235 template< typename MT // Type of the dense matrix
1236  , bool SO // Storage order
1237  , bool SF > // Symmetry flag
1239 {
1240  matrix_.reset( col_ );
1241 }
1242 //*************************************************************************************************
1243 
1244 
1245 //*************************************************************************************************
1255 template< typename MT // Type of the dense matrix
1256  , bool SO // Storage order
1257  , bool SF > // Symmetry flag
1258 template< typename Other > // Data type of the scalar value
1260 {
1262 
1263  const size_t ibegin( ( IsLower<MT>::value )
1265  ?( col_+1UL )
1266  :( col_ ) )
1267  :( 0UL ) );
1268  const size_t iend ( ( IsUpper<MT>::value )
1270  ?( col_ )
1271  :( col_+1UL ) )
1272  :( size() ) );
1273 
1274  for( size_t i=ibegin; i<iend; ++i ) {
1275  matrix_(i,col_) *= scalar;
1276  }
1277 
1278  return *this;
1279 }
1280 //*************************************************************************************************
1281 
1282 
1283 //*************************************************************************************************
1294 template< typename MT // Type of the dense matrix
1295  , bool SO // Storage order
1296  , bool SF > // Symmetry flag
1297 template< typename MT2 // Type of the left-hand side dense matrix
1298  , bool SO2 // Storage order of the left-hand side dense matrix
1299  , typename VT > // Type of the right-hand side vector
1300 inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
1302 {
1303  UNUSED_PARAMETER( lhs, rhs );
1304 
1305  return true;
1306 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1321 template< typename MT // Type of the dense matrix
1322  , bool SO // Storage order
1323  , bool SF > // Symmetry flag
1324 template< typename MT2 // Type of the left-hand side dense matrix
1325  , bool SO2 // Storage order of the left-hand side dense matrix
1326  , typename VT > // Type of the right-hand side dense vector
1327 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1329 {
1331 
1332  UNUSED_PARAMETER( lhs );
1333 
1334  const size_t iend( ( IsStrictlyLower<MT2>::value )?( col_+1UL ):( col_ ) );
1335 
1336  for( size_t i=0UL; i<iend; ++i ) {
1337  if( !isDefault( (~rhs)[i] ) )
1338  return false;
1339  }
1340 
1341  if( IsUniLower<MT2>::value && !isOne( (~rhs)[col_] ) )
1342  return false;
1343 
1344  return true;
1345 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1360 template< typename MT // Type of the dense matrix
1361  , bool SO // Storage order
1362  , bool SF > // Symmetry flag
1363 template< typename MT2 // Type of the left-hand side dense matrix
1364  , bool SO2 // Storage order of the left-hand side dense matrix
1365  , typename VT > // Type of the right-hand side sparse vector
1366 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1368 {
1370 
1371  UNUSED_PARAMETER( lhs );
1372 
1373  typedef typename VT::ConstIterator RhsIterator;
1374 
1375  const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyLower<MT2>::value )?( col_+1UL ):( col_ ) ) );
1376 
1377  if( IsUniLower<MT2>::value && ( last == (~rhs).end() || last->index() != col_ || !isOne( last->value() ) ) )
1378  return false;
1379 
1380  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
1381  if( !isDefault( element->value() ) )
1382  return false;
1383  }
1384 
1385  return true;
1386 }
1387 //*************************************************************************************************
1388 
1389 
1390 //*************************************************************************************************
1401 template< typename MT // Type of the dense matrix
1402  , bool SO // Storage order
1403  , bool SF > // Symmetry flag
1404 template< typename MT2 // Type of the left-hand side dense matrix
1405  , bool SO2 // Storage order of the left-hand side dense matrix
1406  , typename VT > // Type of the right-hand side dense vector
1407 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1409 {
1411 
1412  UNUSED_PARAMETER( lhs );
1413 
1414  if( IsUniUpper<MT2>::value && !isOne( (~rhs)[col_] ) )
1415  return false;
1416 
1417  const size_t ibegin( ( IsStrictlyUpper<MT2>::value )?( col_ ):( col_+1UL ) );
1418 
1419  for( size_t i=ibegin; i<size(); ++i ) {
1420  if( !isDefault( (~rhs)[i] ) )
1421  return false;
1422  }
1423 
1424  return true;
1425 }
1426 //*************************************************************************************************
1427 
1428 
1429 //*************************************************************************************************
1440 template< typename MT // Type of the dense matrix
1441  , bool SO // Storage order
1442  , bool SF > // Symmetry flag
1443 template< typename MT2 // Type of the left-hand side dense matrix
1444  , bool SO2 // Storage order of the left-hand side dense matrix
1445  , typename VT > // Type of the right-hand side sparse vector
1446 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1448 {
1450 
1451  UNUSED_PARAMETER( lhs );
1452 
1453  typedef typename VT::ConstIterator RhsIterator;
1454 
1455  const bool checkDiagonal( IsUniUpper<MT2>::value || IsStrictlyUpper<MT2>::value );
1456  const RhsIterator last( (~rhs).end() );
1457  RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( col_ ):( col_+1UL ) ) );
1458 
1459  if( IsUniUpper<MT2>::value ) {
1460  if( element == last || element->index() != col_ || !isOne( element->value() ) )
1461  return false;
1462  ++element;
1463  }
1464 
1465  for( ; element!=last; ++element ) {
1466  if( !isDefault( element->value() ) )
1467  return false;
1468  }
1469 
1470  return true;
1471 }
1472 //*************************************************************************************************
1473 
1474 
1475 //*************************************************************************************************
1486 template< typename MT // Type of the dense matrix
1487  , bool SO // Storage order
1488  , bool SF > // Symmetry flag
1489 template< typename MT2 // Type of the left-hand side dense matrix
1490  , bool SO2 // Storage order of the left-hand side dense matrix
1491  , typename VT > // Type of the right-hand side dense vector
1492 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
1494 {
1496 
1497  UNUSED_PARAMETER( lhs );
1498 
1499  for( size_t i=0UL; i<col_; ++i ) {
1500  if( !isDefault( (~rhs)[i] ) )
1501  return false;
1502  }
1503 
1504  for( size_t i=col_+1UL; i<size(); ++i ) {
1505  if( !isDefault( (~rhs)[i] ) )
1506  return false;
1507  }
1508 
1509  return true;
1510 }
1511 //*************************************************************************************************
1512 
1513 
1514 //*************************************************************************************************
1525 template< typename MT // Type of the dense matrix
1526  , bool SO // Storage order
1527  , bool SF > // Symmetry flag
1528 template< typename MT2 // Type of the left-hand side dense matrix
1529  , bool SO2 // Storage order of the left-hand side dense matrix
1530  , typename VT > // Type of the right-hand side sparse vector
1531 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
1533 {
1535 
1536  UNUSED_PARAMETER( lhs );
1537 
1538  typedef typename VT::ConstIterator RhsIterator;
1539 
1540  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1541  if( element->index() != col_ && !isDefault( element->value() ) )
1542  return false;
1543  }
1544 
1545  return true;
1546 }
1547 //*************************************************************************************************
1548 
1549 
1550 
1551 
1552 //=================================================================================================
1553 //
1554 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1555 //
1556 //=================================================================================================
1557 
1558 //*************************************************************************************************
1568 template< typename MT // Type of the dense matrix
1569  , bool SO // Storage order
1570  , bool SF > // Symmetry flag
1571 template< typename Other > // Data type of the foreign expression
1572 inline bool DenseColumn<MT,SO,SF>::canAlias( const Other* alias ) const
1573 {
1574  return matrix_.isAliased( alias );
1575 }
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1589 template< typename MT // Type of the dense matrix
1590  , bool SO // Storage order
1591  , bool SF > // Symmetry flag
1592 template< typename MT2 // Data type of the foreign dense column
1593  , bool SO2 // Storage order of the foreign dense column
1594  , bool SF2 > // Symmetry flag of the foreign dense column
1596 {
1597  return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
1598 }
1599 //*************************************************************************************************
1600 
1601 
1602 //*************************************************************************************************
1612 template< typename MT // Type of the dense matrix
1613  , bool SO // Storage order
1614  , bool SF > // Symmetry flag
1615 template< typename Other > // Data type of the foreign expression
1616 inline bool DenseColumn<MT,SO,SF>::isAliased( const Other* alias ) const
1617 {
1618  return matrix_.isAliased( alias );
1619 }
1620 //*************************************************************************************************
1621 
1622 
1623 //*************************************************************************************************
1633 template< typename MT // Type of the dense matrix
1634  , bool SO // Storage order
1635  , bool SF > // Symmetry flag
1636 template< typename MT2 // Data type of the foreign dense column
1637  , bool SO2 // Storage order of the foreign dense column
1638  , bool SF2 > // Symmetry flag of the foreign dense column
1640 {
1641  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
1642 }
1643 //*************************************************************************************************
1644 
1645 
1646 //*************************************************************************************************
1655 template< typename MT // Type of the dense matrix
1656  , bool SO // Storage order
1657  , bool SF > // Symmetry flag
1659 {
1660  return matrix_.isAligned();
1661 }
1662 //*************************************************************************************************
1663 
1664 
1665 //*************************************************************************************************
1675 template< typename MT // Type of the dense matrix
1676  , bool SO // Storage order
1677  , bool SF > // Symmetry flag
1679 {
1680  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1681 }
1682 //*************************************************************************************************
1683 
1684 
1685 //*************************************************************************************************
1697 template< typename MT // Type of the dense matrix
1698  , bool SO // Storage order
1699  , bool SF > // Symmetry flag
1701  DenseColumn<MT,SO,SF>::load( size_t index ) const
1702 {
1703  return matrix_.load( index, col_ );
1704 }
1705 //*************************************************************************************************
1706 
1707 
1708 //*************************************************************************************************
1720 template< typename MT // Type of the dense matrix
1721  , bool SO // Storage order
1722  , bool SF > // Symmetry flag
1724  DenseColumn<MT,SO,SF>::loadu( size_t index ) const
1725 {
1726  return matrix_.loadu( index, col_ );
1727 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1744 template< typename MT // Type of the dense matrix
1745  , bool SO // Storage order
1746  , bool SF > // Symmetry flag
1748 {
1749  matrix_.store( index, col_, value );
1750 }
1751 //*************************************************************************************************
1752 
1753 
1754 //*************************************************************************************************
1767 template< typename MT // Type of the dense matrix
1768  , bool SO // Storage order
1769  , bool SF > // Symmetry flag
1771 {
1772  matrix_.storeu( index, col_, value );
1773 }
1774 //*************************************************************************************************
1775 
1776 
1777 //*************************************************************************************************
1790 template< typename MT // Type of the dense matrix
1791  , bool SO // Storage order
1792  , bool SF > // Symmetry flag
1794 {
1795  matrix_.stream( index, col_, value );
1796 }
1797 //*************************************************************************************************
1798 
1799 
1800 //*************************************************************************************************
1811 template< typename MT // Type of the dense matrix
1812  , bool SO // Storage order
1813  , bool SF > // Symmetry flag
1814 template< typename VT > // Type of the right-hand side dense vector
1815 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1817 {
1819 
1820  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1821 
1822  const size_t ipos( (~rhs).size() & size_t(-2) );
1823  for( size_t i=0UL; i<ipos; i+=2UL ) {
1824  matrix_(i ,col_) = (~rhs)[i ];
1825  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1826  }
1827  if( ipos < (~rhs).size() )
1828  matrix_(ipos,col_) = (~rhs)[ipos];
1829 }
1830 //*************************************************************************************************
1831 
1832 
1833 //*************************************************************************************************
1844 template< typename MT // Type of the dense matrix
1845  , bool SO // Storage order
1846  , bool SF > // Symmetry flag
1847 template< typename VT > // Type of the right-hand side dense vector
1848 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1850 {
1853 
1854  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1855 
1856  const size_t rows( size() );
1857 
1858  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( this ) )
1859  {
1860  for( size_t i=0UL; i<rows; i+=IT::size ) {
1861  matrix_.stream( i, col_, (~rhs).load(i) );
1862  }
1863  }
1864  else
1865  {
1866  const size_t ipos( rows & size_t(-IT::size*4) );
1867  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
1868 
1869  typename VT::ConstIterator it( (~rhs).begin() );
1870  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
1871  matrix_.store( i , col_, it.load() ); it+=IT::size;
1872  matrix_.store( i+IT::size , col_, it.load() ); it+=IT::size;
1873  matrix_.store( i+IT::size*2UL, col_, it.load() ); it+=IT::size;
1874  matrix_.store( i+IT::size*3UL, col_, it.load() ); it+=IT::size;
1875  }
1876  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
1877  matrix_.store( i, col_, it.load() );
1878  }
1879  }
1880 }
1881 //*************************************************************************************************
1882 
1883 
1884 //*************************************************************************************************
1895 template< typename MT // Type of the dense matrix
1896  , bool SO // Storage order
1897  , bool SF > // Symmetry flag
1898 template< typename VT > // Type of the right-hand side sparse vector
1900 {
1902 
1903  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1904 
1905  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1906  matrix_(element->index(),col_) = element->value();
1907 }
1908 //*************************************************************************************************
1909 
1910 
1911 //*************************************************************************************************
1922 template< typename MT // Type of the dense matrix
1923  , bool SO // Storage order
1924  , bool SF > // Symmetry flag
1925 template< typename VT > // Type of the right-hand side dense vector
1926 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1928 {
1930 
1931  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1932 
1933  const size_t ipos( (~rhs).size() & size_t(-2) );
1934  for( size_t i=0UL; i<ipos; i+=2UL ) {
1935  matrix_(i ,col_) += (~rhs)[i ];
1936  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1937  }
1938  if( ipos < (~rhs).size() )
1939  matrix_(ipos,col_) += (~rhs)[ipos];
1940 }
1941 //*************************************************************************************************
1942 
1943 
1944 //*************************************************************************************************
1955 template< typename MT // Type of the dense matrix
1956  , bool SO // Storage order
1957  , bool SF > // Symmetry flag
1958 template< typename VT > // Type of the right-hand side dense vector
1959 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1961 {
1964 
1965  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1966 
1967  const size_t rows( size() );
1968 
1969  const size_t ipos( rows & size_t(-IT::size*4) );
1970  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
1971 
1972  typename VT::ConstIterator it( (~rhs).begin() );
1973  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
1974  matrix_.store( i , col_, matrix_.load(i ,col_) + it.load() ); it += IT::size;
1975  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) + it.load() ); it += IT::size;
1976  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) + it.load() ); it += IT::size;
1977  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) + it.load() ); it += IT::size;
1978  }
1979  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
1980  matrix_.store( i, col_, matrix_.load(i,col_) + it.load() );
1981  }
1982 }
1983 //*************************************************************************************************
1984 
1985 
1986 //*************************************************************************************************
1997 template< typename MT // Type of the dense matrix
1998  , bool SO // Storage order
1999  , bool SF > // Symmetry flag
2000 template< typename VT > // Type of the right-hand side sparse vector
2002 {
2004 
2005  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2006 
2007  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2008  matrix_(element->index(),col_) += element->value();
2009 }
2010 //*************************************************************************************************
2011 
2012 
2013 //*************************************************************************************************
2024 template< typename MT // Type of the dense matrix
2025  , bool SO // Storage order
2026  , bool SF > // Symmetry flag
2027 template< typename VT > // Type of the right-hand side dense vector
2028 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2030 {
2032 
2033  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2034 
2035  const size_t ipos( (~rhs).size() & size_t(-2) );
2036  for( size_t i=0UL; i<ipos; i+=2UL ) {
2037  matrix_(i ,col_) -= (~rhs)[i ];
2038  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
2039  }
2040  if( ipos < (~rhs).size() )
2041  matrix_(ipos,col_) -= (~rhs)[ipos];
2042 }
2043 //*************************************************************************************************
2044 
2045 
2046 //*************************************************************************************************
2057 template< typename MT // Type of the dense matrix
2058  , bool SO // Storage order
2059  , bool SF > // Symmetry flag
2060 template< typename VT > // Type of the right-hand side dense vector
2061 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2063 {
2066 
2067  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2068 
2069  const size_t rows( size() );
2070 
2071  const size_t ipos( rows & size_t(-IT::size*4) );
2072  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
2073 
2074  typename VT::ConstIterator it( (~rhs).begin() );
2075  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
2076  matrix_.store( i , col_, matrix_.load(i ,col_) - it.load() ); it += IT::size;
2077  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) - it.load() ); it += IT::size;
2078  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) - it.load() ); it += IT::size;
2079  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) - it.load() ); it += IT::size;
2080  }
2081  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
2082  matrix_.store( i, col_, matrix_.load(i,col_) - it.load() );
2083  }
2084 }
2085 //*************************************************************************************************
2086 
2087 
2088 //*************************************************************************************************
2099 template< typename MT // Type of the dense matrix
2100  , bool SO // Storage order
2101  , bool SF > // Symmetry flag
2102 template< typename VT > // Type of the right-hand side sparse vector
2104 {
2106 
2107  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2108 
2109  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2110  matrix_(element->index(),col_) -= element->value();
2111 }
2112 //*************************************************************************************************
2113 
2114 
2115 //*************************************************************************************************
2126 template< typename MT // Type of the dense matrix
2127  , bool SO // Storage order
2128  , bool SF > // Symmetry flag
2129 template< typename VT > // Type of the right-hand side dense vector
2130 inline typename DisableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2132 {
2134 
2135  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2136 
2137  const size_t ipos( (~rhs).size() & size_t(-2) );
2138  for( size_t i=0UL; i<ipos; i+=2UL ) {
2139  matrix_(i ,col_) *= (~rhs)[i ];
2140  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
2141  }
2142  if( ipos < (~rhs).size() )
2143  matrix_(ipos,col_) *= (~rhs)[ipos];
2144 }
2145 //*************************************************************************************************
2146 
2147 
2148 //*************************************************************************************************
2159 template< typename MT // Type of the dense matrix
2160  , bool SO // Storage order
2161  , bool SF > // Symmetry flag
2162 template< typename VT > // Type of the right-hand side dense vector
2163 inline typename EnableIf< typename DenseColumn<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2165 {
2168 
2169  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2170 
2171  const size_t rows( size() );
2172 
2173  const size_t ipos( rows & size_t(-IT::size*4) );
2174  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
2175 
2176  typename VT::ConstIterator it( (~rhs).begin() );
2177  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
2178  matrix_.store( i , col_, matrix_.load(i ,col_) * it.load() ); it += IT::size;
2179  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) * it.load() ); it += IT::size;
2180  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) * it.load() ); it += IT::size;
2181  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) * it.load() ); it += IT::size;
2182  }
2183  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
2184  matrix_.store( i, col_, matrix_.load(i,col_) * it.load() );
2185  }
2186 }
2187 //*************************************************************************************************
2188 
2189 
2190 //*************************************************************************************************
2201 template< typename MT // Type of the dense matrix
2202  , bool SO // Storage order
2203  , bool SF > // Symmetry flag
2204 template< typename VT > // Type of the right-hand side sparse vector
2206 {
2208 
2209  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2210 
2211  const ResultType tmp( serial( *this ) );
2212 
2213  reset();
2214 
2215  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2216  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
2217 }
2218 //*************************************************************************************************
2219 
2220 
2221 
2222 
2223 
2224 
2225 
2226 
2227 //=================================================================================================
2228 //
2229 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL ROW-MAJOR MATRICES
2230 //
2231 //=================================================================================================
2232 
2233 //*************************************************************************************************
2241 template< typename MT > // Type of the dense matrix
2242 class DenseColumn<MT,false,false> : public DenseVector< DenseColumn<MT,false,false>, false >
2243  , private Column
2244 {
2245  private:
2246  //**Type definitions****************************************************************************
2248  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
2249  //**********************************************************************************************
2250 
2251  //**********************************************************************************************
2253 
2259  enum { useConst = IsConst<MT>::value };
2260  //**********************************************************************************************
2261 
2262  public:
2263  //**Type definitions****************************************************************************
2264  typedef DenseColumn<MT,false,false> This;
2265  typedef typename ColumnTrait<MT>::Type ResultType;
2266  typedef typename ResultType::TransposeType TransposeType;
2267  typedef typename MT::ElementType ElementType;
2268  typedef typename MT::ReturnType ReturnType;
2269  typedef const DenseColumn& CompositeType;
2270 
2272  typedef typename MT::ConstReference ConstReference;
2273 
2275  typedef typename IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference;
2276  //**********************************************************************************************
2277 
2278  //**ColumnIterator class definition*************************************************************
2281  template< typename MatrixType > // Type of the dense matrix
2282  class ColumnIterator
2283  {
2284  private:
2285  //*******************************************************************************************
2287 
2292  enum { returnConst = IsConst<MatrixType>::value };
2293  //*******************************************************************************************
2294 
2295  public:
2296  //**Type definitions*************************************************************************
2298  typedef typename IfTrue< returnConst
2299  , typename MatrixType::ConstReference
2300  , typename MatrixType::Reference >::Type Reference;
2301 
2302  typedef std::random_access_iterator_tag IteratorCategory;
2303  typedef RemoveReference<Reference> ValueType;
2304  typedef ValueType* PointerType;
2305  typedef Reference ReferenceType;
2306  typedef ptrdiff_t DifferenceType;
2307 
2308  // STL iterator requirements
2309  typedef IteratorCategory iterator_category;
2310  typedef ValueType value_type;
2311  typedef PointerType pointer;
2312  typedef ReferenceType reference;
2313  typedef DifferenceType difference_type;
2314  //*******************************************************************************************
2315 
2316  //**Constructor******************************************************************************
2319  inline ColumnIterator()
2320  : matrix_( NULL ) // The dense matrix containing the column.
2321  , row_ ( 0UL ) // The current row index.
2322  , column_( 0UL ) // The current column index.
2323  {}
2324  //*******************************************************************************************
2325 
2326  //**Constructor******************************************************************************
2333  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column )
2334  : matrix_( &matrix ) // The dense matrix containing the column.
2335  , row_ ( row ) // The current row index.
2336  , column_( column ) // The current column index.
2337  {}
2338  //*******************************************************************************************
2339 
2340  //**Constructor******************************************************************************
2345  template< typename MatrixType2 >
2346  inline ColumnIterator( const ColumnIterator<MatrixType2>& it )
2347  : matrix_( it.matrix_ ) // The dense matrix containing the column.
2348  , row_ ( it.row_ ) // The current row index.
2349  , column_( it.column_ ) // The current column index.
2350  {}
2351  //*******************************************************************************************
2352 
2353  //**Addition assignment operator*************************************************************
2359  inline ColumnIterator& operator+=( size_t inc ) {
2360  row_ += inc;
2361  return *this;
2362  }
2363  //*******************************************************************************************
2364 
2365  //**Subtraction assignment operator**********************************************************
2371  inline ColumnIterator& operator-=( size_t dec ) {
2372  row_ -= dec;
2373  return *this;
2374  }
2375  //*******************************************************************************************
2376 
2377  //**Prefix increment operator****************************************************************
2382  inline ColumnIterator& operator++() {
2383  ++row_;
2384  return *this;
2385  }
2386  //*******************************************************************************************
2387 
2388  //**Postfix increment operator***************************************************************
2393  inline const ColumnIterator operator++( int ) {
2394  const ColumnIterator tmp( *this );
2395  ++(*this);
2396  return tmp;
2397  }
2398  //*******************************************************************************************
2399 
2400  //**Prefix decrement operator****************************************************************
2405  inline ColumnIterator& operator--() {
2406  --row_;
2407  return *this;
2408  }
2409  //*******************************************************************************************
2410 
2411  //**Postfix decrement operator***************************************************************
2416  inline const ColumnIterator operator--( int ) {
2417  const ColumnIterator tmp( *this );
2418  --(*this);
2419  return tmp;
2420  }
2421  //*******************************************************************************************
2422 
2423  //**Subscript operator***********************************************************************
2429  inline ReferenceType operator[]( size_t index ) const {
2430  return (*matrix_)(row_+index,column_);
2431  }
2432  //*******************************************************************************************
2433 
2434  //**Element access operator******************************************************************
2439  inline ReferenceType operator*() const {
2440  return (*matrix_)(row_,column_);
2441  }
2442  //*******************************************************************************************
2443 
2444  //**Element access operator******************************************************************
2449  inline PointerType operator->() const {
2450  return &(*matrix_)(row_,column_);
2451  }
2452  //*******************************************************************************************
2453 
2454  //**Equality operator************************************************************************
2460  template< typename MatrixType2 >
2461  inline bool operator==( const ColumnIterator<MatrixType2>& rhs ) const {
2462  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2463  }
2464  //*******************************************************************************************
2465 
2466  //**Inequality operator**********************************************************************
2472  template< typename MatrixType2 >
2473  inline bool operator!=( const ColumnIterator<MatrixType2>& rhs ) const {
2474  return !( *this == rhs );
2475  }
2476  //*******************************************************************************************
2477 
2478  //**Less-than operator***********************************************************************
2484  template< typename MatrixType2 >
2485  inline bool operator<( const ColumnIterator<MatrixType2>& rhs ) const {
2486  return ( matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
2487  }
2488  //*******************************************************************************************
2489 
2490  //**Greater-than operator********************************************************************
2496  template< typename MatrixType2 >
2497  inline bool operator>( const ColumnIterator<MatrixType2>& rhs ) const {
2498  return ( matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
2499  }
2500  //*******************************************************************************************
2501 
2502  //**Less-or-equal-than operator**************************************************************
2508  template< typename MatrixType2 >
2509  inline bool operator<=( const ColumnIterator<MatrixType2>& rhs ) const {
2510  return ( matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
2511  }
2512  //*******************************************************************************************
2513 
2514  //**Greater-or-equal-than operator***********************************************************
2520  template< typename MatrixType2 >
2521  inline bool operator>=( const ColumnIterator<MatrixType2>& rhs ) const {
2522  return ( matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
2523  }
2524  //*******************************************************************************************
2525 
2526  //**Subtraction operator*********************************************************************
2532  inline DifferenceType operator-( const ColumnIterator& rhs ) const {
2533  return row_ - rhs.row_;
2534  }
2535  //*******************************************************************************************
2536 
2537  //**Addition operator************************************************************************
2544  friend inline const ColumnIterator operator+( const ColumnIterator& it, size_t inc ) {
2545  return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2546  }
2547  //*******************************************************************************************
2548 
2549  //**Addition operator************************************************************************
2556  friend inline const ColumnIterator operator+( size_t inc, const ColumnIterator& it ) {
2557  return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2558  }
2559  //*******************************************************************************************
2560 
2561  //**Subtraction operator*********************************************************************
2568  friend inline const ColumnIterator operator-( const ColumnIterator& it, size_t dec ) {
2569  return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2570  }
2571  //*******************************************************************************************
2572 
2573  private:
2574  //**Member variables*************************************************************************
2575  MatrixType* matrix_;
2576  size_t row_;
2577  size_t column_;
2578  //*******************************************************************************************
2579 
2580  //**Friend declarations**********************************************************************
2581  template< typename MatrixType2 > friend class ColumnIterator;
2582  //*******************************************************************************************
2583  };
2584  //**********************************************************************************************
2585 
2586  //**Type definitions****************************************************************************
2588  typedef ColumnIterator<const MT> ConstIterator;
2589 
2591  typedef typename IfTrue< useConst, ConstIterator, ColumnIterator<MT> >::Type Iterator;
2592  //**********************************************************************************************
2593 
2594  //**Compilation flags***************************************************************************
2596  enum { vectorizable = 0 };
2597 
2599  enum { smpAssignable = MT::smpAssignable };
2600  //**********************************************************************************************
2601 
2602  //**Constructors********************************************************************************
2605  explicit inline DenseColumn( MT& matrix, size_t index );
2606  // No explicitly declared copy constructor.
2608  //**********************************************************************************************
2609 
2610  //**Destructor**********************************************************************************
2611  // No explicitly declared destructor.
2612  //**********************************************************************************************
2613 
2614  //**Data access functions***********************************************************************
2617  inline Reference operator[]( size_t index );
2618  inline ConstReference operator[]( size_t index ) const;
2619  inline Iterator begin ();
2620  inline ConstIterator begin () const;
2621  inline ConstIterator cbegin() const;
2622  inline Iterator end ();
2623  inline ConstIterator end () const;
2624  inline ConstIterator cend () const;
2626  //**********************************************************************************************
2627 
2628  //**Assignment operators************************************************************************
2631  inline DenseColumn& operator= ( const ElementType& rhs );
2632  inline DenseColumn& operator= ( const DenseColumn& rhs );
2633 
2634  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
2635  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
2636  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
2637  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
2638 
2639  template< typename Other >
2640  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
2641  operator*=( Other rhs );
2642 
2643  template< typename Other >
2644  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
2645  operator/=( Other rhs );
2647  //**********************************************************************************************
2648 
2649  //**Utility functions***************************************************************************
2652  inline size_t size() const;
2653  inline size_t capacity() const;
2654  inline size_t nonZeros() const;
2655  inline void reset();
2656  template< typename Other > inline DenseColumn& scale( const Other& scalar );
2658  //**********************************************************************************************
2659 
2660  public:
2661  //**Expression template evaluation functions****************************************************
2664  template< typename Other >
2665  inline bool canAlias ( const Other* alias ) const;
2666 
2667  template< typename MT2, bool SO2, bool SF2 >
2668  inline bool canAlias ( const DenseColumn<MT2,SO2,SF2>* alias ) const;
2669 
2670  template< typename Other >
2671  inline bool isAliased( const Other* alias ) const;
2672 
2673  template< typename MT2, bool SO2, bool SF2 >
2674  inline bool isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const;
2675 
2676  inline bool isAligned () const;
2677  inline bool canSMPAssign() const;
2678 
2679  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
2680  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
2681  template< typename VT > inline void addAssign ( const DenseVector <VT,false>& rhs );
2682  template< typename VT > inline void addAssign ( const SparseVector<VT,false>& rhs );
2683  template< typename VT > inline void subAssign ( const DenseVector <VT,false>& rhs );
2684  template< typename VT > inline void subAssign ( const SparseVector<VT,false>& rhs );
2685  template< typename VT > inline void multAssign( const DenseVector <VT,false>& rhs );
2686  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
2688  //**********************************************************************************************
2689 
2690  private:
2691  //**Utility functions***************************************************************************
2694  template< typename MT2, bool SO2, typename VT >
2695  inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
2696  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,false>& rhs );
2697 
2698  template< typename MT2, bool SO2, typename VT >
2699  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2700  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
2701 
2702  template< typename MT2, bool SO2, typename VT >
2703  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2704  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
2705 
2706  template< typename MT2, bool SO2, typename VT >
2707  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2708  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
2709 
2710  template< typename MT2, bool SO2, typename VT >
2711  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2712  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
2713 
2714  template< typename MT2, bool SO2, typename VT >
2715  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
2716  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
2717 
2718  template< typename MT2, bool SO2, typename VT >
2719  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
2720  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
2722  //**********************************************************************************************
2723 
2724  //**Member variables****************************************************************************
2727  Operand matrix_;
2728  const size_t col_;
2729 
2730  //**********************************************************************************************
2731 
2732  //**Friend declarations*************************************************************************
2733  template< typename MT2, bool SO2, bool SF2 > friend class DenseColumn;
2734 
2735  template< typename MT2, bool SO2, bool SF2 >
2736  friend bool isSame( const DenseColumn<MT2,SO2,SF2>& a, const DenseColumn<MT2,SO2,SF2>& b );
2737 
2738  template< typename MT2, bool SO2, bool SF2 >
2739  friend typename DerestrictTrait< DenseColumn<MT2,SO2,SF2> >::Type
2740  derestrict( DenseColumn<MT2,SO2,SF2>& dm );
2741  //**********************************************************************************************
2742 
2743  //**Compile time checks*************************************************************************
2751  BLAZE_STATIC_ASSERT( !IsRestricted<MT>::value || IsLower<MT>::value || IsUpper<MT>::value );
2752  //**********************************************************************************************
2753 };
2755 //*************************************************************************************************
2756 
2757 
2758 
2759 
2760 //=================================================================================================
2761 //
2762 // CONSTRUCTOR
2763 //
2764 //=================================================================================================
2765 
2766 //*************************************************************************************************
2774 template< typename MT > // Type of the dense matrix
2775 inline DenseColumn<MT,false,false>::DenseColumn( MT& matrix, size_t index )
2776  : matrix_( matrix ) // The dense matrix containing the column
2777  , col_ ( index ) // The index of the column in the matrix
2778 {
2779  if( matrix_.columns() <= index )
2780  throw std::invalid_argument( "Invalid column access index" );
2781 }
2783 //*************************************************************************************************
2784 
2785 
2786 
2787 
2788 //=================================================================================================
2789 //
2790 // DATA ACCESS FUNCTIONS
2791 //
2792 //=================================================================================================
2793 
2794 //*************************************************************************************************
2801 template< typename MT > // Type of the dense matrix
2804 {
2805  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2806  return matrix_(index,col_);
2807 }
2809 //*************************************************************************************************
2810 
2811 
2812 //*************************************************************************************************
2819 template< typename MT > // Type of the dense matrix
2821  DenseColumn<MT,false,false>::operator[]( size_t index ) const
2822 {
2823  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2824  return matrix_(index,col_);
2825 }
2827 //*************************************************************************************************
2828 
2829 
2830 //*************************************************************************************************
2838 template< typename MT > // Type of the dense matrix
2840 {
2841  return Iterator( matrix_, 0UL, col_ );
2842 }
2844 //*************************************************************************************************
2845 
2846 
2847 //*************************************************************************************************
2855 template< typename MT > // Type of the dense matrix
2858 {
2859  return ConstIterator( matrix_, 0UL, col_ );
2860 }
2862 //*************************************************************************************************
2863 
2864 
2865 //*************************************************************************************************
2873 template< typename MT > // Type of the dense matrix
2876 {
2877  return ConstIterator( matrix_, 0UL, col_ );
2878 }
2880 //*************************************************************************************************
2881 
2882 
2883 //*************************************************************************************************
2891 template< typename MT > // Type of the dense matrix
2893 {
2894  return Iterator( matrix_, size(), col_ );
2895 }
2897 //*************************************************************************************************
2898 
2899 
2900 //*************************************************************************************************
2908 template< typename MT > // Type of the dense matrix
2911 {
2912  return ConstIterator( matrix_, size(), col_ );
2913 }
2915 //*************************************************************************************************
2916 
2917 
2918 //*************************************************************************************************
2926 template< typename MT > // Type of the dense matrix
2929 {
2930  return ConstIterator( matrix_, size(), col_ );
2931 }
2933 //*************************************************************************************************
2934 
2935 
2936 
2937 
2938 //=================================================================================================
2939 //
2940 // ASSIGNMENT OPERATORS
2941 //
2942 //=================================================================================================
2943 
2944 //*************************************************************************************************
2955 template< typename MT > // Type of the dense matrix
2956 inline DenseColumn<MT,false,false>&
2957  DenseColumn<MT,false,false>::operator=( const ElementType& rhs )
2958 {
2959  const size_t ibegin( ( IsLower<MT>::value )
2960  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2961  ?( col_+1UL )
2962  :( col_ ) )
2963  :( 0UL ) );
2964  const size_t iend ( ( IsUpper<MT>::value )
2965  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2966  ?( col_ )
2967  :( col_+1UL ) )
2968  :( size() ) );
2969 
2970  for( size_t i=ibegin; i<iend; ++i )
2971  matrix_(i,col_) = rhs;
2972 
2973  return *this;
2974 }
2976 //*************************************************************************************************
2977 
2978 
2979 //*************************************************************************************************
2993 template< typename MT > // Type of the dense matrix
2994 inline DenseColumn<MT,false,false>&
2995  DenseColumn<MT,false,false>::operator=( const DenseColumn& rhs )
2996 {
2997  if( &rhs == this ) return *this;
2998 
2999  if( size() != rhs.size() )
3000  throw std::invalid_argument( "Column sizes do not match" );
3001 
3002  if( !preservesInvariant( matrix_, rhs ) )
3003  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3004 
3005  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3006 
3007  smpAssign( left, rhs );
3008 
3009  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3010  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3011 
3012  return *this;
3013 }
3015 //*************************************************************************************************
3016 
3017 
3018 //*************************************************************************************************
3032 template< typename MT > // Type of the dense matrix
3033 template< typename VT > // Type of the right-hand side vector
3034 inline DenseColumn<MT,false,false>&
3035  DenseColumn<MT,false,false>::operator=( const Vector<VT,false>& rhs )
3036 {
3040 
3041  if( size() != (~rhs).size() )
3042  throw std::invalid_argument( "Vector sizes do not match" );
3043 
3044  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3045  Right right( ~rhs );
3046 
3047  if( !preservesInvariant( matrix_, right ) )
3048  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3049 
3050  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3051 
3052  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3053  const ResultType tmp( right );
3054  smpAssign( left, tmp );
3055  }
3056  else {
3057  if( IsSparseVector<VT>::value )
3058  reset();
3059  smpAssign( left, right );
3060  }
3061 
3062  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3063  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3064 
3065  return *this;
3066 }
3068 //*************************************************************************************************
3069 
3070 
3071 //*************************************************************************************************
3085 template< typename MT > // Type of the dense matrix
3086 template< typename VT > // Type of the right-hand side vector
3087 inline DenseColumn<MT,false,false>&
3088  DenseColumn<MT,false,false>::operator+=( const Vector<VT,false>& rhs )
3089 {
3092 
3093  if( size() != (~rhs).size() )
3094  throw std::invalid_argument( "Vector sizes do not match" );
3095 
3096  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3097  Right right( ~rhs );
3098 
3099  if( !preservesInvariant( matrix_, right ) )
3100  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3101 
3102  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3103 
3104  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3105  const typename VT::ResultType tmp( right );
3106  smpAddAssign( left, tmp );
3107  }
3108  else {
3109  smpAddAssign( left, right );
3110  }
3111 
3112  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3113  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3114 
3115  return *this;
3116 }
3118 //*************************************************************************************************
3119 
3120 
3121 //*************************************************************************************************
3135 template< typename MT > // Type of the dense matrix
3136 template< typename VT > // Type of the right-hand side vector
3137 inline DenseColumn<MT,false,false>&
3138  DenseColumn<MT,false,false>::operator-=( const Vector<VT,false>& rhs )
3139 {
3142 
3143  if( size() != (~rhs).size() )
3144  throw std::invalid_argument( "Vector sizes do not match" );
3145 
3146  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3147  Right right( ~rhs );
3148 
3149  if( !preservesInvariant( matrix_, right ) )
3150  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3151 
3152  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3153 
3154  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3155  const typename VT::ResultType tmp( right );
3156  smpSubAssign( left, tmp );
3157  }
3158  else {
3159  smpSubAssign( left, right );
3160  }
3161 
3162  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3163  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3164 
3165  return *this;
3166 }
3168 //*************************************************************************************************
3169 
3170 
3171 //*************************************************************************************************
3183 template< typename MT > // Type of the dense matrix
3184 template< typename VT > // Type of the right-hand side vector
3185 inline DenseColumn<MT,false,false>&
3186  DenseColumn<MT,false,false>::operator*=( const Vector<VT,false>& rhs )
3187 {
3190 
3191  if( size() != (~rhs).size() )
3192  throw std::invalid_argument( "Vector sizes do not match" );
3193 
3194  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3195 
3196  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
3197  const ResultType tmp( *this * (~rhs) );
3198  smpAssign( left, tmp );
3199  }
3200  else {
3201  smpMultAssign( left, ~rhs );
3202  }
3203 
3204  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3205  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3206 
3207  return *this;
3208 }
3210 //*************************************************************************************************
3211 
3212 
3213 //*************************************************************************************************
3224 template< typename MT > // Type of the dense matrix
3225 template< typename Other > // Data type of the right-hand side scalar
3226 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,false> >::Type&
3227  DenseColumn<MT,false,false>::operator*=( Other rhs )
3228 {
3230 
3231  return operator=( (*this) * rhs );
3232 }
3234 //*************************************************************************************************
3235 
3236 
3237 //*************************************************************************************************
3250 template< typename MT > // Type of the dense matrix
3251 template< typename Other > // Data type of the right-hand side scalar
3252 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,false> >::Type&
3253  DenseColumn<MT,false,false>::operator/=( Other rhs )
3254 {
3256 
3257  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
3258 
3259  return operator=( (*this) / rhs );
3260 }
3262 //*************************************************************************************************
3263 
3264 
3265 
3266 
3267 //=================================================================================================
3268 //
3269 // UTILITY FUNCTIONS
3270 //
3271 //=================================================================================================
3272 
3273 //*************************************************************************************************
3279 template< typename MT > // Type of the dense matrix
3280 inline size_t DenseColumn<MT,false,false>::size() const
3281 {
3282  return matrix_.rows();
3283 }
3285 //*************************************************************************************************
3286 
3287 
3288 //*************************************************************************************************
3294 template< typename MT > // Type of the dense matrix
3295 inline size_t DenseColumn<MT,false,false>::capacity() const
3296 {
3297  return matrix_.rows();
3298 }
3300 //*************************************************************************************************
3301 
3302 
3303 //*************************************************************************************************
3312 template< typename MT > // Type of the dense matrix
3313 inline size_t DenseColumn<MT,false,false>::nonZeros() const
3314 {
3315  const size_t rows( size() );
3316  size_t nonzeros( 0UL );
3317 
3318  for( size_t i=0UL; i<rows; ++i )
3319  if( !isDefault( matrix_(i,col_) ) )
3320  ++nonzeros;
3321 
3322  return nonzeros;
3323 }
3325 //*************************************************************************************************
3326 
3327 
3328 //*************************************************************************************************
3334 template< typename MT > // Type of the dense matrix
3336 {
3337  using blaze::clear;
3338 
3339  const size_t ibegin( ( IsLower<MT>::value )
3340  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3341  ?( col_+1UL )
3342  :( col_ ) )
3343  :( 0UL ) );
3344  const size_t iend ( ( IsUpper<MT>::value )
3345  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3346  ?( col_ )
3347  :( col_+1UL ) )
3348  :( size() ) );
3349 
3350  for( size_t i=ibegin; i<iend; ++i )
3351  clear( matrix_(i,col_) );
3352 }
3354 //*************************************************************************************************
3355 
3356 
3357 //*************************************************************************************************
3368 template< typename MT > // Type of the dense matrix
3369 template< typename Other > // Data type of the scalar value
3370 inline DenseColumn<MT,false,false>& DenseColumn<MT,false,false>::scale( const Other& scalar )
3371 {
3373 
3374  const size_t ibegin( ( IsLower<MT>::value )
3375  ?( ( IsStrictlyLower<MT>::value )
3376  ?( col_+1UL )
3377  :( col_ ) )
3378  :( 0UL ) );
3379  const size_t iend ( ( IsUpper<MT>::value )
3380  ?( ( IsStrictlyUpper<MT>::value )
3381  ?( col_ )
3382  :( col_+1UL ) )
3383  :( size() ) );
3384 
3385  for( size_t i=ibegin; i<iend; ++i ) {
3386  matrix_(i,col_) *= scalar;
3387  }
3388 
3389  return *this;
3390 }
3392 //*************************************************************************************************
3393 
3394 
3395 //*************************************************************************************************
3407 template< typename MT > // Type of the dense matrix
3408 template< typename MT2 // Type of the left-hand side dense matrix
3409  , bool SO2 // Storage order of the left-hand side dense matrix
3410  , typename VT > // Type of the right-hand side vector
3411 inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
3412  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,false>& rhs )
3413 {
3414  UNUSED_PARAMETER( lhs, rhs );
3415 
3416  return true;
3417 }
3419 //*************************************************************************************************
3420 
3421 
3422 //*************************************************************************************************
3434 template< typename MT > // Type of the dense matrix
3435 template< typename MT2 // Type of the left-hand side dense matrix
3436  , bool SO2 // Storage order of the left-hand side dense matrix
3437  , typename VT > // Type of the right-hand side dense vector
3438 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3439  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs )
3440 {
3442 
3443  UNUSED_PARAMETER( lhs );
3444 
3445  const size_t iend( ( IsStrictlyLower<MT2>::value )?( col_+1UL ):( col_ ) );
3446 
3447  for( size_t i=0UL; i<iend; ++i ) {
3448  if( !isDefault( (~rhs)[i] ) )
3449  return false;
3450  }
3451 
3452  if( IsUniLower<MT2>::value && !isOne( (~rhs)[col_] ) )
3453  return false;
3454 
3455  return true;
3456 }
3458 //*************************************************************************************************
3459 
3460 
3461 //*************************************************************************************************
3473 template< typename MT > // Type of the dense matrix
3474 template< typename MT2 // Type of the left-hand side dense matrix
3475  , bool SO2 // Storage order of the left-hand side dense matrix
3476  , typename VT > // Type of the right-hand side sparse vector
3477 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3478  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs )
3479 {
3481 
3482  UNUSED_PARAMETER( lhs );
3483 
3484  typedef typename VT::ConstIterator RhsIterator;
3485 
3486  const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyLower<MT2>::value )?( col_+1UL ):( col_ ) ) );
3487 
3488  if( IsUniLower<MT2>::value && ( last == (~rhs).end() || last->index() != col_ || !isOne( last->value() ) ) )
3489  return false;
3490 
3491  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
3492  if( !isDefault( element->value() ) )
3493  return false;
3494  }
3495 
3496  return true;
3497 }
3499 //*************************************************************************************************
3500 
3501 
3502 //*************************************************************************************************
3514 template< typename MT > // Type of the dense matrix
3515 template< typename MT2 // Type of the left-hand side dense matrix
3516  , bool SO2 // Storage order of the left-hand side dense matrix
3517  , typename VT > // Type of the right-hand side dense vector
3518 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3519  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs )
3520 {
3522 
3523  UNUSED_PARAMETER( lhs );
3524 
3525  if( IsUniUpper<MT2>::value && !isOne( (~rhs)[col_] ) )
3526  return false;
3527 
3528  const size_t ibegin( ( IsStrictlyUpper<MT2>::value )?( col_ ):( col_+1UL ) );
3529 
3530  for( size_t i=ibegin; i<size(); ++i ) {
3531  if( !isDefault( (~rhs)[i] ) )
3532  return false;
3533  }
3534 
3535  return true;
3536 }
3538 //*************************************************************************************************
3539 
3540 
3541 //*************************************************************************************************
3553 template< typename MT > // Type of the dense matrix
3554 template< typename MT2 // Type of the left-hand side dense matrix
3555  , bool SO2 // Storage order of the left-hand side dense matrix
3556  , typename VT > // Type of the right-hand side sparse vector
3557 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3558  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs )
3559 {
3561 
3562  UNUSED_PARAMETER( lhs );
3563 
3564  typedef typename VT::ConstIterator RhsIterator;
3565 
3566  const bool checkDiagonal( IsUniUpper<MT2>::value || IsStrictlyUpper<MT2>::value );
3567  const RhsIterator last( (~rhs).end() );
3568  RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( col_ ):( col_+1UL ) ) );
3569 
3570  if( IsUniUpper<MT2>::value ) {
3571  if( element == last || element->index() != col_ || !isOne( element->value() ) )
3572  return false;
3573  ++element;
3574  }
3575 
3576  for( ; element!=last; ++element ) {
3577  if( !isDefault( element->value() ) )
3578  return false;
3579  }
3580 
3581  return true;
3582 }
3584 //*************************************************************************************************
3585 
3586 
3587 //*************************************************************************************************
3599 template< typename MT > // Type of the dense matrix
3600 template< typename MT2 // Type of the left-hand side dense matrix
3601  , bool SO2 // Storage order of the left-hand side dense matrix
3602  , typename VT > // Type of the right-hand side dense vector
3603 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
3604  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs )
3605 {
3607 
3608  UNUSED_PARAMETER( lhs );
3609 
3610  for( size_t i=0UL; i<col_; ++i ) {
3611  if( !isDefault( (~rhs)[i] ) )
3612  return false;
3613  }
3614 
3615  for( size_t i=col_+1UL; i<size(); ++i ) {
3616  if( !isDefault( (~rhs)[i] ) )
3617  return false;
3618  }
3619 
3620  return true;
3621 }
3623 //*************************************************************************************************
3624 
3625 
3626 //*************************************************************************************************
3638 template< typename MT > // Type of the dense matrix
3639 template< typename MT2 // Type of the left-hand side dense matrix
3640  , bool SO2 // Storage order of the left-hand side dense matrix
3641  , typename VT > // Type of the right-hand side sparse vector
3642 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
3643  DenseColumn<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs )
3644 {
3646 
3647  UNUSED_PARAMETER( lhs );
3648 
3649  typedef typename VT::ConstIterator RhsIterator;
3650 
3651  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3652  if( element->index() != col_ && !isDefault( element->value() ) )
3653  return false;
3654  }
3655 
3656  return true;
3657 }
3659 //*************************************************************************************************
3660 
3661 
3662 
3663 
3664 //=================================================================================================
3665 //
3666 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3667 //
3668 //=================================================================================================
3669 
3670 //*************************************************************************************************
3681 template< typename MT > // Type of the dense matrix
3682 template< typename Other > // Data type of the foreign expression
3683 inline bool DenseColumn<MT,false,false>::canAlias( const Other* alias ) const
3684 {
3685  return matrix_.isAliased( alias );
3686 }
3688 //*************************************************************************************************
3689 
3690 
3691 //*************************************************************************************************
3702 template< typename MT > // Type of the dense matrix
3703 template< typename MT2 // Data type of the foreign dense column
3704  , bool SO2 // Storage order of the foreign dense column
3705  , bool SF2 > // Symmetry flag of the foreign dense column
3706 inline bool DenseColumn<MT,false,false>::canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const
3707 {
3708  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3709 }
3711 //*************************************************************************************************
3712 
3713 
3714 //*************************************************************************************************
3725 template< typename MT > // Type of the dense matrix
3726 template< typename Other > // Data type of the foreign expression
3727 inline bool DenseColumn<MT,false,false>::isAliased( const Other* alias ) const
3728 {
3729  return matrix_.isAliased( alias );
3730 }
3732 //*************************************************************************************************
3733 
3734 
3735 //*************************************************************************************************
3746 template< typename MT > // Type of the dense matrix
3747 template< typename MT2 // Data type of the foreign dense column
3748  , bool SO2 // Storage order of the foreign dense column
3749  , bool SF2 > // Symmetry flag of the foreign dense column
3750 inline bool DenseColumn<MT,false,false>::isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const
3751 {
3752  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
3753 }
3755 //*************************************************************************************************
3756 
3757 
3758 //*************************************************************************************************
3768 template< typename MT > // Type of the dense matrix
3769 inline bool DenseColumn<MT,false,false>::isAligned() const
3770 {
3771  return false;
3772 }
3774 //*************************************************************************************************
3775 
3776 
3777 //*************************************************************************************************
3788 template< typename MT > // Type of the dense matrix
3790 {
3791  return ( size() > SMP_DVECASSIGN_THRESHOLD );
3792 }
3794 //*************************************************************************************************
3795 
3796 
3797 //*************************************************************************************************
3809 template< typename MT > // Type of the dense matrix
3810 template< typename VT > // Type of the right-hand side dense vector
3811 inline void DenseColumn<MT,false,false>::assign( const DenseVector<VT,false>& rhs )
3812 {
3814 
3815  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3816 
3817  const size_t ipos( (~rhs).size() & size_t(-2) );
3818  for( size_t i=0UL; i<ipos; i+=2UL ) {
3819  matrix_(i ,col_) = (~rhs)[i ];
3820  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
3821  }
3822  if( ipos < (~rhs).size() )
3823  matrix_(ipos,col_) = (~rhs)[ipos];
3824 }
3826 //*************************************************************************************************
3827 
3828 
3829 //*************************************************************************************************
3841 template< typename MT > // Type of the dense matrix
3842 template< typename VT > // Type of the right-hand side sparse vector
3843 inline void DenseColumn<MT,false,false>::assign( const SparseVector<VT,false>& rhs )
3844 {
3846 
3847  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3848 
3849  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3850  matrix_(element->index(),col_) = element->value();
3851 }
3853 //*************************************************************************************************
3854 
3855 
3856 //*************************************************************************************************
3868 template< typename MT > // Type of the dense matrix
3869 template< typename VT > // Type of the right-hand side dense vector
3870 inline void DenseColumn<MT,false,false>::addAssign( const DenseVector<VT,false>& rhs )
3871 {
3873 
3874  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3875 
3876  const size_t ipos( (~rhs).size() & size_t(-2) );
3877  for( size_t i=0UL; i<ipos; i+=2UL ) {
3878  matrix_(i ,col_) += (~rhs)[i ];
3879  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
3880  }
3881  if( ipos < (~rhs).size() )
3882  matrix_(ipos,col_) += (~rhs)[ipos];
3883 }
3885 //*************************************************************************************************
3886 
3887 
3888 //*************************************************************************************************
3900 template< typename MT > // Type of the dense matrix
3901 template< typename VT > // Type of the right-hand side sparse vector
3902 inline void DenseColumn<MT,false,false>::addAssign( const SparseVector<VT,false>& rhs )
3903 {
3905 
3906  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3907 
3908  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3909  matrix_(element->index(),col_) += element->value();
3910 }
3912 //*************************************************************************************************
3913 
3914 
3915 //*************************************************************************************************
3927 template< typename MT > // Type of the dense matrix
3928 template< typename VT > // Type of the right-hand side dense vector
3929 inline void DenseColumn<MT,false,false>::subAssign( const DenseVector<VT,false>& rhs )
3930 {
3932 
3933  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3934 
3935  const size_t ipos( (~rhs).size() & size_t(-2) );
3936  for( size_t i=0UL; i<ipos; i+=2UL ) {
3937  matrix_(i ,col_) -= (~rhs)[i ];
3938  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
3939  }
3940  if( ipos < (~rhs).size() )
3941  matrix_(ipos,col_) -= (~rhs)[ipos];
3942 }
3944 //*************************************************************************************************
3945 
3946 
3947 //*************************************************************************************************
3959 template< typename MT > // Type of the dense matrix
3960 template< typename VT > // Type of the right-hand side sparse vector
3961 inline void DenseColumn<MT,false,false>::subAssign( const SparseVector<VT,false>& rhs )
3962 {
3964 
3965  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3966 
3967  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3968  matrix_(element->index(),col_) -= element->value();
3969 }
3971 //*************************************************************************************************
3972 
3973 
3974 //*************************************************************************************************
3986 template< typename MT > // Type of the dense matrix
3987 template< typename VT > // Type of the right-hand side dense vector
3988 inline void DenseColumn<MT,false,false>::multAssign( const DenseVector<VT,false>& rhs )
3989 {
3991 
3992  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3993 
3994  const size_t ipos( (~rhs).size() & size_t(-2) );
3995  for( size_t i=0UL; i<ipos; i+=2UL ) {
3996  matrix_(i ,col_) *= (~rhs)[i ];
3997  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
3998  }
3999  if( ipos < (~rhs).size() )
4000  matrix_(ipos,col_) *= (~rhs)[ipos];
4001 }
4003 //*************************************************************************************************
4004 
4005 
4006 //*************************************************************************************************
4018 template< typename MT > // Type of the dense matrix
4019 template< typename VT > // Type of the right-hand side sparse vector
4020 inline void DenseColumn<MT,false,false>::multAssign( const SparseVector<VT,false>& rhs )
4021 {
4023 
4024  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4025 
4026  const ResultType tmp( serial( *this ) );
4027 
4028  reset();
4029 
4030  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4031  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
4032 }
4034 //*************************************************************************************************
4035 
4036 
4037 
4038 
4039 
4040 
4041 
4042 
4043 //=================================================================================================
4044 //
4045 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC ROW-MAJOR MATRICES
4046 //
4047 //=================================================================================================
4048 
4049 //*************************************************************************************************
4057 template< typename MT > // Type of the dense matrix
4058 class DenseColumn<MT,false,true> : public DenseVector< DenseColumn<MT,false,true>, false >
4059  , private Column
4060 {
4061  private:
4062  //**Type definitions****************************************************************************
4064  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
4065 
4067  typedef IntrinsicTrait<typename MT::ElementType> IT;
4068  //**********************************************************************************************
4069 
4070  //**********************************************************************************************
4072 
4078  enum { useConst = IsConst<MT>::value };
4079  //**********************************************************************************************
4080 
4081  public:
4082  //**Type definitions****************************************************************************
4083  typedef DenseColumn<MT,false,true> This;
4084  typedef typename ColumnTrait<MT>::Type ResultType;
4085  typedef typename ResultType::TransposeType TransposeType;
4086  typedef typename MT::ElementType ElementType;
4087  typedef typename IT::Type IntrinsicType;
4088  typedef typename MT::ReturnType ReturnType;
4089  typedef const DenseColumn& CompositeType;
4090 
4092  typedef typename MT::ConstReference ConstReference;
4093 
4095  typedef typename IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference;
4096 
4098  typedef const ElementType* ConstPointer;
4099 
4101  typedef typename IfTrue< useConst, ConstPointer, ElementType* >::Type Pointer;
4102 
4104  typedef typename MT::ConstIterator ConstIterator;
4105 
4107  typedef typename IfTrue< useConst, ConstIterator, typename MT::Iterator >::Type Iterator;
4108  //**********************************************************************************************
4109 
4110  //**Compilation flags***************************************************************************
4112  enum { vectorizable = MT::vectorizable };
4113 
4115  enum { smpAssignable = MT::smpAssignable };
4116  //**********************************************************************************************
4117 
4118  //**Constructors********************************************************************************
4121  explicit inline DenseColumn( MT& matrix, size_t index );
4122  // No explicitly declared copy constructor.
4124  //**********************************************************************************************
4125 
4126  //**Destructor**********************************************************************************
4127  // No explicitly declared destructor.
4128  //**********************************************************************************************
4129 
4130  //**Data access functions***********************************************************************
4133  inline Reference operator[]( size_t index );
4134  inline ConstReference operator[]( size_t index ) const;
4135  inline Pointer data ();
4136  inline ConstPointer data () const;
4137  inline Iterator begin ();
4138  inline ConstIterator begin () const;
4139  inline ConstIterator cbegin() const;
4140  inline Iterator end ();
4141  inline ConstIterator end () const;
4142  inline ConstIterator cend () const;
4144  //**********************************************************************************************
4145 
4146  //**Assignment operators************************************************************************
4149  inline DenseColumn& operator=( const ElementType& rhs );
4150  inline DenseColumn& operator=( const DenseColumn& rhs );
4151 
4152  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
4153  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
4154  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
4155  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
4156 
4157  template< typename Other >
4158  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
4159  operator*=( Other rhs );
4160 
4161  template< typename Other >
4162  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
4163  operator/=( Other rhs );
4165  //**********************************************************************************************
4166 
4167  //**Utility functions***************************************************************************
4170  inline size_t size() const;
4171  inline size_t capacity() const;
4172  inline size_t nonZeros() const;
4173  inline void reset();
4174  template< typename Other > inline DenseColumn& scale( const Other& scalar );
4176  //**********************************************************************************************
4177 
4178  private:
4179  //**********************************************************************************************
4181  template< typename VT >
4182  struct VectorizedAssign {
4183  enum { value = vectorizable && VT::vectorizable &&
4184  IsSame<ElementType,typename VT::ElementType>::value };
4185  };
4186  //**********************************************************************************************
4187 
4188  //**********************************************************************************************
4190  template< typename VT >
4191  struct VectorizedAddAssign {
4192  enum { value = vectorizable && VT::vectorizable &&
4193  IsSame<ElementType,typename VT::ElementType>::value &&
4194  IntrinsicTrait<ElementType>::addition };
4195  };
4196  //**********************************************************************************************
4197 
4198  //**********************************************************************************************
4200  template< typename VT >
4201  struct VectorizedSubAssign {
4202  enum { value = vectorizable && VT::vectorizable &&
4203  IsSame<ElementType,typename VT::ElementType>::value &&
4204  IntrinsicTrait<ElementType>::subtraction };
4205  };
4206  //**********************************************************************************************
4207 
4208  //**********************************************************************************************
4210  template< typename VT >
4211  struct VectorizedMultAssign {
4212  enum { value = vectorizable && VT::vectorizable &&
4213  IsSame<ElementType,typename VT::ElementType>::value &&
4214  IntrinsicTrait<ElementType>::multiplication };
4215  };
4216  //**********************************************************************************************
4217 
4218  public:
4219  //**Expression template evaluation functions****************************************************
4222  template< typename Other >
4223  inline bool canAlias( const Other* alias ) const;
4224 
4225  template< typename MT2, bool SO2, bool SF2 >
4226  inline bool canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const;
4227 
4228  template< typename Other >
4229  inline bool isAliased( const Other* alias ) const;
4230 
4231  template< typename MT2, bool SO2, bool SF2 >
4232  inline bool isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const;
4233 
4234  inline bool isAligned () const;
4235  inline bool canSMPAssign() const;
4236 
4237  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
4238  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
4239 
4240  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
4241  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
4242  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
4243 
4244  template< typename VT >
4245  inline typename DisableIf< VectorizedAssign<VT> >::Type
4246  assign( const DenseVector<VT,false>& rhs );
4247 
4248  template< typename VT >
4249  inline typename EnableIf< VectorizedAssign<VT> >::Type
4250  assign( const DenseVector<VT,false>& rhs );
4251 
4252  template< typename VT > inline void assign( const SparseVector<VT,false>& rhs );
4253 
4254  template< typename VT >
4255  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
4256  addAssign( const DenseVector<VT,false>& rhs );
4257 
4258  template< typename VT >
4259  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
4260  addAssign( const DenseVector<VT,false>& rhs );
4261 
4262  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
4263 
4264  template< typename VT >
4265  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
4266  subAssign( const DenseVector<VT,false>& rhs );
4267 
4268  template< typename VT >
4269  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
4270  subAssign( const DenseVector<VT,false>& rhs );
4271 
4272  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
4273 
4274  template< typename VT >
4275  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
4276  multAssign( const DenseVector<VT,false>& rhs );
4277 
4278  template< typename VT >
4279  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
4280  multAssign( const DenseVector<VT,false>& rhs );
4281 
4282  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
4284  //**********************************************************************************************
4285 
4286  private:
4287  //**Utility functions***************************************************************************
4290  template< typename MT2, bool SO2, typename VT >
4291  inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
4292  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,false>& rhs );
4293 
4294  template< typename MT2, bool SO2, typename VT >
4295  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4296  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
4297 
4298  template< typename MT2, bool SO2, typename VT >
4299  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4300  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
4301 
4302  template< typename MT2, bool SO2, typename VT >
4303  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4304  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
4305 
4306  template< typename MT2, bool SO2, typename VT >
4307  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4308  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
4309 
4310  template< typename MT2, bool SO2, typename VT >
4311  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
4312  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs );
4313 
4314  template< typename MT2, bool SO2, typename VT >
4315  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
4316  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs );
4318  //**********************************************************************************************
4319 
4320  //**Member variables****************************************************************************
4323  Operand matrix_;
4324  const size_t col_;
4325 
4326  //**********************************************************************************************
4327 
4328  //**Friend declarations*************************************************************************
4329  template< typename MT2, bool SO2, bool SF2 > friend class DenseColumn;
4330 
4331  template< typename MT2, bool SO2, bool SF2 >
4332  friend bool isSame( const DenseColumn<MT2,SO2,SF2>& a, const DenseColumn<MT2,SO2,SF2>& b );
4333 
4334  template< typename MT2, bool SO2, bool SF2 >
4335  friend typename DerestrictTrait< DenseColumn<MT2,SO2,SF2> >::Type
4336  derestrict( DenseColumn<MT2,SO2,SF2>& dm );
4337  //**********************************************************************************************
4338 
4339  //**Compile time checks*************************************************************************
4347  BLAZE_STATIC_ASSERT( !IsRestricted<MT>::value || IsLower<MT>::value || IsUpper<MT>::value );
4348  //**********************************************************************************************
4349 };
4351 //*************************************************************************************************
4352 
4353 
4354 
4355 
4356 //=================================================================================================
4357 //
4358 // CONSTRUCTOR
4359 //
4360 //=================================================================================================
4361 
4362 //*************************************************************************************************
4370 template< typename MT > // Type of the dense matrix
4371 inline DenseColumn<MT,false,true>::DenseColumn( MT& matrix, size_t index )
4372  : matrix_( matrix ) // The dense matrix containing the column
4373  , col_ ( index ) // The index of the column in the matrix
4374 {
4375  if( matrix_.columns() <= index )
4376  throw std::invalid_argument( "Invalid column access index" );
4377 }
4379 //*************************************************************************************************
4380 
4381 
4382 
4383 
4384 //=================================================================================================
4385 //
4386 // DATA ACCESS FUNCTIONS
4387 //
4388 //=================================================================================================
4389 
4390 //*************************************************************************************************
4397 template< typename MT > // Type of the dense matrix
4400 {
4401  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4402  return matrix_(col_,index);
4403 }
4405 //*************************************************************************************************
4406 
4407 
4408 //*************************************************************************************************
4415 template< typename MT > // Type of the dense matrix
4417  DenseColumn<MT,false,true>::operator[]( size_t index ) const
4418 {
4419  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
4420  return matrix_(col_,index);
4421 }
4423 //*************************************************************************************************
4424 
4425 
4426 //*************************************************************************************************
4434 template< typename MT > // Type of the dense matrix
4435 inline typename DenseColumn<MT,false,true>::Pointer DenseColumn<MT,false,true>::data()
4436 {
4437  return matrix_.data( col_ );
4438 }
4440 //*************************************************************************************************
4441 
4442 
4443 //*************************************************************************************************
4451 template< typename MT > // Type of the dense matrix
4452 inline typename DenseColumn<MT,false,true>::ConstPointer DenseColumn<MT,false,true>::data() const
4453 {
4454  return matrix_.data( col_ );
4455 }
4457 //*************************************************************************************************
4458 
4459 
4460 //*************************************************************************************************
4468 template< typename MT > // Type of the dense matrix
4470 {
4471  return matrix_.begin( col_ );
4472 }
4474 //*************************************************************************************************
4475 
4476 
4477 //*************************************************************************************************
4485 template< typename MT > // Type of the dense matrix
4487 {
4488  return matrix_.cbegin( col_ );
4489 }
4491 //*************************************************************************************************
4492 
4493 
4494 //*************************************************************************************************
4502 template< typename MT > // Type of the dense matrix
4504 {
4505  return matrix_.cbegin( col_ );
4506 }
4508 //*************************************************************************************************
4509 
4510 
4511 //*************************************************************************************************
4519 template< typename MT > // Type of the dense matrix
4521 {
4522  return matrix_.end( col_ );
4523 }
4525 //*************************************************************************************************
4526 
4527 
4528 //*************************************************************************************************
4536 template< typename MT > // Type of the dense matrix
4538 {
4539  return matrix_.cend( col_ );
4540 }
4542 //*************************************************************************************************
4543 
4544 
4545 //*************************************************************************************************
4553 template< typename MT > // Type of the dense matrix
4555 {
4556  return matrix_.cend( col_ );
4557 }
4559 //*************************************************************************************************
4560 
4561 
4562 
4563 
4564 //=================================================================================================
4565 //
4566 // ASSIGNMENT OPERATORS
4567 //
4568 //=================================================================================================
4569 
4570 //*************************************************************************************************
4577 template< typename MT > // Type of the dense matrix
4578 inline DenseColumn<MT,false,true>& DenseColumn<MT,false,true>::operator=( const ElementType& rhs )
4579 {
4580  const size_t jbegin( ( IsUpper<MT>::value )
4581  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4582  ?( col_+1UL )
4583  :( col_ ) )
4584  :( 0UL ) );
4585  const size_t jend ( ( IsLower<MT>::value )
4586  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4587  ?( col_ )
4588  :( col_+1UL ) )
4589  :( size() ) );
4590 
4591  for( size_t j=jbegin; j<jend; ++j )
4592  matrix_(col_,j) = rhs;
4593 
4594  return *this;
4595 }
4597 //*************************************************************************************************
4598 
4599 
4600 //*************************************************************************************************
4614 template< typename MT > // Type of the dense matrix
4615 inline DenseColumn<MT,false,true>& DenseColumn<MT,false,true>::operator=( const DenseColumn& rhs )
4616 {
4617  if( &rhs == this ) return *this;
4618 
4619  if( size() != rhs.size() )
4620  throw std::invalid_argument( "Column sizes do not match" );
4621 
4622  if( !preservesInvariant( matrix_, rhs ) )
4623  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4624 
4625  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4626 
4627  smpAssign( left, rhs );
4628 
4629  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4630  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4631 
4632  return *this;
4633 }
4635 //*************************************************************************************************
4636 
4637 
4638 //*************************************************************************************************
4652 template< typename MT > // Type of the dense matrix
4653 template< typename VT > // Type of the right-hand side vector
4654 inline DenseColumn<MT,false,true>&
4655  DenseColumn<MT,false,true>::operator=( const Vector<VT,false>& rhs )
4656 {
4659 
4660  if( size() != (~rhs).size() )
4661  throw std::invalid_argument( "Vector sizes do not match" );
4662 
4663  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4664  Right right( ~rhs );
4665 
4666  if( !preservesInvariant( matrix_, right ) )
4667  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4668 
4669  if( IsSparseVector<VT>::value )
4670  reset();
4671 
4672  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4673 
4674  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4675  const typename VT::ResultType tmp( right );
4676  smpAssign( left, tmp );
4677  }
4678  else {
4679  smpAssign( left, right );
4680  }
4681 
4682  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4683  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4684 
4685  return *this;
4686 }
4688 //*************************************************************************************************
4689 
4690 
4691 //*************************************************************************************************
4705 template< typename MT > // Type of the dense matrix
4706 template< typename VT > // Type of the right-hand side vector
4707 inline DenseColumn<MT,false,true>&
4708  DenseColumn<MT,false,true>::operator+=( const Vector<VT,false>& rhs )
4709 {
4712 
4713  if( size() != (~rhs).size() )
4714  throw std::invalid_argument( "Vector sizes do not match" );
4715 
4716  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4717  Right right( ~rhs );
4718 
4719  if( !preservesInvariant( matrix_, right ) )
4720  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4721 
4722  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4723 
4724  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4725  const typename VT::ResultType tmp( right );
4726  smpAddAssign( left, tmp );
4727  }
4728  else {
4729  smpAddAssign( left, right );
4730  }
4731 
4732  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4733  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4734 
4735  return *this;
4736 }
4738 //*************************************************************************************************
4739 
4740 
4741 //*************************************************************************************************
4755 template< typename MT > // Type of the dense matrix
4756 template< typename VT > // Type of the right-hand side vector
4757 inline DenseColumn<MT,false,true>&
4758  DenseColumn<MT,false,true>::operator-=( const Vector<VT,false>& rhs )
4759 {
4762 
4763  if( size() != (~rhs).size() )
4764  throw std::invalid_argument( "Vector sizes do not match" );
4765 
4766  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4767  Right right( ~rhs );
4768 
4769  if( !preservesInvariant( matrix_, right ) )
4770  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4771 
4772  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4773 
4774  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4775  const typename VT::ResultType tmp( right );
4776  smpSubAssign( left, tmp );
4777  }
4778  else {
4779  smpSubAssign( left, right );
4780  }
4781 
4782  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4783  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4784 
4785  return *this;
4786 }
4788 //*************************************************************************************************
4789 
4790 
4791 //*************************************************************************************************
4803 template< typename MT > // Type of the dense matrix
4804 template< typename VT > // Type of the right-hand side vector
4805 inline DenseColumn<MT,false,true>&
4806  DenseColumn<MT,false,true>::operator*=( const Vector<VT,false>& rhs )
4807 {
4810 
4811  if( size() != (~rhs).size() )
4812  throw std::invalid_argument( "Vector sizes do not match" );
4813 
4814  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4815 
4816  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
4817  const ResultType tmp( *this * (~rhs) );
4818  smpAssign( left, tmp );
4819  }
4820  else {
4821  smpMultAssign( left, ~rhs );
4822  }
4823 
4824  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4825  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4826 
4827  return *this;
4828 }
4830 //*************************************************************************************************
4831 
4832 
4833 //*************************************************************************************************
4844 template< typename MT > // Type of the dense matrix
4845 template< typename Other > // Data type of the right-hand side scalar
4846 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,true> >::Type&
4847  DenseColumn<MT,false,true>::operator*=( Other rhs )
4848 {
4850 
4851  return operator=( (*this) * rhs );
4852 }
4854 //*************************************************************************************************
4855 
4856 
4857 //*************************************************************************************************
4870 template< typename MT > // Type of the dense matrix
4871 template< typename Other > // Data type of the right-hand side scalar
4872 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false,true> >::Type&
4873  DenseColumn<MT,false,true>::operator/=( Other rhs )
4874 {
4876 
4877  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
4878 
4879  return operator=( (*this) / rhs );
4880 }
4882 //*************************************************************************************************
4883 
4884 
4885 
4886 
4887 //=================================================================================================
4888 //
4889 // UTILITY FUNCTIONS
4890 //
4891 //=================================================================================================
4892 
4893 //*************************************************************************************************
4899 template< typename MT > // Type of the dense matrix
4900 inline size_t DenseColumn<MT,false,true>::size() const
4901 {
4902  return matrix_.rows();
4903 }
4905 //*************************************************************************************************
4906 
4907 
4908 //*************************************************************************************************
4914 template< typename MT > // Type of the dense matrix
4915 inline size_t DenseColumn<MT,false,true>::capacity() const
4916 {
4917  return matrix_.capacity( col_ );
4918 }
4920 //*************************************************************************************************
4921 
4922 
4923 //*************************************************************************************************
4932 template< typename MT > // Type of the dense matrix
4933 inline size_t DenseColumn<MT,false,true>::nonZeros() const
4934 {
4935  return matrix_.nonZeros( col_ );
4936 }
4938 //*************************************************************************************************
4939 
4940 
4941 //*************************************************************************************************
4947 template< typename MT > // Type of the dense matrix
4949 {
4950  matrix_.reset( col_ );
4951 }
4953 //*************************************************************************************************
4954 
4955 
4956 //*************************************************************************************************
4967 template< typename MT > // Type of the dense matrix
4968 template< typename Other > // Data type of the scalar value
4969 inline DenseColumn<MT,false,true>& DenseColumn<MT,false,true>::scale( const Other& scalar )
4970 {
4972 
4973  const size_t jbegin( ( IsUpper<MT>::value )
4974  ?( ( IsStrictlyUpper<MT>::value )
4975  ?( col_+1UL )
4976  :( col_ ) )
4977  :( 0UL ) );
4978  const size_t jend ( ( IsLower<MT>::value )
4979  ?( ( IsStrictlyLower<MT>::value )
4980  ?( col_ )
4981  :( col_+1UL ) )
4982  :( size() ) );
4983 
4984  for( size_t j=jbegin; j<jend; ++j ) {
4985  matrix_(col_,j) *= scalar;
4986  }
4987 
4988  return *this;
4989 }
4991 //*************************************************************************************************
4992 
4993 
4994 //*************************************************************************************************
5006 template< typename MT > // Type of the dense matrix
5007 template< typename MT2 // Type of the left-hand side dense matrix
5008  , bool SO2 // Storage order of the left-hand side dense matrix
5009  , typename VT > // Type of the right-hand side vector
5010 inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
5011  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,false>& rhs )
5012 {
5013  UNUSED_PARAMETER( lhs, rhs );
5014 
5015  return true;
5016 }
5018 //*************************************************************************************************
5019 
5020 
5021 //*************************************************************************************************
5033 template< typename MT > // Type of the dense matrix
5034 template< typename MT2 // Type of the left-hand side dense matrix
5035  , bool SO2 // Storage order of the left-hand side dense matrix
5036  , typename VT > // Type of the right-hand side dense vector
5037 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5038  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs )
5039 {
5041 
5042  UNUSED_PARAMETER( lhs );
5043 
5044  const size_t iend( ( IsStrictlyLower<MT2>::value )?( col_+1UL ):( col_ ) );
5045 
5046  for( size_t i=0UL; i<iend; ++i ) {
5047  if( !isDefault( (~rhs)[i] ) )
5048  return false;
5049  }
5050 
5051  if( IsUniLower<MT2>::value && !isOne( (~rhs)[col_] ) )
5052  return false;
5053 
5054  return true;
5055 }
5057 //*************************************************************************************************
5058 
5059 
5060 //*************************************************************************************************
5072 template< typename MT > // Type of the dense matrix
5073 template< typename MT2 // Type of the left-hand side dense matrix
5074  , bool SO2 // Storage order of the left-hand side dense matrix
5075  , typename VT > // Type of the right-hand side sparse vector
5076 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5077  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs )
5078 {
5080 
5081  UNUSED_PARAMETER( lhs );
5082 
5083  typedef typename VT::ConstIterator RhsIterator;
5084 
5085  const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyLower<MT2>::value )?( col_+1UL ):( col_ ) ) );
5086 
5087  if( IsUniLower<MT2>::value && ( last == (~rhs).end() || last->index() != col_ || !isOne( last->value() ) ) )
5088  return false;
5089 
5090  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
5091  if( !isDefault( element->value() ) )
5092  return false;
5093  }
5094 
5095  return true;
5096 }
5098 //*************************************************************************************************
5099 
5100 
5101 //*************************************************************************************************
5113 template< typename MT > // Type of the dense matrix
5114 template< typename MT2 // Type of the left-hand side dense matrix
5115  , bool SO2 // Storage order of the left-hand side dense matrix
5116  , typename VT > // Type of the right-hand side dense vector
5117 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5118  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs )
5119 {
5121 
5122  UNUSED_PARAMETER( lhs );
5123 
5124  if( IsUniUpper<MT2>::value && !isOne( (~rhs)[col_] ) )
5125  return false;
5126 
5127  const size_t ibegin( ( IsStrictlyUpper<MT2>::value )?( col_ ):( col_+1UL ) );
5128 
5129  for( size_t i=ibegin; i<size(); ++i ) {
5130  if( !isDefault( (~rhs)[i] ) )
5131  return false;
5132  }
5133 
5134  return true;
5135 }
5137 //*************************************************************************************************
5138 
5139 
5140 //*************************************************************************************************
5152 template< typename MT > // Type of the dense matrix
5153 template< typename MT2 // Type of the left-hand side dense matrix
5154  , bool SO2 // Storage order of the left-hand side dense matrix
5155  , typename VT > // Type of the right-hand side sparse vector
5156 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5157  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs )
5158 {
5160 
5161  UNUSED_PARAMETER( lhs );
5162 
5163  typedef typename VT::ConstIterator RhsIterator;
5164 
5165  const bool checkDiagonal( IsUniUpper<MT2>::value || IsStrictlyUpper<MT2>::value );
5166  const RhsIterator last( (~rhs).end() );
5167  RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( col_ ):( col_+1UL ) ) );
5168 
5169  if( IsUniUpper<MT2>::value ) {
5170  if( element == last || element->index() != col_ || !isOne( element->value() ) )
5171  return false;
5172  ++element;
5173  }
5174 
5175  for( ; element!=last; ++element ) {
5176  if( !isDefault( element->value() ) )
5177  return false;
5178  }
5179 
5180  return true;
5181 }
5183 //*************************************************************************************************
5184 
5185 
5186 //*************************************************************************************************
5198 template< typename MT > // Type of the dense matrix
5199 template< typename MT2 // Type of the left-hand side dense matrix
5200  , bool SO2 // Storage order of the left-hand side dense matrix
5201  , typename VT > // Type of the right-hand side dense vector
5202 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
5203  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,false>& rhs )
5204 {
5206 
5207  UNUSED_PARAMETER( lhs );
5208 
5209  for( size_t i=0UL; i<col_; ++i ) {
5210  if( !isDefault( (~rhs)[i] ) )
5211  return false;
5212  }
5213 
5214  for( size_t i=col_+1UL; i<size(); ++i ) {
5215  if( !isDefault( (~rhs)[i] ) )
5216  return false;
5217  }
5218 
5219  return true;
5220 }
5222 //*************************************************************************************************
5223 
5224 
5225 //*************************************************************************************************
5237 template< typename MT > // Type of the dense matrix
5238 template< typename MT2 // Type of the left-hand side dense matrix
5239  , bool SO2 // Storage order of the left-hand side dense matrix
5240  , typename VT > // Type of the right-hand side sparse vector
5241 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
5242  DenseColumn<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,false>& rhs )
5243 {
5245 
5246  UNUSED_PARAMETER( lhs );
5247 
5248  typedef typename VT::ConstIterator RhsIterator;
5249 
5250  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5251  if( element->index() != col_ && !isDefault( element->value() ) )
5252  return false;
5253  }
5254 
5255  return true;
5256 }
5258 //*************************************************************************************************
5259 
5260 
5261 
5262 
5263 //=================================================================================================
5264 //
5265 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5266 //
5267 //=================================================================================================
5268 
5269 //*************************************************************************************************
5280 template< typename MT > // Type of the dense matrix
5281 template< typename Other > // Data type of the foreign expression
5282 inline bool DenseColumn<MT,false,true>::canAlias( const Other* alias ) const
5283 {
5284  return matrix_.isAliased( alias );
5285 }
5287 //*************************************************************************************************
5288 
5289 
5290 //*************************************************************************************************
5301 template< typename MT > // Type of the dense matrix
5302 template< typename MT2 // Data type of the foreign dense column
5303  , bool SO2 // Storage order of the foreign dense column
5304  , bool SF2 > // Symmetry flag of the foreign dense column
5305 inline bool DenseColumn<MT,false,true>::canAlias( const DenseColumn<MT2,SO2,SF2>* alias ) const
5306 {
5307  return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
5308 }
5310 //*************************************************************************************************
5311 
5312 
5313 //*************************************************************************************************
5324 template< typename MT > // Type of the dense matrix
5325 template< typename Other > // Data type of the foreign expression
5326 inline bool DenseColumn<MT,false,true>::isAliased( const Other* alias ) const
5327 {
5328  return matrix_.isAliased( alias );
5329 }
5331 //*************************************************************************************************
5332 
5333 
5334 //*************************************************************************************************
5345 template< typename MT > // Type of the dense matrix
5346 template< typename MT2 // Data type of the foreign dense column
5347  , bool SO2 // Storage order of the foreign dense column
5348  , bool SF2 > // Symmetry flag of the foreign dense column
5349 inline bool DenseColumn<MT,false,true>::isAliased( const DenseColumn<MT2,SO2,SF2>* alias ) const
5350 {
5351  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
5352 }
5354 //*************************************************************************************************
5355 
5356 
5357 //*************************************************************************************************
5367 template< typename MT > // Type of the dense matrix
5368 inline bool DenseColumn<MT,false,true>::isAligned() const
5369 {
5370  return matrix_.isAligned();
5371 }
5373 //*************************************************************************************************
5374 
5375 
5376 //*************************************************************************************************
5387 template< typename MT > // Type of the dense matrix
5388 inline bool DenseColumn<MT,false,true>::canSMPAssign() const
5389 {
5390  return ( size() > SMP_DVECASSIGN_THRESHOLD );
5391 }
5393 //*************************************************************************************************
5394 
5395 
5396 //*************************************************************************************************
5409 template< typename MT > // Type of the dense matrix
5410 BLAZE_ALWAYS_INLINE typename DenseColumn<MT,false,true>::IntrinsicType
5411  DenseColumn<MT,false,true>::load( size_t index ) const
5412 {
5413  return matrix_.load( col_, index );
5414 }
5416 //*************************************************************************************************
5417 
5418 
5419 //*************************************************************************************************
5432 template< typename MT > // Type of the dense matrix
5433 BLAZE_ALWAYS_INLINE typename DenseColumn<MT,false,true>::IntrinsicType
5434  DenseColumn<MT,false,true>::loadu( size_t index ) const
5435 {
5436  return matrix_.loadu( col_, index );
5437 }
5439 //*************************************************************************************************
5440 
5441 
5442 //*************************************************************************************************
5456 template< typename MT > // Type of the dense matrix
5457 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::store( size_t index, const IntrinsicType& value )
5458 {
5459  matrix_.store( col_, index, value );
5460 }
5462 //*************************************************************************************************
5463 
5464 
5465 //*************************************************************************************************
5479 template< typename MT > // Type of the dense matrix
5480 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::storeu( size_t index, const IntrinsicType& value )
5481 {
5482  matrix_.storeu( col_, index, value );
5483 }
5485 //*************************************************************************************************
5486 
5487 
5488 //*************************************************************************************************
5502 template< typename MT > // Type of the dense matrix
5503 BLAZE_ALWAYS_INLINE void DenseColumn<MT,false,true>::stream( size_t index, const IntrinsicType& value )
5504 {
5505  matrix_.stream( col_, index, value );
5506 }
5508 //*************************************************************************************************
5509 
5510 
5511 //*************************************************************************************************
5523 template< typename MT > // Type of the dense matrix
5524 template< typename VT > // Type of the right-hand side dense vector
5525 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5526  DenseColumn<MT,false,true>::assign( const DenseVector<VT,false>& rhs )
5527 {
5529 
5530  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5531 
5532  const size_t jpos( (~rhs).size() & size_t(-2) );
5533  for( size_t j=0UL; j<jpos; j+=2UL ) {
5534  matrix_(col_,j ) = (~rhs)[j ];
5535  matrix_(col_,j+1UL) = (~rhs)[j+1UL];
5536  }
5537  if( jpos < (~rhs).size() )
5538  matrix_(col_,jpos) = (~rhs)[jpos];
5539 }
5541 //*************************************************************************************************
5542 
5543 
5544 //*************************************************************************************************
5556 template< typename MT > // Type of the dense matrix
5557 template< typename VT > // Type of the right-hand side dense vector
5558 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5559  DenseColumn<MT,false,true>::assign( const DenseVector<VT,false>& rhs )
5560 {
5563 
5564  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5565 
5566  const size_t columns( size() );
5567 
5568  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( this ) )
5569  {
5570  for( size_t j=0UL; j<columns; j+=IT::size ) {
5571  matrix_.stream( col_, j, (~rhs).load(j) );
5572  }
5573  }
5574  else
5575  {
5576  const size_t jpos( columns & size_t(-IT::size*4) );
5577  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
5578 
5579  typename VT::ConstIterator it( (~rhs).begin() );
5580  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
5581  matrix_.store( col_, j , it.load() ); it+=IT::size;
5582  matrix_.store( col_, j+IT::size , it.load() ); it+=IT::size;
5583  matrix_.store( col_, j+IT::size*2UL, it.load() ); it+=IT::size;
5584  matrix_.store( col_, j+IT::size*3UL, it.load() ); it+=IT::size;
5585  }
5586  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
5587  matrix_.store( col_, j, it.load() );
5588  }
5589  }
5590 }
5592 //*************************************************************************************************
5593 
5594 
5595 //*************************************************************************************************
5607 template< typename MT > // Type of the dense matrix
5608 template< typename VT > // Type of the right-hand side sparse vector
5609 inline void DenseColumn<MT,false,true>::assign( const SparseVector<VT,false>& rhs )
5610 {
5612 
5613  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5614 
5615  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5616  matrix_(col_,element->index()) = element->value();
5617 }
5619 //*************************************************************************************************
5620 
5621 
5622 //*************************************************************************************************
5634 template< typename MT > // Type of the dense matrix
5635 template< typename VT > // Type of the right-hand side dense vector
5636 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5637  DenseColumn<MT,false,true>::addAssign( const DenseVector<VT,false>& rhs )
5638 {
5640 
5641  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5642 
5643  const size_t jpos( (~rhs).size() & size_t(-2) );
5644  for( size_t j=0UL; j<jpos; j+=2UL ) {
5645  matrix_(col_,j ) += (~rhs)[j ];
5646  matrix_(col_,j+1UL) += (~rhs)[j+1UL];
5647  }
5648  if( jpos < (~rhs).size() )
5649  matrix_(col_,jpos) += (~rhs)[jpos];
5650 }
5652 //*************************************************************************************************
5653 
5654 
5655 //*************************************************************************************************
5667 template< typename MT > // Type of the dense matrix
5668 template< typename VT > // Type of the right-hand side dense vector
5669 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5670  DenseColumn<MT,false,true>::addAssign( const DenseVector<VT,false>& rhs )
5671 {
5674 
5675  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5676 
5677  const size_t columns( size() );
5678 
5679  const size_t jpos( columns & size_t(-IT::size*4) );
5680  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
5681 
5682  typename VT::ConstIterator it( (~rhs).begin() );
5683  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
5684  matrix_.store( col_, j , matrix_.load(col_,j ) + it.load() ); it += IT::size;
5685  matrix_.store( col_, j+IT::size , matrix_.load(col_,j+IT::size ) + it.load() ); it += IT::size;
5686  matrix_.store( col_, j+IT::size*2UL, matrix_.load(col_,j+IT::size*2UL) + it.load() ); it += IT::size;
5687  matrix_.store( col_, j+IT::size*3UL, matrix_.load(col_,j+IT::size*3UL) + it.load() ); it += IT::size;
5688  }
5689  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
5690  matrix_.store( col_, j, matrix_.load(col_,j) + it.load() );
5691  }
5692 }
5694 //*************************************************************************************************
5695 
5696 
5697 //*************************************************************************************************
5709 template< typename MT > // Type of the dense matrix
5710 template< typename VT > // Type of the right-hand side sparse vector
5711 inline void DenseColumn<MT,false,true>::addAssign( const SparseVector<VT,false>& rhs )
5712 {
5714 
5715  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5716 
5717  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5718  matrix_(col_,element->index()) += element->value();
5719 }
5721 //*************************************************************************************************
5722 
5723 
5724 //*************************************************************************************************
5736 template< typename MT > // Type of the dense matrix
5737 template< typename VT > // Type of the right-hand side dense vector
5738 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5739  DenseColumn<MT,false,true>::subAssign( const DenseVector<VT,false>& rhs )
5740 {
5742 
5743  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5744 
5745  const size_t jpos( (~rhs).size() & size_t(-2) );
5746  for( size_t j=0UL; j<jpos; j+=2UL ) {
5747  matrix_(col_,j ) -= (~rhs)[j ];
5748  matrix_(col_,j+1UL) -= (~rhs)[j+1UL];
5749  }
5750  if( jpos < (~rhs).size() )
5751  matrix_(col_,jpos) -= (~rhs)[jpos];
5752 }
5754 //*************************************************************************************************
5755 
5756 
5757 //*************************************************************************************************
5769 template< typename MT > // Type of the dense matrix
5770 template< typename VT > // Type of the right-hand side dense vector
5771 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5772  DenseColumn<MT,false,true>::subAssign( const DenseVector<VT,false>& rhs )
5773 {
5776 
5777  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5778 
5779  const size_t columns( size() );
5780 
5781  const size_t jpos( columns & size_t(-IT::size*4) );
5782  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
5783 
5784  typename VT::ConstIterator it( (~rhs).begin() );
5785  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
5786  matrix_.store( col_, j , matrix_.load(col_,j ) - it.load() ); it += IT::size;
5787  matrix_.store( col_, j+IT::size , matrix_.load(col_,j+IT::size ) - it.load() ); it += IT::size;
5788  matrix_.store( col_, j+IT::size*2UL, matrix_.load(col_,j+IT::size*2UL) - it.load() ); it += IT::size;
5789  matrix_.store( col_, j+IT::size*3UL, matrix_.load(col_,j+IT::size*3UL) - it.load() ); it += IT::size;
5790  }
5791  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
5792  matrix_.store( col_, j, matrix_.load(col_,j) - it.load() );
5793  }
5794 }
5796 //*************************************************************************************************
5797 
5798 
5799 //*************************************************************************************************
5811 template< typename MT > // Type of the dense matrix
5812 template< typename VT > // Type of the right-hand side sparse vector
5813 inline void DenseColumn<MT,false,true>::subAssign( const SparseVector<VT,false>& rhs )
5814 {
5816 
5817  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5818 
5819  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5820  matrix_(col_,element->index()) -= element->value();
5821 }
5823 //*************************************************************************************************
5824 
5825 
5826 //*************************************************************************************************
5838 template< typename MT > // Type of the dense matrix
5839 template< typename VT > // Type of the right-hand side dense vector
5840 inline typename DisableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5841  DenseColumn<MT,false,true>::multAssign( const DenseVector<VT,false>& rhs )
5842 {
5844 
5845  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5846 
5847  const size_t jpos( (~rhs).size() & size_t(-2) );
5848  for( size_t j=0UL; j<jpos; j+=2UL ) {
5849  matrix_(col_,j ) *= (~rhs)[j ];
5850  matrix_(col_,j+1UL) *= (~rhs)[j+1UL];
5851  }
5852  if( jpos < (~rhs).size() )
5853  matrix_(col_,jpos) *= (~rhs)[jpos];
5854 }
5856 //*************************************************************************************************
5857 
5858 
5859 //*************************************************************************************************
5871 template< typename MT > // Type of the dense matrix
5872 template< typename VT > // Type of the right-hand side dense vector
5873 inline typename EnableIf< typename DenseColumn<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5874  DenseColumn<MT,false,true>::multAssign( const DenseVector<VT,false>& rhs )
5875 {
5878 
5879  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5880 
5881  const size_t columns( size() );
5882 
5883  const size_t jpos( columns & size_t(-IT::size*4) );
5884  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
5885 
5886  typename VT::ConstIterator it( (~rhs).begin() );
5887  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
5888  matrix_.store( col_, j , matrix_.load(col_,j ) * it.load() ); it += IT::size;
5889  matrix_.store( col_, j+IT::size , matrix_.load(col_,j+IT::size ) * it.load() ); it += IT::size;
5890  matrix_.store( col_, j+IT::size*2UL, matrix_.load(col_,j+IT::size*2UL) * it.load() ); it += IT::size;
5891  matrix_.store( col_, j+IT::size*3UL, matrix_.load(col_,j+IT::size*3UL) * it.load() ); it += IT::size;
5892  }
5893  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
5894  matrix_.store( col_, j, matrix_.load(col_,j) * it.load() );
5895  }
5896 }
5898 //*************************************************************************************************
5899 
5900 
5901 //*************************************************************************************************
5913 template< typename MT > // Type of the dense matrix
5914 template< typename VT > // Type of the right-hand side sparse vector
5915 inline void DenseColumn<MT,false,true>::multAssign( const SparseVector<VT,false>& rhs )
5916 {
5918 
5919  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5920 
5921  const ResultType tmp( serial( *this ) );
5922 
5923  reset();
5924 
5925  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5926  matrix_(col_,element->index()) = tmp[element->index()] * element->value();
5927 }
5929 //*************************************************************************************************
5930 
5931 
5932 
5933 
5934 
5935 
5936 
5937 
5938 //=================================================================================================
5939 //
5940 // DENSECOLUMN OPERATORS
5941 //
5942 //=================================================================================================
5943 
5944 //*************************************************************************************************
5947 template< typename MT, bool SO, bool SF >
5948 inline void reset( DenseColumn<MT,SO,SF>& column );
5949 
5950 template< typename MT, bool SO, bool SF >
5951 inline void clear( DenseColumn<MT,SO,SF>& column );
5952 
5953 template< typename MT, bool SO, bool SF >
5954 inline bool isDefault( const DenseColumn<MT,SO,SF>& column );
5955 
5956 template< typename MT, bool SO, bool SF >
5957 inline bool isSame( const DenseColumn<MT,SO,SF>& a, const DenseColumn<MT,SO,SF>& b );
5959 //*************************************************************************************************
5960 
5961 
5962 //*************************************************************************************************
5969 template< typename MT // Type of the dense matrix
5970  , bool SO // Storage order
5971  , bool SF > // Symmetry flag
5973 {
5974  column.reset();
5975 }
5976 //*************************************************************************************************
5977 
5978 
5979 //*************************************************************************************************
5988 template< typename MT // Type of the dense matrix
5989  , bool SO // Storage order
5990  , bool SF > // Symmetry flag
5992 {
5993  column.reset();
5994 }
5995 //*************************************************************************************************
5996 
5997 
5998 //*************************************************************************************************
6016 template< typename MT // Type of the dense matrix
6017  , bool SO // Storage order
6018  , bool SF > // Symmetry flag
6020 {
6021  for( size_t i=0UL; i<column.size(); ++i )
6022  if( !isDefault( column[i] ) ) return false;
6023  return true;
6024 }
6025 //*************************************************************************************************
6026 
6027 
6028 //*************************************************************************************************
6040 template< typename MT // Type of the dense matrix
6041  , bool SO // Storage order
6042  , bool SF > // Symmetry flag
6043 inline bool isSame( const DenseColumn<MT,SO,SF>& a, const DenseColumn<MT,SO,SF>& b )
6044 {
6045  return ( isSame( a.matrix_, b.matrix_ ) && ( a.col_ == b.col_ ) );
6046 }
6047 //*************************************************************************************************
6048 
6049 
6050 //*************************************************************************************************
6065 template< typename MT // Type of the dense matrix
6066  , bool SO // Storage order
6067  , bool SF > // Symmetry flag
6068 inline typename DerestrictTrait< DenseColumn<MT,SO,SF> >::Type
6069  derestrict( DenseColumn<MT,SO,SF>& column )
6070 {
6071  typedef typename DerestrictTrait< DenseColumn<MT,SO,SF> >::Type ReturnType;
6072  return ReturnType( derestrict( column.matrix_ ), column.col_ );
6073 }
6075 //*************************************************************************************************
6076 
6077 
6078 
6079 
6080 //=================================================================================================
6081 //
6082 // ISRESTRICTED SPECIALIZATIONS
6083 //
6084 //=================================================================================================
6085 
6086 //*************************************************************************************************
6088 template< typename MT, bool SO, bool SF >
6089 struct IsRestricted< DenseColumn<MT,SO,SF> > : public If< IsRestricted<MT>, TrueType, FalseType >::Type
6090 {
6091  enum { value = IsRestricted<MT>::value };
6092  typedef typename If< IsRestricted<MT>, TrueType, FalseType >::Type Type;
6093 };
6095 //*************************************************************************************************
6096 
6097 
6098 
6099 
6100 //=================================================================================================
6101 //
6102 // DERESTRICTTRAIT SPECIALIZATIONS
6103 //
6104 //=================================================================================================
6105 
6106 //*************************************************************************************************
6108 template< typename MT, bool SO, bool SF >
6109 struct DerestrictTrait< DenseColumn<MT,SO,SF> >
6110 {
6111  typedef DenseColumn< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type > Type;
6112 };
6114 //*************************************************************************************************
6115 
6116 
6117 
6118 
6119 //=================================================================================================
6120 //
6121 // HASCONSTDATAACCESS SPECIALIZATIONS
6122 //
6123 //=================================================================================================
6124 
6125 //*************************************************************************************************
6127 template< typename MT, bool SO, bool SF >
6128 struct HasConstDataAccess< DenseColumn<MT,SO,SF> >
6129  : public If< HasConstDataAccess<MT>, TrueType, FalseType >::Type
6130 {
6131  enum { value = HasConstDataAccess<MT>::value };
6132  typedef typename If< HasConstDataAccess<MT>, TrueType, FalseType >::Type Type;
6133 };
6135 //*************************************************************************************************
6136 
6137 
6138 
6139 
6140 //=================================================================================================
6141 //
6142 // HASMUTABLEDATAACCESS SPECIALIZATIONS
6143 //
6144 //=================================================================================================
6145 
6146 //*************************************************************************************************
6148 template< typename MT, bool SO, bool SF >
6149 struct HasMutableDataAccess< DenseColumn<MT,SO,SF> >
6150  : public If< HasMutableDataAccess<MT>, TrueType, FalseType >::Type
6151 {
6152  enum { value = HasMutableDataAccess<MT>::value };
6153  typedef typename If< HasMutableDataAccess<MT>, TrueType, FalseType >::Type Type;
6154 };
6156 //*************************************************************************************************
6157 
6158 
6159 
6160 
6161 //=================================================================================================
6162 //
6163 // SUBVECTORTRAIT SPECIALIZATIONS
6164 //
6165 //=================================================================================================
6166 
6167 //*************************************************************************************************
6169 template< typename MT, bool SO, bool SF >
6170 struct SubvectorTrait< DenseColumn<MT,SO,SF> >
6171 {
6172  typedef typename SubvectorTrait< typename DenseColumn<MT,SO,SF>::ResultType >::Type Type;
6173 };
6175 //*************************************************************************************************
6176 
6177 } // namespace blaze
6178 
6179 #endif
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:879
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
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:8247
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:264
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:258
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: TransposeFlag.h:159
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
Header file for the IsDiagonal type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the column element type.
Definition: DenseColumn.h:347
#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:725
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:946
Header file for the IsSame and IsStrictlySame type traits.
DenseColumn(MT &matrix, size_t index)
The constructor for DenseColumn.
Definition: DenseColumn.h:662
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
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:821
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Iterator begin()
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:759
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
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:103
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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:1678
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
#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
#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
Header file for the RequiresEvaluation type trait.
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1747
Header file for the IsUniLower type trait.
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:964
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
Header file for the column base class.
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: DenseColumn.h:372
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 row value.
Definition: DenseColumn.h:378
Header file for the DisableIf class template.
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.
Compile time assertion.
IT::Type IntrinsicType
Intrinsic type of the column elements.
Definition: DenseColumn.h:367
Constraint on the data type.
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: StorageOrder.h:161
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseColumn.h:384
const DenseColumn & CompositeType
Data type for composite expression templates.
Definition: DenseColumn.h:369
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#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
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseColumn.h:344
Header file for the Or class template.
size_t capacity() const
Returns the maximum capacity of the dense column.
Definition: DenseColumn.h:1205
Reference to a specific column of a dense matrix.The DenseColumn template represents a reference to a...
Definition: DenseColumn.h:338
bool isAligned() const
Returns whether the dense column is properly aligned in memory.
Definition: DenseColumn.h:1658
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
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 subvector trait.
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
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
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:1793
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1701
Constraint on the data type.
Constraint on the data type.
DenseColumn & operator=(const ElementType &rhs)
Homogenous assignment to all column elements.
Definition: DenseColumn.h:872
#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
IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: DenseColumn.h:375
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: DenseColumn.h:689
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1197
Constraints on the storage order of matrix types.
Operand matrix_
The dense matrix containing the column.
Definition: DenseColumn.h:611
Constraint on the data type.
DenseColumn< MT, SO, SF > This
Type of this DenseColumn instance.
Definition: DenseColumn.h:363
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:195
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:2505
Constraint on the data type.
ConstIterator cbegin() const
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:793
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
System settings for streaming (non-temporal stores)
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:841
bool canAlias(const Other *alias) const
Returns whether the dense column can alias with the given address alias.
Definition: DenseColumn.h:1572
Header file for the isOne shim.
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.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
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:103
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1770
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:1223
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: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Header file for the IsConst type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
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
IfTrue< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:387
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseColumn.h:365
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Header file for the division trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESTRICTED(T)
Constraint on the data type.In case the given data type T does have a restricted data access...
Definition: Restricted.h:118
Iterator end()
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:810
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1724
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
IfTrue< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant row value.
Definition: DenseColumn.h:381
void reset()
Reset to the default initial values.
Definition: DenseColumn.h:1238
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
#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:1616
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:612
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:151
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:260
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:1190
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
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:2502
MT::ElementType ElementType
Type of the column elements.
Definition: DenseColumn.h:366
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
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
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseColumn.h:368
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
Header file for the IsUpper type trait.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a simple dense v...
Definition: Thresholds.h:207
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseColumn.h:364
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
EnableIf< IsNumeric< Type >, bool >::Type isOne(const Type &v)
Returns whether the given value/object represents the numeric value 1.
Definition: IsOne.h:80
Header file for the IsRestricted type trait.
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:844
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
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
Header file for a safe C++ NULL pointer implementation.