All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
54 #include <blaze/math/Intrinsics.h>
56 #include <blaze/math/shims/Reset.h>
64 #include <blaze/system/CacheSize.h>
65 #include <blaze/system/Streaming.h>
67 #include <blaze/util/Assert.h>
69 #include <blaze/util/DisableIf.h>
70 #include <blaze/util/EnableIf.h>
72 #include <blaze/util/mpl/Or.h>
73 #include <blaze/util/Template.h>
74 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS DEFINITION
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
307 template< typename MT // Type of the dense matrix
308  , bool SO = IsColumnMajorMatrix<MT>::value > // Storage order
309 class DenseColumn : public DenseVector< DenseColumn<MT,SO>, false >
310  , private Column
311 {
312  private:
313  //**Type definitions****************************************************************************
315  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
316 
319  //**********************************************************************************************
320 
321  //**********************************************************************************************
323 
329  enum { useConst = IsConst<MT>::value };
330  //**********************************************************************************************
331 
332  public:
333  //**Type definitions****************************************************************************
337  typedef typename MT::ElementType ElementType;
338  typedef typename IT::Type IntrinsicType;
339  typedef typename MT::ReturnType ReturnType;
340  typedef const DenseColumn& CompositeType;
341 
344 
347 
349  typedef const ElementType* ConstPointer;
350 
353 
356 
359  //**********************************************************************************************
360 
361  //**Compilation flags***************************************************************************
363  enum { vectorizable = MT::vectorizable };
364 
366  enum { smpAssignable = MT::smpAssignable };
367  //**********************************************************************************************
368 
369  //**Constructors********************************************************************************
372  explicit inline DenseColumn( MT& matrix, size_t index );
373  // No explicitly declared copy constructor.
375  //**********************************************************************************************
376 
377  //**Destructor**********************************************************************************
378  // No explicitly declared destructor.
379  //**********************************************************************************************
380 
381  //**Data access functions***********************************************************************
384  inline Reference operator[]( size_t index );
385  inline ConstReference operator[]( size_t index ) const;
386  inline Pointer data ();
387  inline ConstPointer data () const;
388  inline Iterator begin ();
389  inline ConstIterator begin () const;
390  inline ConstIterator cbegin() const;
391  inline Iterator end ();
392  inline ConstIterator end () const;
393  inline ConstIterator cend () const;
395  //**********************************************************************************************
396 
397  //**Assignment operators************************************************************************
400  inline DenseColumn& operator= ( const ElementType& rhs );
401  inline DenseColumn& operator= ( const DenseColumn& rhs );
402  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
403  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
404  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
405  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
406 
407  template< typename Other >
408  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
409  operator*=( Other rhs );
410 
411  template< typename Other >
412  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
413  operator/=( Other rhs );
415  //**********************************************************************************************
416 
417  //**Utility functions***************************************************************************
420  inline size_t size() const;
421  inline size_t capacity() const;
422  inline size_t nonZeros() const;
423  inline void reset();
424  template< typename Other > inline DenseColumn& scale( const Other& scalar );
426  //**********************************************************************************************
427 
428  private:
429  //**********************************************************************************************
431  template< typename VT >
433  struct VectorizedAssign {
434  enum { value = vectorizable && VT::vectorizable &&
435  IsSame<ElementType,typename VT::ElementType>::value };
436  };
438  //**********************************************************************************************
439 
440  //**********************************************************************************************
442  template< typename VT >
444  struct VectorizedAddAssign {
445  enum { value = vectorizable && VT::vectorizable &&
446  IsSame<ElementType,typename VT::ElementType>::value &&
447  IntrinsicTrait<ElementType>::addition };
448  };
450  //**********************************************************************************************
451 
452  //**********************************************************************************************
454  template< typename VT >
456  struct VectorizedSubAssign {
457  enum { value = vectorizable && VT::vectorizable &&
458  IsSame<ElementType,typename VT::ElementType>::value &&
459  IntrinsicTrait<ElementType>::subtraction };
460  };
462  //**********************************************************************************************
463 
464  //**********************************************************************************************
466  template< typename VT >
468  struct VectorizedMultAssign {
469  enum { value = vectorizable && VT::vectorizable &&
470  IsSame<ElementType,typename VT::ElementType>::value &&
471  IntrinsicTrait<ElementType>::multiplication };
472  };
474  //**********************************************************************************************
475 
476  public:
477  //**Expression template evaluation functions****************************************************
480  template< typename Other > inline bool canAlias ( const Other* alias ) const;
481  template< typename MT2, bool SO2 > inline bool canAlias ( const DenseColumn<MT2,SO2>* alias ) const;
482  template< typename Other > inline bool isAliased( const Other* alias ) const;
483  template< typename MT2, bool SO2 > inline bool isAliased( const DenseColumn<MT2,SO2>* alias ) const;
484 
485  inline bool isAligned () const;
486  inline bool canSMPAssign() const;
487 
488  inline IntrinsicType load ( size_t index ) const;
489  inline IntrinsicType loadu ( size_t index ) const;
490  inline void store ( size_t index, const IntrinsicType& value );
491  inline void storeu( size_t index, const IntrinsicType& value );
492  inline void stream( size_t index, const IntrinsicType& value );
493 
494  template< typename VT >
495  inline typename DisableIf< VectorizedAssign<VT> >::Type
496  assign( const DenseVector<VT,false>& rhs );
497 
498  template< typename VT >
499  inline typename EnableIf< VectorizedAssign<VT> >::Type
500  assign( const DenseVector<VT,false>& rhs );
501 
502  template< typename VT > inline void assign( const SparseVector<VT,false>& rhs );
503 
504  template< typename VT >
505  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
506  addAssign( const DenseVector<VT,false>& rhs );
507 
508  template< typename VT >
509  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
510  addAssign( const DenseVector<VT,false>& rhs );
511 
512  template< typename VT > inline void addAssign( const SparseVector<VT,false>& rhs );
513 
514  template< typename VT >
515  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
516  subAssign( const DenseVector<VT,false>& rhs );
517 
518  template< typename VT >
519  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
520  subAssign( const DenseVector<VT,false>& rhs );
521 
522  template< typename VT > inline void subAssign( const SparseVector<VT,false>& rhs );
523 
524  template< typename VT >
525  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
526  multAssign( const DenseVector<VT,false>& rhs );
527 
528  template< typename VT >
529  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
530  multAssign( const DenseVector<VT,false>& rhs );
531 
532  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
534  //**********************************************************************************************
535 
536  private:
537  //**Member variables****************************************************************************
541  const size_t col_;
542 
543  //**********************************************************************************************
544 
545  //**Friend declarations*************************************************************************
547  template< typename MT2, bool SO2 > friend class DenseColumn;
548 
549  template< typename MT2, bool SO2 >
550  friend bool isSame( const DenseColumn<MT2,SO2>& a, const DenseColumn<MT2,SO2>& b );
552  //**********************************************************************************************
553 
554  //**Compile time checks*************************************************************************
561  //**********************************************************************************************
562 };
563 //*************************************************************************************************
564 
565 
566 
567 
568 //=================================================================================================
569 //
570 // CONSTRUCTOR
571 //
572 //=================================================================================================
573 
574 //*************************************************************************************************
581 template< typename MT // Type of the dense matrix
582  , bool SO > // Storage order
583 inline DenseColumn<MT,SO>::DenseColumn( MT& matrix, size_t index )
584  : matrix_( matrix ) // The dense matrix containing the column
585  , col_ ( index ) // The index of the column in the matrix
586 {
587  if( matrix_.columns() <= index )
588  throw std::invalid_argument( "Invalid column access index" );
589 }
590 //*************************************************************************************************
591 
592 
593 
594 
595 //=================================================================================================
596 //
597 // DATA ACCESS FUNCTIONS
598 //
599 //=================================================================================================
600 
601 //*************************************************************************************************
607 template< typename MT // Type of the dense matrix
608  , bool SO > // Storage order
610 {
611  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
612  return matrix_(index,col_);
613 }
614 //*************************************************************************************************
615 
616 
617 //*************************************************************************************************
623 template< typename MT // Type of the dense matrix
624  , bool SO > // Storage order
626 {
627  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
628  return matrix_(index,col_);
629 }
630 //*************************************************************************************************
631 
632 
633 //*************************************************************************************************
640 template< typename MT // Type of the dense matrix
641  , bool SO > // Storage order
643 {
644  return matrix_.data( col_ );
645 }
646 //*************************************************************************************************
647 
648 
649 //*************************************************************************************************
656 template< typename MT // Type of the dense matrix
657  , bool SO > // Storage order
659 {
660  return matrix_.data( col_ );
661 }
662 //*************************************************************************************************
663 
664 
665 //*************************************************************************************************
672 template< typename MT // Type of the dense matrix
673  , bool SO > // Storage order
675 {
676  return matrix_.begin( col_ );
677 }
678 //*************************************************************************************************
679 
680 
681 //*************************************************************************************************
688 template< typename MT // Type of the dense matrix
689  , bool SO > // Storage order
691 {
692  return matrix_.cbegin( col_ );
693 }
694 //*************************************************************************************************
695 
696 
697 //*************************************************************************************************
704 template< typename MT // Type of the dense matrix
705  , bool SO > // Storage order
707 {
708  return matrix_.cbegin( col_ );
709 }
710 //*************************************************************************************************
711 
712 
713 //*************************************************************************************************
720 template< typename MT // Type of the dense matrix
721  , bool SO > // Storage order
723 {
724  return matrix_.end( col_ );
725 }
726 //*************************************************************************************************
727 
728 
729 //*************************************************************************************************
736 template< typename MT // Type of the dense matrix
737  , bool SO > // Storage order
739 {
740  return matrix_.cend( col_ );
741 }
742 //*************************************************************************************************
743 
744 
745 //*************************************************************************************************
752 template< typename MT // Type of the dense matrix
753  , bool SO > // Storage order
755 {
756  return matrix_.cend( col_ );
757 }
758 //*************************************************************************************************
759 
760 
761 
762 
763 //=================================================================================================
764 //
765 // ASSIGNMENT OPERATORS
766 //
767 //=================================================================================================
768 
769 //*************************************************************************************************
775 template< typename MT // Type of the dense matrix
776  , bool SO > // Storage order
778 {
779  const size_t rows( size() );
780 
781  for( size_t i=0UL; i<rows; ++i )
782  matrix_(i,col_) = rhs;
783 
784  return *this;
785 }
786 //*************************************************************************************************
787 
788 
789 //*************************************************************************************************
799 template< typename MT // Type of the dense matrix
800  , bool SO > // Storage order
802 {
803  if( &rhs == this ) return *this;
804 
805  if( size() != rhs.size() )
806  throw std::invalid_argument( "Column sizes do not match" );
807 
808  const size_t rows( size() );
809 
810  for( size_t i=0UL; i<rows; ++i )
811  matrix_(i,col_) = rhs[i];
812 
813  return *this;
814 }
815 //*************************************************************************************************
816 
817 
818 //*************************************************************************************************
828 template< typename MT // Type of the dense matrix
829  , bool SO > // Storage order
830 template< typename VT > // Type of the right-hand side vector
832 {
835 
836  if( size() != (~rhs).size() )
837  throw std::invalid_argument( "Vector sizes do not match" );
838 
839  if( (~rhs).canAlias( &matrix_ ) ) {
840  const typename VT::ResultType tmp( ~rhs );
841  smpAssign( *this, tmp );
842  }
843  else {
845  reset();
846  smpAssign( *this, ~rhs );
847  }
848 
849  return *this;
850 }
851 //*************************************************************************************************
852 
853 
854 //*************************************************************************************************
864 template< typename MT // Type of the dense matrix
865  , bool SO > // Storage order
866 template< typename VT > // Type of the right-hand side vector
868 {
871 
872  if( size() != (~rhs).size() )
873  throw std::invalid_argument( "Vector sizes do not match" );
874 
875  if( (~rhs).canAlias( &matrix_ ) ) {
876  const typename VT::ResultType tmp( ~rhs );
877  smpAddAssign( *this, tmp );
878  }
879  else {
880  smpAddAssign( *this, ~rhs );
881  }
882 
883  return *this;
884 }
885 //*************************************************************************************************
886 
887 
888 //*************************************************************************************************
898 template< typename MT // Type of the dense matrix
899  , bool SO > // Storage order
900 template< typename VT > // Type of the right-hand side vector
902 {
905 
906  if( size() != (~rhs).size() )
907  throw std::invalid_argument( "Vector sizes do not match" );
908 
909  if( (~rhs).canAlias( &matrix_ ) ) {
910  const typename VT::ResultType tmp( ~rhs );
911  smpSubAssign( *this, tmp );
912  }
913  else {
914  smpSubAssign( *this, ~rhs );
915  }
916 
917  return *this;
918 }
919 //*************************************************************************************************
920 
921 
922 //*************************************************************************************************
933 template< typename MT // Type of the dense matrix
934  , bool SO > // Storage order
935 template< typename VT > // Type of the right-hand side vector
937 {
940 
941  if( size() != (~rhs).size() )
942  throw std::invalid_argument( "Vector sizes do not match" );
943 
944  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
945  const ResultType tmp( *this * (~rhs) );
946  smpAssign( *this, tmp );
947  }
948  else {
949  smpMultAssign( *this, ~rhs );
950  }
951 
952  return *this;
953 }
954 //*************************************************************************************************
955 
956 
957 //*************************************************************************************************
964 template< typename MT // Type of the dense matrix
965  , bool SO > // Storage order
966 template< typename Other > // Data type of the right-hand side scalar
967 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO> >::Type&
969 {
970  return operator=( (*this) * rhs );
971 }
972 //*************************************************************************************************
973 
974 
975 //*************************************************************************************************
984 template< typename MT // Type of the dense matrix
985  , bool SO > // Storage order
986 template< typename Other > // Data type of the right-hand side scalar
987 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,SO> >::Type&
989 {
990  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
991 
992  return operator=( (*this) / rhs );
993 }
994 //*************************************************************************************************
995 
996 
997 
998 
999 //=================================================================================================
1000 //
1001 // UTILITY FUNCTIONS
1002 //
1003 //=================================================================================================
1004 
1005 //*************************************************************************************************
1010 template< typename MT // Type of the dense matrix
1011  , bool SO > // Storage order
1012 inline size_t DenseColumn<MT,SO>::size() const
1013 {
1014  return matrix_.rows();
1015 }
1016 //*************************************************************************************************
1017 
1018 
1019 //*************************************************************************************************
1024 template< typename MT // Type of the dense matrix
1025  , bool SO > // Storage order
1026 inline size_t DenseColumn<MT,SO>::capacity() const
1027 {
1028  return matrix_.capacity( col_ );
1029 }
1030 //*************************************************************************************************
1031 
1032 
1033 //*************************************************************************************************
1041 template< typename MT // Type of the dense matrix
1042  , bool SO > // Storage order
1043 inline size_t DenseColumn<MT,SO>::nonZeros() const
1044 {
1045  return matrix_.nonZeros( col_ );
1046 }
1047 //*************************************************************************************************
1048 
1049 
1050 //*************************************************************************************************
1055 template< typename MT // Type of the dense matrix
1056  , bool SO > // Storage order
1058 {
1059  matrix_.reset( col_ );
1060 }
1061 //*************************************************************************************************
1062 
1063 
1064 //*************************************************************************************************
1070 template< typename MT // Type of the dense matrix
1071  , bool SO > // Storage order
1072 template< typename Other > // Data type of the scalar value
1073 inline DenseColumn<MT,SO>& DenseColumn<MT,SO>::scale( const Other& scalar )
1074 {
1075  for( size_t j=0UL; j<size(); ++j ) {
1076  matrix_(j,col_) *= scalar;
1077  }
1078  return *this;
1079 }
1080 //*************************************************************************************************
1081 
1082 
1083 
1084 
1085 //=================================================================================================
1086 //
1087 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1088 //
1089 //=================================================================================================
1090 
1091 //*************************************************************************************************
1101 template< typename MT // Type of the dense matrix
1102  , bool SO > // Storage order
1103 template< typename Other > // Data type of the foreign expression
1104 inline bool DenseColumn<MT,SO>::canAlias( const Other* alias ) const
1105 {
1106  return matrix_.isAliased( alias );
1107 }
1108 //*************************************************************************************************
1109 
1110 
1111 //*************************************************************************************************
1121 template< typename MT // Type of the dense matrix
1122  , bool SO > // Storage order
1123 template< typename MT2 // Data type of the foreign dense column
1124  , bool SO2 > // Storage order of the foreign dense column
1125 inline bool DenseColumn<MT,SO>::canAlias( const DenseColumn<MT2,SO2>* alias ) const
1126 {
1127  return matrix_.isAliased( alias->matrix_ ) && ( col_ == alias->col_ );
1128 }
1129 //*************************************************************************************************
1130 
1131 
1132 //*************************************************************************************************
1142 template< typename MT // Type of the dense matrix
1143  , bool SO > // Storage order
1144 template< typename Other > // Data type of the foreign expression
1145 inline bool DenseColumn<MT,SO>::isAliased( const Other* alias ) const
1146 {
1147  return matrix_.isAliased( alias );
1148 }
1149 //*************************************************************************************************
1150 
1151 
1152 //*************************************************************************************************
1162 template< typename MT // Type of the dense matrix
1163  , bool SO > // Storage order
1164 template< typename MT2 // Data type of the foreign dense column
1165  , bool SO2 > // Storage order of the foreign dense column
1166 inline bool DenseColumn<MT,SO>::isAliased( const DenseColumn<MT2,SO2>* alias ) const
1167 {
1168  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
1169 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1182 template< typename MT // Type of the dense matrix
1183  , bool SO > // Storage order
1185 {
1186  return matrix_.isAligned();
1187 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1201 template< typename MT // Type of the dense matrix
1202  , bool SO > // Storage order
1204 {
1205  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1206 }
1207 //*************************************************************************************************
1208 
1209 
1210 //*************************************************************************************************
1222 template< typename MT // Type of the dense matrix
1223  , bool SO > // Storage order
1225 {
1226  return matrix_.load( index, col_ );
1227 }
1228 //*************************************************************************************************
1229 
1230 
1231 //*************************************************************************************************
1243 template< typename MT // Type of the dense matrix
1244  , bool SO > // Storage order
1246 {
1247  return matrix_.loadu( index, col_ );
1248 }
1249 //*************************************************************************************************
1250 
1251 
1252 //*************************************************************************************************
1265 template< typename MT // Type of the dense matrix
1266  , bool SO > // Storage order
1267 inline void DenseColumn<MT,SO>::store( size_t index, const IntrinsicType& value )
1268 {
1269  matrix_.store( index, col_, value );
1270 }
1271 //*************************************************************************************************
1272 
1273 
1274 //*************************************************************************************************
1287 template< typename MT // Type of the dense matrix
1288  , bool SO > // Storage order
1289 inline void DenseColumn<MT,SO>::storeu( size_t index, const IntrinsicType& value )
1290 {
1291  matrix_.storeu( index, col_, value );
1292 }
1293 //*************************************************************************************************
1294 
1295 
1296 //*************************************************************************************************
1309 template< typename MT // Type of the dense matrix
1310  , bool SO > // Storage order
1311 inline void DenseColumn<MT,SO>::stream( size_t index, const IntrinsicType& value )
1312 {
1313  matrix_.stream( index, col_, value );
1314 }
1315 //*************************************************************************************************
1316 
1317 
1318 //*************************************************************************************************
1329 template< typename MT // Type of the dense matrix
1330  , bool SO > // Storage order
1331 template< typename VT > // Type of the right-hand side dense vector
1332 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1334 {
1335  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1336 
1337  const size_t iend( (~rhs).size() & size_t(-2) );
1338  for( size_t i=0UL; i<iend; i+=2UL ) {
1339  matrix_(i ,col_) = (~rhs)[i ];
1340  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
1341  }
1342  if( iend < (~rhs).size() )
1343  matrix_(iend,col_) = (~rhs)[iend];
1344 }
1345 //*************************************************************************************************
1346 
1347 
1348 //*************************************************************************************************
1359 template< typename MT // Type of the dense matrix
1360  , bool SO > // Storage order
1361 template< typename VT > // Type of the right-hand side dense vector
1362 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1364 {
1365  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1366 
1368 
1369  const size_t rows( size() );
1370 
1371  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( this ) )
1372  {
1373  for( size_t i=0UL; i<rows; i+=IT::size ) {
1374  matrix_.stream( i, col_, (~rhs).load(i) );
1375  }
1376  }
1377  else
1378  {
1379  const size_t iend( rows & size_t(-IT::size*4) );
1380  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
1381 
1382  typename VT::ConstIterator it( (~rhs).begin() );
1383  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1384  matrix_.store( i , col_, it.load() ); it+=IT::size;
1385  matrix_.store( i+IT::size , col_, it.load() ); it+=IT::size;
1386  matrix_.store( i+IT::size*2UL, col_, it.load() ); it+=IT::size;
1387  matrix_.store( i+IT::size*3UL, col_, it.load() ); it+=IT::size;
1388  }
1389  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
1390  matrix_.store( i, col_, it.load() );
1391  }
1392  }
1393 }
1394 //*************************************************************************************************
1395 
1396 
1397 //*************************************************************************************************
1408 template< typename MT // Type of the dense matrix
1409  , bool SO > // Storage order
1410 template< typename VT > // Type of the right-hand side sparse vector
1412 {
1413  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1414 
1415  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1416  matrix_(element->index(),col_) = element->value();
1417 }
1418 //*************************************************************************************************
1419 
1420 
1421 //*************************************************************************************************
1432 template< typename MT // Type of the dense matrix
1433  , bool SO > // Storage order
1434 template< typename VT > // Type of the right-hand side dense vector
1435 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1437 {
1438  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1439 
1440  const size_t iend( (~rhs).size() & size_t(-2) );
1441  for( size_t i=0UL; i<iend; i+=2UL ) {
1442  matrix_(i ,col_) += (~rhs)[i ];
1443  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
1444  }
1445  if( iend < (~rhs).size() )
1446  matrix_(iend,col_) += (~rhs)[iend];
1447 }
1448 //*************************************************************************************************
1449 
1450 
1451 //*************************************************************************************************
1462 template< typename MT // Type of the dense matrix
1463  , bool SO > // Storage order
1464 template< typename VT > // Type of the right-hand side dense vector
1465 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1467 {
1468  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1469 
1471 
1472  const size_t rows( size() );
1473 
1474  const size_t iend( rows & size_t(-IT::size*4) );
1475  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
1476 
1477  typename VT::ConstIterator it( (~rhs).begin() );
1478  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1479  matrix_.store( i , col_, matrix_.load(i ,col_) + it.load() ); it += IT::size;
1480  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) + it.load() ); it += IT::size;
1481  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) + it.load() ); it += IT::size;
1482  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) + it.load() ); it += IT::size;
1483  }
1484  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
1485  matrix_.store( i, col_, matrix_.load(i,col_) + it.load() );
1486  }
1487 }
1488 //*************************************************************************************************
1489 
1490 
1491 //*************************************************************************************************
1502 template< typename MT // Type of the dense matrix
1503  , bool SO > // Storage order
1504 template< typename VT > // Type of the right-hand side sparse vector
1506 {
1507  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1508 
1509  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1510  matrix_(element->index(),col_) += element->value();
1511 }
1512 //*************************************************************************************************
1513 
1514 
1515 //*************************************************************************************************
1526 template< typename MT // Type of the dense matrix
1527  , bool SO > // Storage order
1528 template< typename VT > // Type of the right-hand side dense vector
1529 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1531 {
1532  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1533 
1534  const size_t iend( (~rhs).size() & size_t(-2) );
1535  for( size_t i=0UL; i<iend; i+=2UL ) {
1536  matrix_(i ,col_) -= (~rhs)[i ];
1537  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
1538  }
1539  if( iend < (~rhs).size() )
1540  matrix_(iend,col_) -= (~rhs)[iend];
1541 }
1542 //*************************************************************************************************
1543 
1544 
1545 //*************************************************************************************************
1556 template< typename MT // Type of the dense matrix
1557  , bool SO > // Storage order
1558 template< typename VT > // Type of the right-hand side dense vector
1559 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1561 {
1562  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1563 
1565 
1566  const size_t rows( size() );
1567 
1568  const size_t iend( rows & size_t(-IT::size*4) );
1569  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
1570 
1571  typename VT::ConstIterator it( (~rhs).begin() );
1572  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1573  matrix_.store( i , col_, matrix_.load(i ,col_) - it.load() ); it += IT::size;
1574  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) - it.load() ); it += IT::size;
1575  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) - it.load() ); it += IT::size;
1576  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) - it.load() ); it += IT::size;
1577  }
1578  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
1579  matrix_.store( i, col_, matrix_.load(i,col_) - it.load() );
1580  }
1581 }
1582 //*************************************************************************************************
1583 
1584 
1585 //*************************************************************************************************
1596 template< typename MT // Type of the dense matrix
1597  , bool SO > // Storage order
1598 template< typename VT > // Type of the right-hand side sparse vector
1600 {
1601  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1602 
1603  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1604  matrix_(element->index(),col_) -= element->value();
1605 }
1606 //*************************************************************************************************
1607 
1608 
1609 //*************************************************************************************************
1620 template< typename MT // Type of the dense matrix
1621  , bool SO > // Storage order
1622 template< typename VT > // Type of the right-hand side dense vector
1623 inline typename DisableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1625 {
1626  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1627 
1628  const size_t iend( (~rhs).size() & size_t(-2) );
1629  for( size_t i=0UL; i<iend; i+=2UL ) {
1630  matrix_(i ,col_) *= (~rhs)[i ];
1631  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
1632  }
1633  if( iend < (~rhs).size() )
1634  matrix_(iend,col_) *= (~rhs)[iend];
1635 }
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1650 template< typename MT // Type of the dense matrix
1651  , bool SO > // Storage order
1652 template< typename VT > // Type of the right-hand side dense vector
1653 inline typename EnableIf< typename DenseColumn<MT,SO>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1655 {
1656  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1657 
1659 
1660  const size_t rows( size() );
1661 
1662  const size_t iend( rows & size_t(-IT::size*4) );
1663  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
1664 
1665  typename VT::ConstIterator it( (~rhs).begin() );
1666  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1667  matrix_.store( i , col_, matrix_.load(i ,col_) * it.load() ); it += IT::size;
1668  matrix_.store( i+IT::size , col_, matrix_.load(i+IT::size ,col_) * it.load() ); it += IT::size;
1669  matrix_.store( i+IT::size*2UL, col_, matrix_.load(i+IT::size*2UL,col_) * it.load() ); it += IT::size;
1670  matrix_.store( i+IT::size*3UL, col_, matrix_.load(i+IT::size*3UL,col_) * it.load() ); it += IT::size;
1671  }
1672  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
1673  matrix_.store( i, col_, matrix_.load(i,col_) * it.load() );
1674  }
1675 }
1676 //*************************************************************************************************
1677 
1678 
1679 //*************************************************************************************************
1690 template< typename MT // Type of the dense matrix
1691  , bool SO > // Storage order
1692 template< typename VT > // Type of the right-hand side sparse vector
1694 {
1695  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1696 
1697  const ResultType tmp( serial( *this ) );
1698 
1699  reset();
1700 
1701  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1702  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
1703 }
1704 //*************************************************************************************************
1705 
1706 
1707 
1708 
1709 
1710 
1711 
1712 
1713 //=================================================================================================
1714 //
1715 // CLASS TEMPLATE SPECIALIZATION FOR ROW-MAJOR MATRICES
1716 //
1717 //=================================================================================================
1718 
1719 //*************************************************************************************************
1727 template< typename MT > // Type of the dense matrix
1728 class DenseColumn<MT,false> : public DenseVector< DenseColumn<MT,false>, false >
1729  , private Column
1730 {
1731  private:
1732  //**Type definitions****************************************************************************
1734  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
1735  //**********************************************************************************************
1736 
1737  //**********************************************************************************************
1739 
1745  enum { useConst = IsConst<MT>::value };
1746  //**********************************************************************************************
1747 
1748  public:
1749  //**Type definitions****************************************************************************
1750  typedef DenseColumn<MT,false> This;
1751  typedef typename ColumnTrait<MT>::Type ResultType;
1752  typedef typename ResultType::TransposeType TransposeType;
1753  typedef typename MT::ElementType ElementType;
1754  typedef typename MT::ReturnType ReturnType;
1755  typedef const DenseColumn& CompositeType;
1756 
1758  typedef typename MT::ConstReference ConstReference;
1759 
1761  typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference;
1762  //**********************************************************************************************
1763 
1764  //**ColumnIterator class definition*************************************************************
1767  template< typename MatrixType > // Type of the dense matrix
1768  class ColumnIterator
1769  {
1770  private:
1771  //*******************************************************************************************
1773 
1778  enum { returnConst = IsConst<MatrixType>::value };
1779  //*******************************************************************************************
1780 
1781  public:
1782  //**Type definitions*************************************************************************
1784  typedef typename SelectType< returnConst, typename MT::ConstReference, typename MT::Reference >::Type Reference;
1785 
1786  typedef std::random_access_iterator_tag IteratorCategory;
1787  typedef RemoveReference<Reference> ValueType;
1788  typedef ValueType* PointerType;
1789  typedef Reference ReferenceType;
1790  typedef ptrdiff_t DifferenceType;
1791 
1792  // STL iterator requirements
1793  typedef IteratorCategory iterator_category;
1794  typedef ValueType value_type;
1795  typedef PointerType pointer;
1796  typedef ReferenceType reference;
1797  typedef DifferenceType difference_type;
1798  //*******************************************************************************************
1799 
1800  //**Constructor******************************************************************************
1807  inline ColumnIterator( MatrixType& matrix, size_t row, size_t column )
1808  : matrix_( &matrix ) // The dense matrix containing the column.
1809  , row_ ( row ) // The current row index.
1810  , column_( column ) // The current column index.
1811  {}
1812  //*******************************************************************************************
1813 
1814  //**Constructor******************************************************************************
1819  template< typename MatrixType2 >
1820  inline ColumnIterator( const ColumnIterator<MatrixType2>& it )
1821  : matrix_( it.matrix_ ) // The dense matrix containing the column.
1822  , row_ ( it.row_ ) // The current row index.
1823  , column_( it.column_ ) // The current column index.
1824  {}
1825  //*******************************************************************************************
1826 
1827  //**Addition assignment operator*************************************************************
1833  inline ColumnIterator& operator+=( size_t inc ) {
1834  row_ += inc;
1835  return *this;
1836  }
1837  //*******************************************************************************************
1838 
1839  //**Subtraction assignment operator**********************************************************
1845  inline ColumnIterator& operator-=( size_t dec ) {
1846  row_ -= dec;
1847  return *this;
1848  }
1849  //*******************************************************************************************
1850 
1851  //**Prefix increment operator****************************************************************
1856  inline ColumnIterator& operator++() {
1857  ++row_;
1858  return *this;
1859  }
1860  //*******************************************************************************************
1861 
1862  //**Postfix increment operator***************************************************************
1867  inline const ColumnIterator operator++( int ) {
1868  const ColumnIterator tmp( *this );
1869  ++(*this);
1870  return tmp;
1871  }
1872  //*******************************************************************************************
1873 
1874  //**Prefix decrement operator****************************************************************
1879  inline ColumnIterator& operator--() {
1880  --row_;
1881  return *this;
1882  }
1883  //*******************************************************************************************
1884 
1885  //**Postfix decrement operator***************************************************************
1890  inline const ColumnIterator operator--( int ) {
1891  const ColumnIterator tmp( *this );
1892  --(*this);
1893  return tmp;
1894  }
1895  //*******************************************************************************************
1896 
1897  //**Subscript operator***********************************************************************
1903  inline ReferenceType operator[]( size_t index ) const {
1904  return (*matrix_)(row_+index,column_);
1905  }
1906  //*******************************************************************************************
1907 
1908  //**Element access operator******************************************************************
1913  inline ReferenceType operator*() const {
1914  return (*matrix_)(row_,column_);
1915  }
1916  //*******************************************************************************************
1917 
1918  //**Element access operator******************************************************************
1923  inline PointerType operator->() const {
1924  return &(*matrix_)(row_,column_);
1925  }
1926  //*******************************************************************************************
1927 
1928  //**Equality operator************************************************************************
1934  template< typename MatrixType2 >
1935  inline bool operator==( const ColumnIterator<MatrixType2>& rhs ) const {
1936  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1937  }
1938  //*******************************************************************************************
1939 
1940  //**Inequality operator**********************************************************************
1946  template< typename MatrixType2 >
1947  inline bool operator!=( const ColumnIterator<MatrixType2>& rhs ) const {
1948  return !( *this == rhs );
1949  }
1950  //*******************************************************************************************
1951 
1952  //**Less-than operator***********************************************************************
1958  template< typename MatrixType2 >
1959  inline bool operator<( const ColumnIterator<MatrixType2>& rhs ) const {
1960  return ( matrix_ == rhs.matrix_ ) && ( row_ < rhs.row_ ) && ( column_ == rhs.column_ );
1961  }
1962  //*******************************************************************************************
1963 
1964  //**Greater-than operator********************************************************************
1970  template< typename MatrixType2 >
1971  inline bool operator>( const ColumnIterator<MatrixType2>& rhs ) const {
1972  return ( matrix_ == rhs.matrix_ ) && ( row_ > rhs.row_ ) && ( column_ == rhs.column_ );
1973  }
1974  //*******************************************************************************************
1975 
1976  //**Less-or-equal-than operator**************************************************************
1982  template< typename MatrixType2 >
1983  inline bool operator<=( const ColumnIterator<MatrixType2>& rhs ) const {
1984  return ( matrix_ == rhs.matrix_ ) && ( row_ <= rhs.row_ ) && ( column_ == rhs.column_ );
1985  }
1986  //*******************************************************************************************
1987 
1988  //**Greater-or-equal-than operator***********************************************************
1994  template< typename MatrixType2 >
1995  inline bool operator>=( const ColumnIterator<MatrixType2>& rhs ) const {
1996  return ( matrix_ == rhs.matrix_ ) && ( row_ >= rhs.row_ ) && ( column_ == rhs.column_ );
1997  }
1998  //*******************************************************************************************
1999 
2000  //**Subtraction operator*********************************************************************
2006  inline DifferenceType operator-( const ColumnIterator& rhs ) const {
2007  return row_ - rhs.row_;
2008  }
2009  //*******************************************************************************************
2010 
2011  //**Addition operator************************************************************************
2018  friend inline const ColumnIterator operator+( const ColumnIterator& it, size_t inc ) {
2019  return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2020  }
2021  //*******************************************************************************************
2022 
2023  //**Addition operator************************************************************************
2030  friend inline const ColumnIterator operator+( size_t inc, const ColumnIterator& it ) {
2031  return ColumnIterator( *it.matrix_, it.row_+inc, it.column_ );
2032  }
2033  //*******************************************************************************************
2034 
2035  //**Subtraction operator*********************************************************************
2042  friend inline const ColumnIterator operator-( const ColumnIterator& it, size_t dec ) {
2043  return ColumnIterator( *it.matrix_, it.row_-dec, it.column_ );
2044  }
2045  //*******************************************************************************************
2046 
2047  private:
2048  //**Member variables*************************************************************************
2049  MatrixType* matrix_;
2050  size_t row_;
2051  size_t column_;
2052  //*******************************************************************************************
2053 
2054  //**Friend declarations**********************************************************************
2055  template< typename MatrixType2 > friend class ColumnIterator;
2056  //*******************************************************************************************
2057  };
2058  //**********************************************************************************************
2059 
2060  //**Type definitions****************************************************************************
2062  typedef ColumnIterator<const MT> ConstIterator;
2063 
2065  typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT> >::Type Iterator;
2066  //**********************************************************************************************
2067 
2068  //**Compilation flags***************************************************************************
2070  enum { vectorizable = 0 };
2071 
2073  enum { smpAssignable = MT::smpAssignable };
2074  //**********************************************************************************************
2075 
2076  //**Constructors********************************************************************************
2079  explicit inline DenseColumn( MT& matrix, size_t index );
2080  // No explicitly declared copy constructor.
2082  //**********************************************************************************************
2083 
2084  //**Destructor**********************************************************************************
2085  // No explicitly declared destructor.
2086  //**********************************************************************************************
2087 
2088  //**Data access functions***********************************************************************
2091  inline Reference operator[]( size_t index );
2092  inline ConstReference operator[]( size_t index ) const;
2093  inline Iterator begin ();
2094  inline ConstIterator begin () const;
2095  inline ConstIterator cbegin() const;
2096  inline Iterator end ();
2097  inline ConstIterator end () const;
2098  inline ConstIterator cend () const;
2100  //**********************************************************************************************
2101 
2102  //**Assignment operators************************************************************************
2105  inline DenseColumn& operator= ( const ElementType& rhs );
2106  inline DenseColumn& operator= ( const DenseColumn& rhs );
2107  template< typename VT > inline DenseColumn& operator= ( const Vector<VT,false>& rhs );
2108  template< typename VT > inline DenseColumn& operator+=( const Vector<VT,false>& rhs );
2109  template< typename VT > inline DenseColumn& operator-=( const Vector<VT,false>& rhs );
2110  template< typename VT > inline DenseColumn& operator*=( const Vector<VT,false>& rhs );
2111 
2112  template< typename Other >
2113  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
2114  operator*=( Other rhs );
2115 
2116  template< typename Other >
2117  inline typename EnableIf< IsNumeric<Other>, DenseColumn >::Type&
2118  operator/=( Other rhs );
2120  //**********************************************************************************************
2121 
2122  //**Utility functions***************************************************************************
2125  inline size_t size() const;
2126  inline size_t capacity() const;
2127  inline size_t nonZeros() const;
2128  inline void reset();
2129  template< typename Other > inline DenseColumn& scale( const Other& scalar );
2131  //**********************************************************************************************
2132 
2133  public:
2134  //**Expression template evaluation functions****************************************************
2137  template< typename Other > inline bool canAlias ( const Other* alias ) const;
2138  template< typename MT2, bool SO2 > inline bool canAlias ( const DenseColumn<MT2,SO2>* alias ) const;
2139  template< typename Other > inline bool isAliased( const Other* alias ) const;
2140  template< typename MT2, bool SO2 > inline bool isAliased( const DenseColumn<MT2,SO2>* alias ) const;
2141 
2142  inline bool isAligned () const;
2143  inline bool canSMPAssign() const;
2144 
2145  template< typename VT > inline void assign ( const DenseVector <VT,false>& rhs );
2146  template< typename VT > inline void assign ( const SparseVector<VT,false>& rhs );
2147  template< typename VT > inline void addAssign ( const DenseVector <VT,false>& rhs );
2148  template< typename VT > inline void addAssign ( const SparseVector<VT,false>& rhs );
2149  template< typename VT > inline void subAssign ( const DenseVector <VT,false>& rhs );
2150  template< typename VT > inline void subAssign ( const SparseVector<VT,false>& rhs );
2151  template< typename VT > inline void multAssign( const DenseVector <VT,false>& rhs );
2152  template< typename VT > inline void multAssign( const SparseVector<VT,false>& rhs );
2154  //**********************************************************************************************
2155 
2156  private:
2157  //**Member variables****************************************************************************
2160  Operand matrix_;
2161  const size_t col_;
2162 
2163  //**********************************************************************************************
2164 
2165  //**Friend declarations*************************************************************************
2166  template< typename MT2, bool SO2 > friend class DenseColumn;
2167 
2168  template< typename MT2, bool SO2 >
2169  friend bool isSame( const DenseColumn<MT2,SO2>& a, const DenseColumn<MT2,SO2>& b );
2170  //**********************************************************************************************
2171 
2172  //**Compile time checks*************************************************************************
2177  //**********************************************************************************************
2178 };
2180 //*************************************************************************************************
2181 
2182 
2183 
2184 
2185 //=================================================================================================
2186 //
2187 // CONSTRUCTOR
2188 //
2189 //=================================================================================================
2190 
2191 //*************************************************************************************************
2199 template< typename MT > // Type of the dense matrix
2200 inline DenseColumn<MT,false>::DenseColumn( MT& matrix, size_t index )
2201  : matrix_( matrix ) // The dense matrix containing the column
2202  , col_ ( index ) // The index of the column in the matrix
2203 {
2204  if( matrix_.columns() <= index )
2205  throw std::invalid_argument( "Invalid column access index" );
2206 }
2208 //*************************************************************************************************
2209 
2210 
2211 
2212 
2213 //=================================================================================================
2214 //
2215 // DATA ACCESS FUNCTIONS
2216 //
2217 //=================================================================================================
2218 
2219 //*************************************************************************************************
2226 template< typename MT > // Type of the dense matrix
2228 {
2229  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2230  return matrix_(index,col_);
2231 }
2233 //*************************************************************************************************
2234 
2235 
2236 //*************************************************************************************************
2243 template< typename MT > // Type of the dense matrix
2245 {
2246  BLAZE_USER_ASSERT( index < size(), "Invalid column access index" );
2247  return matrix_(index,col_);
2248 }
2250 //*************************************************************************************************
2251 
2252 
2253 //*************************************************************************************************
2261 template< typename MT > // Type of the dense matrix
2263 {
2264  return Iterator( matrix_, 0UL, col_ );
2265 }
2267 //*************************************************************************************************
2268 
2269 
2270 //*************************************************************************************************
2278 template< typename MT > // Type of the dense matrix
2280 {
2281  return ConstIterator( matrix_, 0UL, col_ );
2282 }
2284 //*************************************************************************************************
2285 
2286 
2287 //*************************************************************************************************
2295 template< typename MT > // Type of the dense matrix
2297 {
2298  return ConstIterator( matrix_, 0UL, col_ );
2299 }
2301 //*************************************************************************************************
2302 
2303 
2304 //*************************************************************************************************
2312 template< typename MT > // Type of the dense matrix
2314 {
2315  return Iterator( matrix_, size(), col_ );
2316 }
2318 //*************************************************************************************************
2319 
2320 
2321 //*************************************************************************************************
2329 template< typename MT > // Type of the dense matrix
2331 {
2332  return ConstIterator( matrix_, size(), col_ );
2333 }
2335 //*************************************************************************************************
2336 
2337 
2338 //*************************************************************************************************
2346 template< typename MT > // Type of the dense matrix
2348 {
2349  return ConstIterator( matrix_, size(), col_ );
2350 }
2352 //*************************************************************************************************
2353 
2354 
2355 
2356 
2357 //=================================================================================================
2358 //
2359 // ASSIGNMENT OPERATORS
2360 //
2361 //=================================================================================================
2362 
2363 //*************************************************************************************************
2370 template< typename MT > // Type of the dense matrix
2371 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator=( const ElementType& rhs )
2372 {
2373  const size_t rows( size() );
2374 
2375  for( size_t i=0UL; i<rows; ++i )
2376  matrix_(i,col_) = rhs;
2377 
2378  return *this;
2379 }
2381 //*************************************************************************************************
2382 
2383 
2384 //*************************************************************************************************
2395 template< typename MT > // Type of the dense matrix
2396 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator=( const DenseColumn& rhs )
2397 {
2398  if( &rhs == this ) return *this;
2399 
2400  if( size() != rhs.size() )
2401  throw std::invalid_argument( "Column sizes do not match" );
2402 
2403  const size_t rows( size() );
2404 
2405  for( size_t i=0UL; i<rows; ++i )
2406  matrix_(i,col_) = rhs[i];
2407 
2408  return *this;
2409 }
2411 //*************************************************************************************************
2412 
2413 
2414 //*************************************************************************************************
2425 template< typename MT > // Type of the dense matrix
2426 template< typename VT > // Type of the right-hand side vector
2427 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator=( const Vector<VT,false>& rhs )
2428 {
2432 
2433  if( size() != (~rhs).size() )
2434  throw std::invalid_argument( "Vector sizes do not match" );
2435 
2436  if( (~rhs).canAlias( &matrix_ ) ) {
2437  const ResultType tmp( ~rhs );
2438  smpAssign( *this, tmp );
2439  }
2440  else {
2441  if( IsSparseVector<VT>::value )
2442  reset();
2443  smpAssign( *this, ~rhs );
2444  }
2445 
2446  return *this;
2447 }
2449 //*************************************************************************************************
2450 
2451 
2452 //*************************************************************************************************
2463 template< typename MT > // Type of the dense matrix
2464 template< typename VT > // Type of the right-hand side vector
2465 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator+=( const Vector<VT,false>& rhs )
2466 {
2469 
2470  if( size() != (~rhs).size() )
2471  throw std::invalid_argument( "Vector sizes do not match" );
2472 
2473  if( (~rhs).canAlias( &matrix_ ) ) {
2474  const typename VT::ResultType tmp( ~rhs );
2475  smpAddAssign( *this, tmp );
2476  }
2477  else {
2478  smpAddAssign( *this, ~rhs );
2479  }
2480 
2481  return *this;
2482 }
2484 //*************************************************************************************************
2485 
2486 
2487 //*************************************************************************************************
2498 template< typename MT > // Type of the dense matrix
2499 template< typename VT > // Type of the right-hand side vector
2500 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator-=( const Vector<VT,false>& rhs )
2501 {
2504 
2505  if( size() != (~rhs).size() )
2506  throw std::invalid_argument( "Vector sizes do not match" );
2507 
2508  if( (~rhs).canAlias( &matrix_ ) ) {
2509  const typename VT::ResultType tmp( ~rhs );
2510  smpSubAssign( *this, tmp );
2511  }
2512  else {
2513  smpSubAssign( *this, ~rhs );
2514  }
2515 
2516  return *this;
2517 }
2519 //*************************************************************************************************
2520 
2521 
2522 //*************************************************************************************************
2534 template< typename MT > // Type of the dense matrix
2535 template< typename VT > // Type of the right-hand side vector
2536 inline DenseColumn<MT,false>& DenseColumn<MT,false>::operator*=( const Vector<VT,false>& rhs )
2537 {
2540 
2541  if( size() != (~rhs).size() )
2542  throw std::invalid_argument( "Vector sizes do not match" );
2543 
2544  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
2545  const ResultType tmp( *this * (~rhs) );
2546  smpAssign( *this, tmp );
2547  }
2548  else {
2549  smpMultAssign( *this, ~rhs );
2550  }
2551 
2552  return *this;
2553 }
2555 //*************************************************************************************************
2556 
2557 
2558 //*************************************************************************************************
2566 template< typename MT > // Type of the dense matrix
2567 template< typename Other > // Data type of the right-hand side scalar
2568 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2569  DenseColumn<MT,false>::operator*=( Other rhs )
2570 {
2571  for( size_t i=0UL; i<size(); ++i )
2572  matrix_(i,col_) *= rhs;
2573  return *this;
2574 }
2576 //*************************************************************************************************
2577 
2578 
2579 //*************************************************************************************************
2589 template< typename MT > // Type of the dense matrix
2590 template< typename Other > // Data type of the right-hand side scalar
2591 inline typename EnableIf< IsNumeric<Other>, DenseColumn<MT,false> >::Type&
2592  DenseColumn<MT,false>::operator/=( Other rhs )
2593 {
2594  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2595 
2596  typedef typename DivTrait<ElementType,Other>::Type DT;
2597  typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2598 
2599  // Depending on the two involved data types, an integer division is applied or a
2600  // floating point division is selected.
2601  if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2602  const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2603  for( size_t i=0UL; i<size(); ++i )
2604  matrix_(i,col_) *= tmp;
2605  }
2606  else {
2607  for( size_t i=0UL; i<size(); ++i )
2608  matrix_(i,col_) /= rhs;
2609  }
2610 
2611  return *this;
2612 }
2614 //*************************************************************************************************
2615 
2616 
2617 
2618 
2619 //=================================================================================================
2620 //
2621 // UTILITY FUNCTIONS
2622 //
2623 //=================================================================================================
2624 
2625 //*************************************************************************************************
2631 template< typename MT > // Type of the dense matrix
2632 inline size_t DenseColumn<MT,false>::size() const
2633 {
2634  return matrix_.rows();
2635 }
2637 //*************************************************************************************************
2638 
2639 
2640 //*************************************************************************************************
2646 template< typename MT > // Type of the dense matrix
2647 inline size_t DenseColumn<MT,false>::capacity() const
2648 {
2649  return matrix_.rows();
2650 }
2652 //*************************************************************************************************
2653 
2654 
2655 //*************************************************************************************************
2664 template< typename MT > // Type of the dense matrix
2665 inline size_t DenseColumn<MT,false>::nonZeros() const
2666 {
2667  const size_t rows( size() );
2668  size_t nonzeros( 0UL );
2669 
2670  for( size_t i=0UL; i<rows; ++i )
2671  if( !isDefault( matrix_(i,col_) ) )
2672  ++nonzeros;
2673 
2674  return nonzeros;
2675 }
2677 //*************************************************************************************************
2678 
2679 
2680 //*************************************************************************************************
2686 template< typename MT > // Type of the dense matrix
2687 inline void DenseColumn<MT,false>::reset()
2688 {
2689  using blaze::reset;
2690  const size_t rows( size() );
2691  for( size_t i=0UL; i<rows; ++i )
2692  reset( matrix_(i,col_) );
2693 }
2695 //*************************************************************************************************
2696 
2697 
2698 //*************************************************************************************************
2705 template< typename MT > // Type of the dense matrix
2706 template< typename Other > // Data type of the scalar value
2707 inline DenseColumn<MT,false>& DenseColumn<MT,false>::scale( const Other& scalar )
2708 {
2709  for( size_t i=0UL; i<size(); ++i ) {
2710  matrix_(i,col_) *= scalar;
2711  }
2712  return *this;
2713 }
2715 //*************************************************************************************************
2716 
2717 
2718 
2719 
2720 //=================================================================================================
2721 //
2722 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2723 //
2724 //=================================================================================================
2725 
2726 //*************************************************************************************************
2737 template< typename MT > // Type of the dense matrix
2738 template< typename Other > // Data type of the foreign expression
2739 inline bool DenseColumn<MT,false>::canAlias( const Other* alias ) const
2740 {
2741  return matrix_.isAliased( alias );
2742 }
2744 //*************************************************************************************************
2745 
2746 
2747 //*************************************************************************************************
2758 template< typename MT > // Type of the dense matrix
2759 template< typename MT2 // Data type of the foreign dense column
2760  , bool SO2 > // Storage order of the foreign dense column
2761 inline bool DenseColumn<MT,false>::canAlias( const DenseColumn<MT2,SO2>* alias ) const
2762 {
2763  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
2764 }
2766 //*************************************************************************************************
2767 
2768 
2769 //*************************************************************************************************
2780 template< typename MT > // Type of the dense matrix
2781 template< typename Other > // Data type of the foreign expression
2782 inline bool DenseColumn<MT,false>::isAliased( const Other* alias ) const
2783 {
2784  return matrix_.isAliased( alias );
2785 }
2787 //*************************************************************************************************
2788 
2789 
2790 //*************************************************************************************************
2801 template< typename MT > // Type of the dense matrix
2802 template< typename MT2 // Data type of the foreign dense column
2803  , bool SO2 > // Storage order of the foreign dense column
2804 inline bool DenseColumn<MT,false>::isAliased( const DenseColumn<MT2,SO2>* alias ) const
2805 {
2806  return matrix_.isAliased( &alias->matrix_ ) && ( col_ == alias->col_ );
2807 }
2809 //*************************************************************************************************
2810 
2811 
2812 //*************************************************************************************************
2822 template< typename MT > // Type of the dense matrix
2823 inline bool DenseColumn<MT,false>::isAligned() const
2824 {
2825  return false;
2826 }
2828 //*************************************************************************************************
2829 
2830 
2831 //*************************************************************************************************
2842 template< typename MT > // Type of the dense matrix
2843 inline bool DenseColumn<MT,false>::canSMPAssign() const
2844 {
2845  return ( size() > SMP_DVECASSIGN_THRESHOLD );
2846 }
2848 //*************************************************************************************************
2849 
2850 
2851 //*************************************************************************************************
2863 template< typename MT > // Type of the dense matrix
2864 template< typename VT > // Type of the right-hand side dense vector
2865 inline void DenseColumn<MT,false>::assign( const DenseVector<VT,false>& rhs )
2866 {
2867  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2868 
2869  const size_t iend( (~rhs).size() & size_t(-2) );
2870  for( size_t i=0UL; i<iend; i+=2UL ) {
2871  matrix_(i ,col_) = (~rhs)[i ];
2872  matrix_(i+1UL,col_) = (~rhs)[i+1UL];
2873  }
2874  if( iend < (~rhs).size() )
2875  matrix_(iend,col_) = (~rhs)[iend];
2876 }
2878 //*************************************************************************************************
2879 
2880 
2881 //*************************************************************************************************
2893 template< typename MT > // Type of the dense matrix
2894 template< typename VT > // Type of the right-hand side sparse vector
2895 inline void DenseColumn<MT,false>::assign( const SparseVector<VT,false>& rhs )
2896 {
2897  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2898 
2899  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2900  matrix_(element->index(),col_) = element->value();
2901 }
2903 //*************************************************************************************************
2904 
2905 
2906 //*************************************************************************************************
2918 template< typename MT > // Type of the dense matrix
2919 template< typename VT > // Type of the right-hand side dense vector
2920 inline void DenseColumn<MT,false>::addAssign( const DenseVector<VT,false>& rhs )
2921 {
2922  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2923 
2924  const size_t iend( (~rhs).size() & size_t(-2) );
2925  for( size_t i=0UL; i<iend; i+=2UL ) {
2926  matrix_(i ,col_) += (~rhs)[i ];
2927  matrix_(i+1UL,col_) += (~rhs)[i+1UL];
2928  }
2929  if( iend < (~rhs).size() )
2930  matrix_(iend,col_) += (~rhs)[iend];
2931 }
2933 //*************************************************************************************************
2934 
2935 
2936 //*************************************************************************************************
2948 template< typename MT > // Type of the dense matrix
2949 template< typename VT > // Type of the right-hand side sparse vector
2950 inline void DenseColumn<MT,false>::addAssign( const SparseVector<VT,false>& rhs )
2951 {
2952  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2953 
2954  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2955  matrix_(element->index(),col_) += element->value();
2956 }
2958 //*************************************************************************************************
2959 
2960 
2961 //*************************************************************************************************
2973 template< typename MT > // Type of the dense matrix
2974 template< typename VT > // Type of the right-hand side dense vector
2975 inline void DenseColumn<MT,false>::subAssign( const DenseVector<VT,false>& rhs )
2976 {
2977  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2978 
2979  const size_t iend( (~rhs).size() & size_t(-2) );
2980  for( size_t i=0UL; i<iend; i+=2UL ) {
2981  matrix_(i ,col_) -= (~rhs)[i ];
2982  matrix_(i+1UL,col_) -= (~rhs)[i+1UL];
2983  }
2984  if( iend < (~rhs).size() )
2985  matrix_(iend,col_) -= (~rhs)[iend];
2986 }
2988 //*************************************************************************************************
2989 
2990 
2991 //*************************************************************************************************
3003 template< typename MT > // Type of the dense matrix
3004 template< typename VT > // Type of the right-hand side sparse vector
3005 inline void DenseColumn<MT,false>::subAssign( const SparseVector<VT,false>& rhs )
3006 {
3007  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3008 
3009  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3010  matrix_(element->index(),col_) -= element->value();
3011 }
3013 //*************************************************************************************************
3014 
3015 
3016 //*************************************************************************************************
3028 template< typename MT > // Type of the dense matrix
3029 template< typename VT > // Type of the right-hand side dense vector
3030 inline void DenseColumn<MT,false>::multAssign( const DenseVector<VT,false>& rhs )
3031 {
3032  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3033 
3034  const size_t iend( (~rhs).size() & size_t(-2) );
3035  for( size_t i=0UL; i<iend; i+=2UL ) {
3036  matrix_(i ,col_) *= (~rhs)[i ];
3037  matrix_(i+1UL,col_) *= (~rhs)[i+1UL];
3038  }
3039  if( iend < (~rhs).size() )
3040  matrix_(iend,col_) *= (~rhs)[iend];
3041 }
3043 //*************************************************************************************************
3044 
3045 
3046 //*************************************************************************************************
3058 template< typename MT > // Type of the dense matrix
3059 template< typename VT > // Type of the right-hand side sparse vector
3060 inline void DenseColumn<MT,false>::multAssign( const SparseVector<VT,false>& rhs )
3061 {
3062  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3063 
3064  const ResultType tmp( serial( *this ) );
3065 
3066  reset();
3067 
3068  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3069  matrix_(element->index(),col_) = tmp[element->index()] * element->value();
3070 }
3072 //*************************************************************************************************
3073 
3074 
3075 
3076 
3077 
3078 
3079 
3080 
3081 //=================================================================================================
3082 //
3083 // DENSECOLUMN OPERATORS
3084 //
3085 //=================================================================================================
3086 
3087 //*************************************************************************************************
3090 template< typename MT, bool SO >
3091 inline void reset( DenseColumn<MT,SO>& column );
3092 
3093 template< typename MT, bool SO >
3094 inline void clear( DenseColumn<MT,SO>& column );
3095 
3096 template< typename MT, bool SO >
3097 inline bool isDefault( const DenseColumn<MT,SO>& column );
3098 
3099 template< typename MT, bool SO >
3100 inline bool isSame( const DenseColumn<MT,SO>& a, const DenseColumn<MT,SO>& b );
3102 //*************************************************************************************************
3103 
3104 
3105 //*************************************************************************************************
3112 template< typename MT // Type of the dense matrix
3113  , bool SO > // Storage order
3115 {
3116  column.reset();
3117 }
3118 //*************************************************************************************************
3119 
3120 
3121 //*************************************************************************************************
3130 template< typename MT // Type of the dense matrix
3131  , bool SO > // Storage order
3133 {
3134  column.reset();
3135 }
3136 //*************************************************************************************************
3137 
3138 
3139 //*************************************************************************************************
3157 template< typename MT // Type of the dense matrix
3158  , bool SO > // Storage order
3159 inline bool isDefault( const DenseColumn<MT,SO>& column )
3160 {
3161  for( size_t i=0UL; i<column.size(); ++i )
3162  if( !isDefault( column[i] ) ) return false;
3163  return true;
3164 }
3165 //*************************************************************************************************
3166 
3167 
3168 //*************************************************************************************************
3180 template< typename MT, bool SO >
3181 inline bool isSame( const DenseColumn<MT,SO>& a, const DenseColumn<MT,SO>& b )
3182 {
3183  return ( isSame( a.matrix_, b.matrix_ ) && ( a.col_ == b.col_ ) );
3184 }
3185 //*************************************************************************************************
3186 
3187 
3188 
3189 
3190 //=================================================================================================
3191 //
3192 // SUBVECTORTRAIT SPECIALIZATIONS
3193 //
3194 //=================================================================================================
3195 
3196 //*************************************************************************************************
3198 template< typename MT, bool SO >
3199 struct SubvectorTrait< DenseColumn<MT,SO> >
3200 {
3201  typedef typename SubvectorTrait< typename DenseColumn<MT,SO>::ResultType >::Type Type;
3202 };
3204 //*************************************************************************************************
3205 
3206 } // namespace blaze
3207 
3208 #endif
Constraint on the data type.
Constraint on the data type.
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: DenseColumn.h:346
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseColumn.h:349
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
#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
EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:222
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:4329
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:114
size_t size() const
Returns the current size/dimension of the column.
Definition: DenseColumn.h:1012
#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
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4642
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
#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
void smpMultAssign(DenseVector< 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:179
Header file for the IsSame and IsStrictlySame type traits.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseColumn.h:336
MT::ElementType ElementType
Type of the column elements.
Definition: DenseColumn.h:337
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 stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1311
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
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.
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
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseColumn.h:339
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
#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
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseColumn.h:355
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4615
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:409
Header file for the column base class.
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: DenseColumn.h:1043
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseColumn.h:315
DenseColumn & operator=(const ElementType &rhs)
Homogenous assignment to all column elements.
Definition: DenseColumn.h:777
Constraint on the data type.
void smpAddAssign(DenseMatrix< 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:122
Iterator end()
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:722
void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1267
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant row value.
Definition: DenseColumn.h:352
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
ConstIterator cbegin() const
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:706
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: DenseColumn.h:609
Header file for nested template disabiguation.
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
DenseColumn(MT &matrix, size_t index)
The constructor for DenseColumn.
Definition: DenseColumn.h:583
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
IT::Type IntrinsicType
Intrinsic type of the column elements.
Definition: DenseColumn.h:338
bool canAlias(const Other *alias) const
Returns whether the dense column can alias with the given address alias.
Definition: DenseColumn.h:1104
const size_t col_
The index of the column in the matrix.
Definition: DenseColumn.h:541
Header file for the Or class template.
IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1224
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: DenseColumn.h:343
Reference to a specific column of a dense matrix.The DenseColumn template represents a reference to a...
Definition: DenseColumn.h:309
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
IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense column.
Definition: DenseColumn.h:1245
Header file for the subvector trait.
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:271
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
void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the dense column.
Definition: DenseColumn.h:1289
Constraint on the data type.
Constraint on the data type.
size_t capacity() const
Returns the maximum capacity of the dense column.
Definition: DenseColumn.h:1026
#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
Constraints on the storage order of matrix types.
Constraint on the data type.
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseColumn.h:335
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
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:361
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2410
System settings for streaming (non-temporal stores)
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:358
Header file for the EnableIf class template.
Operand matrix_
The dense matrix containing the column.
Definition: DenseColumn.h:540
bool isAligned() const
Returns whether the dense column is properly aligned in memory.
Definition: DenseColumn.h:1184
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Header file for the IsNumeric 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
Header file for the IsSparseVector type trait.
#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:2407
Header file for the IsConst type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the column element type.
Definition: DenseColumn.h:318
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
bool canSMPAssign() const
Returns whether the dense column can be used in SMP assignments.
Definition: DenseColumn.h:1203
Header file for the division trait.
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:301
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
Header file for the reset shim.
Header file for the cache size of the target architecture.
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:331
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
DenseColumn< MT, SO > This
Type of this DenseColumn instance.
Definition: DenseColumn.h:334
Header file for the column trait.
Header file for the isDefault shim.
void reset()
Reset to the default initial values.
Definition: DenseColumn.h:1057
Pointer data()
Low-level data access to the column elements.
Definition: DenseColumn.h:642
#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
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.
#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
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: DenseColumn.h:754
Header file for the IsRowMajorMatrix type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:151
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:250
Iterator begin()
Returns an iterator to the first element of the column.
Definition: DenseColumn.h:674
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:2403
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2409
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a plain dense ve...
Definition: Thresholds.h:207
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
bool isAliased(const Other *alias) const
Returns whether the dense column is aliased with the given address alias.
Definition: DenseColumn.h:1145
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:154
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the IsExpression type trait class.
const DenseColumn & CompositeType
Data type for composite expression templates.
Definition: DenseColumn.h:340
Header file for the FunctionTrace class.