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>
57 #include <blaze/math/Intrinsics.h>
58 #include <blaze/math/shims/Clear.h>
60 #include <blaze/math/shims/IsOne.h>
80 #include <blaze/system/CacheSize.h>
81 #include <blaze/system/Inline.h>
82 #include <blaze/system/Streaming.h>
84 #include <blaze/util/Assert.h>
88 #include <blaze/util/DisableIf.h>
89 #include <blaze/util/EnableIf.h>
91 #include <blaze/util/mpl/And.h>
92 #include <blaze/util/mpl/If.h>
93 #include <blaze/util/mpl/Or.h>
94 #include <blaze/util/Null.h>
96 #include <blaze/util/Template.h>
97 #include <blaze/util/Types.h>
104 #include <blaze/util/Unused.h>
105 
106 
107 namespace blaze {
108 
109 //=================================================================================================
110 //
111 // CLASS DEFINITION
112 //
113 //=================================================================================================
114 
115 //*************************************************************************************************
335 template< typename MT // Type of the dense matrix
336  , bool SO = IsRowMajorMatrix<MT>::value // Storage order
337  , bool SF = IsSymmetric<MT>::value > // Symmetry flag
338 class DenseRow : public DenseVector< DenseRow<MT,SO,SF>, true >
339  , private Row
340 {
341  private:
342  //**Type definitions****************************************************************************
344  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
345 
348  //**********************************************************************************************
349 
350  //**********************************************************************************************
352 
358  enum { useConst = IsConst<MT>::value };
359  //**********************************************************************************************
360 
361  public:
362  //**Type definitions****************************************************************************
364  typedef typename RowTrait<MT>::Type ResultType;
366  typedef typename MT::ElementType ElementType;
367  typedef typename IT::Type IntrinsicType;
368  typedef typename MT::ReturnType ReturnType;
369  typedef const DenseRow& CompositeType;
370 
373 
376 
378  typedef const ElementType* ConstPointer;
379 
382 
385 
388  //**********************************************************************************************
389 
390  //**Compilation flags***************************************************************************
392  enum { vectorizable = MT::vectorizable };
393 
395  enum { smpAssignable = MT::smpAssignable };
396  //**********************************************************************************************
397 
398  //**Constructors********************************************************************************
401  explicit inline DenseRow( MT& matrix, size_t index );
402  // No explicitly declared copy constructor.
404  //**********************************************************************************************
405 
406  //**Destructor**********************************************************************************
407  // No explicitly declared destructor.
408  //**********************************************************************************************
409 
410  //**Data access functions***********************************************************************
413  inline Reference operator[]( size_t index );
414  inline ConstReference operator[]( size_t index ) const;
415  inline Pointer data ();
416  inline ConstPointer data () const;
417  inline Iterator begin ();
418  inline ConstIterator begin () const;
419  inline ConstIterator cbegin() const;
420  inline Iterator end ();
421  inline ConstIterator end () const;
422  inline ConstIterator cend () const;
424  //**********************************************************************************************
425 
426  //**Assignment operators************************************************************************
429  inline DenseRow& operator=( const ElementType& rhs );
430  inline DenseRow& operator=( const DenseRow& rhs );
431 
432  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
433  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
434  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
435  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
436 
437  template< typename Other >
438  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
439  operator*=( Other rhs );
440 
441  template< typename Other >
442  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
443  operator/=( Other rhs );
445  //**********************************************************************************************
446 
447  //**Utility functions***************************************************************************
450  inline size_t size() const;
451  inline size_t capacity() const;
452  inline size_t nonZeros() const;
453  inline void reset();
454  template< typename Other > inline DenseRow& scale( const Other& scalar );
456  //**********************************************************************************************
457 
458  private:
459  //**********************************************************************************************
461  template< typename VT >
463  struct VectorizedAssign {
464  enum { value = vectorizable && VT::vectorizable &&
465  IsSame<ElementType,typename VT::ElementType>::value };
466  };
468  //**********************************************************************************************
469 
470  //**********************************************************************************************
472  template< typename VT >
474  struct VectorizedAddAssign {
475  enum { value = vectorizable && VT::vectorizable &&
476  IsSame<ElementType,typename VT::ElementType>::value &&
477  IntrinsicTrait<ElementType>::addition };
478  };
480  //**********************************************************************************************
481 
482  //**********************************************************************************************
484  template< typename VT >
486  struct VectorizedSubAssign {
487  enum { value = vectorizable && VT::vectorizable &&
488  IsSame<ElementType,typename VT::ElementType>::value &&
489  IntrinsicTrait<ElementType>::subtraction };
490  };
492  //**********************************************************************************************
493 
494  //**********************************************************************************************
496  template< typename VT >
498  struct VectorizedMultAssign {
499  enum { value = vectorizable && VT::vectorizable &&
500  IsSame<ElementType,typename VT::ElementType>::value &&
501  IntrinsicTrait<ElementType>::multiplication };
502  };
504  //**********************************************************************************************
505 
506  public:
507  //**Expression template evaluation functions****************************************************
510  template< typename Other >
511  inline bool canAlias( const Other* alias ) const;
512 
513  template< typename MT2, bool SO2, bool SF2 >
514  inline bool canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const;
515 
516  template< typename Other >
517  inline bool isAliased( const Other* alias ) const;
518 
519  template< typename MT2, bool SO2, bool SF2 >
520  inline bool isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const;
521 
522  inline bool isAligned () const;
523  inline bool canSMPAssign() const;
524 
525  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
526  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
527 
528  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
529  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
530  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
531 
532  template< typename VT >
533  inline typename DisableIf< VectorizedAssign<VT> >::Type
534  assign( const DenseVector<VT,true>& rhs );
535 
536  template< typename VT >
537  inline typename EnableIf< VectorizedAssign<VT> >::Type
538  assign( const DenseVector<VT,true>& rhs );
539 
540  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
541 
542  template< typename VT >
543  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
544  addAssign( const DenseVector<VT,true>& rhs );
545 
546  template< typename VT >
547  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
548  addAssign( const DenseVector<VT,true>& rhs );
549 
550  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
551 
552  template< typename VT >
553  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
554  subAssign( const DenseVector<VT,true>& rhs );
555 
556  template< typename VT >
557  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
558  subAssign( const DenseVector<VT,true>& rhs );
559 
560  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
561 
562  template< typename VT >
563  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
564  multAssign( const DenseVector<VT,true>& rhs );
565 
566  template< typename VT >
567  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
568  multAssign( const DenseVector<VT,true>& rhs );
569 
570  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
572  //**********************************************************************************************
573 
574  private:
575  //**Utility functions***************************************************************************
578  template< typename MT2, bool SO2, typename VT >
579  inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
580  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,true>& rhs );
581 
582  template< typename MT2, bool SO2, typename VT >
583  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
584  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
585 
586  template< typename MT2, bool SO2, typename VT >
587  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
588  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
589 
590  template< typename MT2, bool SO2, typename VT >
591  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
592  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
593 
594  template< typename MT2, bool SO2, typename VT >
595  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
596  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
597 
598  template< typename MT2, bool SO2, typename VT >
599  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
600  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
601 
602  template< typename MT2, bool SO2, typename VT >
603  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
604  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
606  //**********************************************************************************************
607 
608  //**Member variables****************************************************************************
611  Operand matrix_;
612  const size_t row_;
613 
614  //**********************************************************************************************
615 
616  //**Friend declarations*************************************************************************
618  template< typename MT2, bool SO2, bool SF2 > friend class DenseRow;
619 
620  template< typename MT2, bool SO2, bool SF2 >
621  friend bool isSame( const DenseRow<MT2,SO2,SF2>& a, const DenseRow<MT2,SO2,SF2>& b );
622 
623  template< typename MT2, bool SO2, bool SF2 >
624  friend typename DerestrictTrait< DenseRow<MT2,SO2,SF2> >::Type
625  derestrict( DenseRow<MT2,SO2,SF2>& dm );
627  //**********************************************************************************************
628 
629  //**Compile time checks*************************************************************************
639  //**********************************************************************************************
640 };
641 //*************************************************************************************************
642 
643 
644 
645 
646 //=================================================================================================
647 //
648 // CONSTRUCTOR
649 //
650 //=================================================================================================
651 
652 //*************************************************************************************************
659 template< typename MT // Type of the dense matrix
660  , bool SO // Storage order
661  , bool SF > // Symmetry flag
662 inline DenseRow<MT,SO,SF>::DenseRow( MT& matrix, size_t index )
663  : matrix_( matrix ) // The dense matrix containing the row
664  , row_ ( index ) // The index of the row in the matrix
665 {
666  if( matrix_.rows() <= index )
667  throw std::invalid_argument( "Invalid row access index" );
668 }
669 //*************************************************************************************************
670 
671 
672 
673 
674 //=================================================================================================
675 //
676 // DATA ACCESS FUNCTIONS
677 //
678 //=================================================================================================
679 
680 //*************************************************************************************************
686 template< typename MT // Type of the dense matrix
687  , bool SO // Storage order
688  , bool SF > // Symmetry flag
690 {
691  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
692  return matrix_(row_,index);
693 }
694 //*************************************************************************************************
695 
696 
697 //*************************************************************************************************
703 template< typename MT // Type of the dense matrix
704  , bool SO // Storage order
705  , bool SF > // Symmetry flag
707  DenseRow<MT,SO,SF>::operator[]( size_t index ) const
708 {
709  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
710  return matrix_(row_,index);
711 }
712 //*************************************************************************************************
713 
714 
715 //*************************************************************************************************
722 template< typename MT // Type of the dense matrix
723  , bool SO // Storage order
724  , bool SF > // Symmetry flag
726 {
727  return matrix_.data( row_ );
728 }
729 //*************************************************************************************************
730 
731 
732 //*************************************************************************************************
739 template< typename MT // Type of the dense matrix
740  , bool SO // Storage order
741  , bool SF > // Symmetry flag
743 {
744  return matrix_.data( row_ );
745 }
746 //*************************************************************************************************
747 
748 
749 //*************************************************************************************************
756 template< typename MT // Type of the dense matrix
757  , bool SO // Storage order
758  , bool SF > // Symmetry flag
760 {
761  return matrix_.begin( row_ );
762 }
763 //*************************************************************************************************
764 
765 
766 //*************************************************************************************************
773 template< typename MT // Type of the dense matrix
774  , bool SO // Storage order
775  , bool SF > // Symmetry flag
777 {
778  return matrix_.cbegin( row_ );
779 }
780 //*************************************************************************************************
781 
782 
783 //*************************************************************************************************
790 template< typename MT // Type of the dense matrix
791  , bool SO // Storage order
792  , bool SF > // Symmetry flag
794 {
795  return matrix_.cbegin( row_ );
796 }
797 //*************************************************************************************************
798 
799 
800 //*************************************************************************************************
807 template< typename MT // Type of the dense matrix
808  , bool SO // Storage order
809  , bool SF > // Symmetry flag
811 {
812  return matrix_.end( row_ );
813 }
814 //*************************************************************************************************
815 
816 
817 //*************************************************************************************************
824 template< typename MT // Type of the dense matrix
825  , bool SO // Storage order
826  , bool SF > // Symmetry flag
828 {
829  return matrix_.cend( row_ );
830 }
831 //*************************************************************************************************
832 
833 
834 //*************************************************************************************************
841 template< typename MT // Type of the dense matrix
842  , bool SO // Storage order
843  , bool SF > // Symmetry flag
845 {
846  return matrix_.cend( row_ );
847 }
848 //*************************************************************************************************
849 
850 
851 
852 
853 //=================================================================================================
854 //
855 // ASSIGNMENT OPERATORS
856 //
857 //=================================================================================================
858 
859 //*************************************************************************************************
869 template< typename MT // Type of the dense matrix
870  , bool SO // Storage order
871  , bool SF > // Symmetry flag
873 {
874  const size_t jbegin( ( IsUpper<MT>::value )
876  ?( row_+1UL )
877  :( row_ ) )
878  :( 0UL ) );
879  const size_t jend ( ( IsLower<MT>::value )
881  ?( row_ )
882  :( row_+1UL ) )
883  :( size() ) );
884 
885  for( size_t j=jbegin; j<jend; ++j )
886  matrix_(row_,j) = rhs;
887 
888  return *this;
889 }
890 //*************************************************************************************************
891 
892 
893 //*************************************************************************************************
906 template< typename MT // Type of the dense matrix
907  , bool SO // Storage order
908  , bool SF > // Symmetry flag
910 {
911  if( &rhs == this ) return *this;
912 
913  if( size() != rhs.size() )
914  throw std::invalid_argument( "Row sizes do not match" );
915 
916  if( !preservesInvariant( matrix_, rhs ) )
917  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
918 
919  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
920 
921  smpAssign( left, rhs );
922 
923  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
924  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
925 
926  return *this;
927 }
928 //*************************************************************************************************
929 
930 
931 //*************************************************************************************************
944 template< typename MT // Type of the dense matrix
945  , bool SO // Storage order
946  , bool SF > // Symmetry flag
947 template< typename VT > // Type of the right-hand side vector
949 {
952 
953  if( size() != (~rhs).size() )
954  throw std::invalid_argument( "Vector sizes do not match" );
955 
956  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
957  Right right( ~rhs );
958 
959  if( !preservesInvariant( matrix_, right ) )
960  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
961 
963  reset();
964 
965  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
966 
967  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
968  const typename VT::ResultType tmp( right );
969  smpAssign( left, tmp );
970  }
971  else {
972  smpAssign( left, right );
973  }
974 
975  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
976  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
977 
978  return *this;
979 }
980 //*************************************************************************************************
981 
982 
983 //*************************************************************************************************
996 template< typename MT // Type of the dense matrix
997  , bool SO // Storage order
998  , bool SF > // Symmetry flag
999 template< typename VT > // Type of the right-hand side vector
1001 {
1004 
1005  if( size() != (~rhs).size() )
1006  throw std::invalid_argument( "Vector sizes do not match" );
1007 
1008  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1009  Right right( ~rhs );
1010 
1011  if( !preservesInvariant( matrix_, right ) )
1012  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
1013 
1014  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1015 
1016  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1017  const typename VT::ResultType tmp( right );
1018  smpAddAssign( left, tmp );
1019  }
1020  else {
1021  smpAddAssign( left, right );
1022  }
1023 
1024  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
1025  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
1026 
1027  return *this;
1028 }
1029 //*************************************************************************************************
1030 
1031 
1032 //*************************************************************************************************
1045 template< typename MT // Type of the dense matrix
1046  , bool SO // Storage order
1047  , bool SF > // Symmetry flag
1048 template< typename VT > // Type of the right-hand side vector
1050 {
1053 
1054  if( size() != (~rhs).size() )
1055  throw std::invalid_argument( "Vector sizes do not match" );
1056 
1057  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
1058  Right right( ~rhs );
1059 
1060  if( !preservesInvariant( matrix_, right ) )
1061  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
1062 
1063  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1064 
1065  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1066  const typename VT::ResultType tmp( right );
1067  smpSubAssign( left, tmp );
1068  }
1069  else {
1070  smpSubAssign( left, right );
1071  }
1072 
1073  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
1074  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
1075 
1076  return *this;
1077 }
1078 //*************************************************************************************************
1079 
1080 
1081 //*************************************************************************************************
1092 template< typename MT // Type of the dense matrix
1093  , bool SO // Storage order
1094  , bool SF > // Symmetry flag
1095 template< typename VT > // Type of the right-hand side vector
1097 {
1100 
1101  if( size() != (~rhs).size() )
1102  throw std::invalid_argument( "Vector sizes do not match" );
1103 
1104  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
1105 
1106  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
1107  const ResultType tmp( *this * (~rhs) );
1108  smpAssign( left, tmp );
1109  }
1110  else {
1111  smpMultAssign( left, ~rhs );
1112  }
1113 
1114  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
1115  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
1116 
1117  return *this;
1118 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1132 template< typename MT // Type of the dense matrix
1133  , bool SO // Storage order
1134  , bool SF > // Symmetry flag
1135 template< typename Other > // Data type of the right-hand side scalar
1136 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,SO,SF> >::Type&
1138 {
1140 
1141  return operator=( (*this) * rhs );
1142 }
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1158 template< typename MT // Type of the dense matrix
1159  , bool SO // Storage order
1160  , bool SF > // Symmetry flag
1161 template< typename Other > // Data type of the right-hand side scalar
1162 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,SO,SF> >::Type&
1164 {
1166 
1167  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1168 
1169  return operator=( (*this) / rhs );
1170 }
1171 //*************************************************************************************************
1172 
1173 
1174 
1175 
1176 //=================================================================================================
1177 //
1178 // UTILITY FUNCTIONS
1179 //
1180 //=================================================================================================
1181 
1182 //*************************************************************************************************
1187 template< typename MT // Type of the dense matrix
1188  , bool SO // Storage order
1189  , bool SF > // Symmetry flag
1190 inline size_t DenseRow<MT,SO,SF>::size() const
1191 {
1192  return matrix_.columns();
1193 }
1194 //*************************************************************************************************
1195 
1196 
1197 //*************************************************************************************************
1202 template< typename MT // Type of the dense matrix
1203  , bool SO // Storage order
1204  , bool SF > // Symmetry flag
1205 inline size_t DenseRow<MT,SO,SF>::capacity() const
1206 {
1207  return matrix_.capacity( row_ );
1208 }
1209 //*************************************************************************************************
1210 
1211 
1212 //*************************************************************************************************
1220 template< typename MT // Type of the dense matrix
1221  , bool SO // Storage order
1222  , bool SF > // Symmetry flag
1223 inline size_t DenseRow<MT,SO,SF>::nonZeros() const
1224 {
1225  return matrix_.nonZeros( row_ );
1226 }
1227 //*************************************************************************************************
1228 
1229 
1230 //*************************************************************************************************
1235 template< typename MT // Type of the dense matrix
1236  , bool SO // Storage order
1237  , bool SF > // Symmetry flag
1239 {
1240  matrix_.reset( row_ );
1241 }
1242 //*************************************************************************************************
1243 
1244 
1245 //*************************************************************************************************
1255 template< typename MT // Type of the dense matrix
1256  , bool SO // Storage order
1257  , bool SF > // Symmetry flag
1258 template< typename Other > // Data type of the scalar value
1259 inline DenseRow<MT,SO,SF>& DenseRow<MT,SO,SF>::scale( const Other& scalar )
1260 {
1262 
1263  const size_t jbegin( ( IsUpper<MT>::value )
1265  ?( row_+1UL )
1266  :( row_ ) )
1267  :( 0UL ) );
1268  const size_t jend ( ( IsLower<MT>::value )
1270  ?( row_ )
1271  :( row_+1UL ) )
1272  :( size() ) );
1273 
1274  for( size_t j=jbegin; j<jend; ++j ) {
1275  matrix_(row_,j) *= scalar;
1276  }
1277 
1278  return *this;
1279 }
1280 //*************************************************************************************************
1281 
1282 
1283 //*************************************************************************************************
1294 template< typename MT // Type of the dense matrix
1295  , bool SO // Storage order
1296  , bool SF > // Symmetry flag
1297 template< typename MT2 // Type of the left-hand side dense matrix
1298  , bool SO2 // Storage order of the left-hand side dense matrix
1299  , typename VT > // Type of the right-hand side vector
1300 inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
1302 {
1303  UNUSED_PARAMETER( lhs, rhs );
1304 
1305  return true;
1306 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1321 template< typename MT // Type of the dense matrix
1322  , bool SO // Storage order
1323  , bool SF > // Symmetry flag
1324 template< typename MT2 // Type of the left-hand side dense matrix
1325  , bool SO2 // Storage order of the left-hand side dense matrix
1326  , typename VT > // Type of the right-hand side dense vector
1327 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1329 {
1331 
1332  UNUSED_PARAMETER( lhs );
1333 
1334  if( IsUniLower<MT2>::value && !isOne( (~rhs)[row_] ) )
1335  return false;
1336 
1337  const size_t ibegin( ( IsStrictlyLower<MT2>::value )?( row_ ):( row_+1UL ) );
1338 
1339  for( size_t i=ibegin; i<size(); ++i ) {
1340  if( !isDefault( (~rhs)[i] ) )
1341  return false;
1342  }
1343 
1344  return true;
1345 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1360 template< typename MT // Type of the dense matrix
1361  , bool SO // Storage order
1362  , bool SF > // Symmetry flag
1363 template< typename MT2 // Type of the left-hand side dense matrix
1364  , bool SO2 // Storage order of the left-hand side dense matrix
1365  , typename VT > // Type of the right-hand side sparse vector
1366 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1368 {
1370 
1371  UNUSED_PARAMETER( lhs );
1372 
1373  typedef typename VT::ConstIterator RhsIterator;
1374 
1375  const bool checkDiagonal( IsUniLower<MT2>::value || IsStrictlyLower<MT2>::value );
1376  const RhsIterator last( (~rhs).end() );
1377  RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( row_ ):( row_+1UL ) ) );
1378 
1379  if( IsUniLower<MT2>::value ) {
1380  if( element == last || element->index() != row_ || !isOne( element->value() ) )
1381  return false;
1382  ++element;
1383  }
1384 
1385  for( ; element!=last; ++element ) {
1386  if( !isDefault( element->value() ) )
1387  return false;
1388  }
1389 
1390  return true;
1391 }
1392 //*************************************************************************************************
1393 
1394 
1395 //*************************************************************************************************
1406 template< typename MT // Type of the dense matrix
1407  , bool SO // Storage order
1408  , bool SF > // Symmetry flag
1409 template< typename MT2 // Type of the left-hand side dense matrix
1410  , bool SO2 // Storage order of the left-hand side dense matrix
1411  , typename VT > // Type of the right-hand side dense vector
1412 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1414 {
1416 
1417  UNUSED_PARAMETER( lhs );
1418 
1419  const size_t iend( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) );
1420 
1421  for( size_t i=0UL; i<iend; ++i ) {
1422  if( !isDefault( (~rhs)[i] ) )
1423  return false;
1424  }
1425 
1426  if( IsUniUpper<MT2>::value && !isOne( (~rhs)[row_] ) )
1427  return false;
1428 
1429  return true;
1430 }
1431 //*************************************************************************************************
1432 
1433 
1434 //*************************************************************************************************
1445 template< typename MT // Type of the dense matrix
1446  , bool SO // Storage order
1447  , bool SF > // Symmetry flag
1448 template< typename MT2 // Type of the left-hand side dense matrix
1449  , bool SO2 // Storage order of the left-hand side dense matrix
1450  , typename VT > // Type of the right-hand side sparse vector
1451 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
1453 {
1455 
1456  UNUSED_PARAMETER( lhs );
1457 
1458  typedef typename VT::ConstIterator RhsIterator;
1459 
1460  const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) ) );
1461 
1462  if( IsUniUpper<MT2>::value && ( last == (~rhs).end() || last->index() != row_ || !isOne( last->value() ) ) )
1463  return false;
1464 
1465  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
1466  if( !isDefault( element->value() ) )
1467  return false;
1468  }
1469 
1470  return true;
1471 }
1472 //*************************************************************************************************
1473 
1474 
1475 //*************************************************************************************************
1486 template< typename MT // Type of the dense matrix
1487  , bool SO // Storage order
1488  , bool SF > // Symmetry flag
1489 template< typename MT2 // Type of the left-hand side dense matrix
1490  , bool SO2 // Storage order of the left-hand side dense matrix
1491  , typename VT > // Type of the right-hand side dense vector
1492 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
1494 {
1496 
1497  UNUSED_PARAMETER( lhs );
1498 
1499  for( size_t i=0UL; i<row_; ++i ) {
1500  if( !isDefault( (~rhs)[i] ) )
1501  return false;
1502  }
1503 
1504  for( size_t i=row_+1UL; i<size(); ++i ) {
1505  if( !isDefault( (~rhs)[i] ) )
1506  return false;
1507  }
1508 
1509  return true;
1510 }
1511 //*************************************************************************************************
1512 
1513 
1514 //*************************************************************************************************
1525 template< typename MT // Type of the dense matrix
1526  , bool SO // Storage order
1527  , bool SF > // Symmetry flag
1528 template< typename MT2 // Type of the left-hand side dense matrix
1529  , bool SO2 // Storage order of the left-hand side dense matrix
1530  , typename VT > // Type of the right-hand side sparse vector
1531 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
1533 {
1535 
1536  UNUSED_PARAMETER( lhs );
1537 
1538  typedef typename VT::ConstIterator RhsIterator;
1539 
1540  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1541  if( element->index() != row_ && !isDefault( element->value() ) )
1542  return false;
1543  }
1544 
1545  return true;
1546 }
1547 //*************************************************************************************************
1548 
1549 
1550 
1551 
1552 //=================================================================================================
1553 //
1554 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1555 //
1556 //=================================================================================================
1557 
1558 //*************************************************************************************************
1568 template< typename MT // Type of the dense matrix
1569  , bool SO // Storage order
1570  , bool SF > // Symmetry flag
1571 template< typename Other > // Data type of the foreign expression
1572 inline bool DenseRow<MT,SO,SF>::canAlias( const Other* alias ) const
1573 {
1574  return matrix_.isAliased( alias );
1575 }
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1589 template< typename MT // Type of the dense matrix
1590  , bool SO // Storage order
1591  , bool SF > // Symmetry flag
1592 template< typename MT2 // Data type of the foreign dense row
1593  , bool SO2 // Storage order of the foreign dense row
1594  , bool SF2 > // Symmetry flag of the foreign dense row
1595 inline bool DenseRow<MT,SO,SF>::canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const
1596 {
1597  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1598 }
1599 //*************************************************************************************************
1600 
1601 
1602 //*************************************************************************************************
1612 template< typename MT // Type of the dense matrix
1613  , bool SO // Storage order
1614  , bool SF > // Symmetry flag
1615 template< typename Other > // Data type of the foreign expression
1616 inline bool DenseRow<MT,SO,SF>::isAliased( const Other* alias ) const
1617 {
1618  return matrix_.isAliased( alias );
1619 }
1620 //*************************************************************************************************
1621 
1622 
1623 //*************************************************************************************************
1633 template< typename MT // Type of the dense matrix
1634  , bool SO // Storage order
1635  , bool SF > // Symmetry flag
1636 template< typename MT2 // Data type of the foreign dense row
1637  , bool SO2 // Storage order of the foreign dense row
1638  , bool SF2 > // Symmetry flag of the foreign dense row
1639 inline bool DenseRow<MT,SO,SF>::isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const
1640 {
1641  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1642 }
1643 //*************************************************************************************************
1644 
1645 
1646 //*************************************************************************************************
1655 template< typename MT // Type of the dense matrix
1656  , bool SO // Storage order
1657  , bool SF > // Symmetry flag
1659 {
1660  return matrix_.isAligned();
1661 }
1662 //*************************************************************************************************
1663 
1664 
1665 //*************************************************************************************************
1675 template< typename MT // Type of the dense matrix
1676  , bool SO // Storage order
1677  , bool SF > // Symmetry flag
1679 {
1680  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1681 }
1682 //*************************************************************************************************
1683 
1684 
1685 //*************************************************************************************************
1697 template< typename MT // Type of the dense matrix
1698  , bool SO // Storage order
1699  , bool SF > // Symmetry flag
1701  DenseRow<MT,SO,SF>::load( size_t index ) const
1702 {
1703  return matrix_.load( row_, index );
1704 }
1705 //*************************************************************************************************
1706 
1707 
1708 //*************************************************************************************************
1720 template< typename MT // Type of the dense matrix
1721  , bool SO // Storage order
1722  , bool SF > // Symmetry flag
1724  DenseRow<MT,SO,SF>::loadu( size_t index ) const
1725 {
1726  return matrix_.loadu( row_, index );
1727 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1744 template< typename MT // Type of the dense matrix
1745  , bool SO // Storage order
1746  , bool SF > // Symmetry flag
1748 {
1749  matrix_.store( row_, index, value );
1750 }
1751 //*************************************************************************************************
1752 
1753 
1754 //*************************************************************************************************
1767 template< typename MT // Type of the dense matrix
1768  , bool SO // Storage order
1769  , bool SF > // Symmetry flag
1771 {
1772  matrix_.storeu( row_, index, value );
1773 }
1774 //*************************************************************************************************
1775 
1776 
1777 //*************************************************************************************************
1790 template< typename MT // Type of the dense matrix
1791  , bool SO // Storage order
1792  , bool SF > // Symmetry flag
1794 {
1795  matrix_.stream( row_, index, value );
1796 }
1797 //*************************************************************************************************
1798 
1799 
1800 //*************************************************************************************************
1811 template< typename MT // Type of the dense matrix
1812  , bool SO // Storage order
1813  , bool SF > // Symmetry flag
1814 template< typename VT > // Type of the right-hand side dense vector
1815 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1817 {
1819 
1820  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1821 
1822  const size_t jpos( (~rhs).size() & size_t(-2) );
1823  for( size_t j=0UL; j<jpos; j+=2UL ) {
1824  matrix_(row_,j ) = (~rhs)[j ];
1825  matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1826  }
1827  if( jpos < (~rhs).size() )
1828  matrix_(row_,jpos) = (~rhs)[jpos];
1829 }
1830 //*************************************************************************************************
1831 
1832 
1833 //*************************************************************************************************
1844 template< typename MT // Type of the dense matrix
1845  , bool SO // Storage order
1846  , bool SF > // Symmetry flag
1847 template< typename VT > // Type of the right-hand side dense vector
1848 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1850 {
1853 
1854  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1855 
1856  const size_t columns( size() );
1857 
1858  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1859  {
1860  for( size_t j=0UL; j<columns; j+=IT::size ) {
1861  matrix_.stream( row_, j, (~rhs).load(j) );
1862  }
1863  }
1864  else
1865  {
1866  const size_t jpos( columns & size_t(-IT::size*4) );
1867  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
1868 
1869  typename VT::ConstIterator it( (~rhs).begin() );
1870  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
1871  matrix_.store( row_, j , it.load() ); it += IT::size;
1872  matrix_.store( row_, j+IT::size , it.load() ); it += IT::size;
1873  matrix_.store( row_, j+IT::size*2UL, it.load() ); it += IT::size;
1874  matrix_.store( row_, j+IT::size*3UL, it.load() ); it += IT::size;
1875  }
1876  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
1877  matrix_.store( row_, j, it.load() );
1878  }
1879  }
1880 }
1881 //*************************************************************************************************
1882 
1883 
1884 //*************************************************************************************************
1895 template< typename MT // Type of the dense matrix
1896  , bool SO // Storage order
1897  , bool SF > // Symmetry flag
1898 template< typename VT > // Type of the right-hand side sparse vector
1900 {
1902 
1903  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1904 
1905  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1906  matrix_(row_,element->index()) = element->value();
1907 }
1908 //*************************************************************************************************
1909 
1910 
1911 //*************************************************************************************************
1922 template< typename MT // Type of the dense matrix
1923  , bool SO // Storage order
1924  , bool SF > // Symmetry flag
1925 template< typename VT > // Type of the right-hand side dense vector
1926 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1928 {
1930 
1931  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1932 
1933  const size_t jpos( (~rhs).size() & size_t(-2) );
1934  for( size_t j=0UL; j<jpos; j+=2UL ) {
1935  matrix_(row_,j ) += (~rhs)[j ];
1936  matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1937  }
1938  if( jpos < (~rhs).size() )
1939  matrix_(row_,jpos) += (~rhs)[jpos];
1940 }
1941 //*************************************************************************************************
1942 
1943 
1944 //*************************************************************************************************
1955 template< typename MT // Type of the dense matrix
1956  , bool SO // Storage order
1957  , bool SF > // Symmetry flag
1958 template< typename VT > // Type of the right-hand side dense vector
1959 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1961 {
1964 
1965  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1966 
1967  const size_t columns( size() );
1968 
1969  const size_t jpos( columns & size_t(-IT::size*4) );
1970  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
1971 
1972  typename VT::ConstIterator it( (~rhs).begin() );
1973  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
1974  matrix_.store( row_, j , matrix_.load(row_,j ) + it.load() ); it += IT::size;
1975  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) + it.load() ); it += IT::size;
1976  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) + it.load() ); it += IT::size;
1977  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) + it.load() ); it += IT::size;
1978  }
1979  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
1980  matrix_.store( row_, j, matrix_.load(row_,j) + it.load() );
1981  }
1982 }
1983 //*************************************************************************************************
1984 
1985 
1986 //*************************************************************************************************
1997 template< typename MT // Type of the dense matrix
1998  , bool SO // Storage order
1999  , bool SF > // Symmetry flag
2000 template< typename VT > // Type of the right-hand side sparse vector
2002 {
2004 
2005  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2006 
2007  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2008  matrix_(row_,element->index()) += element->value();
2009 }
2010 //*************************************************************************************************
2011 
2012 
2013 //*************************************************************************************************
2024 template< typename MT // Type of the dense matrix
2025  , bool SO // Storage order
2026  , bool SF > // Symmetry flag
2027 template< typename VT > // Type of the right-hand side dense vector
2028 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2030 {
2032 
2033  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2034 
2035  const size_t jpos( (~rhs).size() & size_t(-2) );
2036  for( size_t j=0UL; j<jpos; j+=2UL ) {
2037  matrix_(row_,j ) -= (~rhs)[j ];
2038  matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
2039  }
2040  if( jpos < (~rhs).size() )
2041  matrix_(row_,jpos) -= (~rhs)[jpos];
2042 }
2043 //*************************************************************************************************
2044 
2045 
2046 //*************************************************************************************************
2057 template< typename MT // Type of the dense matrix
2058  , bool SO // Storage order
2059  , bool SF > // Symmetry flag
2060 template< typename VT > // Type of the right-hand side dense vector
2061 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2063 {
2066 
2067  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2068 
2069  const size_t columns( size() );
2070 
2071  const size_t jpos( columns & size_t(-IT::size*4) );
2072  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
2073 
2074  typename VT::ConstIterator it( (~rhs).begin() );
2075  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
2076  matrix_.store( row_, j , matrix_.load(row_,j ) - it.load() ); it += IT::size;
2077  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) - it.load() ); it += IT::size;
2078  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) - it.load() ); it += IT::size;
2079  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) - it.load() ); it += IT::size;
2080  }
2081  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
2082  matrix_.store( row_, j, matrix_.load(row_,j) - it.load() );
2083  }
2084 }
2085 //*************************************************************************************************
2086 
2087 
2088 //*************************************************************************************************
2099 template< typename MT // Type of the dense matrix
2100  , bool SO // Storage order
2101  , bool SF > // Symmetry flag
2102 template< typename VT > // Type of the right-hand side sparse vector
2104 {
2106 
2107  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2108 
2109  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2110  matrix_(row_,element->index()) -= element->value();
2111 }
2112 //*************************************************************************************************
2113 
2114 
2115 //*************************************************************************************************
2126 template< typename MT // Type of the dense matrix
2127  , bool SO // Storage order
2128  , bool SF > // Symmetry flag
2129 template< typename VT > // Type of the right-hand side dense vector
2130 inline typename DisableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2132 {
2134 
2135  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2136 
2137  const size_t jpos( (~rhs).size() & size_t(-2) );
2138  for( size_t j=0UL; j<jpos; j+=2UL ) {
2139  matrix_(row_,j ) *= (~rhs)[j ];
2140  matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
2141  }
2142  if( jpos < (~rhs).size() )
2143  matrix_(row_,jpos) *= (~rhs)[jpos];
2144 }
2145 //*************************************************************************************************
2146 
2147 
2148 //*************************************************************************************************
2159 template< typename MT // Type of the dense matrix
2160  , bool SO // Storage order
2161  , bool SF > // Symmetry flag
2162 template< typename VT > // Type of the right-hand side dense vector
2163 inline typename EnableIf< typename DenseRow<MT,SO,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2165 {
2168 
2169  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2170 
2171  const size_t columns( size() );
2172 
2173  const size_t jpos( columns & size_t(-IT::size*4) );
2174  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jpos, "Invalid end calculation" );
2175 
2176  typename VT::ConstIterator it( (~rhs).begin() );
2177  for( size_t j=0UL; j<jpos; j+=IT::size*4UL ) {
2178  matrix_.store( row_, j , matrix_.load(row_,j ) * it.load() ); it += IT::size;
2179  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) * it.load() ); it += IT::size;
2180  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) * it.load() ); it += IT::size;
2181  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) * it.load() ); it += IT::size;
2182  }
2183  for( size_t j=jpos; j<columns; j+=IT::size, it+=IT::size ) {
2184  matrix_.store( row_, j, matrix_.load(row_,j) * it.load() );
2185  }
2186 }
2187 //*************************************************************************************************
2188 
2189 
2190 //*************************************************************************************************
2201 template< typename MT // Type of the dense matrix
2202  , bool SO // Storage order
2203  , bool SF > // Symmetry flag
2204 template< typename VT > // Type of the right-hand side sparse vector
2206 {
2208 
2209  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2210 
2211  const ResultType tmp( serial( *this ) );
2212 
2213  reset();
2214 
2215  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2216  matrix_(row_,element->index()) = tmp[element->index()] * element->value();
2217 }
2218 //*************************************************************************************************
2219 
2220 
2221 
2222 
2223 
2224 
2225 
2226 
2227 //=================================================================================================
2228 //
2229 // CLASS TEMPLATE SPECIALIZATION FOR GENERAL COLUMN-MAJOR MATRICES
2230 //
2231 //=================================================================================================
2232 
2233 //*************************************************************************************************
2241 template< typename MT > // Type of the dense matrix
2242 class DenseRow<MT,false,false> : public DenseVector< DenseRow<MT,false,false>, true >
2243  , private Row
2244 {
2245  private:
2246  //**Type definitions****************************************************************************
2248  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
2249  //**********************************************************************************************
2250 
2251  //**********************************************************************************************
2253 
2259  enum { useConst = IsConst<MT>::value };
2260  //**********************************************************************************************
2261 
2262  public:
2263  //**Type definitions****************************************************************************
2264  typedef DenseRow<MT,false,false> This;
2265  typedef typename RowTrait<MT>::Type ResultType;
2266  typedef typename ResultType::TransposeType TransposeType;
2267  typedef typename MT::ElementType ElementType;
2268  typedef typename MT::ReturnType ReturnType;
2269  typedef const DenseRow& CompositeType;
2270 
2272  typedef typename MT::ConstReference ConstReference;
2273 
2275  typedef typename IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference;
2276  //**********************************************************************************************
2277 
2278  //**RowIterator class definition****************************************************************
2281  template< typename MatrixType > // Type of the dense matrix
2282  class RowIterator
2283  {
2284  private:
2285  //*******************************************************************************************
2287 
2292  enum { returnConst = IsConst<MatrixType>::value };
2293  //*******************************************************************************************
2294 
2295  public:
2296  //**Type definitions*************************************************************************
2298  typedef typename IfTrue< returnConst
2299  , typename MatrixType::ConstReference
2300  , typename MatrixType::Reference >::Type Reference;
2301 
2302  typedef std::random_access_iterator_tag IteratorCategory;
2303  typedef RemoveReference<Reference> ValueType;
2304  typedef ValueType* PointerType;
2305  typedef Reference ReferenceType;
2306  typedef ptrdiff_t DifferenceType;
2307 
2308  // STL iterator requirements
2309  typedef IteratorCategory iterator_category;
2310  typedef ValueType value_type;
2311  typedef PointerType pointer;
2312  typedef ReferenceType reference;
2313  typedef DifferenceType difference_type;
2314  //*******************************************************************************************
2315 
2316  //**Constructor******************************************************************************
2319  inline RowIterator()
2320  : matrix_( NULL ) // The dense matrix containing the row.
2321  , row_ ( 0UL ) // The current row index.
2322  , column_( 0UL ) // The current column index.
2323  {}
2324  //*******************************************************************************************
2325 
2326  //**Constructor******************************************************************************
2333  inline RowIterator( MatrixType& matrix, size_t row, size_t column )
2334  : matrix_( &matrix ) // The dense matrix containing the row.
2335  , row_ ( row ) // The current row index.
2336  , column_( column ) // The current column index.
2337  {}
2338  //*******************************************************************************************
2339 
2340  //**Constructor******************************************************************************
2345  template< typename MatrixType2 >
2346  inline RowIterator( const RowIterator<MatrixType2>& it )
2347  : matrix_( it.matrix_ ) // The dense matrix containing the row.
2348  , row_ ( it.row_ ) // The current row index.
2349  , column_( it.column_ ) // The current column index.
2350  {}
2351  //*******************************************************************************************
2352 
2353  //**Addition assignment operator*************************************************************
2359  inline RowIterator& operator+=( size_t inc ) {
2360  column_ += inc;
2361  return *this;
2362  }
2363  //*******************************************************************************************
2364 
2365  //**Subtraction assignment operator**********************************************************
2371  inline RowIterator& operator-=( size_t dec ) {
2372  column_ -= dec;
2373  return *this;
2374  }
2375  //*******************************************************************************************
2376 
2377  //**Prefix increment operator****************************************************************
2382  inline RowIterator& operator++() {
2383  ++column_;
2384  return *this;
2385  }
2386  //*******************************************************************************************
2387 
2388  //**Postfix increment operator***************************************************************
2393  inline const RowIterator operator++( int ) {
2394  const RowIterator tmp( *this );
2395  ++(*this);
2396  return tmp;
2397  }
2398  //*******************************************************************************************
2399 
2400  //**Prefix decrement operator****************************************************************
2405  inline RowIterator& operator--() {
2406  --column_;
2407  return *this;
2408  }
2409  //*******************************************************************************************
2410 
2411  //**Postfix decrement operator***************************************************************
2416  inline const RowIterator operator--( int ) {
2417  const RowIterator tmp( *this );
2418  --(*this);
2419  return tmp;
2420  }
2421  //*******************************************************************************************
2422 
2423  //**Subscript operator***********************************************************************
2429  inline ReferenceType operator[]( size_t index ) const {
2430  return (*matrix_)(row_,column_+index);
2431  }
2432  //*******************************************************************************************
2433 
2434  //**Element access operator******************************************************************
2439  inline ReferenceType operator*() const {
2440  return (*matrix_)(row_,column_);
2441  }
2442  //*******************************************************************************************
2443 
2444  //**Element access operator******************************************************************
2449  inline PointerType operator->() const {
2450  return &(*matrix_)(row_,column_);
2451  }
2452  //*******************************************************************************************
2453 
2454  //**Equality operator************************************************************************
2460  template< typename MatrixType2 >
2461  inline bool operator==( const RowIterator<MatrixType2>& rhs ) const {
2462  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2463  }
2464  //*******************************************************************************************
2465 
2466  //**Inequality operator**********************************************************************
2472  template< typename MatrixType2 >
2473  inline bool operator!=( const RowIterator<MatrixType2>& rhs ) const {
2474  return !( *this == rhs );
2475  }
2476  //*******************************************************************************************
2477 
2478  //**Less-than operator***********************************************************************
2484  template< typename MatrixType2 >
2485  inline bool operator<( const RowIterator<MatrixType2>& rhs ) const {
2486  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ < rhs.column_ );
2487  }
2488  //*******************************************************************************************
2489 
2490  //**Greater-than operator********************************************************************
2496  template< typename MatrixType2 >
2497  inline bool operator>( const RowIterator<MatrixType2>& rhs ) const {
2498  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ > rhs.column_ );
2499  }
2500  //*******************************************************************************************
2501 
2502  //**Less-or-equal-than operator**************************************************************
2508  template< typename MatrixType2 >
2509  inline bool operator<=( const RowIterator<MatrixType2>& rhs ) const {
2510  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
2511  }
2512  //*******************************************************************************************
2513 
2514  //**Greater-or-equal-than operator***********************************************************
2520  template< typename MatrixType2 >
2521  inline bool operator>=( const RowIterator<MatrixType2>& rhs ) const {
2522  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
2523  }
2524  //*******************************************************************************************
2525 
2526  //**Subtraction operator*********************************************************************
2532  inline DifferenceType operator-( const RowIterator& rhs ) const {
2533  return column_ - rhs.column_;
2534  }
2535  //*******************************************************************************************
2536 
2537  //**Addition operator************************************************************************
2544  friend inline const RowIterator operator+( const RowIterator& it, size_t inc ) {
2545  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2546  }
2547  //*******************************************************************************************
2548 
2549  //**Addition operator************************************************************************
2556  friend inline const RowIterator operator+( size_t inc, const RowIterator& it ) {
2557  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2558  }
2559  //*******************************************************************************************
2560 
2561  //**Subtraction operator*********************************************************************
2568  friend inline const RowIterator operator-( const RowIterator& it, size_t dec ) {
2569  return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2570  }
2571  //*******************************************************************************************
2572 
2573  private:
2574  //**Member variables*************************************************************************
2575  MatrixType* matrix_;
2576  size_t row_;
2577  size_t column_;
2578  //*******************************************************************************************
2579 
2580  //**Friend declarations**********************************************************************
2581  template< typename MatrixType2 > friend class RowIterator;
2582  //*******************************************************************************************
2583  };
2584  //**********************************************************************************************
2585 
2586  //**Type definitions****************************************************************************
2588  typedef RowIterator<const MT> ConstIterator;
2589 
2591  typedef typename IfTrue< useConst, ConstIterator, RowIterator<MT> >::Type Iterator;
2592  //**********************************************************************************************
2593 
2594  //**Compilation flags***************************************************************************
2596  enum { vectorizable = 0 };
2597 
2599  enum { smpAssignable = MT::smpAssignable };
2600  //**********************************************************************************************
2601 
2602  //**Constructors********************************************************************************
2605  explicit inline DenseRow( MT& matrix, size_t index );
2606  // No explicitly declared copy constructor.
2608  //**********************************************************************************************
2609 
2610  //**Destructor**********************************************************************************
2611  // No explicitly declared destructor.
2612  //**********************************************************************************************
2613 
2614  //**Data access functions***********************************************************************
2617  inline Reference operator[]( size_t index );
2618  inline ConstReference operator[]( size_t index ) const;
2619  inline Iterator begin ();
2620  inline ConstIterator begin () const;
2621  inline ConstIterator cbegin() const;
2622  inline Iterator end ();
2623  inline ConstIterator end () const;
2624  inline ConstIterator cend () const;
2626  //**********************************************************************************************
2627 
2628  //**Assignment operators************************************************************************
2631  inline DenseRow& operator=( const ElementType& rhs );
2632  inline DenseRow& operator=( const DenseRow& rhs );
2633 
2634  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
2635  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
2636  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
2637  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
2638 
2639  template< typename Other >
2640  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
2641  operator*=( Other rhs );
2642 
2643  template< typename Other >
2644  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
2645  operator/=( Other rhs );
2647  //**********************************************************************************************
2648 
2649  //**Utility functions***************************************************************************
2652  inline size_t size() const;
2653  inline size_t capacity() const;
2654  inline size_t nonZeros() const;
2655  inline void reset();
2656  template< typename Other > inline DenseRow& scale( const Other& scalar );
2658  //**********************************************************************************************
2659 
2660  public:
2661  //**Expression template evaluation functions****************************************************
2664  template< typename Other >
2665  inline bool canAlias( const Other* alias ) const;
2666 
2667  template< typename MT2, bool SO2, bool SF2 >
2668  inline bool canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const;
2669 
2670  template< typename Other >
2671  inline bool isAliased( const Other* alias ) const;
2672 
2673  template< typename MT2, bool SO2, bool SF2 >
2674  inline bool isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const;
2675 
2676  inline bool isAligned () const;
2677  inline bool canSMPAssign() const;
2678 
2679  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2680  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2681  template< typename VT > inline void addAssign ( const DenseVector <VT,true>& rhs );
2682  template< typename VT > inline void addAssign ( const SparseVector<VT,true>& rhs );
2683  template< typename VT > inline void subAssign ( const DenseVector <VT,true>& rhs );
2684  template< typename VT > inline void subAssign ( const SparseVector<VT,true>& rhs );
2685  template< typename VT > inline void multAssign( const DenseVector <VT,true>& rhs );
2686  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
2688  //**********************************************************************************************
2689 
2690  private:
2691  //**Utility functions***************************************************************************
2694  template< typename MT2, bool SO2, typename VT >
2695  inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
2696  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,true>& rhs );
2697 
2698  template< typename MT2, bool SO2, typename VT >
2699  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2700  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
2701 
2702  template< typename MT2, bool SO2, typename VT >
2703  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2704  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
2705 
2706  template< typename MT2, bool SO2, typename VT >
2707  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2708  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
2709 
2710  template< typename MT2, bool SO2, typename VT >
2711  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
2712  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
2713 
2714  template< typename MT2, bool SO2, typename VT >
2715  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
2716  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
2717 
2718  template< typename MT2, bool SO2, typename VT >
2719  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
2720  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
2722  //**********************************************************************************************
2723 
2724  //**Member variables****************************************************************************
2727  Operand matrix_;
2728  const size_t row_;
2729 
2730  //**********************************************************************************************
2731 
2732  //**Friend declarations*************************************************************************
2733  template< typename MT2, bool SO2, bool SF2 > friend class DenseRow;
2734 
2735  template< typename MT2, bool SO2, bool SF2 >
2736  friend bool isSame( const DenseRow<MT2,SO2,SF2>& a, const DenseRow<MT2,SO2,SF2>& b );
2737 
2738  template< typename MT2, bool SO2, bool SF2 >
2739  friend typename DerestrictTrait< DenseRow<MT2,SO2,SF2> >::Type
2740  derestrict( DenseRow<MT2,SO2,SF2>& dm );
2741  //**********************************************************************************************
2742 
2743  //**Compile time checks*************************************************************************
2751  BLAZE_STATIC_ASSERT( !IsRestricted<MT>::value || IsLower<MT>::value || IsUpper<MT>::value );
2752  //**********************************************************************************************
2753 };
2755 //*************************************************************************************************
2756 
2757 
2758 
2759 
2760 //=================================================================================================
2761 //
2762 // CONSTRUCTOR
2763 //
2764 //=================================================================================================
2765 
2766 //*************************************************************************************************
2774 template< typename MT > // Type of the dense matrix
2775 inline DenseRow<MT,false,false>::DenseRow( MT& matrix, size_t index )
2776  : matrix_( matrix ) // The dense matrix containing the row
2777  , row_ ( index ) // The index of the row in the matrix
2778 {
2779  if( matrix_.rows() <= index )
2780  throw std::invalid_argument( "Invalid row access index" );
2781 }
2783 //*************************************************************************************************
2784 
2785 
2786 
2787 
2788 //=================================================================================================
2789 //
2790 // DATA ACCESS FUNCTIONS
2791 //
2792 //=================================================================================================
2793 
2794 //*************************************************************************************************
2801 template< typename MT > // Type of the dense matrix
2803  DenseRow<MT,false,false>::operator[]( size_t index )
2804 {
2805  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2806  return matrix_(row_,index);
2807 }
2809 //*************************************************************************************************
2810 
2811 
2812 //*************************************************************************************************
2819 template< typename MT > // Type of the dense matrix
2821  DenseRow<MT,false,false>::operator[]( size_t index ) const
2822 {
2823  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2824  return matrix_(row_,index);
2825 }
2827 //*************************************************************************************************
2828 
2829 
2830 //*************************************************************************************************
2838 template< typename MT > // Type of the dense matrix
2840 {
2841  return Iterator( matrix_, row_, 0UL );
2842 }
2844 //*************************************************************************************************
2845 
2846 
2847 //*************************************************************************************************
2855 template< typename MT > // Type of the dense matrix
2857 {
2858  return ConstIterator( matrix_, row_, 0UL );
2859 }
2861 //*************************************************************************************************
2862 
2863 
2864 //*************************************************************************************************
2872 template< typename MT > // Type of the dense matrix
2874 {
2875  return ConstIterator( matrix_, row_, 0UL );
2876 }
2878 //*************************************************************************************************
2879 
2880 
2881 //*************************************************************************************************
2889 template< typename MT > // Type of the dense matrix
2891 {
2892  return Iterator( matrix_, row_, size() );
2893 }
2895 //*************************************************************************************************
2896 
2897 
2898 //*************************************************************************************************
2906 template< typename MT > // Type of the dense matrix
2908 {
2909  return ConstIterator( matrix_, row_, size() );
2910 }
2912 //*************************************************************************************************
2913 
2914 
2915 //*************************************************************************************************
2923 template< typename MT > // Type of the dense matrix
2925 {
2926  return ConstIterator( matrix_, row_, size() );
2927 }
2929 //*************************************************************************************************
2930 
2931 
2932 
2933 
2934 //=================================================================================================
2935 //
2936 // ASSIGNMENT OPERATORS
2937 //
2938 //=================================================================================================
2939 
2940 //*************************************************************************************************
2951 template< typename MT > // Type of the dense matrix
2952 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator=( const ElementType& rhs )
2953 {
2954  const size_t jbegin( ( IsUpper<MT>::value )
2955  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2956  ?( row_+1UL )
2957  :( row_ ) )
2958  :( 0UL ) );
2959  const size_t jend ( ( IsLower<MT>::value )
2960  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2961  ?( row_ )
2962  :( row_+1UL ) )
2963  :( size() ) );
2964 
2965  for( size_t j=jbegin; j<jend; ++j )
2966  matrix_(row_,j) = rhs;
2967 
2968  return *this;
2969 }
2971 //*************************************************************************************************
2972 
2973 
2974 //*************************************************************************************************
2988 template< typename MT > // Type of the dense matrix
2989 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator=( const DenseRow& rhs )
2990 {
2991  if( &rhs == this ) return *this;
2992 
2993  if( size() != rhs.size() )
2994  throw std::invalid_argument( "Row sizes do not match" );
2995 
2996  if( !preservesInvariant( matrix_, rhs ) )
2997  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
2998 
2999  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3000 
3001  smpAssign( left, rhs );
3002 
3003  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3004  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3005 
3006  return *this;
3007 }
3009 //*************************************************************************************************
3010 
3011 
3012 //*************************************************************************************************
3026 template< typename MT > // Type of the dense matrix
3027 template< typename VT > // Type of the right-hand side vector
3028 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator=( const Vector<VT,true>& rhs )
3029 {
3033 
3034  if( size() != (~rhs).size() )
3035  throw std::invalid_argument( "Vector sizes do not match" );
3036 
3037  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3038  Right right( ~rhs );
3039 
3040  if( !preservesInvariant( matrix_, right ) )
3041  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3042 
3043  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3044 
3045  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3046  const ResultType tmp( right );
3047  smpAssign( left, tmp );
3048  }
3049  else {
3050  if( IsSparseVector<VT>::value )
3051  reset();
3052  smpAssign( left, right );
3053  }
3054 
3055  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3056  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3057 
3058  return *this;
3059 }
3061 //*************************************************************************************************
3062 
3063 
3064 //*************************************************************************************************
3078 template< typename MT > // Type of the dense matrix
3079 template< typename VT > // Type of the right-hand side vector
3080 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator+=( const Vector<VT,true>& rhs )
3081 {
3084 
3085  if( size() != (~rhs).size() )
3086  throw std::invalid_argument( "Vector sizes do not match" );
3087 
3088  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3089  Right right( ~rhs );
3090 
3091  if( !preservesInvariant( matrix_, right ) )
3092  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3093 
3094  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3095 
3096  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3097  const typename VT::ResultType tmp( right );
3098  smpAddAssign( left, tmp );
3099  }
3100  else {
3101  smpAddAssign( left, right );
3102  }
3103 
3104  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3105  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3106 
3107  return *this;
3108 }
3110 //*************************************************************************************************
3111 
3112 
3113 //*************************************************************************************************
3127 template< typename MT > // Type of the dense matrix
3128 template< typename VT > // Type of the right-hand side vector
3129 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator-=( const Vector<VT,true>& rhs )
3130 {
3133 
3134  if( size() != (~rhs).size() )
3135  throw std::invalid_argument( "Vector sizes do not match" );
3136 
3137  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
3138  Right right( ~rhs );
3139 
3140  if( !preservesInvariant( matrix_, right ) )
3141  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
3142 
3143  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3144 
3145  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3146  const typename VT::ResultType tmp( right );
3147  smpSubAssign( left, tmp );
3148  }
3149  else {
3150  smpSubAssign( left, right );
3151  }
3152 
3153  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3154  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3155 
3156  return *this;
3157 }
3159 //*************************************************************************************************
3160 
3161 
3162 //*************************************************************************************************
3174 template< typename MT > // Type of the dense matrix
3175 template< typename VT > // Type of the right-hand side vector
3176 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::operator*=( const Vector<VT,true>& rhs )
3177 {
3180 
3181  if( size() != (~rhs).size() )
3182  throw std::invalid_argument( "Vector sizes do not match" );
3183 
3184  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
3185 
3186  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
3187  const ResultType tmp( *this * (~rhs) );
3188  smpAssign( left, tmp );
3189  }
3190  else {
3191  smpMultAssign( left, ~rhs );
3192  }
3193 
3194  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
3195  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
3196 
3197  return *this;
3198 }
3200 //*************************************************************************************************
3201 
3202 
3203 //*************************************************************************************************
3214 template< typename MT > // Type of the dense matrix
3215 template< typename Other > // Data type of the right-hand side scalar
3216 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,false> >::Type&
3217  DenseRow<MT,false,false>::operator*=( Other rhs )
3218 {
3220 
3221  return operator=( (*this) * rhs );
3222 }
3224 //*************************************************************************************************
3225 
3226 
3227 //*************************************************************************************************
3240 template< typename MT > // Type of the dense matrix
3241 template< typename Other > // Data type of the right-hand side scalar
3242 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,false> >::Type&
3243  DenseRow<MT,false,false>::operator/=( Other rhs )
3244 {
3246 
3247  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
3248 
3249  return operator=( (*this) / rhs );
3250 }
3252 //*************************************************************************************************
3253 
3254 
3255 
3256 
3257 //=================================================================================================
3258 //
3259 // UTILITY FUNCTIONS
3260 //
3261 //=================================================================================================
3262 
3263 //*************************************************************************************************
3269 template< typename MT > // Type of the dense matrix
3270 inline size_t DenseRow<MT,false,false>::size() const
3271 {
3272  return matrix_.columns();
3273 }
3275 //*************************************************************************************************
3276 
3277 
3278 //*************************************************************************************************
3284 template< typename MT > // Type of the dense matrix
3285 inline size_t DenseRow<MT,false,false>::capacity() const
3286 {
3287  return matrix_.columns();
3288 }
3290 //*************************************************************************************************
3291 
3292 
3293 //*************************************************************************************************
3302 template< typename MT > // Type of the dense matrix
3303 inline size_t DenseRow<MT,false,false>::nonZeros() const
3304 {
3305  const size_t columns( size() );
3306  size_t nonzeros( 0UL );
3307 
3308  for( size_t j=0UL; j<columns; ++j )
3309  if( !isDefault( matrix_(row_,j) ) )
3310  ++nonzeros;
3311 
3312  return nonzeros;
3313 }
3315 //*************************************************************************************************
3316 
3317 
3318 //*************************************************************************************************
3324 template< typename MT > // Type of the dense matrix
3325 inline void DenseRow<MT,false,false>::reset()
3326 {
3327  using blaze::clear;
3328 
3329  const size_t jbegin( ( IsUpper<MT>::value )
3330  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3331  ?( row_+1UL )
3332  :( row_ ) )
3333  :( 0UL ) );
3334  const size_t jend ( ( IsLower<MT>::value )
3335  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3336  ?( row_ )
3337  :( row_+1UL ) )
3338  :( size() ) );
3339 
3340  for( size_t j=jbegin; j<jend; ++j )
3341  clear( matrix_(row_,j) );
3342 }
3344 //*************************************************************************************************
3345 
3346 
3347 //*************************************************************************************************
3358 template< typename MT > // Type of the dense matrix
3359 template< typename Other > // Data type of the scalar value
3360 inline DenseRow<MT,false,false>& DenseRow<MT,false,false>::scale( const Other& scalar )
3361 {
3363 
3364  const size_t jbegin( ( IsUpper<MT>::value )
3365  ?( ( IsStrictlyUpper<MT>::value )
3366  ?( row_+1UL )
3367  :( row_ ) )
3368  :( 0UL ) );
3369  const size_t jend ( ( IsLower<MT>::value )
3370  ?( ( IsStrictlyLower<MT>::value )
3371  ?( row_ )
3372  :( row_+1UL ) )
3373  :( size() ) );
3374 
3375  for( size_t j=jbegin; j<jend; ++j ) {
3376  matrix_(row_,j) *= scalar;
3377  }
3378 
3379  return *this;
3380 }
3382 //*************************************************************************************************
3383 
3384 
3385 //*************************************************************************************************
3397 template< typename MT > // Type of the dense matrix
3398 template< typename MT2 // Type of the left-hand side dense matrix
3399  , bool SO2 // Storage order of the left-hand side dense matrix
3400  , typename VT > // Type of the right-hand side vector
3401 inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
3402  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,true>& rhs )
3403 {
3404  UNUSED_PARAMETER( lhs, rhs );
3405 
3406  return true;
3407 }
3409 //*************************************************************************************************
3410 
3411 
3412 //*************************************************************************************************
3424 template< typename MT > // Type of the dense matrix
3425 template< typename MT2 // Type of the left-hand side dense matrix
3426  , bool SO2 // Storage order of the left-hand side dense matrix
3427  , typename VT > // Type of the right-hand side dense vector
3428 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3429  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs )
3430 {
3432 
3433  UNUSED_PARAMETER( lhs );
3434 
3435  if( IsUniLower<MT2>::value && !isOne( (~rhs)[row_] ) )
3436  return false;
3437 
3438  const size_t ibegin( ( IsStrictlyLower<MT2>::value )?( row_ ):( row_+1UL ) );
3439 
3440  for( size_t i=ibegin; i<size(); ++i ) {
3441  if( !isDefault( (~rhs)[i] ) )
3442  return false;
3443  }
3444 
3445  return true;
3446 }
3448 //*************************************************************************************************
3449 
3450 
3451 //*************************************************************************************************
3463 template< typename MT > // Type of the dense matrix
3464 template< typename MT2 // Type of the left-hand side dense matrix
3465  , bool SO2 // Storage order of the left-hand side dense matrix
3466  , typename VT > // Type of the right-hand side sparse vector
3467 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3468  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs )
3469 {
3471 
3472  UNUSED_PARAMETER( lhs );
3473 
3474  typedef typename VT::ConstIterator RhsIterator;
3475 
3476  const bool checkDiagonal( IsUniLower<MT2>::value || IsStrictlyLower<MT2>::value );
3477  const RhsIterator last( (~rhs).end() );
3478  RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( row_ ):( row_+1UL ) ) );
3479 
3480  if( IsUniLower<MT2>::value ) {
3481  if( element == last || element->index() != row_ || !isOne( element->value() ) )
3482  return false;
3483  ++element;
3484  }
3485 
3486  for( ; element!=last; ++element ) {
3487  if( !isDefault( element->value() ) )
3488  return false;
3489  }
3490 
3491  return true;
3492 }
3494 //*************************************************************************************************
3495 
3496 
3497 //*************************************************************************************************
3509 template< typename MT > // Type of the dense matrix
3510 template< typename MT2 // Type of the left-hand side dense matrix
3511  , bool SO2 // Storage order of the left-hand side dense matrix
3512  , typename VT > // Type of the right-hand side dense vector
3513 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3514  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs )
3515 {
3517 
3518  UNUSED_PARAMETER( lhs );
3519 
3520  const size_t iend( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) );
3521 
3522  for( size_t i=0UL; i<iend; ++i ) {
3523  if( !isDefault( (~rhs)[i] ) )
3524  return false;
3525  }
3526 
3527  if( IsUniUpper<MT2>::value && !isOne( (~rhs)[row_] ) )
3528  return false;
3529 
3530  return true;
3531 }
3533 //*************************************************************************************************
3534 
3535 
3536 //*************************************************************************************************
3548 template< typename MT > // Type of the dense matrix
3549 template< typename MT2 // Type of the left-hand side dense matrix
3550  , bool SO2 // Storage order of the left-hand side dense matrix
3551  , typename VT > // Type of the right-hand side sparse vector
3552 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
3553  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs )
3554 {
3556 
3557  UNUSED_PARAMETER( lhs );
3558 
3559  typedef typename VT::ConstIterator RhsIterator;
3560 
3561  const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) ) );
3562 
3563  if( IsUniUpper<MT2>::value && ( last == (~rhs).end() || last->index() != row_ || !isOne( last->value() ) ) )
3564  return false;
3565 
3566  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
3567  if( !isDefault( element->value() ) )
3568  return false;
3569  }
3570 
3571  return true;
3572 }
3574 //*************************************************************************************************
3575 
3576 
3577 //*************************************************************************************************
3589 template< typename MT > // Type of the dense matrix
3590 template< typename MT2 // Type of the left-hand side dense matrix
3591  , bool SO2 // Storage order of the left-hand side dense matrix
3592  , typename VT > // Type of the right-hand side dense vector
3593 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
3594  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs )
3595 {
3597 
3598  UNUSED_PARAMETER( lhs );
3599 
3600  for( size_t i=0UL; i<row_; ++i ) {
3601  if( !isDefault( (~rhs)[i] ) )
3602  return false;
3603  }
3604 
3605  for( size_t i=row_+1UL; i<size(); ++i ) {
3606  if( !isDefault( (~rhs)[i] ) )
3607  return false;
3608  }
3609 
3610  return true;
3611 }
3613 //*************************************************************************************************
3614 
3615 
3616 //*************************************************************************************************
3628 template< typename MT > // Type of the dense matrix
3629 template< typename MT2 // Type of the left-hand side dense matrix
3630  , bool SO2 // Storage order of the left-hand side dense matrix
3631  , typename VT > // Type of the right-hand side sparse vector
3632 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
3633  DenseRow<MT,false,false>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs )
3634 {
3636 
3637  UNUSED_PARAMETER( lhs );
3638 
3639  typedef typename VT::ConstIterator RhsIterator;
3640 
3641  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3642  if( element->index() != row_ && !isDefault( element->value() ) )
3643  return false;
3644  }
3645 
3646  return true;
3647 }
3649 //*************************************************************************************************
3650 
3651 
3652 
3653 
3654 //=================================================================================================
3655 //
3656 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
3657 //
3658 //=================================================================================================
3659 
3660 //*************************************************************************************************
3671 template< typename MT > // Type of the dense matrix
3672 template< typename Other > // Data type of the foreign expression
3673 inline bool DenseRow<MT,false,false>::canAlias( const Other* alias ) const
3674 {
3675  return matrix_.isAliased( alias );
3676 }
3678 //*************************************************************************************************
3679 
3680 
3681 //*************************************************************************************************
3692 template< typename MT > // Type of the dense matrix
3693 template< typename MT2 // Data type of the foreign dense row
3694  , bool SO2 // Storage order of the foreign dense row
3695  , bool SF2 > // Symmetry flag of the foreign dense row
3696 inline bool DenseRow<MT,false,false>::canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const
3697 {
3698  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3699 }
3701 //*************************************************************************************************
3702 
3703 
3704 //*************************************************************************************************
3715 template< typename MT > // Type of the dense matrix
3716 template< typename Other > // Data type of the foreign expression
3717 inline bool DenseRow<MT,false,false>::isAliased( const Other* alias ) const
3718 {
3719  return matrix_.isAliased( alias );
3720 }
3722 //*************************************************************************************************
3723 
3724 
3725 //*************************************************************************************************
3736 template< typename MT > // Type of the dense matrix
3737 template< typename MT2 // Data type of the foreign dense row
3738  , bool SO2 // Storage order of the foreign dense row
3739  , bool SF2 > // Symmetry flag of the foreign dense row
3740 inline bool DenseRow<MT,false,false>::isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const
3741 {
3742  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3743 }
3745 //*************************************************************************************************
3746 
3747 
3748 //*************************************************************************************************
3758 template< typename MT > // Type of the dense matrix
3759 inline bool DenseRow<MT,false,false>::isAligned() const
3760 {
3761  return false;
3762 }
3764 //*************************************************************************************************
3765 
3766 
3767 //*************************************************************************************************
3778 template< typename MT > // Type of the dense matrix
3779 inline bool DenseRow<MT,false,false>::canSMPAssign() const
3780 {
3781  return ( size() > SMP_DVECASSIGN_THRESHOLD );
3782 }
3784 //*************************************************************************************************
3785 
3786 
3787 //*************************************************************************************************
3799 template< typename MT > // Type of the dense matrix
3800 template< typename VT > // Type of the right-hand side dense vector
3801 inline void DenseRow<MT,false,false>::assign( const DenseVector<VT,true>& rhs )
3802 {
3804 
3805  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3806 
3807  const size_t jpos( (~rhs).size() & size_t(-2) );
3808  for( size_t j=0UL; j<jpos; j+=2UL ) {
3809  matrix_(row_,j ) = (~rhs)[j ];
3810  matrix_(row_,j+1UL) = (~rhs)[j+1UL];
3811  }
3812  if( jpos < (~rhs).size() )
3813  matrix_(row_,jpos) = (~rhs)[jpos];
3814 }
3816 //*************************************************************************************************
3817 
3818 
3819 //*************************************************************************************************
3831 template< typename MT > // Type of the dense matrix
3832 template< typename VT > // Type of the right-hand side sparse vector
3833 inline void DenseRow<MT,false,false>::assign( const SparseVector<VT,true>& rhs )
3834 {
3836 
3837  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3838 
3839  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3840  matrix_(row_,element->index()) = element->value();
3841 }
3843 //*************************************************************************************************
3844 
3845 
3846 //*************************************************************************************************
3858 template< typename MT > // Type of the dense matrix
3859 template< typename VT > // Type of the right-hand side dense vector
3860 inline void DenseRow<MT,false,false>::addAssign( const DenseVector<VT,true>& rhs )
3861 {
3863 
3864  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3865 
3866  const size_t jpos( (~rhs).size() & size_t(-2) );
3867  for( size_t j=0UL; j<jpos; j+=2UL ) {
3868  matrix_(row_,j ) += (~rhs)[j ];
3869  matrix_(row_,j+1UL) += (~rhs)[j+1UL];
3870  }
3871  if( jpos < (~rhs).size() )
3872  matrix_(row_,jpos) += (~rhs)[jpos];
3873 }
3875 //*************************************************************************************************
3876 
3877 
3878 //*************************************************************************************************
3890 template< typename MT > // Type of the dense matrix
3891 template< typename VT > // Type of the right-hand side sparse vector
3892 inline void DenseRow<MT,false,false>::addAssign( const SparseVector<VT,true>& rhs )
3893 {
3895 
3896  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3897 
3898  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3899  matrix_(row_,element->index()) += element->value();
3900 }
3902 //*************************************************************************************************
3903 
3904 
3905 //*************************************************************************************************
3917 template< typename MT > // Type of the dense matrix
3918 template< typename VT > // Type of the right-hand side dense vector
3919 inline void DenseRow<MT,false,false>::subAssign( const DenseVector<VT,true>& rhs )
3920 {
3922 
3923  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3924 
3925  const size_t jpos( (~rhs).size() & size_t(-2) );
3926  for( size_t j=0UL; j<jpos; j+=2UL ) {
3927  matrix_(row_,j ) -= (~rhs)[j ];
3928  matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
3929  }
3930  if( jpos < (~rhs).size() )
3931  matrix_(row_,jpos) -= (~rhs)[jpos];
3932 }
3934 //*************************************************************************************************
3935 
3936 
3937 //*************************************************************************************************
3949 template< typename MT > // Type of the dense matrix
3950 template< typename VT > // Type of the right-hand side sparse vector
3951 inline void DenseRow<MT,false,false>::subAssign( const SparseVector<VT,true>& rhs )
3952 {
3954 
3955  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3956 
3957  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3958  matrix_(row_,element->index()) -= element->value();
3959 }
3961 //*************************************************************************************************
3962 
3963 
3964 //*************************************************************************************************
3976 template< typename MT > // Type of the dense matrix
3977 template< typename VT > // Type of the right-hand side dense vector
3978 inline void DenseRow<MT,false,false>::multAssign( const DenseVector<VT,true>& rhs )
3979 {
3981 
3982  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
3983 
3984  const size_t jpos( (~rhs).size() & size_t(-2) );
3985  for( size_t j=0UL; j<jpos; j+=2UL ) {
3986  matrix_(row_,j ) *= (~rhs)[j ];
3987  matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
3988  }
3989  if( jpos < (~rhs).size() )
3990  matrix_(row_,jpos) *= (~rhs)[jpos];
3991 }
3993 //*************************************************************************************************
3994 
3995 
3996 //*************************************************************************************************
4008 template< typename MT > // Type of the dense matrix
4009 template< typename VT > // Type of the right-hand side sparse vector
4010 inline void DenseRow<MT,false,false>::multAssign( const SparseVector<VT,true>& rhs )
4011 {
4013 
4014  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
4015 
4016  const ResultType tmp( serial( *this ) );
4017 
4018  reset();
4019 
4020  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
4021  matrix_(row_,element->index()) = tmp[element->index()] * element->value();
4022 }
4024 //*************************************************************************************************
4025 
4026 
4027 
4028 
4029 
4030 
4031 
4032 
4033 //=================================================================================================
4034 //
4035 // CLASS TEMPLATE SPECIALIZATION FOR SYMMETRIC COLUMN-MAJOR MATRICES
4036 //
4037 //=================================================================================================
4038 
4039 //*************************************************************************************************
4047 template< typename MT > // Type of the dense matrix
4048 class DenseRow<MT,false,true> : public DenseVector< DenseRow<MT,false,true>, true >
4049  , private Row
4050 {
4051  private:
4052  //**Type definitions****************************************************************************
4054  typedef typename If< IsExpression<MT>, MT, MT& >::Type Operand;
4055 
4057  typedef IntrinsicTrait<typename MT::ElementType> IT;
4058  //**********************************************************************************************
4059 
4060  //**********************************************************************************************
4062 
4068  enum { useConst = IsConst<MT>::value };
4069  //**********************************************************************************************
4070 
4071  public:
4072  //**Type definitions****************************************************************************
4073  typedef DenseRow<MT,false,true> This;
4074  typedef typename RowTrait<MT>::Type ResultType;
4075  typedef typename ResultType::TransposeType TransposeType;
4076  typedef typename MT::ElementType ElementType;
4077  typedef typename IT::Type IntrinsicType;
4078  typedef typename MT::ReturnType ReturnType;
4079  typedef const DenseRow& CompositeType;
4080 
4082  typedef typename MT::ConstReference ConstReference;
4083 
4085  typedef typename IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference;
4086 
4088  typedef const ElementType* ConstPointer;
4089 
4091  typedef typename IfTrue< useConst, ConstPointer, ElementType* >::Type Pointer;
4092 
4094  typedef typename MT::ConstIterator ConstIterator;
4095 
4097  typedef typename IfTrue< useConst, ConstIterator, typename MT::Iterator >::Type Iterator;
4098  //**********************************************************************************************
4099 
4100  //**Compilation flags***************************************************************************
4102  enum { vectorizable = MT::vectorizable };
4103 
4105  enum { smpAssignable = MT::smpAssignable };
4106  //**********************************************************************************************
4107 
4108  //**Constructors********************************************************************************
4111  explicit inline DenseRow( MT& matrix, size_t index );
4112  // No explicitly declared copy constructor.
4114  //**********************************************************************************************
4115 
4116  //**Destructor**********************************************************************************
4117  // No explicitly declared destructor.
4118  //**********************************************************************************************
4119 
4120  //**Data access functions***********************************************************************
4123  inline Reference operator[]( size_t index );
4124  inline ConstReference operator[]( size_t index ) const;
4125  inline Pointer data ();
4126  inline ConstPointer data () const;
4127  inline Iterator begin ();
4128  inline ConstIterator begin () const;
4129  inline ConstIterator cbegin() const;
4130  inline Iterator end ();
4131  inline ConstIterator end () const;
4132  inline ConstIterator cend () const;
4134  //**********************************************************************************************
4135 
4136  //**Assignment operators************************************************************************
4139  inline DenseRow& operator=( const ElementType& rhs );
4140  inline DenseRow& operator=( const DenseRow& rhs );
4141 
4142  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
4143  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
4144  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
4145  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
4146 
4147  template< typename Other >
4148  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
4149  operator*=( Other rhs );
4150 
4151  template< typename Other >
4152  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
4153  operator/=( Other rhs );
4155  //**********************************************************************************************
4156 
4157  //**Utility functions***************************************************************************
4160  inline size_t size() const;
4161  inline size_t capacity() const;
4162  inline size_t nonZeros() const;
4163  inline void reset();
4164  template< typename Other > inline DenseRow& scale( const Other& scalar );
4166  //**********************************************************************************************
4167 
4168  private:
4169  //**********************************************************************************************
4171  template< typename VT >
4172  struct VectorizedAssign {
4173  enum { value = vectorizable && VT::vectorizable &&
4174  IsSame<ElementType,typename VT::ElementType>::value };
4175  };
4176  //**********************************************************************************************
4177 
4178  //**********************************************************************************************
4180  template< typename VT >
4181  struct VectorizedAddAssign {
4182  enum { value = vectorizable && VT::vectorizable &&
4183  IsSame<ElementType,typename VT::ElementType>::value &&
4184  IntrinsicTrait<ElementType>::addition };
4185  };
4186  //**********************************************************************************************
4187 
4188  //**********************************************************************************************
4190  template< typename VT >
4191  struct VectorizedSubAssign {
4192  enum { value = vectorizable && VT::vectorizable &&
4193  IsSame<ElementType,typename VT::ElementType>::value &&
4194  IntrinsicTrait<ElementType>::subtraction };
4195  };
4196  //**********************************************************************************************
4197 
4198  //**********************************************************************************************
4200  template< typename VT >
4201  struct VectorizedMultAssign {
4202  enum { value = vectorizable && VT::vectorizable &&
4203  IsSame<ElementType,typename VT::ElementType>::value &&
4204  IntrinsicTrait<ElementType>::multiplication };
4205  };
4206  //**********************************************************************************************
4207 
4208  public:
4209  //**Expression template evaluation functions****************************************************
4212  template< typename Other >
4213  inline bool canAlias( const Other* alias ) const;
4214 
4215  template< typename MT2, bool SO2, bool SF2 >
4216  inline bool canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const;
4217 
4218  template< typename Other >
4219  inline bool isAliased( const Other* alias ) const;
4220 
4221  template< typename MT2, bool SO2, bool SF2 >
4222  inline bool isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const;
4223 
4224  inline bool isAligned () const;
4225  inline bool canSMPAssign() const;
4226 
4227  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
4228  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
4229 
4230  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
4231  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
4232  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
4233 
4234  template< typename VT >
4235  inline typename DisableIf< VectorizedAssign<VT> >::Type
4236  assign( const DenseVector<VT,true>& rhs );
4237 
4238  template< typename VT >
4239  inline typename EnableIf< VectorizedAssign<VT> >::Type
4240  assign( const DenseVector<VT,true>& rhs );
4241 
4242  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
4243 
4244  template< typename VT >
4245  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
4246  addAssign( const DenseVector<VT,true>& rhs );
4247 
4248  template< typename VT >
4249  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
4250  addAssign( const DenseVector<VT,true>& rhs );
4251 
4252  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
4253 
4254  template< typename VT >
4255  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
4256  subAssign( const DenseVector<VT,true>& rhs );
4257 
4258  template< typename VT >
4259  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
4260  subAssign( const DenseVector<VT,true>& rhs );
4261 
4262  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
4263 
4264  template< typename VT >
4265  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
4266  multAssign( const DenseVector<VT,true>& rhs );
4267 
4268  template< typename VT >
4269  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
4270  multAssign( const DenseVector<VT,true>& rhs );
4271 
4272  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
4274  //**********************************************************************************************
4275 
4276  private:
4277  //**Utility functions***************************************************************************
4280  template< typename MT2, bool SO2, typename VT >
4281  inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
4282  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,true>& rhs );
4283 
4284  template< typename MT2, bool SO2, typename VT >
4285  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4286  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
4287 
4288  template< typename MT2, bool SO2, typename VT >
4289  inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4290  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
4291 
4292  template< typename MT2, bool SO2, typename VT >
4293  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4294  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
4295 
4296  template< typename MT2, bool SO2, typename VT >
4297  inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
4298  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
4299 
4300  template< typename MT2, bool SO2, typename VT >
4301  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
4302  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs );
4303 
4304  template< typename MT2, bool SO2, typename VT >
4305  inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
4306  preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs );
4308  //**********************************************************************************************
4309 
4310  //**Member variables****************************************************************************
4313  Operand matrix_;
4314  const size_t row_;
4315 
4316  //**********************************************************************************************
4317 
4318  //**Friend declarations*************************************************************************
4319  template< typename MT2, bool SO2, bool SF2 > friend class DenseRow;
4320 
4321  template< typename MT2, bool SO2, bool SF2 >
4322  friend bool isSame( const DenseRow<MT2,SO2,SF2>& a, const DenseRow<MT2,SO2,SF2>& b );
4323 
4324  template< typename MT2, bool SO2, bool SF2 >
4325  friend typename DerestrictTrait< DenseRow<MT2,SO2,SF2> >::Type
4326  derestrict( DenseRow<MT2,SO2,SF2>& dm );
4327  //**********************************************************************************************
4328 
4329  //**Compile time checks*************************************************************************
4337  BLAZE_STATIC_ASSERT( !IsRestricted<MT>::value || IsLower<MT>::value || IsUpper<MT>::value );
4338  //**********************************************************************************************
4339 };
4341 //*************************************************************************************************
4342 
4343 
4344 
4345 
4346 //=================================================================================================
4347 //
4348 // CONSTRUCTOR
4349 //
4350 //=================================================================================================
4351 
4352 //*************************************************************************************************
4360 template< typename MT > // Type of the dense matrix
4361 inline DenseRow<MT,false,true>::DenseRow( MT& matrix, size_t index )
4362  : matrix_( matrix ) // The dense matrix containing the row
4363  , row_ ( index ) // The index of the row in the matrix
4364 {
4365  if( matrix_.rows() <= index )
4366  throw std::invalid_argument( "Invalid row access index" );
4367 }
4369 //*************************************************************************************************
4370 
4371 
4372 
4373 
4374 //=================================================================================================
4375 //
4376 // DATA ACCESS FUNCTIONS
4377 //
4378 //=================================================================================================
4379 
4380 //*************************************************************************************************
4387 template< typename MT > // Type of the dense matrix
4388 inline typename DenseRow<MT,false,true>::Reference
4389  DenseRow<MT,false,true>::operator[]( size_t index )
4390 {
4391  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4392  return matrix_(index,row_);
4393 }
4395 //*************************************************************************************************
4396 
4397 
4398 //*************************************************************************************************
4405 template< typename MT > // Type of the dense matrix
4407  DenseRow<MT,false,true>::operator[]( size_t index ) const
4408 {
4409  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
4410  return matrix_(index,row_);
4411 }
4413 //*************************************************************************************************
4414 
4415 
4416 //*************************************************************************************************
4424 template< typename MT > // Type of the dense matrix
4425 inline typename DenseRow<MT,false,true>::Pointer DenseRow<MT,false,true>::data()
4426 {
4427  return matrix_.data( row_ );
4428 }
4430 //*************************************************************************************************
4431 
4432 
4433 //*************************************************************************************************
4441 template< typename MT > // Type of the dense matrix
4442 inline typename DenseRow<MT,false,true>::ConstPointer DenseRow<MT,false,true>::data() const
4443 {
4444  return matrix_.data( row_ );
4445 }
4447 //*************************************************************************************************
4448 
4449 
4450 //*************************************************************************************************
4458 template< typename MT > // Type of the dense matrix
4460 {
4461  return matrix_.begin( row_ );
4462 }
4464 //*************************************************************************************************
4465 
4466 
4467 //*************************************************************************************************
4475 template< typename MT > // Type of the dense matrix
4477 {
4478  return matrix_.cbegin( row_ );
4479 }
4481 //*************************************************************************************************
4482 
4483 
4484 //*************************************************************************************************
4492 template< typename MT > // Type of the dense matrix
4494 {
4495  return matrix_.cbegin( row_ );
4496 }
4498 //*************************************************************************************************
4499 
4500 
4501 //*************************************************************************************************
4509 template< typename MT > // Type of the dense matrix
4511 {
4512  return matrix_.end( row_ );
4513 }
4515 //*************************************************************************************************
4516 
4517 
4518 //*************************************************************************************************
4526 template< typename MT > // Type of the dense matrix
4528 {
4529  return matrix_.cend( row_ );
4530 }
4532 //*************************************************************************************************
4533 
4534 
4535 //*************************************************************************************************
4543 template< typename MT > // Type of the dense matrix
4545 {
4546  return matrix_.cend( row_ );
4547 }
4549 //*************************************************************************************************
4550 
4551 
4552 
4553 
4554 //=================================================================================================
4555 //
4556 // ASSIGNMENT OPERATORS
4557 //
4558 //=================================================================================================
4559 
4560 //*************************************************************************************************
4567 template< typename MT > // Type of the dense matrix
4568 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator=( const ElementType& rhs )
4569 {
4570  const size_t ibegin( ( IsLower<MT>::value )
4571  ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4572  ?( row_+1UL )
4573  :( row_ ) )
4574  :( 0UL ) );
4575  const size_t iend ( ( IsUpper<MT>::value )
4576  ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4577  ?( row_ )
4578  :( row_+1UL ) )
4579  :( size() ) );
4580 
4581  for( size_t i=ibegin; i<iend; ++i )
4582  matrix_(i,row_) = rhs;
4583 
4584  return *this;
4585 }
4587 //*************************************************************************************************
4588 
4589 
4590 //*************************************************************************************************
4604 template< typename MT > // Type of the dense matrix
4605 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator=( const DenseRow& rhs )
4606 {
4607  if( &rhs == this ) return *this;
4608 
4609  if( size() != rhs.size() )
4610  throw std::invalid_argument( "Row sizes do not match" );
4611 
4612  if( !preservesInvariant( matrix_, rhs ) )
4613  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4614 
4615  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4616 
4617  smpAssign( left, rhs );
4618 
4619  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4620  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4621 
4622  return *this;
4623 }
4625 //*************************************************************************************************
4626 
4627 
4628 //*************************************************************************************************
4642 template< typename MT > // Type of the dense matrix
4643 template< typename VT > // Type of the right-hand side vector
4644 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator=( const Vector<VT,true>& rhs )
4645 {
4648 
4649  if( size() != (~rhs).size() )
4650  throw std::invalid_argument( "Vector sizes do not match" );
4651 
4652  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4653  Right right( ~rhs );
4654 
4655  if( !preservesInvariant( matrix_, right ) )
4656  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4657 
4658  if( IsSparseVector<VT>::value )
4659  reset();
4660 
4661  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4662 
4663  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4664  const typename VT::ResultType tmp( right );
4665  smpAssign( left, tmp );
4666  }
4667  else {
4668  smpAssign( left, right );
4669  }
4670 
4671  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4672  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4673 
4674  return *this;
4675 }
4677 //*************************************************************************************************
4678 
4679 
4680 //*************************************************************************************************
4694 template< typename MT > // Type of the dense matrix
4695 template< typename VT > // Type of the right-hand side vector
4696 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator+=( const Vector<VT,true>& rhs )
4697 {
4700 
4701  if( size() != (~rhs).size() )
4702  throw std::invalid_argument( "Vector sizes do not match" );
4703 
4704  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4705  Right right( ~rhs );
4706 
4707  if( !preservesInvariant( matrix_, right ) )
4708  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4709 
4710  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4711 
4712  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4713  const typename VT::ResultType tmp( right );
4714  smpAddAssign( left, tmp );
4715  }
4716  else {
4717  smpAddAssign( left, right );
4718  }
4719 
4720  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4721  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4722 
4723  return *this;
4724 }
4726 //*************************************************************************************************
4727 
4728 
4729 //*************************************************************************************************
4743 template< typename MT > // Type of the dense matrix
4744 template< typename VT > // Type of the right-hand side vector
4745 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator-=( const Vector<VT,true>& rhs )
4746 {
4749 
4750  if( size() != (~rhs).size() )
4751  throw std::invalid_argument( "Vector sizes do not match" );
4752 
4753  typedef typename If< IsRestricted<MT>, typename VT::CompositeType, const VT& >::Type Right;
4754  Right right( ~rhs );
4755 
4756  if( !preservesInvariant( matrix_, right ) )
4757  throw std::invalid_argument( "Invalid assignment to restricted matrix" );
4758 
4759  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4760 
4761  if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4762  const typename VT::ResultType tmp( right );
4763  smpSubAssign( left, tmp );
4764  }
4765  else {
4766  smpSubAssign( left, right );
4767  }
4768 
4769  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4770  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4771 
4772  return *this;
4773 }
4775 //*************************************************************************************************
4776 
4777 
4778 //*************************************************************************************************
4790 template< typename MT > // Type of the dense matrix
4791 template< typename VT > // Type of the right-hand side vector
4792 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::operator*=( const Vector<VT,true>& rhs )
4793 {
4796 
4797  if( size() != (~rhs).size() )
4798  throw std::invalid_argument( "Vector sizes do not match" );
4799 
4800  typename DerestrictTrait<This>::Type left( derestrict( *this ) );
4801 
4802  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
4803  const ResultType tmp( *this * (~rhs) );
4804  smpAssign( left, tmp );
4805  }
4806  else {
4807  smpMultAssign( left, ~rhs );
4808  }
4809 
4810  BLAZE_INTERNAL_ASSERT( !IsLower<MT>::value || isLower( derestrict( matrix_ ) ), "Lower violation detected" );
4811  BLAZE_INTERNAL_ASSERT( !IsUpper<MT>::value || isUpper( derestrict( matrix_ ) ), "Upper violation detected" );
4812 
4813  return *this;
4814 }
4816 //*************************************************************************************************
4817 
4818 
4819 //*************************************************************************************************
4830 template< typename MT > // Type of the dense matrix
4831 template< typename Other > // Data type of the right-hand side scalar
4832 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,true> >::Type&
4833  DenseRow<MT,false,true>::operator*=( Other rhs )
4834 {
4836 
4837  return operator=( (*this) * rhs );
4838 }
4840 //*************************************************************************************************
4841 
4842 
4843 //*************************************************************************************************
4856 template< typename MT > // Type of the dense matrix
4857 template< typename Other > // Data type of the right-hand side scalar
4858 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false,true> >::Type&
4859  DenseRow<MT,false,true>::operator/=( Other rhs )
4860 {
4862 
4863  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
4864 
4865  return operator=( (*this) / rhs );
4866 }
4868 //*************************************************************************************************
4869 
4870 
4871 
4872 
4873 //=================================================================================================
4874 //
4875 // UTILITY FUNCTIONS
4876 //
4877 //=================================================================================================
4878 
4879 //*************************************************************************************************
4885 template< typename MT > // Type of the dense matrix
4886 inline size_t DenseRow<MT,false,true>::size() const
4887 {
4888  return matrix_.columns();
4889 }
4891 //*************************************************************************************************
4892 
4893 
4894 //*************************************************************************************************
4900 template< typename MT > // Type of the dense matrix
4901 inline size_t DenseRow<MT,false,true>::capacity() const
4902 {
4903  return matrix_.capacity( row_ );
4904 }
4906 //*************************************************************************************************
4907 
4908 
4909 //*************************************************************************************************
4918 template< typename MT > // Type of the dense matrix
4919 inline size_t DenseRow<MT,false,true>::nonZeros() const
4920 {
4921  return matrix_.nonZeros( row_ );
4922 }
4924 //*************************************************************************************************
4925 
4926 
4927 //*************************************************************************************************
4933 template< typename MT > // Type of the dense matrix
4934 inline void DenseRow<MT,false,true>::reset()
4935 {
4936  matrix_.reset( row_ );
4937 }
4939 //*************************************************************************************************
4940 
4941 
4942 //*************************************************************************************************
4953 template< typename MT > // Type of the dense matrix
4954 template< typename Other > // Data type of the scalar value
4955 inline DenseRow<MT,false,true>& DenseRow<MT,false,true>::scale( const Other& scalar )
4956 {
4958 
4959  const size_t ibegin( ( IsLower<MT>::value )
4960  ?( ( IsStrictlyLower<MT>::value )
4961  ?( row_+1UL )
4962  :( row_ ) )
4963  :( 0UL ) );
4964  const size_t iend ( ( IsUpper<MT>::value )
4965  ?( ( IsStrictlyUpper<MT>::value )
4966  ?( row_ )
4967  :( row_+1UL ) )
4968  :( size() ) );
4969 
4970  for( size_t i=ibegin; i<iend; ++i ) {
4971  matrix_(i,row_) *= scalar;
4972  }
4973 
4974  return *this;
4975 }
4977 //*************************************************************************************************
4978 
4979 
4980 //*************************************************************************************************
4992 template< typename MT > // Type of the dense matrix
4993 template< typename MT2 // Type of the left-hand side dense matrix
4994  , bool SO2 // Storage order of the left-hand side dense matrix
4995  , typename VT > // Type of the right-hand side vector
4996 inline typename EnableIf< Not< IsRestricted<MT2> >, bool >::Type
4997  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const Vector<VT,true>& rhs )
4998 {
4999  UNUSED_PARAMETER( lhs, rhs );
5000 
5001  return true;
5002 }
5004 //*************************************************************************************************
5005 
5006 
5007 //*************************************************************************************************
5019 template< typename MT > // Type of the dense matrix
5020 template< typename MT2 // Type of the left-hand side dense matrix
5021  , bool SO2 // Storage order of the left-hand side dense matrix
5022  , typename VT > // Type of the right-hand side dense vector
5023 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5024  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs )
5025 {
5027 
5028  UNUSED_PARAMETER( lhs );
5029 
5030  if( IsUniLower<MT2>::value && !isOne( (~rhs)[row_] ) )
5031  return false;
5032 
5033  const size_t ibegin( ( IsStrictlyLower<MT2>::value )?( row_ ):( row_+1UL ) );
5034 
5035  for( size_t i=ibegin; i<size(); ++i ) {
5036  if( !isDefault( (~rhs)[i] ) )
5037  return false;
5038  }
5039 
5040  return true;
5041 }
5043 //*************************************************************************************************
5044 
5045 
5046 //*************************************************************************************************
5058 template< typename MT > // Type of the dense matrix
5059 template< typename MT2 // Type of the left-hand side dense matrix
5060  , bool SO2 // Storage order of the left-hand side dense matrix
5061  , typename VT > // Type of the right-hand side sparse vector
5062 inline typename EnableIf< And< IsLower<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5063  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs )
5064 {
5066 
5067  UNUSED_PARAMETER( lhs );
5068 
5069  typedef typename VT::ConstIterator RhsIterator;
5070 
5071  const bool checkDiagonal( IsUniLower<MT2>::value || IsStrictlyLower<MT2>::value );
5072  const RhsIterator last( (~rhs).end() );
5073  RhsIterator element( (~rhs).lowerBound( ( checkDiagonal )?( row_ ):( row_+1UL ) ) );
5074 
5075  if( IsUniLower<MT2>::value ) {
5076  if( element == last || element->index() != row_ || !isOne( element->value() ) )
5077  return false;
5078  ++element;
5079  }
5080 
5081  for( ; element!=last; ++element ) {
5082  if( !isDefault( element->value() ) )
5083  return false;
5084  }
5085 
5086  return true;
5087 }
5089 //*************************************************************************************************
5090 
5091 
5092 //*************************************************************************************************
5104 template< typename MT > // Type of the dense matrix
5105 template< typename MT2 // Type of the left-hand side dense matrix
5106  , bool SO2 // Storage order of the left-hand side dense matrix
5107  , typename VT > // Type of the right-hand side dense vector
5108 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5109  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs )
5110 {
5112 
5113  UNUSED_PARAMETER( lhs );
5114 
5115  const size_t iend( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) );
5116 
5117  for( size_t i=0UL; i<iend; ++i ) {
5118  if( !isDefault( (~rhs)[i] ) )
5119  return false;
5120  }
5121 
5122  if( IsUniUpper<MT2>::value && !isOne( (~rhs)[row_] ) )
5123  return false;
5124 
5125  return true;
5126 }
5128 //*************************************************************************************************
5129 
5130 
5131 //*************************************************************************************************
5143 template< typename MT > // Type of the dense matrix
5144 template< typename MT2 // Type of the left-hand side dense matrix
5145  , bool SO2 // Storage order of the left-hand side dense matrix
5146  , typename VT > // Type of the right-hand side sparse vector
5147 inline typename EnableIf< And< IsUpper<MT2>, Not< IsDiagonal<MT2> > >, bool >::Type
5148  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs )
5149 {
5151 
5152  UNUSED_PARAMETER( lhs );
5153 
5154  typedef typename VT::ConstIterator RhsIterator;
5155 
5156  const RhsIterator last( (~rhs).lowerBound( ( IsStrictlyUpper<MT2>::value )?( row_+1UL ):( row_ ) ) );
5157 
5158  if( IsUniUpper<MT2>::value && ( last == (~rhs).end() || last->index() != row_ || !isOne( last->value() ) ) )
5159  return false;
5160 
5161  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
5162  if( !isDefault( element->value() ) )
5163  return false;
5164  }
5165 
5166  return true;
5167 }
5169 //*************************************************************************************************
5170 
5171 
5172 //*************************************************************************************************
5184 template< typename MT > // Type of the dense matrix
5185 template< typename MT2 // Type of the left-hand side dense matrix
5186  , bool SO2 // Storage order of the left-hand side dense matrix
5187  , typename VT > // Type of the right-hand side dense vector
5188 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
5189  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const DenseVector<VT,true>& rhs )
5190 {
5192 
5193  UNUSED_PARAMETER( lhs );
5194 
5195  for( size_t i=0UL; i<row_; ++i ) {
5196  if( !isDefault( (~rhs)[i] ) )
5197  return false;
5198  }
5199 
5200  for( size_t i=row_+1UL; i<size(); ++i ) {
5201  if( !isDefault( (~rhs)[i] ) )
5202  return false;
5203  }
5204 
5205  return true;
5206 }
5208 //*************************************************************************************************
5209 
5210 
5211 //*************************************************************************************************
5223 template< typename MT > // Type of the dense matrix
5224 template< typename MT2 // Type of the left-hand side dense matrix
5225  , bool SO2 // Storage order of the left-hand side dense matrix
5226  , typename VT > // Type of the right-hand side sparse vector
5227 inline typename EnableIf< IsDiagonal<MT2>, bool >::Type
5228  DenseRow<MT,false,true>::preservesInvariant( const DenseMatrix<MT2,SO2>& lhs, const SparseVector<VT,true>& rhs )
5229 {
5231 
5232  UNUSED_PARAMETER( lhs );
5233 
5234  typedef typename VT::ConstIterator RhsIterator;
5235 
5236  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
5237  if( element->index() != row_ && !isDefault( element->value() ) )
5238  return false;
5239  }
5240 
5241  return true;
5242 }
5244 //*************************************************************************************************
5245 
5246 
5247 
5248 
5249 //=================================================================================================
5250 //
5251 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5252 //
5253 //=================================================================================================
5254 
5255 //*************************************************************************************************
5266 template< typename MT > // Type of the dense matrix
5267 template< typename Other > // Data type of the foreign expression
5268 inline bool DenseRow<MT,false,true>::canAlias( const Other* alias ) const
5269 {
5270  return matrix_.isAliased( alias );
5271 }
5273 //*************************************************************************************************
5274 
5275 
5276 //*************************************************************************************************
5287 template< typename MT > // Type of the dense matrix
5288 template< typename MT2 // Data type of the foreign dense row
5289  , bool SO2 // Storage order of the foreign dense row
5290  , bool SF2 > // Symmetry flag of the foreign dense row
5291 inline bool DenseRow<MT,false,true>::canAlias( const DenseRow<MT2,SO2,SF2>* alias ) const
5292 {
5293  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5294 }
5296 //*************************************************************************************************
5297 
5298 
5299 //*************************************************************************************************
5310 template< typename MT > // Type of the dense matrix
5311 template< typename Other > // Data type of the foreign expression
5312 inline bool DenseRow<MT,false,true>::isAliased( const Other* alias ) const
5313 {
5314  return matrix_.isAliased( alias );
5315 }
5317 //*************************************************************************************************
5318 
5319 
5320 //*************************************************************************************************
5331 template< typename MT > // Type of the dense matrix
5332 template< typename MT2 // Data type of the foreign dense row
5333  , bool SO2 // Storage order of the foreign dense row
5334  , bool SF2 > // Symmetry flag of the foreign dense row
5335 inline bool DenseRow<MT,false,true>::isAliased( const DenseRow<MT2,SO2,SF2>* alias ) const
5336 {
5337  return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5338 }
5340 //*************************************************************************************************
5341 
5342 
5343 //*************************************************************************************************
5353 template< typename MT > // Type of the dense matrix
5354 inline bool DenseRow<MT,false,true>::isAligned() const
5355 {
5356  return matrix_.isAligned();
5357 }
5359 //*************************************************************************************************
5360 
5361 
5362 //*************************************************************************************************
5373 template< typename MT > // Type of the dense matrix
5374 inline bool DenseRow<MT,false,true>::canSMPAssign() const
5375 {
5376  return ( size() > SMP_DVECASSIGN_THRESHOLD );
5377 }
5379 //*************************************************************************************************
5380 
5381 
5382 //*************************************************************************************************
5395 template< typename MT > // Type of the dense matrix
5396 BLAZE_ALWAYS_INLINE typename DenseRow<MT,false,true>::IntrinsicType
5397  DenseRow<MT,false,true>::load( size_t index ) const
5398 {
5399  return matrix_.load( index, row_ );
5400 }
5402 //*************************************************************************************************
5403 
5404 
5405 //*************************************************************************************************
5418 template< typename MT > // Type of the dense matrix
5419 BLAZE_ALWAYS_INLINE typename DenseRow<MT,false,true>::IntrinsicType
5420  DenseRow<MT,false,true>::loadu( size_t index ) const
5421 {
5422  return matrix_.loadu( index, row_ );
5423 }
5425 //*************************************************************************************************
5426 
5427 
5428 //*************************************************************************************************
5442 template< typename MT > // Type of the dense matrix
5443 BLAZE_ALWAYS_INLINE void DenseRow<MT,false,true>::store( size_t index, const IntrinsicType& value )
5444 {
5445  matrix_.store( index, row_, value );
5446 }
5448 //*************************************************************************************************
5449 
5450 
5451 //*************************************************************************************************
5465 template< typename MT > // Type of the dense matrix
5466 BLAZE_ALWAYS_INLINE void DenseRow<MT,false,true>::storeu( size_t index, const IntrinsicType& value )
5467 {
5468  matrix_.storeu( index, row_, value );
5469 }
5471 //*************************************************************************************************
5472 
5473 
5474 //*************************************************************************************************
5488 template< typename MT > // Type of the dense matrix
5489 BLAZE_ALWAYS_INLINE void DenseRow<MT,false,true>::stream( size_t index, const IntrinsicType& value )
5490 {
5491  matrix_.stream( index, row_, value );
5492 }
5494 //*************************************************************************************************
5495 
5496 
5497 //*************************************************************************************************
5509 template< typename MT > // Type of the dense matrix
5510 template< typename VT > // Type of the right-hand side dense vector
5511 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5512  DenseRow<MT,false,true>::assign( const DenseVector<VT,true>& rhs )
5513 {
5515 
5516  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5517 
5518  const size_t ipos( (~rhs).size() & size_t(-2) );
5519  for( size_t i=0UL; i<ipos; i+=2UL ) {
5520  matrix_(i ,row_) = (~rhs)[i ];
5521  matrix_(i+1UL,row_) = (~rhs)[i+1UL];
5522  }
5523  if( ipos < (~rhs).size() )
5524  matrix_(ipos,row_) = (~rhs)[ipos];
5525 }
5527 //*************************************************************************************************
5528 
5529 
5530 //*************************************************************************************************
5542 template< typename MT > // Type of the dense matrix
5543 template< typename VT > // Type of the right-hand side dense vector
5544 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
5545  DenseRow<MT,false,true>::assign( const DenseVector<VT,true>& rhs )
5546 {
5549 
5550  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5551 
5552  const size_t rows( size() );
5553 
5554  if( useStreaming && rows > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
5555  {
5556  for( size_t i=0UL; i<rows; i+=IT::size ) {
5557  matrix_.stream( i, row_, (~rhs).load(i) );
5558  }
5559  }
5560  else
5561  {
5562  const size_t ipos( rows & size_t(-IT::size*4) );
5563  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
5564 
5565  typename VT::ConstIterator it( (~rhs).begin() );
5566  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
5567  matrix_.store( i , row_, it.load() ); it += IT::size;
5568  matrix_.store( i+IT::size , row_, it.load() ); it += IT::size;
5569  matrix_.store( i+IT::size*2UL, row_, it.load() ); it += IT::size;
5570  matrix_.store( i+IT::size*3UL, row_, it.load() ); it += IT::size;
5571  }
5572  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
5573  matrix_.store( i, row_, it.load() );
5574  }
5575  }
5576 }
5578 //*************************************************************************************************
5579 
5580 
5581 //*************************************************************************************************
5593 template< typename MT > // Type of the dense matrix
5594 template< typename VT > // Type of the right-hand side sparse vector
5595 inline void DenseRow<MT,false,true>::assign( const SparseVector<VT,true>& rhs )
5596 {
5598 
5599  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5600 
5601  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5602  matrix_(element->index(),row_) = element->value();
5603 }
5605 //*************************************************************************************************
5606 
5607 
5608 //*************************************************************************************************
5620 template< typename MT > // Type of the dense matrix
5621 template< typename VT > // Type of the right-hand side dense vector
5622 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5623  DenseRow<MT,false,true>::addAssign( const DenseVector<VT,true>& rhs )
5624 {
5626 
5627  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5628 
5629  const size_t ipos( (~rhs).size() & size_t(-2) );
5630  for( size_t i=0UL; i<ipos; i+=2UL ) {
5631  matrix_(i ,row_) += (~rhs)[i ];
5632  matrix_(i+1UL,row_) += (~rhs)[i+1UL];
5633  }
5634  if( ipos < (~rhs).size() )
5635  matrix_(ipos,row_) += (~rhs)[ipos];
5636 }
5638 //*************************************************************************************************
5639 
5640 
5641 //*************************************************************************************************
5653 template< typename MT > // Type of the dense matrix
5654 template< typename VT > // Type of the right-hand side dense vector
5655 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
5656  DenseRow<MT,false,true>::addAssign( const DenseVector<VT,true>& rhs )
5657 {
5660 
5661  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5662 
5663  const size_t rows( size() );
5664 
5665  const size_t ipos( rows & size_t(-IT::size*4) );
5666  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
5667 
5668  typename VT::ConstIterator it( (~rhs).begin() );
5669  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
5670  matrix_.store( i , row_, matrix_.load(i ,row_) + it.load() ); it += IT::size;
5671  matrix_.store( i+IT::size , row_, matrix_.load(i+IT::size ,row_) + it.load() ); it += IT::size;
5672  matrix_.store( i+IT::size*2UL, row_, matrix_.load(i+IT::size*2UL,row_) + it.load() ); it += IT::size;
5673  matrix_.store( i+IT::size*3UL, row_, matrix_.load(i+IT::size*3UL,row_) + it.load() ); it += IT::size;
5674  }
5675  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
5676  matrix_.store( i, row_, matrix_.load(i,row_) + it.load() );
5677  }
5678 }
5680 //*************************************************************************************************
5681 
5682 
5683 //*************************************************************************************************
5695 template< typename MT > // Type of the dense matrix
5696 template< typename VT > // Type of the right-hand side sparse vector
5697 inline void DenseRow<MT,false,true>::addAssign( const SparseVector<VT,true>& rhs )
5698 {
5700 
5701  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5702 
5703  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5704  matrix_(element->index(),row_) += element->value();
5705 }
5707 //*************************************************************************************************
5708 
5709 
5710 //*************************************************************************************************
5722 template< typename MT > // Type of the dense matrix
5723 template< typename VT > // Type of the right-hand side dense vector
5724 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5725  DenseRow<MT,false,true>::subAssign( const DenseVector<VT,true>& rhs )
5726 {
5728 
5729  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5730 
5731  const size_t ipos( (~rhs).size() & size_t(-2) );
5732  for( size_t i=0UL; i<ipos; i+=2UL ) {
5733  matrix_(i ,row_) -= (~rhs)[i ];
5734  matrix_(i+1UL,row_) -= (~rhs)[i+1UL];
5735  }
5736  if( ipos < (~rhs).size() )
5737  matrix_(ipos,row_) -= (~rhs)[ipos];
5738 }
5740 //*************************************************************************************************
5741 
5742 
5743 //*************************************************************************************************
5755 template< typename MT > // Type of the dense matrix
5756 template< typename VT > // Type of the right-hand side dense vector
5757 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
5758  DenseRow<MT,false,true>::subAssign( const DenseVector<VT,true>& rhs )
5759 {
5762 
5763  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5764 
5765  const size_t rows( size() );
5766 
5767  const size_t ipos( rows & size_t(-IT::size*4) );
5768  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
5769 
5770  typename VT::ConstIterator it( (~rhs).begin() );
5771  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
5772  matrix_.store( i , row_, matrix_.load(i ,row_) - it.load() ); it += IT::size;
5773  matrix_.store( i+IT::size , row_, matrix_.load(i+IT::size ,row_) - it.load() ); it += IT::size;
5774  matrix_.store( i+IT::size*2UL, row_, matrix_.load(i+IT::size*2UL,row_) - it.load() ); it += IT::size;
5775  matrix_.store( i+IT::size*3UL, row_, matrix_.load(i+IT::size*3UL,row_) - it.load() ); it += IT::size;
5776  }
5777  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
5778  matrix_.store( i, row_, matrix_.load(i,row_) - it.load() );
5779  }
5780 }
5782 //*************************************************************************************************
5783 
5784 
5785 //*************************************************************************************************
5797 template< typename MT > // Type of the dense matrix
5798 template< typename VT > // Type of the right-hand side sparse vector
5799 inline void DenseRow<MT,false,true>::subAssign( const SparseVector<VT,true>& rhs )
5800 {
5802 
5803  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5804 
5805  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5806  matrix_(element->index(),row_) -= element->value();
5807 }
5809 //*************************************************************************************************
5810 
5811 
5812 //*************************************************************************************************
5824 template< typename MT > // Type of the dense matrix
5825 template< typename VT > // Type of the right-hand side dense vector
5826 inline typename DisableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5827  DenseRow<MT,false,true>::multAssign( const DenseVector<VT,true>& rhs )
5828 {
5830 
5831  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5832 
5833  const size_t ipos( (~rhs).size() & size_t(-2) );
5834  for( size_t i=0UL; i<ipos; i+=2UL ) {
5835  matrix_(i ,row_) *= (~rhs)[i ];
5836  matrix_(i+1UL,row_) *= (~rhs)[i+1UL];
5837  }
5838  if( ipos < (~rhs).size() )
5839  matrix_(ipos,row_) *= (~rhs)[ipos];
5840 }
5842 //*************************************************************************************************
5843 
5844 
5845 //*************************************************************************************************
5857 template< typename MT > // Type of the dense matrix
5858 template< typename VT > // Type of the right-hand side dense vector
5859 inline typename EnableIf< typename DenseRow<MT,false,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
5860  DenseRow<MT,false,true>::multAssign( const DenseVector<VT,true>& rhs )
5861 {
5864 
5865  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5866 
5867  const size_t rows( size() );
5868 
5869  const size_t ipos( rows & size_t(-IT::size*4) );
5870  BLAZE_INTERNAL_ASSERT( ( rows - ( rows % (IT::size*4UL) ) ) == ipos, "Invalid end calculation" );
5871 
5872  typename VT::ConstIterator it( (~rhs).begin() );
5873  for( size_t i=0UL; i<ipos; i+=IT::size*4UL ) {
5874  matrix_.store( i , row_, matrix_.load(i ,row_) * it.load() ); it += IT::size;
5875  matrix_.store( i+IT::size , row_, matrix_.load(i+IT::size ,row_) * it.load() ); it += IT::size;
5876  matrix_.store( i+IT::size*2UL, row_, matrix_.load(i+IT::size*2UL,row_) * it.load() ); it += IT::size;
5877  matrix_.store( i+IT::size*3UL, row_, matrix_.load(i+IT::size*3UL,row_) * it.load() ); it += IT::size;
5878  }
5879  for( size_t i=ipos; i<rows; i+=IT::size, it+=IT::size ) {
5880  matrix_.store( i, row_, matrix_.load(i,row_) * it.load() );
5881  }
5882 }
5884 //*************************************************************************************************
5885 
5886 
5887 //*************************************************************************************************
5899 template< typename MT > // Type of the dense matrix
5900 template< typename VT > // Type of the right-hand side sparse vector
5901 inline void DenseRow<MT,false,true>::multAssign( const SparseVector<VT,true>& rhs )
5902 {
5904 
5905  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
5906 
5907  const ResultType tmp( serial( *this ) );
5908 
5909  reset();
5910 
5911  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
5912  matrix_(element->index(),row_) = tmp[element->index()] * element->value();
5913 }
5915 //*************************************************************************************************
5916 
5917 
5918 
5919 
5920 
5921 
5922 
5923 
5924 //=================================================================================================
5925 //
5926 // DENSEROW OPERATORS
5927 //
5928 //=================================================================================================
5929 
5930 //*************************************************************************************************
5933 template< typename MT, bool SO, bool SF >
5934 inline void reset( DenseRow<MT,SO,SF>& row );
5935 
5936 template< typename MT, bool SO, bool SF >
5937 inline void clear( DenseRow<MT,SO,SF>& row );
5938 
5939 template< typename MT, bool SO, bool SF >
5940 inline bool isDefault( const DenseRow<MT,SO,SF>& row );
5941 
5942 template< typename MT, bool SO, bool SF >
5943 inline bool isSame( const DenseRow<MT,SO,SF>& a, const DenseRow<MT,SO,SF>& b );
5945 //*************************************************************************************************
5946 
5947 
5948 //*************************************************************************************************
5955 template< typename MT // Type of the dense matrix
5956  , bool SO // Storage order
5957  , bool SF > // Symmetry flag
5959 {
5960  row.reset();
5961 }
5962 //*************************************************************************************************
5963 
5964 
5965 //*************************************************************************************************
5974 template< typename MT // Type of the dense matrix
5975  , bool SO // Storage order
5976  , bool SF > // Symmetry flag
5978 {
5979  row.reset();
5980 }
5981 //*************************************************************************************************
5982 
5983 
5984 //*************************************************************************************************
6002 template< typename MT // Type of the dense matrix
6003  , bool SO // Storage order
6004  , bool SF > // Symmetry flag
6005 inline bool isDefault( const DenseRow<MT,SO,SF>& row )
6006 {
6007  for( size_t i=0UL; i<row.size(); ++i )
6008  if( !isDefault( row[i] ) ) return false;
6009  return true;
6010 }
6011 //*************************************************************************************************
6012 
6013 
6014 //*************************************************************************************************
6026 template< typename MT // Type of the dense matrix
6027  , bool SO // Storage order
6028  , bool SF > // Symmetry flag
6029 inline bool isSame( const DenseRow<MT,SO,SF>& a, const DenseRow<MT,SO,SF>& b )
6030 {
6031  return ( isSame( a.matrix_, b.matrix_ ) && ( a.row_ == b.row_ ) );
6032 }
6033 //*************************************************************************************************
6034 
6035 
6036 //*************************************************************************************************
6051 template< typename MT // Type of the dense matrix
6052  , bool SO // Storage order
6053  , bool SF > // Symmetry flag
6054 inline typename DerestrictTrait< DenseRow<MT,SO,SF> >::Type
6055  derestrict( DenseRow<MT,SO,SF>& row )
6056 {
6057  typedef typename DerestrictTrait< DenseRow<MT,SO,SF> >::Type ReturnType;
6058  return ReturnType( derestrict( row.matrix_ ), row.row_ );
6059 }
6061 //*************************************************************************************************
6062 
6063 
6064 
6065 
6066 //=================================================================================================
6067 //
6068 // ISRESTRICTED SPECIALIZATIONS
6069 //
6070 //=================================================================================================
6071 
6072 //*************************************************************************************************
6074 template< typename MT, bool SO, bool SF >
6075 struct IsRestricted< DenseRow<MT,SO,SF> > : public If< IsRestricted<MT>, TrueType, FalseType >::Type
6076 {
6077  enum { value = IsRestricted<MT>::value };
6078  typedef typename If< IsRestricted<MT>, TrueType, FalseType >::Type Type;
6079 };
6081 //*************************************************************************************************
6082 
6083 
6084 
6085 
6086 //=================================================================================================
6087 //
6088 // DERESTRICTTRAIT SPECIALIZATIONS
6089 //
6090 //=================================================================================================
6091 
6092 //*************************************************************************************************
6094 template< typename MT, bool SO, bool SF >
6095 struct DerestrictTrait< DenseRow<MT,SO,SF> >
6096 {
6097  typedef DenseRow< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type > Type;
6098 };
6100 //*************************************************************************************************
6101 
6102 
6103 
6104 
6105 //=================================================================================================
6106 //
6107 // HASCONSTDATAACCESS SPECIALIZATIONS
6108 //
6109 //=================================================================================================
6110 
6111 //*************************************************************************************************
6113 template< typename MT, bool SO, bool SF >
6114 struct HasConstDataAccess< DenseRow<MT,SO,SF> >
6115  : public If< HasConstDataAccess<MT>, TrueType, FalseType >::Type
6116 {
6117  enum { value = HasConstDataAccess<MT>::value };
6118  typedef typename If< HasConstDataAccess<MT>, TrueType, FalseType >::Type Type;
6119 };
6121 //*************************************************************************************************
6122 
6123 
6124 
6125 
6126 //=================================================================================================
6127 //
6128 // HASMUTABLEDATAACCESS SPECIALIZATIONS
6129 //
6130 //=================================================================================================
6131 
6132 //*************************************************************************************************
6134 template< typename MT, bool SO, bool SF >
6135 struct HasMutableDataAccess< DenseRow<MT,SO,SF> >
6136  : public If< HasMutableDataAccess<MT>, TrueType, FalseType >::Type
6137 {
6138  enum { value = HasMutableDataAccess<MT>::value };
6139  typedef typename If< HasMutableDataAccess<MT>, TrueType, FalseType >::Type Type;
6140 };
6142 //*************************************************************************************************
6143 
6144 
6145 
6146 
6147 //=================================================================================================
6148 //
6149 // SUBVECTORTRAIT SPECIALIZATIONS
6150 //
6151 //=================================================================================================
6152 
6153 //*************************************************************************************************
6155 template< typename MT, bool SO, bool SF >
6156 struct SubvectorTrait< DenseRow<MT,SO,SF> >
6157 {
6158  typedef typename SubvectorTrait< typename DenseRow<MT,SO,SF>::ResultType >::Type Type;
6159 };
6161 //*************************************************************************************************
6162 
6163 } // namespace blaze
6164 
6165 #endif
Pointer data()
Low-level data access to the row elements.
Definition: DenseRow.h:725
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:879
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8247
ConstIterator cend() const
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:844
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
Operand matrix_
The dense matrix containing the row.
Definition: DenseRow.h:611
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:793
IfTrue< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: DenseRow.h:375
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
Header file for the row base class.
Header file for the IsDiagonal type trait.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseRow.h:365
#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
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense row.
Definition: DenseRow.h:1793
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
size_t nonZeros() const
Returns the number of non-zero elements in the row.
Definition: DenseRow.h:1223
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
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:689
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:103
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the And class template.
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
Header file for the DenseVector base class.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:118
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseRow.h:344
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
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1724
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:78
size_t size() const
Returns the current size/dimension of the row.
Definition: DenseRow.h:1190
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:118
Header file for the RequiresEvaluation type trait.
Header file for the IsUniLower type trait.
MT::ElementType ElementType
Type of the row elements.
Definition: DenseRow.h:366
void reset()
Reset to the default initial values.
Definition: DenseRow.h:1238
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:964
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
bool canAlias(const Other *alias) const
Returns whether the dense row can alias with the given address alias.
Definition: DenseRow.h:1572
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Constraint on the data type.
Base template for the RowTrait class.
Definition: RowTrait.h:115
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:85
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
Compile time assertion.
Constraint on the data type.
Header file for the IsFloatingPoint type trait.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:116
Header file for the Or class template.
IfTrue< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseRow.h:387
bool isAligned() const
Returns whether the dense row is properly aligned in memory.
Definition: DenseRow.h:1658
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the subvector trait.
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseRow.h:384
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseRow.h:378
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:759
IT::Type IntrinsicType
Intrinsic type of the row elements.
Definition: DenseRow.h:367
Header file for the IsLower type trait.
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:612
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1197
Constraints on the storage order of matrix types.
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
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:841
Header file for the isOne shim.
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:85
Header file for the DerestrictTrait class template.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
DenseRow & operator=(const ElementType &rhs)
Homogenous assignment to all row elements.
Definition: DenseRow.h:872
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:2506
Header file for the IsConst type trait.
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseRow.h:364
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:1678
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:347
const DenseRow & CompositeType
Data type for composite expression templates.
Definition: DenseRow.h:369
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:363
DenseRow(MT &matrix, size_t index)
The constructor for DenseRow.
Definition: DenseRow.h:662
bool isAliased(const Other *alias) const
Returns whether the dense row is aliased with the given address alias.
Definition: DenseRow.h:1616
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESTRICTED(T)
Constraint on the data type.In case the given data type T does have a restricted data access...
Definition: Restricted.h:118
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:338
Header file for the cache size of the target architecture.
Compile time type negation.The Not class template negates the given compile time condition. In case the given condition would evaluate to true, the nested member enumeration is set to false and vice versa:
Definition: Not.h:70
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
Iterator end()
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:810
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1747
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Header file for the IsReference type trait.
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
Header file for all intrinsic functionality.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:79
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
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:260
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1701
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:1205
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:94
#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
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: DenseRow.h:372
Header file for the IsUpper type trait.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a simple dense v...
Definition: Thresholds.h:207
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
EnableIf< IsNumeric< Type >, bool >::Type isOne(const Type &v)
Returns whether the given value/object represents the numeric value 1.
Definition: IsOne.h:80
Header file for the IsRestricted type trait.
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1770
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseRow.h:368
Header file for a safe C++ NULL pointer implementation.
IfTrue< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant row value.
Definition: DenseRow.h:381