All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DenseRow.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_DENSEROW_H_
36 #define _BLAZE_MATH_VIEWS_DENSEROW_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <stdexcept>
55 #include <blaze/math/Intrinsics.h>
56 #include <blaze/math/shims/Clear.h>
65 #include <blaze/system/CacheSize.h>
66 #include <blaze/system/Streaming.h>
68 #include <blaze/util/Assert.h>
70 #include <blaze/util/DisableIf.h>
71 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/mpl/Or.h>
74 #include <blaze/util/Null.h>
75 #include <blaze/util/Template.h>
76 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS DEFINITION
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
312 template< typename MT // Type of the dense matrix
313  , bool SO = IsRowMajorMatrix<MT>::value // Storage order
314  , bool SF = IsSymmetric<MT>::value > // Symmetry flag
315 class DenseRow : public DenseVector< DenseRow<MT,SO,SF>, true >
316  , private Row
317 {
318  private:
319  //**Type definitions****************************************************************************
321  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
322 
325  //**********************************************************************************************
326 
327  //**********************************************************************************************
329 
335  enum { useConst = IsConst<MT>::value };
336  //**********************************************************************************************
337 
338  public:
339  //**Type definitions****************************************************************************
341  typedef typename RowTrait<MT>::Type ResultType;
343  typedef typename MT::ElementType ElementType;
344  typedef typename IT::Type IntrinsicType;
345  typedef typename MT::ReturnType ReturnType;
346  typedef const DenseRow& CompositeType;
347 
350 
353 
355  typedef const ElementType* ConstPointer;
356 
359 
362 
365  //**********************************************************************************************
366 
367  //**Compilation flags***************************************************************************
369  enum { vectorizable = MT::vectorizable };
370 
372  enum { smpAssignable = MT::smpAssignable };
373  //**********************************************************************************************
374 
375  //**Constructors********************************************************************************
378  explicit inline DenseRow( MT& matrix, size_t index );
379  // No explicitly declared copy constructor.
381  //**********************************************************************************************
382 
383  //**Destructor**********************************************************************************
384  // No explicitly declared destructor.
385  //**********************************************************************************************
386 
387  //**Data access functions***********************************************************************
390  inline Reference operator[]( size_t index );
391  inline ConstReference operator[]( size_t index ) const;
392  inline Pointer data ();
393  inline ConstPointer data () const;
394  inline Iterator begin ();
395  inline ConstIterator begin () const;
396  inline ConstIterator cbegin() const;
397  inline Iterator end ();
398  inline ConstIterator end () const;
399  inline ConstIterator cend () const;
401  //**********************************************************************************************
402 
403  //**Assignment operators************************************************************************
406  inline DenseRow& operator= ( const ElementType& rhs );
407  inline DenseRow& operator= ( const DenseRow& rhs );
408  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
409  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
410  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
411  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
412 
413  template< typename Other >
414  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
415  operator*=( Other rhs );
416 
417  template< typename Other >
418  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
419  operator/=( Other rhs );
421  //**********************************************************************************************
422 
423  //**Utility functions***************************************************************************
426  inline size_t size() const;
427  inline size_t capacity() const;
428  inline size_t nonZeros() const;
429  inline void reset();
430  template< typename Other > inline DenseRow& scale( const Other& scalar );
432  //**********************************************************************************************
433 
434  private:
435  //**********************************************************************************************
437  template< typename VT >
439  struct VectorizedAssign {
440  enum { value = vectorizable && VT::vectorizable &&
441  IsSame<ElementType,typename VT::ElementType>::value };
442  };
444  //**********************************************************************************************
445 
446  //**********************************************************************************************
448  template< typename VT >
450  struct VectorizedAddAssign {
451  enum { value = vectorizable && VT::vectorizable &&
452  IsSame<ElementType,typename VT::ElementType>::value &&
453  IntrinsicTrait<ElementType>::addition };
454  };
456  //**********************************************************************************************
457 
458  //**********************************************************************************************
460  template< typename VT >
462  struct VectorizedSubAssign {
463  enum { value = vectorizable && VT::vectorizable &&
464  IsSame<ElementType,typename VT::ElementType>::value &&
465  IntrinsicTrait<ElementType>::subtraction };
466  };
468  //**********************************************************************************************
469 
470  //**********************************************************************************************
472  template< typename VT >
474  struct VectorizedMultAssign {
475  enum { value = vectorizable && VT::vectorizable &&
476  IsSame<ElementType,typename VT::ElementType>::value &&
477  IntrinsicTrait<ElementType>::multiplication };
478  };
480  //**********************************************************************************************
481 
482  public:
483  //**Expression template evaluation functions****************************************************
486  template< typename Other >
487  inline bool canAlias( const Other* alias ) const;
488 
489  template< typename MT2, bool SO2, bool SF2 >
490  inline bool canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const;
491 
492  template< typename Other >
493  inline bool isAliased( const Other* alias ) const;
494 
495  template< typename MT2, bool SO2, bool SF2 >
496  inline bool isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const;
497 
498  inline bool isAligned () const;
499  inline bool canSMPAssign() const;
500 
501  inline IntrinsicType load ( size_t index ) const;
502  inline IntrinsicType loadu ( size_t index ) const;
503  inline void store ( size_t index, const IntrinsicType& value );
504  inline void storeu( size_t index, const IntrinsicType& value );
505  inline void stream( size_t index, const IntrinsicType& value );
506 
507  template< typename VT >
508  inline typename DisableIf< VectorizedAssign<VT> >::Type
509  assign( const DenseVector<VT,true>& rhs );
510 
511  template< typename VT >
512  inline typename EnableIf< VectorizedAssign<VT> >::Type
513  assign( const DenseVector<VT,true>& rhs );
514 
515  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
516 
517  template< typename VT >
518  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
519  addAssign( const DenseVector<VT,true>& rhs );
520 
521  template< typename VT >
522  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
523  addAssign( const DenseVector<VT,true>& rhs );
524 
525  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
526 
527  template< typename VT >
528  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
529  subAssign( const DenseVector<VT,true>& rhs );
530 
531  template< typename VT >
532  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
533  subAssign( const DenseVector<VT,true>& rhs );
534 
535  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
536 
537  template< typename VT >
538  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
539  multAssign( const DenseVector<VT,true>& rhs );
540 
541  template< typename VT >
542  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
543  multAssign( const DenseVector<VT,true>& rhs );
544 
545  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
547  //**********************************************************************************************
548 
549  private:
550  //**Member variables****************************************************************************
554  const size_t row_;
555 
556  //**********************************************************************************************
557 
558  //**Friend declarations*************************************************************************
560  template< typename MT2, bool SO2, bool SF2 > friend class DenseRow;
561 
562  template< typename MT2, bool SO2, bool SF2 >
563  friend bool isSame( const DenseRow<MT2,SO2,SF2>& a, const DenseRow<MT2,SO2,SF2>& b );
565  //**********************************************************************************************
566 
567  //**Compile time checks*************************************************************************
574  //**********************************************************************************************
575 };
576 //*************************************************************************************************
577 
578 
579 
580 
581 //=================================================================================================
582 //
583 // CONSTRUCTOR
584 //
585 //=================================================================================================
586 
587 //*************************************************************************************************
594 template< typename MT // Type of the dense matrix
595  , bool SO // Storage order
596  , bool SF > // Symmetry flag
597 inline DenseRow<MT,SO,SF>::DenseRow( MT& matrix, size_t index )
598  : matrix_( matrix ) // The dense matrix containing the row
599  , row_ ( index ) // The index of the row in the matrix
600 {
601  if( matrix_.rows() <= index )
602  throw std::invalid_argument( "Invalid row access index" );
603 }
604 //*************************************************************************************************
605 
606 
607 
608 
609 //=================================================================================================
610 //
611 // DATA ACCESS FUNCTIONS
612 //
613 //=================================================================================================
614 
615 //*************************************************************************************************
621 template< typename MT // Type of the dense matrix
622  , bool SO // Storage order
623  , bool SF > // Symmetry flag
625 {
626  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
627  return matrix_(row_,index);
628 }
629 //*************************************************************************************************
630 
631 
632 //*************************************************************************************************
638 template< typename MT // Type of the dense matrix
639  , bool SO // Storage order
640  , bool SF > // Symmetry flag
642  DenseRow<MT,SO,SF>::operator[]( size_t index ) const
643 {
644  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
645  return matrix_(row_,index);
646 }
647 //*************************************************************************************************
648 
649 
650 //*************************************************************************************************
657 template< typename MT // Type of the dense matrix
658  , bool SO // Storage order
659  , bool SF > // Symmetry flag
661 {
662  return matrix_.data( row_ );
663 }
664 //*************************************************************************************************
665 
666 
667 //*************************************************************************************************
674 template< typename MT // Type of the dense matrix
675  , bool SO // Storage order
676  , bool SF > // Symmetry flag
678 {
679  return matrix_.data( row_ );
680 }
681 //*************************************************************************************************
682 
683 
684 //*************************************************************************************************
691 template< typename MT // Type of the dense matrix
692  , bool SO // Storage order
693  , bool SF > // Symmetry flag
695 {
696  return matrix_.begin( row_ );
697 }
698 //*************************************************************************************************
699 
700 
701 //*************************************************************************************************
708 template< typename MT // Type of the dense matrix
709  , bool SO // Storage order
710  , bool SF > // Symmetry flag
712 {
713  return matrix_.cbegin( row_ );
714 }
715 //*************************************************************************************************
716 
717 
718 //*************************************************************************************************
725 template< typename MT // Type of the dense matrix
726  , bool SO // Storage order
727  , bool SF > // Symmetry flag
729 {
730  return matrix_.cbegin( row_ );
731 }
732 //*************************************************************************************************
733 
734 
735 //*************************************************************************************************
742 template< typename MT // Type of the dense matrix
743  , bool SO // Storage order
744  , bool SF > // Symmetry flag
746 {
747  return matrix_.end( row_ );
748 }
749 //*************************************************************************************************
750 
751 
752 //*************************************************************************************************
759 template< typename MT // Type of the dense matrix
760  , bool SO // Storage order
761  , bool SF > // Symmetry flag
763 {
764  return matrix_.cend( row_ );
765 }
766 //*************************************************************************************************
767 
768 
769 //*************************************************************************************************
776 template< typename MT // Type of the dense matrix
777  , bool SO // Storage order
778  , bool SF > // Symmetry flag
780 {
781  return matrix_.cend( row_ );
782 }
783 //*************************************************************************************************
784 
785 
786 
787 
788 //=================================================================================================
789 //
790 // ASSIGNMENT OPERATORS
791 //
792 //=================================================================================================
793 
794 //*************************************************************************************************
800 template< typename MT // Type of the dense matrix
801  , bool SO // Storage order
802  , bool SF > // Symmetry flag
804 {
805  const size_t columns( size() );
806 
807  for( size_t j=0UL; j<columns; ++j )
808  matrix_(row_,j) = rhs;
809 
810  return *this;
811 }
812 //*************************************************************************************************
813 
814 
815 //*************************************************************************************************
825 template< typename MT // Type of the dense matrix
826  , bool SO // Storage order
827  , bool SF > // Symmetry flag
829 {
830  if( &rhs == this ) return *this;
831 
832  if( size() != rhs.size() )
833  throw std::invalid_argument( "Row sizes do not match" );
834 
835  const size_t columns( size() );
836 
837  for( size_t j=0UL; j<columns; ++j )
838  matrix_(row_,j) = rhs[j];
839 
840  return *this;
841 }
842 //*************************************************************************************************
843 
844 
845 //*************************************************************************************************
855 template< typename MT // Type of the dense matrix
856  , bool SO // Storage order
857  , bool SF > // Symmetry flag
858 template< typename VT > // Type of the right-hand side vector
860 {
863 
864  if( size() != (~rhs).size() )
865  throw std::invalid_argument( "Vector sizes do not match" );
866 
867  if( (~rhs).canAlias( &matrix_ ) ) {
868  const typename VT::ResultType tmp( ~rhs );
869  smpAssign( *this, tmp );
870  }
871  else {
873  reset();
874  smpAssign( *this, ~rhs );
875  }
876 
877  return *this;
878 }
879 //*************************************************************************************************
880 
881 
882 //*************************************************************************************************
892 template< typename MT // Type of the dense matrix
893  , bool SO // Storage order
894  , bool SF > // Symmetry flag
895 template< typename VT > // Type of the right-hand side vector
897 {
900 
901  if( size() != (~rhs).size() )
902  throw std::invalid_argument( "Vector sizes do not match" );
903 
904  if( (~rhs).canAlias( &matrix_ ) ) {
905  const typename VT::ResultType tmp( ~rhs );
906  smpAddAssign( *this, tmp );
907  }
908  else {
909  smpAddAssign( *this, ~rhs );
910  }
911 
912  return *this;
913 }
914 //*************************************************************************************************
915 
916 
917 //*************************************************************************************************
927 template< typename MT // Type of the dense matrix
928  , bool SO // Storage order
929  , bool SF > // Symmetry flag
930 template< typename VT > // Type of the right-hand side vector
932 {
935 
936  if( size() != (~rhs).size() )
937  throw std::invalid_argument( "Vector sizes do not match" );
938 
939  if( (~rhs).canAlias( &matrix_ ) ) {
940  const typename VT::ResultType tmp( ~rhs );
941  smpSubAssign( *this, tmp );
942  }
943  else {
944  smpSubAssign( *this, ~rhs );
945  }
946 
947  return *this;
948 }
949 //*************************************************************************************************
950 
951 
952 //*************************************************************************************************
963 template< typename MT // Type of the dense matrix
964  , bool SO // Storage order
965  , bool SF > // Symmetry flag
966 template< typename VT > // Type of the right-hand side vector
968 {
971 
972  if( size() != (~rhs).size() )
973  throw std::invalid_argument( "Vector sizes do not match" );
974 
975  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
976  const ResultType tmp( *this * (~rhs) );
977  smpAssign( *this, tmp );
978  }
979  else {
980  smpMultAssign( *this, ~rhs );
981  }
982 
983  return *this;
984 }
985 //*************************************************************************************************
986 
987 
988 //*************************************************************************************************
995 template< typename MT // Type of the dense matrix
996  , bool SO // Storage order
997  , bool SF > // Symmetry flag
998 template< typename Other > // Data type of the right-hand side scalar
999 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,SO,SF> >::Type&
1001 {
1002  return operator=( (*this) * rhs );
1003 }
1004 //*************************************************************************************************
1005 
1006 
1007 //*************************************************************************************************
1016 template< typename MT // Type of the dense matrix
1017  , bool SO // Storage order
1018  , bool SF > // Symmetry flag
1019 template< typename Other > // Data type of the right-hand side scalar
1020 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,SO,SF> >::Type&
1022 {
1023  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1024 
1025  return operator=( (*this) / rhs );
1026 }
1027 //*************************************************************************************************
1028 
1029 
1030 
1031 
1032 //=================================================================================================
1033 //
1034 // UTILITY FUNCTIONS
1035 //
1036 //=================================================================================================
1037 
1038 //*************************************************************************************************
1043 template< typename MT // Type of the dense matrix
1044  , bool SO // Storage order
1045  , bool SF > // Symmetry flag
1046 inline size_t DenseRow<MT,SO,SF>::size() const
1047 {
1048  return matrix_.columns();
1049 }
1050 //*************************************************************************************************
1051 
1052 
1053 //*************************************************************************************************
1058 template< typename MT // Type of the dense matrix
1059  , bool SO // Storage order
1060  , bool SF > // Symmetry flag
1061 inline size_t DenseRow<MT,SO,SF>::capacity() const
1062 {
1063  return matrix_.capacity( row_ );
1064 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1076 template< typename MT // Type of the dense matrix
1077  , bool SO // Storage order
1078  , bool SF > // Symmetry flag
1079 inline size_t DenseRow<MT,SO,SF>::nonZeros() const
1080 {
1081  return matrix_.nonZeros( row_ );
1082 }
1083 //*************************************************************************************************
1084 
1085 
1086 //*************************************************************************************************
1091 template< typename MT // Type of the dense matrix
1092  , bool SO // Storage order
1093  , bool SF > // Symmetry flag
1095 {
1096  matrix_.reset( row_ );
1097 }
1098 //*************************************************************************************************
1099 
1100 
1101 //*************************************************************************************************
1107 template< typename MT // Type of the dense matrix
1108  , bool SO // Storage order
1109  , bool SF > // Symmetry flag
1110 template< typename Other > // Data type of the scalar value
1111 inline DenseRow<MT,SO,SF>& DenseRow<MT,SO,SF>::scale( const Other& scalar )
1112 {
1113  for( size_t j=0UL; j<size(); ++j ) {
1114  matrix_(row_,j) *= scalar;
1115  }
1116  return *this;
1117 }
1118 //*************************************************************************************************
1119 
1120 
1121 
1122 
1123 //=================================================================================================
1124 //
1125 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1126 //
1127 //=================================================================================================
1128 
1129 //*************************************************************************************************
1139 template< typename MT // Type of the dense matrix
1140  , bool SO // Storage order
1141  , bool SF > // Symmetry flag
1142 template< typename Other > // Data type of the foreign expression
1143 inline bool DenseRow<MT,SO,SF>::canAlias( const Other* alias ) const
1144 {
1145  return matrix_.isAliased( alias );
1146 }
1147 //*************************************************************************************************
1148 
1149 
1150 //*************************************************************************************************
1160 template< typename MT // Type of the dense matrix
1161  , bool SO // Storage order
1162  , bool SF > // Symmetry flag
1163 template< typename MT2 // Data type of the foreign dense row
1164  , bool SO2 // Storage order of the foreign dense row
1165  , bool SF2 > // Symmetry flag of the foreign dense row
1166 inline bool DenseRow<MT,SO,SF>::canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const
1167 {
1168  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1169 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1183 template< typename MT // Type of the dense matrix
1184  , bool SO // Storage order
1185  , bool SF > // Symmetry flag
1186 template< typename Other > // Data type of the foreign expression
1187 inline bool DenseRow<MT,SO,SF>::isAliased( const Other* alias ) const
1188 {
1189  return matrix_.isAliased( alias );
1190 }
1191 //*************************************************************************************************
1192 
1193 
1194 //*************************************************************************************************
1204 template< typename MT // Type of the dense matrix
1205  , bool SO // Storage order
1206  , bool SF > // Symmetry flag
1207 template< typename MT2 // Data type of the foreign dense row
1208  , bool SO2 // Storage order of the foreign dense row
1209  , bool SF2 > // Symmetry flag of the foreign dense row
1210 inline bool DenseRow<MT,SO,SF>::isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const
1211 {
1212  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1213 }
1214 //*************************************************************************************************
1215 
1216 
1217 //*************************************************************************************************
1226 template< typename MT // Type of the dense matrix
1227  , bool SO // Storage order
1228  , bool SF > // Symmetry flag
1230 {
1231  return matrix_.isAligned();
1232 }
1233 //*************************************************************************************************
1234 
1235 
1236 //*************************************************************************************************
1246 template< typename MT // Type of the dense matrix
1247  , bool SO // Storage order
1248  , bool SF > // Symmetry flag
1250 {
1251  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1252 }
1253 //*************************************************************************************************
1254 
1255 
1256 //*************************************************************************************************
1268 template< typename MT // Type of the dense matrix
1269  , bool SO // Storage order
1270  , bool SF > // Symmetry flag
1272 {
1273  return matrix_.load( row_, index );
1274 }
1275 //*************************************************************************************************
1276 
1277 
1278 //*************************************************************************************************
1290 template< typename MT // Type of the dense matrix
1291  , bool SO // Storage order
1292  , bool SF > // Symmetry flag
1294 {
1295  return matrix_.loadu( row_, index );
1296 }
1297 //*************************************************************************************************
1298 
1299 
1300 //*************************************************************************************************
1313 template< typename MT // Type of the dense matrix
1314  , bool SO // Storage order
1315  , bool SF > // Symmetry flag
1316 inline void DenseRow<MT,SO,SF>::store( size_t index, const IntrinsicType& value )
1317 {
1318  matrix_.store( row_, index, value );
1319 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1336 template< typename MT // Type of the dense matrix
1337  , bool SO // Storage order
1338  , bool SF > // Symmetry flag
1339 inline void DenseRow<MT,SO,SF>::storeu( size_t index, const IntrinsicType& value )
1340 {
1341  matrix_.storeu( row_, index, value );
1342 }
1343 //*************************************************************************************************
1344 
1345 
1346 //*************************************************************************************************
1359 template< typename MT // Type of the dense matrix
1360  , bool SO // Storage order
1361  , bool SF > // Symmetry flag
1362 inline void DenseRow<MT,SO,SF>::stream( size_t index, const IntrinsicType& value )
1363 {
1364  matrix_.stream( row_, index, value );
1365 }
1366 //*************************************************************************************************
1367 
1368 
1369 //*************************************************************************************************
1380 template< typename MT // Type of the dense matrix
1381  , bool SO // Storage order
1382  , bool SF > // Symmetry flag
1383 template< typename VT > // Type of the right-hand side dense vector
1384 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1386 {
1387  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1388 
1389  const size_t jend( (~rhs).size() & size_t(-2) );
1390  for( size_t j=0UL; j<jend; j+=2UL ) {
1391  matrix_(row_,j ) = (~rhs)[j ];
1392  matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1393  }
1394  if( jend < (~rhs).size() )
1395  matrix_(row_,jend) = (~rhs)[jend];
1396 }
1397 //*************************************************************************************************
1398 
1399 
1400 //*************************************************************************************************
1411 template< typename MT // Type of the dense matrix
1412  , bool SO // Storage order
1413  , bool SF > // Symmetry flag
1414 template< typename VT > // Type of the right-hand side dense vector
1415 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1417 {
1418  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1419 
1421 
1422  const size_t columns( size() );
1423 
1424  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1425  {
1426  for( size_t j=0UL; j<columns; j+=IT::size ) {
1427  matrix_.stream( row_, j, (~rhs).load(j) );
1428  }
1429  }
1430  else
1431  {
1432  const size_t jend( columns & size_t(-IT::size*4) );
1433  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1434 
1435  typename VT::ConstIterator it( (~rhs).begin() );
1436  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1437  matrix_.store( row_, j , it.load() ); it += IT::size;
1438  matrix_.store( row_, j+IT::size , it.load() ); it += IT::size;
1439  matrix_.store( row_, j+IT::size*2UL, it.load() ); it += IT::size;
1440  matrix_.store( row_, j+IT::size*3UL, it.load() ); it += IT::size;
1441  }
1442  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1443  matrix_.store( row_, j, it.load() );
1444  }
1445  }
1446 }
1447 //*************************************************************************************************
1448 
1449 
1450 //*************************************************************************************************
1461 template< typename MT // Type of the dense matrix
1462  , bool SO // Storage order
1463  , bool SF > // Symmetry flag
1464 template< typename VT > // Type of the right-hand side sparse vector
1466 {
1467  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1468 
1469  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1470  matrix_(row_,element->index()) = element->value();
1471 }
1472 //*************************************************************************************************
1473 
1474 
1475 //*************************************************************************************************
1486 template< typename MT // Type of the dense matrix
1487  , bool SO // Storage order
1488  , bool SF > // Symmetry flag
1489 template< typename VT > // Type of the right-hand side dense vector
1490 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1492 {
1493  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1494 
1495  const size_t jend( (~rhs).size() & size_t(-2) );
1496  for( size_t j=0UL; j<jend; j+=2UL ) {
1497  matrix_(row_,j ) += (~rhs)[j ];
1498  matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1499  }
1500  if( jend < (~rhs).size() )
1501  matrix_(row_,jend) += (~rhs)[jend];
1502 }
1503 //*************************************************************************************************
1504 
1505 
1506 //*************************************************************************************************
1517 template< typename MT // Type of the dense matrix
1518  , bool SO // Storage order
1519  , bool SF > // Symmetry flag
1520 template< typename VT > // Type of the right-hand side dense vector
1521 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1523 {
1524  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1525 
1527 
1528  const size_t columns( size() );
1529 
1530  const size_t jend( columns & size_t(-IT::size*4) );
1531  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1532 
1533  typename VT::ConstIterator it( (~rhs).begin() );
1534  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1535  matrix_.store( row_, j , matrix_.load(row_,j ) + it.load() ); it += IT::size;
1536  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) + it.load() ); it += IT::size;
1537  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) + it.load() ); it += IT::size;
1538  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) + it.load() ); it += IT::size;
1539  }
1540  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1541  matrix_.store( row_, j, matrix_.load(row_,j) + it.load() );
1542  }
1543 }
1544 //*************************************************************************************************
1545 
1546 
1547 //*************************************************************************************************
1558 template< typename MT // Type of the dense matrix
1559  , bool SO // Storage order
1560  , bool SF > // Symmetry flag
1561 template< typename VT > // Type of the right-hand side sparse vector
1563 {
1564  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1565 
1566  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1567  matrix_(row_,element->index()) += element->value();
1568 }
1569 //*************************************************************************************************
1570 
1571 
1572 //*************************************************************************************************
1583 template< typename MT // Type of the dense matrix
1584  , bool SO // Storage order
1585  , bool SF > // Symmetry flag
1586 template< typename VT > // Type of the right-hand side dense vector
1587 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1589 {
1590  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1591 
1592  const size_t jend( (~rhs).size() & size_t(-2) );
1593  for( size_t j=0UL; j<jend; j+=2UL ) {
1594  matrix_(row_,j ) -= (~rhs)[j ];
1595  matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
1596  }
1597  if( jend < (~rhs).size() )
1598  matrix_(row_,jend) -= (~rhs)[jend];
1599 }
1600 //*************************************************************************************************
1601 
1602 
1603 //*************************************************************************************************
1614 template< typename MT // Type of the dense matrix
1615  , bool SO // Storage order
1616  , bool SF > // Symmetry flag
1617 template< typename VT > // Type of the right-hand side dense vector
1618 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1620 {
1621  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1622 
1624 
1625  const size_t columns( size() );
1626 
1627  const size_t jend( columns & size_t(-IT::size*4) );
1628  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1629 
1630  typename VT::ConstIterator it( (~rhs).begin() );
1631  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1632  matrix_.store( row_, j , matrix_.load(row_,j ) - it.load() ); it += IT::size;
1633  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) - it.load() ); it += IT::size;
1634  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) - it.load() ); it += IT::size;
1635  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) - it.load() ); it += IT::size;
1636  }
1637  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1638  matrix_.store( row_, j, matrix_.load(row_,j) - it.load() );
1639  }
1640 }
1641 //*************************************************************************************************
1642 
1643 
1644 //*************************************************************************************************
1655 template< typename MT // Type of the dense matrix
1656  , bool SO // Storage order
1657  , bool SF > // Symmetry flag
1658 template< typename VT > // Type of the right-hand side sparse vector
1660 {
1661  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1662 
1663  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1664  matrix_(row_,element->index()) -= element->value();
1665 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1680 template< typename MT // Type of the dense matrix
1681  , bool SO // Storage order
1682  , bool SF > // Symmetry flag
1683 template< typename VT > // Type of the right-hand side dense vector
1684 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1686 {
1687  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1688 
1689  const size_t jend( (~rhs).size() & size_t(-2) );
1690  for( size_t j=0UL; j<jend; j+=2UL ) {
1691  matrix_(row_,j ) *= (~rhs)[j ];
1692  matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
1693  }
1694  if( jend < (~rhs).size() )
1695  matrix_(row_,jend) *= (~rhs)[jend];
1696 }
1697 //*************************************************************************************************
1698 
1699 
1700 //*************************************************************************************************
1711 template< typename MT // Type of the dense matrix
1712  , bool SO // Storage order
1713  , bool SF > // Symmetry flag
1714 template< typename VT > // Type of the right-hand side dense vector
1715 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1717 {
1718  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1719 
1721 
1722  const size_t columns( size() );
1723 
1724  const size_t jend( columns & size_t(-IT::size*4) );
1725  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1726 
1727  typename VT::ConstIterator it( (~rhs).begin() );
1728  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1729  matrix_.store( row_, j , matrix_.load(row_,j ) * it.load() ); it += IT::size;
1730  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) * it.load() ); it += IT::size;
1731  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) * it.load() ); it += IT::size;
1732  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) * it.load() ); it += IT::size;
1733  }
1734  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1735  matrix_.store( row_, j, matrix_.load(row_,j) * it.load() );
1736  }
1737 }
1738 //*************************************************************************************************
1739 
1740 
1741 //*************************************************************************************************
1752 template< typename MT // Type of the dense matrix
1753  , bool SO // Storage order
1754  , bool SF > // Symmetry flag
1755 template< typename VT > // Type of the right-hand side sparse vector
1757 {
1758  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1759 
1760  const ResultType tmp( serial( *this ) );
1761 
1762  reset();
1763 
1764  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1765  matrix_(row_,element->index()) = tmp[element->index()] * element->value();
1766 }
1767 //*************************************************************************************************
1768 
1769 
1770 
1771 
1772 
1773 
1774 
1775 
1776 //=================================================================================================
1777 //
1778 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR MATRICES
1779 //
1780 //=================================================================================================
1781 
1782 //*************************************************************************************************
1790 template< typename MT > // Type of the dense matrix
1791 class DenseRow<MT,false,false> : public DenseVector< DenseRow<MT,false,false>, true >
1792  , private Row
1793 {
1794  private:
1795  //**Type definitions****************************************************************************
1797  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
1798  //**********************************************************************************************
1799 
1800  //**********************************************************************************************
1802 
1808  enum { useConst = IsConst<MT>::value };
1809  //**********************************************************************************************
1810 
1811  public:
1812  //**Type definitions****************************************************************************
1813  typedef DenseRow<MT,false,false> This;
1814  typedef typename RowTrait<MT>::Type ResultType;
1815  typedef typename ResultType::TransposeType TransposeType;
1816  typedef typename MT::ElementType ElementType;
1817  typedef typename MT::ReturnType ReturnType;
1818  typedef const DenseRow& CompositeType;
1819 
1821  typedef typename MT::ConstReference ConstReference;
1822 
1824  typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference;
1825  //**********************************************************************************************
1826 
1827  //**RowIterator class definition****************************************************************
1830  template< typename MatrixType > // Type of the dense matrix
1831  class RowIterator
1832  {
1833  private:
1834  //*******************************************************************************************
1836 
1841  enum { returnConst = IsConst<MatrixType>::value };
1842  //*******************************************************************************************
1843 
1844  public:
1845  //**Type definitions*************************************************************************
1847  typedef typename SelectType< returnConst
1848  , typename MatrixType::ConstReference
1849  , typename MatrixType::Reference >::Type Reference;
1850 
1851  typedef std::random_access_iterator_tag IteratorCategory;
1852  typedef RemoveReference<Reference> ValueType;
1853  typedef ValueType* PointerType;
1854  typedef Reference ReferenceType;
1855  typedef ptrdiff_t DifferenceType;
1856 
1857  // STL iterator requirements
1858  typedef IteratorCategory iterator_category;
1859  typedef ValueType value_type;
1860  typedef PointerType pointer;
1861  typedef ReferenceType reference;
1862  typedef DifferenceType difference_type;
1863  //*******************************************************************************************
1864 
1865  //**Constructor******************************************************************************
1868  inline RowIterator()
1869  : matrix_( NULL ) // The dense matrix containing the row.
1870  , row_ ( 0UL ) // The current row index.
1871  , column_( 0UL ) // The current column index.
1872  {}
1873  //*******************************************************************************************
1874 
1875  //**Constructor******************************************************************************
1882  inline RowIterator( MatrixType& matrix, size_t row, size_t column )
1883  : matrix_( &matrix ) // The dense matrix containing the row.
1884  , row_ ( row ) // The current row index.
1885  , column_( column ) // The current column index.
1886  {}
1887  //*******************************************************************************************
1888 
1889  //**Constructor******************************************************************************
1894  template< typename MatrixType2 >
1895  inline RowIterator( const RowIterator<MatrixType2>& it )
1896  : matrix_( it.matrix_ ) // The dense matrix containing the row.
1897  , row_ ( it.row_ ) // The current row index.
1898  , column_( it.column_ ) // The current column index.
1899  {}
1900  //*******************************************************************************************
1901 
1902  //**Addition assignment operator*************************************************************
1908  inline RowIterator& operator+=( size_t inc ) {
1909  column_ += inc;
1910  return *this;
1911  }
1912  //*******************************************************************************************
1913 
1914  //**Subtraction assignment operator**********************************************************
1920  inline RowIterator& operator-=( size_t dec ) {
1921  column_ -= dec;
1922  return *this;
1923  }
1924  //*******************************************************************************************
1925 
1926  //**Prefix increment operator****************************************************************
1931  inline RowIterator& operator++() {
1932  ++column_;
1933  return *this;
1934  }
1935  //*******************************************************************************************
1936 
1937  //**Postfix increment operator***************************************************************
1942  inline const RowIterator operator++( int ) {
1943  const RowIterator tmp( *this );
1944  ++(*this);
1945  return tmp;
1946  }
1947  //*******************************************************************************************
1948 
1949  //**Prefix decrement operator****************************************************************
1954  inline RowIterator& operator--() {
1955  --column_;
1956  return *this;
1957  }
1958  //*******************************************************************************************
1959 
1960  //**Postfix decrement operator***************************************************************
1965  inline const RowIterator operator--( int ) {
1966  const RowIterator tmp( *this );
1967  --(*this);
1968  return tmp;
1969  }
1970  //*******************************************************************************************
1971 
1972  //**Subscript operator***********************************************************************
1978  inline ReferenceType operator[]( size_t index ) const {
1979  return (*matrix_)(row_,column_+index);
1980  }
1981  //*******************************************************************************************
1982 
1983  //**Element access operator******************************************************************
1988  inline ReferenceType operator*() const {
1989  return (*matrix_)(row_,column_);
1990  }
1991  //*******************************************************************************************
1992 
1993  //**Element access operator******************************************************************
1998  inline PointerType operator->() const {
1999  return &(*matrix_)(row_,column_);
2000  }
2001  //*******************************************************************************************
2002 
2003  //**Equality operator************************************************************************
2009  template< typename MatrixType2 >
2010  inline bool operator==( const RowIterator<MatrixType2>& rhs ) const {
2011  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2012  }
2013  //*******************************************************************************************
2014 
2015  //**Inequality operator**********************************************************************
2021  template< typename MatrixType2 >
2022  inline bool operator!=( const RowIterator<MatrixType2>& rhs ) const {
2023  return !( *this == rhs );
2024  }
2025  //*******************************************************************************************
2026 
2027  //**Less-than operator***********************************************************************
2033  template< typename MatrixType2 >
2034  inline bool operator<( const RowIterator<MatrixType2>& rhs ) const {
2035  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ < rhs.column_ );
2036  }
2037  //*******************************************************************************************
2038 
2039  //**Greater-than operator********************************************************************
2045  template< typename MatrixType2 >
2046  inline bool operator>( const RowIterator<MatrixType2>& rhs ) const {
2047  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ > rhs.column_ );
2048  }
2049  //*******************************************************************************************
2050 
2051  //**Less-or-equal-than operator**************************************************************
2057  template< typename MatrixType2 >
2058  inline bool operator<=( const RowIterator<MatrixType2>& rhs ) const {
2059  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
2060  }
2061  //*******************************************************************************************
2062 
2063  //**Greater-or-equal-than operator***********************************************************
2069  template< typename MatrixType2 >
2070  inline bool operator>=( const RowIterator<MatrixType2>& rhs ) const {
2071  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
2072  }
2073  //*******************************************************************************************
2074 
2075  //**Subtraction operator*********************************************************************
2081  inline DifferenceType operator-( const RowIterator& rhs ) const {
2082  return column_ - rhs.column_;
2083  }
2084  //*******************************************************************************************
2085 
2086  //**Addition operator************************************************************************
2093  friend inline const RowIterator operator+( const RowIterator& it, size_t inc ) {
2094  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2095  }
2096  //*******************************************************************************************
2097 
2098  //**Addition operator************************************************************************
2105  friend inline const RowIterator operator+( size_t inc, const RowIterator& it ) {
2106  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2107  }
2108  //*******************************************************************************************
2109 
2110  //**Subtraction operator*********************************************************************
2117  friend inline const RowIterator operator-( const RowIterator& it, size_t dec ) {
2118  return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2119  }
2120  //*******************************************************************************************
2121 
2122  private:
2123  //**Member variables*************************************************************************
2124  MatrixType* matrix_;
2125  size_t row_;
2126  size_t column_;
2127  //*******************************************************************************************
2128 
2129  //**Friend declarations**********************************************************************
2130  template< typename MatrixType2 > friend class RowIterator;
2131  //*******************************************************************************************
2132  };
2133  //**********************************************************************************************
2134 
2135  //**Type definitions****************************************************************************
2137  typedef RowIterator<const MT> ConstIterator;
2138 
2140  typedef typename SelectType< useConst, ConstIterator, RowIterator<MT> >::Type Iterator;
2141  //**********************************************************************************************
2142 
2143  //**Compilation flags***************************************************************************
2145  enum { vectorizable = 0 };
2146 
2148  enum { smpAssignable = MT::smpAssignable };
2149  //**********************************************************************************************
2150 
2151  //**Constructors********************************************************************************
2154  explicit inline DenseRow( MT& matrix, size_t index );
2155  // No explicitly declared copy constructor.
2157  //**********************************************************************************************
2158 
2159  //**Destructor**********************************************************************************
2160  // No explicitly declared destructor.
2161  //**********************************************************************************************
2162 
2163  //**Data access functions***********************************************************************
2166  inline Reference operator[]( size_t index );
2167  inline ConstReference operator[]( size_t index ) const;
2168  inline Iterator begin ();
2169  inline ConstIterator begin () const;
2170  inline ConstIterator cbegin() const;
2171  inline Iterator end ();
2172  inline ConstIterator end () const;
2173  inline ConstIterator cend () const;
2175  //**********************************************************************************************
2176 
2177  //**Assignment operators************************************************************************
2180  inline DenseRow& operator= ( const ElementType& rhs );
2181  inline DenseRow& operator= ( const DenseRow& rhs );
2182  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
2183  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
2184  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
2185  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
2186 
2187  template< typename Other >
2188  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
2189  operator*=( Other rhs );
2190 
2191  template< typename Other >
2192  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
2193  operator/=( Other rhs );
2195  //**********************************************************************************************
2196 
2197  //**Utility functions***************************************************************************
2200  inline size_t size() const;
2201  inline size_t capacity() const;
2202  inline size_t nonZeros() const;
2203  inline void reset();
2204  template< typename Other > inline DenseRow& scale( const Other& scalar );
2206  //**********************************************************************************************
2207 
2208  public:
2209  //**Expression template evaluation functions****************************************************
2212  template< typename Other >
2213  inline bool canAlias( const Other* alias ) const;
2214 
2215  template< typename MT2, bool SO2, bool SF2 >
2216  inline bool canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const;
2217 
2218  template< typename Other >
2219  inline bool isAliased( const Other* alias ) const;
2220 
2221  template< typename MT2, bool SO2, bool SF2 >
2222  inline bool isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const;
2223 
2224  inline bool isAligned () const;
2225  inline bool canSMPAssign() const;
2226 
2227  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2228  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2229  template< typename VT > inline void addAssign ( const DenseVector <VT,true>& rhs );
2230  template< typename VT > inline void addAssign ( const SparseVector<VT,true>& rhs );
2231  template< typename VT > inline void subAssign ( const DenseVector <VT,true>& rhs );
2232  template< typename VT > inline void subAssign ( const SparseVector<VT,true>& rhs );
2233  template< typename VT > inline void multAssign( const DenseVector <VT,true>& rhs );
2234  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
2236  //**********************************************************************************************
2237 
2238  private:
2239  //**Member variables****************************************************************************
2242  Operand matrix_;
2243  const size_t row_;
2244 
2245  //**********************************************************************************************
2246 
2247  //**Friend declarations*************************************************************************
2248  template< typename MT2, bool SO2, bool SF2 > friend class DenseRow;
2249 
2250  template< typename MT2, bool SO2, bool SF2 >
2251  friend bool isSame( const DenseRow<MT2,SO2,SF2>& a, const DenseRow<MT2,SO2,SF2>& b );
2252  //**********************************************************************************************
2253 
2254  //**Compile time checks*************************************************************************
2260  //**********************************************************************************************
2261 };
2263 //*************************************************************************************************
2264 
2265 
2266 
2267 
2268 //=================================================================================================
2269 //
2270 // CONSTRUCTOR
2271 //
2272 //=================================================================================================
2273 
2274 //*************************************************************************************************
2282 template< typename MT > // Type of the dense matrix
2283 inline DenseRow<MT,false,false>::DenseRow( MT& matrix, size_t index )
2284  : matrix_( matrix ) // The dense matrix containing the row
2285  , row_ ( index ) // The index of the row in the matrix
2286 {
2287  if( matrix_.rows() <= index )
2288  throw std::invalid_argument( "Invalid row access index" );
2289 }
2291 //*************************************************************************************************
2292 
2293 
2294 
2295 
2296 //=================================================================================================
2297 //
2298 // DATA ACCESS FUNCTIONS
2299 //
2300 //=================================================================================================
2301 
2302 //*************************************************************************************************
2309 template< typename MT > // Type of the dense matrix
2311  DenseRow<MT,false,false>::operator[]( size_t index )
2312 {
2313  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2314  return matrix_(row_,index);
2315 }
2317 //*************************************************************************************************
2318 
2319 
2320 //*************************************************************************************************
2327 template< typename MT > // Type of the dense matrix
2329  DenseRow<MT,false,false>::operator[]( size_t index ) const
2330 {
2331  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2332  return matrix_(row_,index);
2333 }
2335 //*************************************************************************************************
2336 
2337 
2338 //*************************************************************************************************
2346 template< typename MT > // Type of the dense matrix
2348 {
2349  return Iterator( matrix_, row_, 0UL );
2350 }
2352 //*************************************************************************************************
2353 
2354 
2355 //*************************************************************************************************
2363 template< typename MT > // Type of the dense matrix
2365 {
2366  return ConstIterator( matrix_, row_, 0UL );
2367 }
2369 //*************************************************************************************************
2370 
2371 
2372 //*************************************************************************************************
2380 template< typename MT > // Type of the dense matrix
2382 {
2383  return ConstIterator( matrix_, row_, 0UL );
2384 }
2386 //*************************************************************************************************
2387 
2388 
2389 //*************************************************************************************************
2397 template< typename MT > // Type of the dense matrix
2399 {
2400  return Iterator( matrix_, row_, size() );
2401 }
2403 //*************************************************************************************************
2404 
2405 
2406 //*************************************************************************************************
2414 template< typename MT > // Type of the dense matrix
2416 {
2417  return ConstIterator( matrix_, row_, size() );
2418 }
2420 //*************************************************************************************************
2421 
2422 
2423 //*************************************************************************************************
2431 template< typename MT > // Type of the dense matrix
2433 {
2434  return ConstIterator( matrix_, row_, size() );
2435 }
2437 //*************************************************************************************************
2438 
2439 
2440 
2441 
2442 //=================================================================================================
2443 //
2444 // ASSIGNMENT OPERATORS
2445 //
2446 //=================================================================================================
2447 
2448 //*************************************************************************************************
2455 template< typename MT > // Type of the dense matrix
2456 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator=( const ElementType& rhs )
2457 {
2458  const size_t columns( size() );
2459 
2460  for( size_t j=0UL; j<columns; ++j )
2461  matrix_(row_,j) = rhs;
2462 
2463  return *this;
2464 }
2466 //*************************************************************************************************
2467 
2468 
2469 //*************************************************************************************************
2480 template< typename MT > // Type of the dense matrix
2481 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator=( const DenseRow& rhs )
2482 {
2483  if( &rhs == this ) return *this;
2484 
2485  if( size() != rhs.size() )
2486  throw std::invalid_argument( "Row sizes do not match" );
2487 
2488  const size_t columns( size() );
2489 
2490  for( size_t j=0UL; j<columns; ++j )
2491  matrix_(row_,j) = rhs[j];
2492 
2493  return *this;
2494 }
2496 //*************************************************************************************************
2497 
2498 
2499 //*************************************************************************************************
2510 template< typename MT > // Type of the dense matrix
2511 template< typename VT > // Type of the right-hand side vector
2512 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator=( const Vector<VT,true>& rhs )
2513 {
2517 
2518  if( size() != (~rhs).size() )
2519  throw std::invalid_argument( "Vector sizes do not match" );
2520 
2521  if( (~rhs).canAlias( &matrix_ ) ) {
2522  const ResultType tmp( ~rhs );
2523  smpAssign( *this, tmp );
2524  }
2525  else {
2526  if( IsSparseVector<VT>::value )
2527  reset();
2528  smpAssign( *this, ~rhs );
2529  }
2530 
2531  return *this;
2532 }
2534 //*************************************************************************************************
2535 
2536 
2537 //*************************************************************************************************
2548 template< typename MT > // Type of the dense matrix
2549 template< typename VT > // Type of the right-hand side vector
2550 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator+=( const Vector<VT,true>& rhs )
2551 {
2554 
2555  if( size() != (~rhs).size() )
2556  throw std::invalid_argument( "Vector sizes do not match" );
2557 
2558  if( (~rhs).canAlias( &matrix_ ) ) {
2559  const typename VT::ResultType tmp( ~rhs );
2560  smpAddAssign( *this, tmp );
2561  }
2562  else {
2563  smpAddAssign( *this, ~rhs );
2564  }
2565 
2566  return *this;
2567 }
2569 //*************************************************************************************************
2570 
2571 
2572 //*************************************************************************************************
2583 template< typename MT > // Type of the dense matrix
2584 template< typename VT > // Type of the right-hand side vector
2585 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator-=( const Vector<VT,true>& rhs )
2586 {
2589 
2590  if( size() != (~rhs).size() )
2591  throw std::invalid_argument( "Vector sizes do not match" );
2592 
2593  if( (~rhs).canAlias( &matrix_ ) ) {
2594  const typename VT::ResultType tmp( ~rhs );
2595  smpSubAssign( *this, tmp );
2596  }
2597  else {
2598  smpSubAssign( *this, ~rhs );
2599  }
2600 
2601  return *this;
2602 }
2604 //*************************************************************************************************
2605 
2606 
2607 //*************************************************************************************************
2619 template< typename MT > // Type of the dense matrix
2620 template< typename VT > // Type of the right-hand side vector
2621 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator*=( const Vector<VT,true>& rhs )
2622 {
2625 
2626  if( size() != (~rhs).size() )
2627  throw std::invalid_argument( "Vector sizes do not match" );
2628 
2629  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
2630  const ResultType tmp( *this * (~rhs) );
2631  smpAssign( *this, tmp );
2632  }
2633  else {
2634  smpMultAssign( *this, ~rhs );
2635  }
2636 
2637  return *this;
2638 }
2640 //*************************************************************************************************
2641 
2642 
2643 //*************************************************************************************************
2651 template< typename MT > // Type of the dense matrix
2652 template< typename Other > // Data type of the right-hand side scalar
2653 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,false> >::Type&
2654  DenseRow<MT,false,false>::operator*=( Other rhs )
2655 {
2656  for( size_t j=0UL; j<size(); ++j )
2657  matrix_(row_,j) *= rhs;
2658  return *this;
2659 }
2661 //*************************************************************************************************
2662 
2663 
2664 //*************************************************************************************************
2674 template< typename MT > // Type of the dense matrix
2675 template< typename Other > // Data type of the right-hand side scalar
2676 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,false> >::Type&
2677  DenseRow<MT,false,false>::operator/=( Other rhs )
2678 {
2679  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2680 
2681  typedef typename DivTrait<ElementType,Other>::Type DT;
2682  typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2683 
2684  // Depending on the two involved data types, an integer division is applied or a
2685  // floating point division is selected.
2686  if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2687  const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2688  for( size_t j=0UL; j<size(); ++j )
2689  matrix_(row_,j) *= tmp;
2690  }
2691  else {
2692  for( size_t j=0UL; j<size(); ++j )
2693  matrix_(row_,j) /= rhs;
2694  }
2695 
2696  return *this;
2697 }
2699 //*************************************************************************************************
2700 
2701 
2702 
2703 
2704 //=================================================================================================
2705 //
2706 // UTILITY FUNCTIONS
2707 //
2708 //=================================================================================================
2709 
2710 //*************************************************************************************************
2716 template< typename MT > // Type of the dense matrix
2717 inline size_t DenseRow<MT,false,false>::size() const
2718 {
2719  return matrix_.columns();
2720 }
2722 //*************************************************************************************************
2723 
2724 
2725 //*************************************************************************************************
2731 template< typename MT > // Type of the dense matrix
2732 inline size_t DenseRow<MT,false,false>::capacity() const
2733 {
2734  return matrix_.columns();
2735 }
2737 //*************************************************************************************************
2738 
2739 
2740 //*************************************************************************************************
2749 template< typename MT > // Type of the dense matrix
2750 inline size_t DenseRow<MT,false,false>::nonZeros() const
2751 {
2752  const size_t columns( size() );
2753  size_t nonzeros( 0UL );
2754 
2755  for( size_t j=0UL; j<columns; ++j )
2756  if( !isDefault( matrix_(row_,j) ) )
2757  ++nonzeros;
2758 
2759  return nonzeros;
2760 }
2762 //*************************************************************************************************
2763 
2764 
2765 //*************************************************************************************************
2771 template< typename MT > // Type of the dense matrix
2772 inline void DenseRow<MT,false,false>::reset()
2773 {
2774  using blaze::clear;
2775  const size_t columns( size() );
2776  for( size_t j=0UL; j<columns; ++j )
2777  clear( matrix_(row_,j) );
2778 }
2780 //*************************************************************************************************
2781 
2782 
2783 //*************************************************************************************************
2790 template< typename MT > // Type of the dense matrix
2791 template< typename Other > // Data type of the scalar value
2792 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::scale( const Other& scalar )
2793 {
2794  for( size_t j=0UL; j<size(); ++j ) {
2795  matrix_(row_,j) *= scalar;
2796  }
2797  return *this;
2798 }
2800 //*************************************************************************************************
2801 
2802 
2803 
2804 
2805 //=================================================================================================
2806 //
2807 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2808 //
2809 //=================================================================================================
2810 
2811 //*************************************************************************************************
2822 template< typename MT > // Type of the dense matrix
2823 template< typename Other > // Data type of the foreign expression
2824 inline bool DenseRow<MT,false,false>::canAlias( const Other* alias ) const
2825 {
2826  return matrix_.isAliased( alias );
2827 }
2829 //*************************************************************************************************
2830 
2831 
2832 //*************************************************************************************************
2843 template< typename MT > // Type of the dense matrix
2844 template< typename MT2 // Data type of the foreign dense row
2845  , bool SO2 // Storage order of the foreign dense row
2846  , bool SF2 > // Symmetry flag of the foreign dense row
2847 inline bool DenseRow<MT,false,false>::canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const
2848 {
2849  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
2850 }
2852 //*************************************************************************************************
2853 
2854 
2855 //*************************************************************************************************
2866 template< typename MT > // Type of the dense matrix
2867 template< typename Other > // Data type of the foreign expression
2868 inline bool DenseRow<MT,false,false>::isAliased( const Other* alias ) const
2869 {
2870  return matrix_.isAliased( alias );
2871 }
2873 //*************************************************************************************************
2874 
2875 
2876 //*************************************************************************************************
2887 template< typename MT > // Type of the dense matrix
2888 template< typename MT2 // Data type of the foreign dense row
2889  , bool SO2 // Storage order of the foreign dense row
2890  , bool SF2 > // Symmetry flag of the foreign dense row
2891 inline bool DenseRow<MT,false,false>::isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const
2892 {
2893  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
2894 }
2896 //*************************************************************************************************
2897 
2898 
2899 //*************************************************************************************************
2909 template< typename MT > // Type of the dense matrix
2910 inline bool DenseRow<MT,false,false>::isAligned() const
2911 {
2912  return false;
2913 }
2915 //*************************************************************************************************
2916 
2917 
2918 //*************************************************************************************************
2929 template< typename MT > // Type of the dense matrix
2930 inline bool DenseRow<MT,false,false>::canSMPAssign() const
2931 {
2932  return ( size() > SMP_DVECASSIGN_THRESHOLD );
2933 }
2935 //*************************************************************************************************
2936 
2937 
2938 //*************************************************************************************************
2950 template< typename MT > // Type of the dense matrix
2951 template< typename VT > // Type of the right-hand side dense vector
2952 inline void DenseRow<MT,false,false>::assign( const DenseVector<VT,true>& rhs )
2953 {
2954  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2955 
2956  const size_t jend( (~rhs).size() & size_t(-2) );
2957  for( size_t j=0UL; j<jend; j+=2UL ) {
2958  matrix_(row_,j ) = (~rhs)[j ];
2959  matrix_(row_,j+1UL) = (~rhs)[j+1UL];
2960  }
2961  if( jend < (~rhs).size() )
2962  matrix_(row_,jend) = (~rhs)[jend];
2963 }
2965 //*************************************************************************************************
2966 
2967 
2968 //*************************************************************************************************
2980 template< typename MT > // Type of the dense matrix
2981 template< typename VT > // Type of the right-hand side sparse vector
2982 inline void DenseRow<MT,false,false>::assign( const SparseVector<VT,true>& rhs )
2983 {
2984  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2985 
2986  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2987  matrix_(row_,element->index()) = element->value();
2988 }
2990 //*************************************************************************************************
2991 
2992 
2993 //*************************************************************************************************
3005 template< typename MT > // Type of the dense matrix
3006 template< typename VT > // Type of the right-hand side dense vector
3007 inline void DenseRow<MT,false,false>::addAssign( const DenseVector<VT,true>& rhs )
3008 {
3009  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3010 
3011  const size_t jend( (~rhs).size() & size_t(-2) );
3012  for( size_t j=0UL; j<jend; j+=2UL ) {
3013  matrix_(row_,j ) += (~rhs)[j ];
3014  matrix_(row_,j+1UL) += (~rhs)[j+1UL];
3015  }
3016  if( jend < (~rhs).size() )
3017  matrix_(row_,jend) += (~rhs)[jend];
3018 }
3020 //*************************************************************************************************
3021 
3022 
3023 //*************************************************************************************************
3035 template< typename MT > // Type of the dense matrix
3036 template< typename VT > // Type of the right-hand side sparse vector
3037 inline void DenseRow<MT,false,false>::addAssign( const SparseVector<VT,true>& rhs )
3038 {
3039  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3040 
3041  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3042  matrix_(row_,element->index()) += element->value();
3043 }
3045 //*************************************************************************************************
3046 
3047 
3048 //*************************************************************************************************
3060 template< typename MT > // Type of the dense matrix
3061 template< typename VT > // Type of the right-hand side dense vector
3062 inline void DenseRow<MT,false,false>::subAssign( const DenseVector<VT,true>& rhs )
3063 {
3064  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3065 
3066  const size_t jend( (~rhs).size() & size_t(-2) );
3067  for( size_t j=0UL; j<jend; j+=2UL ) {
3068  matrix_(row_,j ) -= (~rhs)[j ];
3069  matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
3070  }
3071  if( jend < (~rhs).size() )
3072  matrix_(row_,jend) -= (~rhs)[jend];
3073 }
3075 //*************************************************************************************************
3076 
3077 
3078 //*************************************************************************************************
3090 template< typename MT > // Type of the dense matrix
3091 template< typename VT > // Type of the right-hand side sparse vector
3092 inline void DenseRow<MT,false,false>::subAssign( const SparseVector<VT,true>& rhs )
3093 {
3094  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3095 
3096  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3097  matrix_(row_,element->index()) -= element->value();
3098 }
3100 //*************************************************************************************************
3101 
3102 
3103 //*************************************************************************************************
3115 template< typename MT > // Type of the dense matrix
3116 template< typename VT > // Type of the right-hand side dense vector
3117 inline void DenseRow<MT,false,false>::multAssign( const DenseVector<VT,true>& rhs )
3118 {
3119  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3120 
3121  const size_t jend( (~rhs).size() & size_t(-2) );
3122  for( size_t j=0UL; j<jend; j+=2UL ) {
3123  matrix_(row_,j ) *= (~rhs)[j ];
3124  matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
3125  }
3126  if( jend < (~rhs).size() )
3127  matrix_(row_,jend) *= (~rhs)[jend];
3128 }
3130 //*************************************************************************************************
3131 
3132 
3133 //*************************************************************************************************
3145 template< typename MT > // Type of the dense matrix
3146 template< typename VT > // Type of the right-hand side sparse vector
3147 inline void DenseRow<MT,false,false>::multAssign( const SparseVector<VT,true>& rhs )
3148 {
3149  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3150 
3151  const ResultType tmp( serial( *this ) );
3152 
3153  reset();
3154 
3155  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3156  matrix_(row_,element->index()) = tmp[element->index()] * element->value();
3157 }
3159 //*************************************************************************************************
3160 
3161 
3162 
3163 
3164 
3165 
3166 
3167 
3168 //=================================================================================================
3169 //
3170 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR MATRICES
3171 //
3172 //=================================================================================================
3173 
3174 //*************************************************************************************************
3182 template< typename MT > // Type of the dense matrix
3183 class DenseRow<MT,false,true> : public DenseVector< DenseRow<MT,false,true>, true >
3184  , private Row
3185 {
3186  private:
3187  //**Type definitions****************************************************************************
3189  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
3190 
3192  typedef IntrinsicTrait<typename MT::ElementType> IT;
3193  //**********************************************************************************************
3194 
3195  //**********************************************************************************************
3197 
3203  enum { useConst = IsConst<MT>::value };
3204  //**********************************************************************************************
3205 
3206  public:
3207  //**Type definitions****************************************************************************
3208  typedef DenseRow<MT,false,true> This;
3209  typedef typename RowTrait<MT>::Type ResultType;
3210  typedef typename ResultType::TransposeType TransposeType;
3211  typedef typename MT::ElementType ElementType;
3212  typedef typename IT::Type IntrinsicType;
3213  typedef typename MT::ReturnType ReturnType;
3214  typedef const DenseRow& CompositeType;
3215 
3217  typedef typename MT::ConstReference ConstReference;
3218 
3220  typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference;
3221 
3223  typedef const ElementType* ConstPointer;
3224 
3226  typedef typename SelectType< useConst, ConstPointer, ElementType* >::Type Pointer;
3227 
3229  typedef typename MT::ConstIterator ConstIterator;
3230 
3232  typedef typename SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator;
3233  //**********************************************************************************************
3234 
3235  //**Compilation flags***************************************************************************
3237  enum { vectorizable = MT::vectorizable };
3238 
3240  enum { smpAssignable = MT::smpAssignable };
3241  //**********************************************************************************************
3242 
3243  //**Constructors********************************************************************************
3246  explicit inline DenseRow( MT& matrix, size_t index );
3247  // No explicitly declared copy constructor.
3249  //**********************************************************************************************
3250 
3251  //**Destructor**********************************************************************************
3252  // No explicitly declared destructor.
3253  //**********************************************************************************************
3254 
3255  //**Data access functions***********************************************************************
3258  inline Reference operator[]( size_t index );
3259  inline ConstReference operator[]( size_t index ) const;
3260  inline Pointer data ();
3261  inline ConstPointer data () const;
3262  inline Iterator begin ();
3263  inline ConstIterator begin () const;
3264  inline ConstIterator cbegin() const;
3265  inline Iterator end ();
3266  inline ConstIterator end () const;
3267  inline ConstIterator cend () const;
3269  //**********************************************************************************************
3270 
3271  //**Assignment operators************************************************************************
3274  inline DenseRow& operator= ( const ElementType& rhs );
3275  inline DenseRow& operator= ( const DenseRow& rhs );
3276  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
3277  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
3278  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
3279  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
3280 
3281  template< typename Other >
3282  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
3283  operator*=( Other rhs );
3284 
3285  template< typename Other >
3286  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
3287  operator/=( Other rhs );
3289  //**********************************************************************************************
3290 
3291  //**Utility functions***************************************************************************
3294  inline size_t size() const;
3295  inline size_t capacity() const;
3296  inline size_t nonZeros() const;
3297  inline void reset();
3298  template< typename Other > inline DenseRow& scale( const Other& scalar );
3300  //**********************************************************************************************
3301 
3302  private:
3303  //**********************************************************************************************
3305  template< typename VT >
3306  struct VectorizedAssign {
3307  enum { value = vectorizable && VT::vectorizable &&
3308  IsSame<ElementType,typename VT::ElementType>::value };
3309  };
3310  //**********************************************************************************************
3311 
3312  //**********************************************************************************************
3314  template< typename VT >
3315  struct VectorizedAddAssign {
3316  enum { value = vectorizable && VT::vectorizable &&
3317  IsSame<ElementType,typename VT::ElementType>::value &&
3318  IntrinsicTrait<ElementType>::addition };
3319  };
3320  //**********************************************************************************************
3321 
3322  //**********************************************************************************************
3324  template< typename VT >
3325  struct VectorizedSubAssign {
3326  enum { value = vectorizable && VT::vectorizable &&
3327  IsSame<ElementType,typename VT::ElementType>::value &&
3328  IntrinsicTrait<ElementType>::subtraction };
3329  };
3330  //**********************************************************************************************
3331 
3332  //**********************************************************************************************
3334  template< typename VT >
3335  struct VectorizedMultAssign {
3336  enum { value = vectorizable && VT::vectorizable &&
3337  IsSame<ElementType,typename VT::ElementType>::value &&
3338  IntrinsicTrait<ElementType>::multiplication };
3339  };
3340  //**********************************************************************************************
3341 
3342  public:
3343  //**Expression template evaluation functions****************************************************
3346  template< typename Other >
3347  inline bool canAlias( const Other* alias ) const;
3348 
3349  template< typename MT2, bool SO2, bool SF2 >
3350  inline bool canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const;
3351 
3352  template< typename Other >
3353  inline bool isAliased( const Other* alias ) const;
3354 
3355  template< typename MT2, bool SO2, bool SF2 >
3356  inline bool isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const;
3357 
3358  inline bool isAligned () const;
3359  inline bool canSMPAssign() const;
3360 
3361  inline IntrinsicType load ( size_t index ) const;
3362  inline IntrinsicType loadu ( size_t index ) const;
3363  inline void store ( size_t index, const IntrinsicType& value );
3364  inline void storeu( size_t index, const IntrinsicType& value );
3365  inline void stream( size_t index, const IntrinsicType& value );
3366 
3367  template< typename VT >
3368  inline typename DisableIf< VectorizedAssign<VT> >::Type
3369  assign( const DenseVector<VT,true>& rhs );
3370 
3371  template< typename VT >
3372  inline typename EnableIf< VectorizedAssign<VT> >::Type
3373  assign( const DenseVector<VT,true>& rhs );
3374 
3375  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
3376 
3377  template< typename VT >
3378  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
3379  addAssign( const DenseVector<VT,true>& rhs );
3380 
3381  template< typename VT >
3382  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
3383  addAssign( const DenseVector<VT,true>& rhs );
3384 
3385  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
3386 
3387  template< typename VT >
3388  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
3389  subAssign( const DenseVector<VT,true>& rhs );
3390 
3391  template< typename VT >
3392  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
3393  subAssign( const DenseVector<VT,true>& rhs );
3394 
3395  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
3396 
3397  template< typename VT >
3398  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
3399  multAssign( const DenseVector<VT,true>& rhs );
3400 
3401  template< typename VT >
3402  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
3403  multAssign( const DenseVector<VT,true>& rhs );
3404 
3405  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
3407  //**********************************************************************************************
3408 
3409  private:
3410  //**Member variables****************************************************************************
3413  Operand matrix_;
3414  const size_t row_;
3415 
3416  //**********************************************************************************************
3417 
3418  //**Friend declarations*************************************************************************
3419  template< typename MT2, bool SO2, bool SF2 > friend class DenseRow;
3420 
3421  template< typename MT2, bool SO2, bool SF2 >
3422  friend bool isSame( const DenseRow<MT2,SO2,SF2>& a, const DenseRow<MT2,SO2,SF2>& b );
3423  //**********************************************************************************************
3424 
3425  //**Compile time checks*************************************************************************
3431  //**********************************************************************************************
3432 };
3434 //*************************************************************************************************
3435 
3436 
3437 
3438 
3439 //=================================================================================================
3440 //
3441 // CONSTRUCTOR
3442 //
3443 //=================================================================================================
3444 
3445 //*************************************************************************************************
3453 template< typename MT > // Type of the dense matrix
3454 inline DenseRow<MT,false,true>::DenseRow( MT& matrix, size_t index )
3455  : matrix_( matrix ) // The dense matrix containing the row
3456  , row_ ( index ) // The index of the row in the matrix
3457 {
3458  if( matrix_.rows() <= index )
3459  throw std::invalid_argument( "Invalid row access index" );
3460 }
3462 //*************************************************************************************************
3463 
3464 
3465 
3466 
3467 //=================================================================================================
3468 //
3469 // DATA ACCESS FUNCTIONS
3470 //
3471 //=================================================================================================
3472 
3473 //*************************************************************************************************
3480 template< typename MT > // Type of the dense matrix
3481 inline typename DenseRow<MT,false,true>::Reference
3482  DenseRow<MT,false,true>::operator[]( size_t index )
3483 {
3484  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
3485  return matrix_(index,row_);
3486 }
3488 //*************************************************************************************************
3489 
3490 
3491 //*************************************************************************************************
3498 template< typename MT > // Type of the dense matrix
3500  DenseRow<MT,false,true>::operator[]( size_t index ) const
3501 {
3502  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
3503  return matrix_(index,row_);
3504 }
3506 //*************************************************************************************************
3507 
3508 
3509 //*************************************************************************************************
3517 template< typename MT > // Type of the dense matrix
3518 inline typename DenseRow<MT,false,true>::Pointer DenseRow<MT,false,true>::data()
3519 {
3520  return matrix_.data( row_ );
3521 }
3523 //*************************************************************************************************
3524 
3525 
3526 //*************************************************************************************************
3534 template< typename MT > // Type of the dense matrix
3535 inline typename DenseRow<MT,false,true>::ConstPointer DenseRow<MT,false,true>::data() const
3536 {
3537  return matrix_.data( row_ );
3538 }
3540 //*************************************************************************************************
3541 
3542 
3543 //*************************************************************************************************
3551 template< typename MT > // Type of the dense matrix
3553 {
3554  return matrix_.begin( row_ );
3555 }
3557 //*************************************************************************************************
3558 
3559 
3560 //*************************************************************************************************
3568 template< typename MT > // Type of the dense matrix
3570 {
3571  return matrix_.cbegin( row_ );
3572 }
3574 //*************************************************************************************************
3575 
3576 
3577 //*************************************************************************************************
3585 template< typename MT > // Type of the dense matrix
3587 {
3588  return matrix_.cbegin( row_ );
3589 }
3591 //*************************************************************************************************
3592 
3593 
3594 //*************************************************************************************************
3602 template< typename MT > // Type of the dense matrix
3604 {
3605  return matrix_.end( row_ );
3606 }
3608 //*************************************************************************************************
3609 
3610 
3611 //*************************************************************************************************
3619 template< typename MT > // Type of the dense matrix
3621 {
3622  return matrix_.cend( row_ );
3623 }
3625 //*************************************************************************************************
3626 
3627 
3628 //*************************************************************************************************
3636 template< typename MT > // Type of the dense matrix
3638 {
3639  return matrix_.cend( row_ );
3640 }
3642 //*************************************************************************************************
3643 
3644 
3645 
3646 
3647 //=================================================================================================
3648 //
3649 // ASSIGNMENT OPERATORS
3650 //
3651 //=================================================================================================
3652 
3653 //*************************************************************************************************
3660 template< typename MT > // Type of the dense matrix
3661 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator=( const ElementType& rhs )
3662 {
3663  const size_t rows( size() );
3664 
3665  for( size_t i=0UL; i<rows; ++i )
3666  matrix_(i,row_) = rhs;
3667 
3668  return *this;
3669 }
3671 //*************************************************************************************************
3672 
3673 
3674 //*************************************************************************************************
3685 template< typename MT > // Type of the dense matrix
3686 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator=( const DenseRow& rhs )
3687 {
3688  if( &rhs == this ) return *this;
3689 
3690  if( size() != rhs.size() )
3691  throw std::invalid_argument( "Row sizes do not match" );
3692 
3693  const size_t rows( size() );
3694 
3695  for( size_t i=0UL; i<rows; ++i )
3696  matrix_(i,row_) = rhs[i];
3697 
3698  return *this;
3699 }
3701 //*************************************************************************************************
3702 
3703 
3704 //*************************************************************************************************
3715 template< typename MT > // Type of the dense matrix
3716 template< typename VT > // Type of the right-hand side vector
3717 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator=( const Vector<VT,true>& rhs )
3718 {
3721 
3722  if( size() != (~rhs).size() )
3723  throw std::invalid_argument( "Vector sizes do not match" );
3724 
3725  if( (~rhs).canAlias( &matrix_ ) ) {
3726  const typename VT::ResultType tmp( ~rhs );
3727  smpAssign( *this, tmp );
3728  }
3729  else {
3730  if( IsSparseVector<VT>::value )
3731  reset();
3732  smpAssign( *this, ~rhs );
3733  }
3734 
3735  return *this;
3736 }
3738 //*************************************************************************************************
3739 
3740 
3741 //*************************************************************************************************
3752 template< typename MT > // Type of the dense matrix
3753 template< typename VT > // Type of the right-hand side vector
3754 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator+=( const Vector<VT,true>& rhs )
3755 {
3758 
3759  if( size() != (~rhs).size() )
3760  throw std::invalid_argument( "Vector sizes do not match" );
3761 
3762  if( (~rhs).canAlias( &matrix_ ) ) {
3763  const typename VT::ResultType tmp( ~rhs );
3764  smpAddAssign( *this, tmp );
3765  }
3766  else {
3767  smpAddAssign( *this, ~rhs );
3768  }
3769 
3770  return *this;
3771 }
3773 //*************************************************************************************************
3774 
3775 
3776 //*************************************************************************************************
3787 template< typename MT > // Type of the dense matrix
3788 template< typename VT > // Type of the right-hand side vector
3789 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator-=( const Vector<VT,true>& rhs )
3790 {
3793 
3794  if( size() != (~rhs).size() )
3795  throw std::invalid_argument( "Vector sizes do not match" );
3796 
3797  if( (~rhs).canAlias( &matrix_ ) ) {
3798  const typename VT::ResultType tmp( ~rhs );
3799  smpSubAssign( *this, tmp );
3800  }
3801  else {
3802  smpSubAssign( *this, ~rhs );
3803  }
3804 
3805  return *this;
3806 }
3808 //*************************************************************************************************
3809 
3810 
3811 //*************************************************************************************************
3823 template< typename MT > // Type of the dense matrix
3824 template< typename VT > // Type of the right-hand side vector
3825 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator*=( const Vector<VT,true>& rhs )
3826 {
3829 
3830  if( size() != (~rhs).size() )
3831  throw std::invalid_argument( "Vector sizes do not match" );
3832 
3833  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
3834  const ResultType tmp( *this * (~rhs) );
3835  smpAssign( *this, tmp );
3836  }
3837  else {
3838  smpMultAssign( *this, ~rhs );
3839  }
3840 
3841  return *this;
3842 }
3844 //*************************************************************************************************
3845 
3846 
3847 //*************************************************************************************************
3855 template< typename MT > // Type of the dense matrix
3856 template< typename Other > // Data type of the right-hand side scalar
3857 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,true> >::Type&
3858  DenseRow<MT,false,true>::operator*=( Other rhs )
3859 {
3860  return operator=( (*this) * rhs );
3861 }
3863 //*************************************************************************************************
3864 
3865 
3866 //*************************************************************************************************
3876 template< typename MT > // Type of the dense matrix
3877 template< typename Other > // Data type of the right-hand side scalar
3878 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,true> >::Type&
3879  DenseRow<MT,false,true>::operator/=( Other rhs )
3880 {
3881  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
3882 
3883  return operator=( (*this) / rhs );
3884 }
3886 //*************************************************************************************************
3887 
3888 
3889 
3890 
3891 //=================================================================================================
3892 //
3893 // UTILITY FUNCTIONS
3894 //
3895 //=================================================================================================
3896 
3897 //*************************************************************************************************
3903 template< typename MT > // Type of the dense matrix
3904 inline size_t DenseRow<MT,false,true>::size() const
3905 {
3906  return matrix_.columns();
3907 }
3909 //*************************************************************************************************
3910 
3911 
3912 //*************************************************************************************************
3918 template< typename MT > // Type of the dense matrix
3919 inline size_t DenseRow<MT,false,true>::capacity() const
3920 {
3921  return matrix_.capacity( row_ );
3922 }
3924 //*************************************************************************************************
3925 
3926 
3927 //*************************************************************************************************
3936 template< typename MT > // Type of the dense matrix
3937 inline size_t DenseRow<MT,false,true>::nonZeros() const
3938 {
3939  return matrix_.nonZeros( row_ );
3940 }
3942 //*************************************************************************************************
3943 
3944 
3945 //*************************************************************************************************
3951 template< typename MT > // Type of the dense matrix
3952 inline void DenseRow<MT,false,true>::reset()
3953 {
3954  matrix_.reset( row_ );
3955 }
3957 //*************************************************************************************************
3958 
3959 
3960 //*************************************************************************************************
3967 template< typename MT > // Type of the dense matrix
3968 template< typename Other > // Data type of the scalar value
3969 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::scale( const Other& scalar )
3970 {
3971  for( size_t i=0UL; i<size(); ++i ) {
3972  matrix_(i,row_) *= scalar;
3973  }
3974  return *this;
3975 }
3977 //*************************************************************************************************
3978 
3979 
3980 
3981 
3982 //=================================================================================================
3983 //
3984 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3985 //
3986 //=================================================================================================
3987 
3988 //*************************************************************************************************
3999 template< typename MT > // Type of the dense matrix
4000 template< typename Other > // Data type of the foreign expression
4001 inline bool DenseRow<MT,false,true>::canAlias( const Other* alias ) const
4002 {
4003  return matrix_.isAliased( alias );
4004 }
4006 //*************************************************************************************************
4007 
4008 
4009 //*************************************************************************************************
4020 template< typename MT > // Type of the dense matrix
4021 template< typename MT2 // Data type of the foreign dense row
4022  , bool SO2 // Storage order of the foreign dense row
4023  , bool SF2 > // Symmetry flag of the foreign dense row
4024 inline bool DenseRow<MT,false,true>::canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const
4025 {
4026  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
4027 }
4029 //*************************************************************************************************
4030 
4031 
4032 //*************************************************************************************************
4043 template< typename MT > // Type of the dense matrix
4044 template< typename Other > // Data type of the foreign expression
4045 inline bool DenseRow<MT,false,true>::isAliased( const Other* alias ) const
4046 {
4047  return matrix_.isAliased( alias );
4048 }
4050 //*************************************************************************************************
4051 
4052 
4053 //*************************************************************************************************
4064 template< typename MT > // Type of the dense matrix
4065 template< typename MT2 // Data type of the foreign dense row
4066  , bool SO2 // Storage order of the foreign dense row
4067  , bool SF2 > // Symmetry flag of the foreign dense row
4068 inline bool DenseRow<MT,false,true>::isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const
4069 {
4070  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
4071 }
4073 //*************************************************************************************************
4074 
4075 
4076 //*************************************************************************************************
4086 template< typename MT > // Type of the dense matrix
4087 inline bool DenseRow<MT,false,true>::isAligned() const
4088 {
4089  return matrix_.isAligned();
4090 }
4092 //*************************************************************************************************
4093 
4094 
4095 //*************************************************************************************************
4106 template< typename MT > // Type of the dense matrix
4107 inline bool DenseRow<MT,false,true>::canSMPAssign() const
4108 {
4109  return ( size() > SMP_DVECASSIGN_THRESHOLD );
4110 }
4112 //*************************************************************************************************
4113 
4114 
4115 //*************************************************************************************************
4128 template< typename MT > // Type of the dense matrix
4129 inline typename DenseRow<MT,false,true>::IntrinsicType
4130  DenseRow<MT,false,true>::load( size_t index ) const
4131 {
4132  return matrix_.load( index, row_ );
4133 }
4135 //*************************************************************************************************
4136 
4137 
4138 //*************************************************************************************************
4151 template< typename MT > // Type of the dense matrix
4152 inline typename DenseRow<MT,false,true>::IntrinsicType
4153  DenseRow<MT,false,true>::loadu( size_t index ) const
4154 {
4155  return matrix_.loadu( index, row_ );
4156 }
4158 //*************************************************************************************************
4159 
4160 
4161 //*************************************************************************************************
4175 template< typename MT > // Type of the dense matrix
4176 inline void DenseRow<MT,false,true>::store( size_t index, const IntrinsicType& value )
4177 {
4178  matrix_.store( index, row_, value );
4179 }
4181 //*************************************************************************************************
4182 
4183 
4184 //*************************************************************************************************
4198 template< typename MT > // Type of the dense matrix
4199 inline void DenseRow<MT,false,true>::storeu( size_t index, const IntrinsicType& value )
4200 {
4201  matrix_.storeu( index, row_, value );
4202 }
4204 //*************************************************************************************************
4205 
4206 
4207 //*************************************************************************************************
4221 template< typename MT > // Type of the dense matrix
4222 inline void DenseRow<MT,false,true>::stream( size_t index, const IntrinsicType& value )
4223 {
4224  matrix_.stream( index, row_, value );
4225 }
4227 //*************************************************************************************************
4228 
4229 
4230 //*************************************************************************************************
4242 template< typename MT > // Type of the dense matrix
4243 template< typename VT > // Type of the right-hand side dense vector
4244 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
4245  DenseRow<MT,false,true>::assign( const DenseVector<VT,true>& rhs )
4246 {
4247  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4248 
4249  const size_t iend( (~rhs).size() & size_t(-2) );
4250  for( size_t i=0UL; i<iend; i+=2UL ) {
4251  matrix_(i ,row_) = (~rhs)[i ];
4252  matrix_(i+1UL,row_) = (~rhs)[i+1UL];
4253  }
4254  if( iend < (~rhs).size() )
4255  matrix_(iend,row_) = (~rhs)[iend];
4256 }
4258 //*************************************************************************************************
4259 
4260 
4261 //*************************************************************************************************
4273 template< typename MT > // Type of the dense matrix
4274 template< typename VT > // Type of the right-hand side dense vector
4275 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
4276  DenseRow<MT,false,true>::assign( const DenseVector<VT,true>& rhs )
4277 {
4278  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4279 
4281 
4282  const size_t rows( size() );
4283 
4284  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
4285  {
4286  for( size_t i=0UL; i<rows; i+=IT::size ) {
4287  matrix_.stream( i, row_, (~rhs).load(i) );
4288  }
4289  }
4290  else
4291  {
4292  const size_t iend( rows & size_t(-IT::size*4) );
4293  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
4294 
4295  typename VT::ConstIterator it( (~rhs).begin() );
4296  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4297  matrix_.store( i , row_, it.load() ); it += IT::size;
4298  matrix_.store( i+IT::size , row_, it.load() ); it += IT::size;
4299  matrix_.store( i+IT::size*2UL, row_, it.load() ); it += IT::size;
4300  matrix_.store( i+IT::size*3UL, row_, it.load() ); it += IT::size;
4301  }
4302  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
4303  matrix_.store( i, row_, it.load() );
4304  }
4305  }
4306 }
4308 //*************************************************************************************************
4309 
4310 
4311 //*************************************************************************************************
4323 template< typename MT > // Type of the dense matrix
4324 template< typename VT > // Type of the right-hand side sparse vector
4325 inline void DenseRow<MT,false,true>::assign( const SparseVector<VT,true>& rhs )
4326 {
4327  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4328 
4329  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4330  matrix_(element->index(),row_) = element->value();
4331 }
4333 //*************************************************************************************************
4334 
4335 
4336 //*************************************************************************************************
4348 template< typename MT > // Type of the dense matrix
4349 template< typename VT > // Type of the right-hand side dense vector
4350 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
4351  DenseRow<MT,false,true>::addAssign( const DenseVector<VT,true>& rhs )
4352 {
4353  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4354 
4355  const size_t iend( (~rhs).size() & size_t(-2) );
4356  for( size_t i=0UL; i<iend; i+=2UL ) {
4357  matrix_(i ,row_) += (~rhs)[i ];
4358  matrix_(i+1UL,row_) += (~rhs)[i+1UL];
4359  }
4360  if( iend < (~rhs).size() )
4361  matrix_(iend,row_) += (~rhs)[iend];
4362 }
4364 //*************************************************************************************************
4365 
4366 
4367 //*************************************************************************************************
4379 template< typename MT > // Type of the dense matrix
4380 template< typename VT > // Type of the right-hand side dense vector
4381 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
4382  DenseRow<MT,false,true>::addAssign( const DenseVector<VT,true>& rhs )
4383 {
4384  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4385 
4387 
4388  const size_t rows( size() );
4389 
4390  const size_t iend( rows & size_t(-IT::size*4) );
4391  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
4392 
4393  typename VT::ConstIterator it( (~rhs).begin() );
4394  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4395  matrix_.store( i , row_, matrix_.load(i ,row_) + it.load() ); it += IT::size;
4396  matrix_.store( i+IT::size , row_, matrix_.load(i+IT::size ,row_) + it.load() ); it += IT::size;
4397  matrix_.store( i+IT::size*2UL, row_, matrix_.load(i+IT::size*2UL,row_) + it.load() ); it += IT::size;
4398  matrix_.store( i+IT::size*3UL, row_, matrix_.load(i+IT::size*3UL,row_) + it.load() ); it += IT::size;
4399  }
4400  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
4401  matrix_.store( i, row_, matrix_.load(i,row_) + it.load() );
4402  }
4403 }
4405 //*************************************************************************************************
4406 
4407 
4408 //*************************************************************************************************
4420 template< typename MT > // Type of the dense matrix
4421 template< typename VT > // Type of the right-hand side sparse vector
4422 inline void DenseRow<MT,false,true>::addAssign( const SparseVector<VT,true>& rhs )
4423 {
4424  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4425 
4426  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4427  matrix_(element->index(),row_) += element->value();
4428 }
4430 //*************************************************************************************************
4431 
4432 
4433 //*************************************************************************************************
4445 template< typename MT > // Type of the dense matrix
4446 template< typename VT > // Type of the right-hand side dense vector
4447 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
4448  DenseRow<MT,false,true>::subAssign( const DenseVector<VT,true>& rhs )
4449 {
4450  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4451 
4452  const size_t iend( (~rhs).size() & size_t(-2) );
4453  for( size_t i=0UL; i<iend; i+=2UL ) {
4454  matrix_(i ,row_) -= (~rhs)[i ];
4455  matrix_(i+1UL,row_) -= (~rhs)[i+1UL];
4456  }
4457  if( iend < (~rhs).size() )
4458  matrix_(iend,row_) -= (~rhs)[iend];
4459 }
4461 //*************************************************************************************************
4462 
4463 
4464 //*************************************************************************************************
4476 template< typename MT > // Type of the dense matrix
4477 template< typename VT > // Type of the right-hand side dense vector
4478 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
4479  DenseRow<MT,false,true>::subAssign( const DenseVector<VT,true>& rhs )
4480 {
4481  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4482 
4484 
4485  const size_t rows( size() );
4486 
4487  const size_t iend( rows & size_t(-IT::size*4) );
4488  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
4489 
4490  typename VT::ConstIterator it( (~rhs).begin() );
4491  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4492  matrix_.store( i , row_, matrix_.load(i ,row_) - it.load() ); it += IT::size;
4493  matrix_.store( i+IT::size , row_, matrix_.load(i+IT::size ,row_) - it.load() ); it += IT::size;
4494  matrix_.store( i+IT::size*2UL, row_, matrix_.load(i+IT::size*2UL,row_) - it.load() ); it += IT::size;
4495  matrix_.store( i+IT::size*3UL, row_, matrix_.load(i+IT::size*3UL,row_) - it.load() ); it += IT::size;
4496  }
4497  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
4498  matrix_.store( i, row_, matrix_.load(i,row_) - it.load() );
4499  }
4500 }
4502 //*************************************************************************************************
4503 
4504 
4505 //*************************************************************************************************
4517 template< typename MT > // Type of the dense matrix
4518 template< typename VT > // Type of the right-hand side sparse vector
4519 inline void DenseRow<MT,false,true>::subAssign( const SparseVector<VT,true>& rhs )
4520 {
4521  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4522 
4523  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4524  matrix_(element->index(),row_) -= element->value();
4525 }
4527 //*************************************************************************************************
4528 
4529 
4530 //*************************************************************************************************
4542 template< typename MT > // Type of the dense matrix
4543 template< typename VT > // Type of the right-hand side dense vector
4544 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
4545  DenseRow<MT,false,true>::multAssign( const DenseVector<VT,true>& rhs )
4546 {
4547  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4548 
4549  const size_t iend( (~rhs).size() & size_t(-2) );
4550  for( size_t i=0UL; i<iend; i+=2UL ) {
4551  matrix_(i ,row_) *= (~rhs)[i ];
4552  matrix_(i+1UL,row_) *= (~rhs)[i+1UL];
4553  }
4554  if( iend < (~rhs).size() )
4555  matrix_(iend,row_) *= (~rhs)[iend];
4556 }
4558 //*************************************************************************************************
4559 
4560 
4561 //*************************************************************************************************
4573 template< typename MT > // Type of the dense matrix
4574 template< typename VT > // Type of the right-hand side dense vector
4575 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
4576  DenseRow<MT,false,true>::multAssign( const DenseVector<VT,true>& rhs )
4577 {
4578  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4579 
4581 
4582  const size_t rows( size() );
4583 
4584  const size_t iend( rows & size_t(-IT::size*4) );
4585  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == iend, "Invalid end calculation" );
4586 
4587  typename VT::ConstIterator it( (~rhs).begin() );
4588  for( size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4589  matrix_.store( i , row_, matrix_.load(i ,row_) * it.load() ); it += IT::size;
4590  matrix_.store( i+IT::size , row_, matrix_.load(i+IT::size ,row_) * it.load() ); it += IT::size;
4591  matrix_.store( i+IT::size*2UL, row_, matrix_.load(i+IT::size*2UL,row_) * it.load() ); it += IT::size;
4592  matrix_.store( i+IT::size*3UL, row_, matrix_.load(i+IT::size*3UL,row_) * it.load() ); it += IT::size;
4593  }
4594  for( size_t i=iend; i<rows; i+=IT::size, it+=IT::size ) {
4595  matrix_.store( i, row_, matrix_.load(i,row_) * it.load() );
4596  }
4597 }
4599 //*************************************************************************************************
4600 
4601 
4602 //*************************************************************************************************
4614 template< typename MT > // Type of the dense matrix
4615 template< typename VT > // Type of the right-hand side sparse vector
4616 inline void DenseRow<MT,false,true>::multAssign( const SparseVector<VT,true>& rhs )
4617 {
4618  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4619 
4620  const ResultType tmp( serial( *this ) );
4621 
4622  reset();
4623 
4624  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4625  matrix_(element->index(),row_) = tmp[element->index()] * element->value();
4626 }
4628 //*************************************************************************************************
4629 
4630 
4631 
4632 
4633 
4634 
4635 
4636 
4637 //=================================================================================================
4638 //
4639 // DENSEROW OPERATORS
4640 //
4641 //=================================================================================================
4642 
4643 //*************************************************************************************************
4646 template< typename MT, bool SO, bool SF >
4647 inline void reset( DenseRow<MT,SO,SF>& row );
4648 
4649 template< typename MT, bool SO, bool SF >
4650 inline void clear( DenseRow<MT,SO,SF>& row );
4651 
4652 template< typename MT, bool SO, bool SF >
4653 inline bool isDefault( const DenseRow<MT,SO,SF>& row );
4654 
4655 template< typename MT, bool SO, bool SF >
4656 inline bool isSame( const DenseRow<MT,SO,SF>& a, const DenseRow<MT,SO,SF>& b );
4658 //*************************************************************************************************
4659 
4660 
4661 //*************************************************************************************************
4668 template< typename MT // Type of the dense matrix
4669  , bool SO // Storage order
4670  , bool SF > // Symmetry flag
4672 {
4673  row.reset();
4674 }
4675 //*************************************************************************************************
4676 
4677 
4678 //*************************************************************************************************
4687 template< typename MT // Type of the dense matrix
4688  , bool SO // Storage order
4689  , bool SF > // Symmetry flag
4691 {
4692  row.reset();
4693 }
4694 //*************************************************************************************************
4695 
4696 
4697 //*************************************************************************************************
4715 template< typename MT // Type of the dense matrix
4716  , bool SO // Storage order
4717  , bool SF > // Symmetry flag
4718 inline bool isDefault( const DenseRow<MT,SO,SF>& row )
4719 {
4720  for( size_t i=0UL; i<row.size(); ++i )
4721  if( !isDefault( row[i] ) ) return false;
4722  return true;
4723 }
4724 //*************************************************************************************************
4725 
4726 
4727 //*************************************************************************************************
4739 template< typename MT // Type of the dense matrix
4740  , bool SO // Storage order
4741  , bool SF > // Symmetry flag
4742 inline bool isSame( const DenseRow<MT,SO,SF>& a, const DenseRow<MT,SO,SF>& b )
4743 {
4744  return ( isSame( a.matrix_, b.matrix_ ) && ( a.row_ == b.row_ ) );
4745 }
4746 //*************************************************************************************************
4747 
4748 
4749 
4750 
4751 //=================================================================================================
4752 //
4753 // SUBVECTORTRAIT SPECIALIZATIONS
4754 //
4755 //=================================================================================================
4756 
4757 //*************************************************************************************************
4759 template< typename MT, bool SO, bool SF >
4760 struct SubvectorTrait< DenseRow<MT,SO,SF> >
4761 {
4762  typedef typename SubvectorTrait< typename DenseRow<MT,SO,SF>::ResultType >::Type Type;
4763 };
4765 //*************************************************************************************************
4766 
4767 } // namespace blaze
4768 
4769 #endif
Pointer data()
Low-level data access to the row elements.
Definition: DenseRow.h:660
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:879
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
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:4838
ConstIterator cend() const
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:779
IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1293
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:258
Operand matrix_
The dense matrix containing the row.
Definition: DenseRow.h:553
Header file for the row trait.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:258
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: DenseRow.h:728
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:205
Header file for the row base class.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseRow.h:342
#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
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:946
Header file for the IsSame and IsStrictlySame type traits.
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
size_t nonZeros() const
Returns the number of non-zero elements in the row.
Definition: DenseRow.h:1079
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
Reference operator[](size_t index)
Subscript operator for the direct access to the row elements.
Definition: DenseRow.h:624
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:224
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
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:695
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:78
size_t size() const
Returns the current size/dimension of the row.
Definition: DenseRow.h:1046
#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::ElementType ElementType
Type of the row elements.
Definition: DenseRow.h:343
void reset()
Reset to the default initial values.
Definition: DenseRow.h:1094
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseRow.h:364
bool canAlias(const Other *alias) const
Returns whether the dense row can alias with the given address alias.
Definition: DenseRow.h:1143
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: DenseRow.h:352
Constraint on the data type.
Base template for the RowTrait class.
Definition: RowTrait.h:115
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant row value.
Definition: DenseRow.h:358
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.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
Header file for the Or class template.
bool isAligned() const
Returns whether the dense row is properly aligned in memory.
Definition: DenseRow.h:1229
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
BLAZE_ALWAYS_INLINE void clear(const NonNumericProxy< MT > &proxy)
Clearing the represented element.
Definition: NonNumericProxy.h:854
Header file for the subvector trait.
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseRow.h:361
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseRow.h:355
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
Iterator begin()
Returns an iterator to the first element of the row.
Definition: DenseRow.h:694
IT::Type IntrinsicType
Intrinsic type of the row elements.
Definition: DenseRow.h:344
Constraint on the data type.
Constraint on the data type.
#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
const size_t row_
The index of the row in the matrix.
Definition: DenseRow.h:554
Constraints on the storage order of matrix types.
Constraint on the data type.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:195
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2476
void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1316
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2480
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
DenseRow & operator=(const ElementType &rhs)
Homogenous assignment to all row elements.
Definition: DenseRow.h:803
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
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2477
Header file for the IsConst type trait.
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseRow.h:341
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Base class for all rows.The Row class serves as a tag for all rows (i.e. dense and sparse rows)...
Definition: Row.h:63
Header file for run time assertion macros.
bool canSMPAssign() const
Returns whether the dense row can be used in SMP assignments.
Definition: DenseRow.h:1249
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the row element type.
Definition: DenseRow.h:324
const DenseRow & CompositeType
Data type for composite expression templates.
Definition: DenseRow.h:346
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Header file for the division trait.
DenseRow< MT, SO, SF > This
Type of this DenseRow instance.
Definition: DenseRow.h:340
DenseRow(MT &matrix, size_t index)
The constructor for DenseRow.
Definition: DenseRow.h:597
bool isAliased(const Other *alias) const
Returns whether the dense row is aliased with the given address alias.
Definition: DenseRow.h:1187
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
Reference to a specific row of a dense matrix.The DenseRow template represents a reference to a speci...
Definition: DenseRow.h:315
Header file for the cache size of the target architecture.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2481
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
Iterator end()
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:745
#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
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseRow.h:321
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
void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense row.
Definition: DenseRow.h:1362
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:256
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
size_t capacity() const
Returns the maximum capacity of the dense row.
Definition: DenseRow.h:1061
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:2473
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: TransposeFlag.h:81
IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1271
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2479
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: DenseRow.h:349
void storeu(size_t index, const IntrinsicType &value)
Unligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1339
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a simple dense v...
Definition: Thresholds.h:207
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseRow.h:345
Header file for a safe C++ NULL pointer implementation.