All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DenseRow.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_DENSEROW_H_
36 #define _BLAZE_MATH_VIEWS_DENSEROW_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <stdexcept>
54 #include <blaze/math/Intrinsics.h>
55 #include <blaze/math/shims/Reset.h>
62 #include <blaze/system/CacheSize.h>
63 #include <blaze/system/Streaming.h>
64 #include <blaze/util/Assert.h>
66 #include <blaze/util/DisableIf.h>
67 #include <blaze/util/EnableIf.h>
69 #include <blaze/util/mpl/Or.h>
70 #include <blaze/util/Template.h>
71 #include <blaze/util/Types.h>
77 
78 
79 namespace blaze {
80 
81 //=================================================================================================
82 //
83 // CLASS DEFINITION
84 //
85 //=================================================================================================
86 
87 //*************************************************************************************************
304 template< typename MT // Type of the dense matrix
305  , bool SO = IsRowMajorMatrix<MT>::value > // Storage order
306 class DenseRow : public DenseVector< DenseRow<MT,SO>, true >
307  , private View
308 {
309  private:
310  //**Type definitions****************************************************************************
312  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
313 
316  //**********************************************************************************************
317 
318  //**********************************************************************************************
320 
326  enum { useConst = IsConst<MT>::value };
327  //**********************************************************************************************
328 
329  public:
330  //**Type definitions****************************************************************************
332  typedef typename RowTrait<MT>::Type ResultType;
334  typedef typename MT::ElementType ElementType;
335  typedef typename IT::Type IntrinsicType;
336  typedef typename MT::ReturnType ReturnType;
337  typedef const DenseRow& CompositeType;
338 
341 
344 
346  typedef const ElementType* ConstPointer;
347 
350 
353 
356  //**********************************************************************************************
357 
358  //**Compilation flags***************************************************************************
360  enum { vectorizable = MT::vectorizable };
361 
363  enum { smpAssignable = 0 };
364  //**********************************************************************************************
365 
366  //**Constructors********************************************************************************
369  explicit inline DenseRow( MT& matrix, size_t index );
370  // No explicitly declared copy constructor.
372  //**********************************************************************************************
373 
374  //**Destructor**********************************************************************************
375  // No explicitly declared destructor.
376  //**********************************************************************************************
377 
378  //**Data access functions***********************************************************************
381  inline Reference operator[]( size_t index );
382  inline ConstReference operator[]( size_t index ) const;
383  inline Pointer data ();
384  inline ConstPointer data () const;
385  inline Iterator begin ();
386  inline ConstIterator begin () const;
387  inline ConstIterator cbegin() const;
388  inline Iterator end ();
389  inline ConstIterator end () const;
390  inline ConstIterator cend () const;
392  //**********************************************************************************************
393 
394  //**Assignment operators************************************************************************
397  inline DenseRow& operator= ( const ElementType& rhs );
398  inline DenseRow& operator= ( const DenseRow& rhs );
399  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
400  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
401  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
402  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
403 
404  template< typename Other >
405  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
406  operator*=( Other rhs );
407 
408  template< typename Other >
409  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
410  operator/=( Other rhs );
412  //**********************************************************************************************
413 
414  //**Utility functions***************************************************************************
417  inline size_t size() const;
418  inline size_t capacity() const;
419  inline size_t nonZeros() const;
420  inline void reset();
421  template< typename Other > inline DenseRow& scale( const Other& scalar );
423  //**********************************************************************************************
424 
425  private:
426  //**********************************************************************************************
428  template< typename VT >
430  struct VectorizedAssign {
431  enum { value = vectorizable && VT::vectorizable &&
432  IsSame<ElementType,typename VT::ElementType>::value };
433  };
435  //**********************************************************************************************
436 
437  //**********************************************************************************************
439  template< typename VT >
441  struct VectorizedAddAssign {
442  enum { value = vectorizable && VT::vectorizable &&
443  IsSame<ElementType,typename VT::ElementType>::value &&
444  IntrinsicTrait<ElementType>::addition };
445  };
447  //**********************************************************************************************
448 
449  //**********************************************************************************************
451  template< typename VT >
453  struct VectorizedSubAssign {
454  enum { value = vectorizable && VT::vectorizable &&
455  IsSame<ElementType,typename VT::ElementType>::value &&
456  IntrinsicTrait<ElementType>::subtraction };
457  };
459  //**********************************************************************************************
460 
461  //**********************************************************************************************
463  template< typename VT >
465  struct VectorizedMultAssign {
466  enum { value = vectorizable && VT::vectorizable &&
467  IsSame<ElementType,typename VT::ElementType>::value &&
468  IntrinsicTrait<ElementType>::multiplication };
469  };
471  //**********************************************************************************************
472 
473  public:
474  //**Expression template evaluation functions****************************************************
477  template< typename Other > inline bool canAlias ( const Other* alias ) const;
478  template< typename Other > inline bool isAliased( const Other* alias ) const;
479 
480  inline IntrinsicType load ( size_t index ) const;
481  inline IntrinsicType loadu ( size_t index ) const;
482  inline void store ( size_t index, const IntrinsicType& value );
483  inline void storeu( size_t index, const IntrinsicType& value );
484  inline void stream( size_t index, const IntrinsicType& value );
485 
486  template< typename VT >
487  inline typename DisableIf< VectorizedAssign<VT> >::Type
488  assign( const DenseVector<VT,true>& rhs );
489 
490  template< typename VT >
491  inline typename EnableIf< VectorizedAssign<VT> >::Type
492  assign( const DenseVector<VT,true>& rhs );
493 
494  template< typename VT > inline void assign( const SparseVector<VT,true>& rhs );
495 
496  template< typename VT >
497  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
498  addAssign( const DenseVector<VT,true>& rhs );
499 
500  template< typename VT >
501  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
502  addAssign( const DenseVector<VT,true>& rhs );
503 
504  template< typename VT > inline void addAssign( const SparseVector<VT,true>& rhs );
505 
506  template< typename VT >
507  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
508  subAssign( const DenseVector<VT,true>& rhs );
509 
510  template< typename VT >
511  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
512  subAssign( const DenseVector<VT,true>& rhs );
513 
514  template< typename VT > inline void subAssign( const SparseVector<VT,true>& rhs );
515 
516  template< typename VT >
517  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
518  multAssign( const DenseVector<VT,true>& rhs );
519 
520  template< typename VT >
521  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
522  multAssign( const DenseVector<VT,true>& rhs );
523 
524  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
526  //**********************************************************************************************
527 
528  private:
529  //**Member variables****************************************************************************
533  const size_t row_;
534 
535  //**********************************************************************************************
536 
537  //**Compile time checks*************************************************************************
544  //**********************************************************************************************
545 };
546 //*************************************************************************************************
547 
548 
549 
550 
551 //=================================================================================================
552 //
553 // CONSTRUCTOR
554 //
555 //=================================================================================================
556 
557 //*************************************************************************************************
564 template< typename MT // Type of the dense matrix
565  , bool SO > // Storage order
566 inline DenseRow<MT,SO>::DenseRow( MT& matrix, size_t index )
567  : matrix_( matrix ) // The dense matrix containing the row
568  , row_ ( index ) // The index of the row in the matrix
569 {
570  if( matrix_.rows() <= index )
571  throw std::invalid_argument( "Invalid row access index" );
572 }
573 //*************************************************************************************************
574 
575 
576 
577 
578 //=================================================================================================
579 //
580 // DATA ACCESS FUNCTIONS
581 //
582 //=================================================================================================
583 
584 //*************************************************************************************************
590 template< typename MT // Type of the dense matrix
591  , bool SO > // Storage order
593 {
594  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
595  return matrix_(row_,index);
596 }
597 //*************************************************************************************************
598 
599 
600 //*************************************************************************************************
606 template< typename MT // Type of the dense matrix
607  , bool SO > // Storage order
609 {
610  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
611  return matrix_(row_,index);
612 }
613 //*************************************************************************************************
614 
615 
616 //*************************************************************************************************
623 template< typename MT // Type of the dense matrix
624  , bool SO > // Storage order
626 {
627  return matrix_.data( row_ );
628 }
629 //*************************************************************************************************
630 
631 
632 //*************************************************************************************************
639 template< typename MT // Type of the dense matrix
640  , bool SO > // Storage order
642 {
643  return matrix_.data( row_ );
644 }
645 //*************************************************************************************************
646 
647 
648 //*************************************************************************************************
655 template< typename MT // Type of the dense matrix
656  , bool SO > // Storage order
658 {
659  return matrix_.begin( row_ );
660 }
661 //*************************************************************************************************
662 
663 
664 //*************************************************************************************************
671 template< typename MT // Type of the dense matrix
672  , bool SO > // Storage order
674 {
675  return matrix_.cbegin( row_ );
676 }
677 //*************************************************************************************************
678 
679 
680 //*************************************************************************************************
687 template< typename MT // Type of the dense matrix
688  , bool SO > // Storage order
690 {
691  return matrix_.cbegin( row_ );
692 }
693 //*************************************************************************************************
694 
695 
696 //*************************************************************************************************
703 template< typename MT // Type of the dense matrix
704  , bool SO > // Storage order
706 {
707  return matrix_.end( row_ );
708 }
709 //*************************************************************************************************
710 
711 
712 //*************************************************************************************************
719 template< typename MT // Type of the dense matrix
720  , bool SO > // Storage order
722 {
723  return matrix_.cend( row_ );
724 }
725 //*************************************************************************************************
726 
727 
728 //*************************************************************************************************
735 template< typename MT // Type of the dense matrix
736  , bool SO > // Storage order
738 {
739  return matrix_.cend( row_ );
740 }
741 //*************************************************************************************************
742 
743 
744 
745 
746 //=================================================================================================
747 //
748 // ASSIGNMENT OPERATORS
749 //
750 //=================================================================================================
751 
752 //*************************************************************************************************
758 template< typename MT // Type of the dense matrix
759  , bool SO > // Storage order
761 {
762  const size_t columns( size() );
763 
764  for( size_t j=0UL; j<columns; ++j )
765  matrix_(row_,j) = rhs;
766 
767  return *this;
768 }
769 //*************************************************************************************************
770 
771 
772 //*************************************************************************************************
782 template< typename MT // Type of the dense matrix
783  , bool SO > // Storage order
785 {
786  if( &rhs == this ) return *this;
787 
788  if( size() != rhs.size() )
789  throw std::invalid_argument( "Row sizes do not match" );
790 
791  const size_t columns( size() );
792 
793  for( size_t j=0UL; j<columns; ++j )
794  matrix_(row_,j) = rhs[j];
795 
796  return *this;
797 }
798 //*************************************************************************************************
799 
800 
801 //*************************************************************************************************
811 template< typename MT // Type of the dense matrix
812  , bool SO > // Storage order
813 template< typename VT > // Type of the right-hand side vector
815 {
816  using blaze::assign;
817 
820 
821  if( size() != (~rhs).size() )
822  throw std::invalid_argument( "Vector sizes do not match" );
823 
824  if( (~rhs).canAlias( &matrix_ ) ) {
825  const typename VT::ResultType tmp( ~rhs );
826  assign( *this, tmp );
827  }
828  else {
830  reset();
831  assign( *this, ~rhs );
832  }
833 
834  return *this;
835 }
836 //*************************************************************************************************
837 
838 
839 //*************************************************************************************************
849 template< typename MT // Type of the dense matrix
850  , bool SO > // Storage order
851 template< typename VT > // Type of the right-hand side vector
853 {
854  using blaze::addAssign;
855 
858 
859  if( size() != (~rhs).size() )
860  throw std::invalid_argument( "Vector sizes do not match" );
861 
862  if( (~rhs).canAlias( &matrix_ ) ) {
863  const typename VT::ResultType tmp( ~rhs );
864  addAssign( *this, tmp );
865  }
866  else {
867  addAssign( *this, ~rhs );
868  }
869 
870  return *this;
871 }
872 //*************************************************************************************************
873 
874 
875 //*************************************************************************************************
885 template< typename MT // Type of the dense matrix
886  , bool SO > // Storage order
887 template< typename VT > // Type of the right-hand side vector
889 {
890  using blaze::subAssign;
891 
894 
895  if( size() != (~rhs).size() )
896  throw std::invalid_argument( "Vector sizes do not match" );
897 
898  if( (~rhs).canAlias( &matrix_ ) ) {
899  const typename VT::ResultType tmp( ~rhs );
900  subAssign( *this, tmp );
901  }
902  else {
903  subAssign( *this, ~rhs );
904  }
905 
906  return *this;
907 }
908 //*************************************************************************************************
909 
910 
911 //*************************************************************************************************
922 template< typename MT // Type of the dense matrix
923  , bool SO > // Storage order
924 template< typename VT > // Type of the right-hand side vector
926 {
927  using blaze::multAssign;
928 
931 
932  if( size() != (~rhs).size() )
933  throw std::invalid_argument( "Vector sizes do not match" );
934 
935  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
936  const typename VT::ResultType tmp( ~rhs );
937  multAssign( *this, tmp );
938  }
939  else {
940  multAssign( *this, ~rhs );
941  }
942 
943  return *this;
944 }
945 //*************************************************************************************************
946 
947 
948 //*************************************************************************************************
955 template< typename MT // Type of the dense matrix
956  , bool SO > // Storage order
957 template< typename Other > // Data type of the right-hand side scalar
958 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,SO> >::Type&
960 {
961  return operator=( (*this) * rhs );
962 }
963 //*************************************************************************************************
964 
965 
966 //*************************************************************************************************
975 template< typename MT // Type of the dense matrix
976  , bool SO > // Storage order
977 template< typename Other > // Data type of the right-hand side scalar
978 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,SO> >::Type&
980 {
981  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
982 
983  return operator=( (*this) / rhs );
984 }
985 //*************************************************************************************************
986 
987 
988 
989 
990 //=================================================================================================
991 //
992 // UTILITY FUNCTIONS
993 //
994 //=================================================================================================
995 
996 //*************************************************************************************************
1001 template< typename MT // Type of the dense matrix
1002  , bool SO > // Storage order
1003 inline size_t DenseRow<MT,SO>::size() const
1004 {
1005  return matrix_.columns();
1006 }
1007 //*************************************************************************************************
1008 
1009 
1010 //*************************************************************************************************
1015 template< typename MT // Type of the dense matrix
1016  , bool SO > // Storage order
1017 inline size_t DenseRow<MT,SO>::capacity() const
1018 {
1019  return matrix_.capacity( row_ );
1020 }
1021 //*************************************************************************************************
1022 
1023 
1024 //*************************************************************************************************
1032 template< typename MT // Type of the dense matrix
1033  , bool SO > // Storage order
1034 inline size_t DenseRow<MT,SO>::nonZeros() const
1035 {
1036  return matrix_.nonZeros( row_ );
1037 }
1038 //*************************************************************************************************
1039 
1040 
1041 //*************************************************************************************************
1046 template< typename MT // Type of the dense matrix
1047  , bool SO > // Storage order
1049 {
1050  matrix_.reset( row_ );
1051 }
1052 //*************************************************************************************************
1053 
1054 
1055 //*************************************************************************************************
1061 template< typename MT // Type of the dense matrix
1062  , bool SO > // Storage order
1063 template< typename Other > // Data type of the scalar value
1064 inline DenseRow<MT,SO>& DenseRow<MT,SO>::scale( const Other& scalar )
1065 {
1066  for( size_t j=0UL; j<size(); ++j ) {
1067  matrix_(row_,j) *= scalar;
1068  }
1069  return *this;
1070 }
1071 //*************************************************************************************************
1072 
1073 
1074 
1075 
1076 //=================================================================================================
1077 //
1078 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1079 //
1080 //=================================================================================================
1081 
1082 //*************************************************************************************************
1092 template< typename MT // Type of the dense matrix
1093  , bool SO > // Storage order
1094 template< typename Other > // Data type of the foreign expression
1095 inline bool DenseRow<MT,SO>::canAlias( const Other* alias ) const
1096 {
1097  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
1098 }
1099 //*************************************************************************************************
1100 
1101 
1102 //*************************************************************************************************
1112 template< typename MT // Type of the dense matrix
1113  , bool SO > // Storage order
1114 template< typename Other > // Data type of the foreign expression
1115 inline bool DenseRow<MT,SO>::isAliased( const Other* alias ) const
1116 {
1117  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
1118 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1134 template< typename MT // Type of the dense matrix
1135  , bool SO > // Storage order
1136 inline typename DenseRow<MT,SO>::IntrinsicType DenseRow<MT,SO>::load( size_t index ) const
1137 {
1138  return matrix_.load( row_, index );
1139 }
1140 //*************************************************************************************************
1141 
1142 
1143 //*************************************************************************************************
1155 template< typename MT // Type of the dense matrix
1156  , bool SO > // Storage order
1157 inline typename DenseRow<MT,SO>::IntrinsicType DenseRow<MT,SO>::loadu( size_t index ) const
1158 {
1159  return matrix_.loadu( row_, index );
1160 }
1161 //*************************************************************************************************
1162 
1163 
1164 //*************************************************************************************************
1177 template< typename MT // Type of the dense matrix
1178  , bool SO > // Storage order
1179 inline void DenseRow<MT,SO>::store( size_t index, const IntrinsicType& value )
1180 {
1181  matrix_.store( row_, index, value );
1182 }
1183 //*************************************************************************************************
1184 
1185 
1186 //*************************************************************************************************
1199 template< typename MT // Type of the dense matrix
1200  , bool SO > // Storage order
1201 inline void DenseRow<MT,SO>::storeu( size_t index, const IntrinsicType& value )
1202 {
1203  matrix_.storeu( row_, index, value );
1204 }
1205 //*************************************************************************************************
1206 
1207 
1208 //*************************************************************************************************
1221 template< typename MT // Type of the dense matrix
1222  , bool SO > // Storage order
1223 inline void DenseRow<MT,SO>::stream( size_t index, const IntrinsicType& value )
1224 {
1225  matrix_.stream( row_, index, value );
1226 }
1227 //*************************************************************************************************
1228 
1229 
1230 //*************************************************************************************************
1241 template< typename MT // Type of the dense matrix
1242  , bool SO > // Storage order
1243 template< typename VT > // Type of the right-hand side dense vector
1244 inline typename DisableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1246 {
1247  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1248 
1249  const size_t jend( (~rhs).size() & size_t(-2) );
1250  for( size_t j=0UL; j<jend; j+=2UL ) {
1251  matrix_(row_,j ) = (~rhs)[j ];
1252  matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1253  }
1254  if( jend < (~rhs).size() )
1255  matrix_(row_,jend) = (~rhs)[jend];
1256 }
1257 //*************************************************************************************************
1258 
1259 
1260 //*************************************************************************************************
1271 template< typename MT // Type of the dense matrix
1272  , bool SO > // Storage order
1273 template< typename VT > // Type of the right-hand side dense vector
1274 inline typename EnableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1276 {
1277  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1278 
1280 
1281  const size_t columns( size() );
1282 
1283  if( useStreaming && columns > ( cacheSize/( sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1284  {
1285  for( size_t j=0UL; j<columns; j+=IT::size ) {
1286  matrix_.stream( row_, j, (~rhs).load(j) );
1287  }
1288  }
1289  else
1290  {
1291  const size_t jend( columns & size_t(-IT::size*4) );
1292  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1293 
1294  typename VT::ConstIterator it( (~rhs).begin() );
1295  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1296  matrix_.store( row_, j , it.load() ); it += IT::size;
1297  matrix_.store( row_, j+IT::size , it.load() ); it += IT::size;
1298  matrix_.store( row_, j+IT::size*2UL, it.load() ); it += IT::size;
1299  matrix_.store( row_, j+IT::size*3UL, it.load() ); it += IT::size;
1300  }
1301  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1302  matrix_.store( row_, j, it.load() );
1303  }
1304  }
1305 }
1306 //*************************************************************************************************
1307 
1308 
1309 //*************************************************************************************************
1320 template< typename MT // Type of the dense matrix
1321  , bool SO > // Storage order
1322 template< typename VT > // Type of the right-hand side sparse vector
1324 {
1325  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1326 
1327  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1328  matrix_(row_,element->index()) = element->value();
1329 }
1330 //*************************************************************************************************
1331 
1332 
1333 //*************************************************************************************************
1344 template< typename MT // Type of the dense matrix
1345  , bool SO > // Storage order
1346 template< typename VT > // Type of the right-hand side dense vector
1347 inline typename DisableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1349 {
1350  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1351 
1352  const size_t jend( (~rhs).size() & size_t(-2) );
1353  for( size_t j=0UL; j<jend; j+=2UL ) {
1354  matrix_(row_,j ) += (~rhs)[j ];
1355  matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1356  }
1357  if( jend < (~rhs).size() )
1358  matrix_(row_,jend) += (~rhs)[jend];
1359 }
1360 //*************************************************************************************************
1361 
1362 
1363 //*************************************************************************************************
1374 template< typename MT // Type of the dense matrix
1375  , bool SO > // Storage order
1376 template< typename VT > // Type of the right-hand side dense vector
1377 inline typename EnableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1379 {
1380  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1381 
1383 
1384  const size_t columns( size() );
1385 
1386  const size_t jend( columns & size_t(-IT::size*4) );
1387  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1388 
1389  typename VT::ConstIterator it( (~rhs).begin() );
1390  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1391  matrix_.store( row_, j , matrix_.load(row_,j ) + it.load() ); it += IT::size;
1392  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) + it.load() ); it += IT::size;
1393  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) + it.load() ); it += IT::size;
1394  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) + it.load() ); it += IT::size;
1395  }
1396  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1397  matrix_.store( row_, j, matrix_.load(row_,j) + it.load() );
1398  }
1399 }
1400 //*************************************************************************************************
1401 
1402 
1403 //*************************************************************************************************
1414 template< typename MT // Type of the dense matrix
1415  , bool SO > // Storage order
1416 template< typename VT > // Type of the right-hand side sparse vector
1418 {
1419  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1420 
1421  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1422  matrix_(row_,element->index()) += element->value();
1423 }
1424 //*************************************************************************************************
1425 
1426 
1427 //*************************************************************************************************
1438 template< typename MT // Type of the dense matrix
1439  , bool SO > // Storage order
1440 template< typename VT > // Type of the right-hand side dense vector
1441 inline typename DisableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1443 {
1444  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1445 
1446  const size_t jend( (~rhs).size() & size_t(-2) );
1447  for( size_t j=0UL; j<jend; j+=2UL ) {
1448  matrix_(row_,j ) -= (~rhs)[j ];
1449  matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
1450  }
1451  if( jend < (~rhs).size() )
1452  matrix_(row_,jend) -= (~rhs)[jend];
1453 }
1454 //*************************************************************************************************
1455 
1456 
1457 //*************************************************************************************************
1468 template< typename MT // Type of the dense matrix
1469  , bool SO > // Storage order
1470 template< typename VT > // Type of the right-hand side dense vector
1471 inline typename EnableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1473 {
1474  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1475 
1477 
1478  const size_t columns( size() );
1479 
1480  const size_t jend( columns & size_t(-IT::size*4) );
1481  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1482 
1483  typename VT::ConstIterator it( (~rhs).begin() );
1484  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1485  matrix_.store( row_, j , matrix_.load(row_,j ) - it.load() ); it += IT::size;
1486  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) - it.load() ); it += IT::size;
1487  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) - it.load() ); it += IT::size;
1488  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) - it.load() ); it += IT::size;
1489  }
1490  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1491  matrix_.store( row_, j, matrix_.load(row_,j) - it.load() );
1492  }
1493 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1508 template< typename MT // Type of the dense matrix
1509  , bool SO > // Storage order
1510 template< typename VT > // Type of the right-hand side sparse vector
1512 {
1513  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1514 
1515  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1516  matrix_(row_,element->index()) -= element->value();
1517 }
1518 //*************************************************************************************************
1519 
1520 
1521 //*************************************************************************************************
1532 template< typename MT // Type of the dense matrix
1533  , bool SO > // Storage order
1534 template< typename VT > // Type of the right-hand side dense vector
1535 inline typename DisableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1537 {
1538  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1539 
1540  const size_t jend( (~rhs).size() & size_t(-2) );
1541  for( size_t j=0UL; j<jend; j+=2UL ) {
1542  matrix_(row_,j ) *= (~rhs)[j ];
1543  matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
1544  }
1545  if( jend < (~rhs).size() )
1546  matrix_(row_,jend) *= (~rhs)[jend];
1547 }
1548 //*************************************************************************************************
1549 
1550 
1551 //*************************************************************************************************
1562 template< typename MT // Type of the dense matrix
1563  , bool SO > // Storage order
1564 template< typename VT > // Type of the right-hand side dense vector
1565 inline typename EnableIf< typename DenseRow<MT,SO>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
1567 {
1568  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1569 
1571 
1572  const size_t columns( size() );
1573 
1574  const size_t jend( columns & size_t(-IT::size*4) );
1575  BLAZE_INTERNAL_ASSERT( ( columns - ( columns % (IT::size*4UL) ) ) == jend, "Invalid end calculation" );
1576 
1577  typename VT::ConstIterator it( (~rhs).begin() );
1578  for( size_t j=0UL; j<jend; j+=IT::size*4UL ) {
1579  matrix_.store( row_, j , matrix_.load(row_,j ) * it.load() ); it += IT::size;
1580  matrix_.store( row_, j+IT::size , matrix_.load(row_,j+IT::size ) * it.load() ); it += IT::size;
1581  matrix_.store( row_, j+IT::size*2UL, matrix_.load(row_,j+IT::size*2UL) * it.load() ); it += IT::size;
1582  matrix_.store( row_, j+IT::size*3UL, matrix_.load(row_,j+IT::size*3UL) * it.load() ); it += IT::size;
1583  }
1584  for( size_t j=jend; j<columns; j+=IT::size, it+=IT::size ) {
1585  matrix_.store( row_, j, matrix_.load(row_,j) * it.load() );
1586  }
1587 }
1588 //*************************************************************************************************
1589 
1590 
1591 //*************************************************************************************************
1602 template< typename MT // Type of the dense matrix
1603  , bool SO > // Storage order
1604 template< typename VT > // Type of the right-hand side sparse vector
1606 {
1607  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
1608 
1609  const ResultType tmp( *this );
1610 
1611  reset();
1612 
1613  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1614  matrix_(row_,element->index()) = tmp[element->index()] * element->value();
1615 }
1616 //*************************************************************************************************
1617 
1618 
1619 
1620 
1621 
1622 
1623 
1624 
1625 //=================================================================================================
1626 //
1627 // CLASS TEMPLATE SPECIALIZATION FOR COLUMN-MAJOR MATRICES
1628 //
1629 //=================================================================================================
1630 
1631 //*************************************************************************************************
1639 template< typename MT > // Type of the dense matrix
1640 class DenseRow<MT,false> : public DenseVector< DenseRow<MT,false>, true >
1641  , private View
1642 {
1643  private:
1644  //**Type definitions****************************************************************************
1646  typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type Operand;
1647  //**********************************************************************************************
1648 
1649  //**********************************************************************************************
1651 
1657  enum { useConst = IsConst<MT>::value };
1658  //**********************************************************************************************
1659 
1660  public:
1661  //**Type definitions****************************************************************************
1662  typedef DenseRow<MT,false> This;
1663  typedef typename RowTrait<MT>::Type ResultType;
1664  typedef typename ResultType::TransposeType TransposeType;
1665  typedef typename MT::ElementType ElementType;
1666  typedef typename MT::ReturnType ReturnType;
1667  typedef const ResultType CompositeType;
1668 
1670  typedef typename MT::ConstReference ConstReference;
1671 
1673  typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference;
1674  //**********************************************************************************************
1675 
1676  //**RowIterator class definition****************************************************************
1679  template< typename MatrixType > // Type of the dense matrix
1680  class RowIterator
1681  {
1682  private:
1683  //*******************************************************************************************
1685 
1690  enum { returnConst = IsConst<MatrixType>::value };
1691  //*******************************************************************************************
1692 
1693  public:
1694  //**Type definitions*************************************************************************
1696  typedef typename SelectType< returnConst, typename MT::ConstReference, typename MT::Reference >::Type Reference;
1697 
1698  typedef std::random_access_iterator_tag IteratorCategory;
1699  typedef RemoveReference<Reference> ValueType;
1700  typedef ValueType* PointerType;
1701  typedef Reference ReferenceType;
1702  typedef ptrdiff_t DifferenceType;
1703 
1704  // STL iterator requirements
1705  typedef IteratorCategory iterator_category;
1706  typedef ValueType value_type;
1707  typedef PointerType pointer;
1708  typedef ReferenceType reference;
1709  typedef DifferenceType difference_type;
1710  //*******************************************************************************************
1711 
1712  //**Constructor******************************************************************************
1719  inline RowIterator( MatrixType& matrix, size_t row, size_t column )
1720  : matrix_( &matrix ) // The dense matrix containing the row.
1721  , row_ ( row ) // The current row index.
1722  , column_( column ) // The current column index.
1723  {}
1724  //*******************************************************************************************
1725 
1726  //**Constructor******************************************************************************
1731  template< typename MatrixType2 >
1732  inline RowIterator( const RowIterator<MatrixType2>& it )
1733  : matrix_( it.matrix_ ) // The dense matrix containing the row.
1734  , row_ ( it.row_ ) // The current row index.
1735  , column_( it.column_ ) // The current column index.
1736  {}
1737  //*******************************************************************************************
1738 
1739  //**Addition assignment operator*************************************************************
1745  inline RowIterator& operator+=( size_t inc ) {
1746  column_ += inc;
1747  return *this;
1748  }
1749  //*******************************************************************************************
1750 
1751  //**Subtraction assignment operator**********************************************************
1757  inline RowIterator& operator-=( size_t dec ) {
1758  column_ -= dec;
1759  return *this;
1760  }
1761  //*******************************************************************************************
1762 
1763  //**Prefix increment operator****************************************************************
1768  inline RowIterator& operator++() {
1769  ++column_;
1770  return *this;
1771  }
1772  //*******************************************************************************************
1773 
1774  //**Postfix increment operator***************************************************************
1779  inline const RowIterator operator++( int ) {
1780  const RowIterator tmp( *this );
1781  ++(*this);
1782  return tmp;
1783  }
1784  //*******************************************************************************************
1785 
1786  //**Prefix decrement operator****************************************************************
1791  inline RowIterator& operator--() {
1792  --column_;
1793  return *this;
1794  }
1795  //*******************************************************************************************
1796 
1797  //**Postfix decrement operator***************************************************************
1802  inline const RowIterator operator--( int ) {
1803  const RowIterator tmp( *this );
1804  --(*this);
1805  return tmp;
1806  }
1807  //*******************************************************************************************
1808 
1809  //**Subscript operator***********************************************************************
1815  inline ReferenceType operator[]( size_t index ) const {
1816  return (*matrix_)(row_,column_+index);
1817  }
1818  //*******************************************************************************************
1819 
1820  //**Element access operator******************************************************************
1825  inline ReferenceType operator*() const {
1826  return (*matrix_)(row_,column_);
1827  }
1828  //*******************************************************************************************
1829 
1830  //**Element access operator******************************************************************
1835  inline PointerType operator->() const {
1836  return &(*matrix_)(row_,column_);
1837  }
1838  //*******************************************************************************************
1839 
1840  //**Equality operator************************************************************************
1846  template< typename MatrixType2 >
1847  inline bool operator==( const RowIterator<MatrixType2>& rhs ) const {
1848  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1849  }
1850  //*******************************************************************************************
1851 
1852  //**Inequality operator**********************************************************************
1858  template< typename MatrixType2 >
1859  inline bool operator!=( const RowIterator<MatrixType2>& rhs ) const {
1860  return !( *this == rhs );
1861  }
1862  //*******************************************************************************************
1863 
1864  //**Less-than operator***********************************************************************
1870  template< typename MatrixType2 >
1871  inline bool operator<( const RowIterator<MatrixType2>& rhs ) const {
1872  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ < rhs.column_ );
1873  }
1874  //*******************************************************************************************
1875 
1876  //**Greater-than operator********************************************************************
1882  template< typename MatrixType2 >
1883  inline bool operator>( const RowIterator<MatrixType2>& rhs ) const {
1884  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ > rhs.column_ );
1885  }
1886  //*******************************************************************************************
1887 
1888  //**Less-or-equal-than operator**************************************************************
1894  template< typename MatrixType2 >
1895  inline bool operator<=( const RowIterator<MatrixType2>& rhs ) const {
1896  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
1897  }
1898  //*******************************************************************************************
1899 
1900  //**Greater-or-equal-than operator***********************************************************
1906  template< typename MatrixType2 >
1907  inline bool operator>=( const RowIterator<MatrixType2>& rhs ) const {
1908  return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
1909  }
1910  //*******************************************************************************************
1911 
1912  //**Subtraction operator*********************************************************************
1918  inline DifferenceType operator-( const RowIterator& rhs ) const {
1919  return column_ - rhs.column_;
1920  }
1921  //*******************************************************************************************
1922 
1923  //**Addition operator************************************************************************
1930  friend inline const RowIterator operator+( const RowIterator& it, size_t inc ) {
1931  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
1932  }
1933  //*******************************************************************************************
1934 
1935  //**Addition operator************************************************************************
1942  friend inline const RowIterator operator+( size_t inc, const RowIterator& it ) {
1943  return RowIterator( *it.matrix_, it.row_, it.column_+inc );
1944  }
1945  //*******************************************************************************************
1946 
1947  //**Subtraction operator*********************************************************************
1954  friend inline const RowIterator operator-( const RowIterator& it, size_t dec ) {
1955  return RowIterator( *it.matrix_, it.row_, it.column_-dec );
1956  }
1957  //*******************************************************************************************
1958 
1959  private:
1960  //**Member variables*************************************************************************
1961  MatrixType* matrix_;
1962  size_t row_;
1963  size_t column_;
1964  //*******************************************************************************************
1965 
1966  //**Friend declarations**********************************************************************
1968  template< typename MatrixType2 > friend class RowIterator;
1970  //*******************************************************************************************
1971  };
1972  //**********************************************************************************************
1973 
1974  //**Type definitions****************************************************************************
1976  typedef RowIterator<const MT> ConstIterator;
1977 
1979  typedef typename SelectType< useConst, ConstIterator, RowIterator<MT> >::Type Iterator;
1980  //**********************************************************************************************
1981 
1982  //**Compilation flags***************************************************************************
1984  enum { vectorizable = 0 };
1985 
1987  enum { smpAssignable = 0 };
1988  //**********************************************************************************************
1989 
1990  //**Constructors********************************************************************************
1993  explicit inline DenseRow( MT& matrix, size_t index );
1994  // No explicitly declared copy constructor.
1996  //**********************************************************************************************
1997 
1998  //**Destructor**********************************************************************************
1999  // No explicitly declared destructor.
2000  //**********************************************************************************************
2001 
2002  //**Data access functions***********************************************************************
2005  inline Reference operator[]( size_t index );
2006  inline ConstReference operator[]( size_t index ) const;
2007  inline Iterator begin ();
2008  inline ConstIterator begin () const;
2009  inline ConstIterator cbegin() const;
2010  inline Iterator end ();
2011  inline ConstIterator end () const;
2012  inline ConstIterator cend () const;
2014  //**********************************************************************************************
2015 
2016  //**Assignment operators************************************************************************
2019  inline DenseRow& operator= ( const ElementType& rhs );
2020  inline DenseRow& operator= ( const DenseRow& rhs );
2021  template< typename VT > inline DenseRow& operator= ( const Vector<VT,true>& rhs );
2022  template< typename VT > inline DenseRow& operator+=( const Vector<VT,true>& rhs );
2023  template< typename VT > inline DenseRow& operator-=( const Vector<VT,true>& rhs );
2024  template< typename VT > inline DenseRow& operator*=( const Vector<VT,true>& rhs );
2025 
2026  template< typename Other >
2027  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
2028  operator*=( Other rhs );
2029 
2030  template< typename Other >
2031  inline typename EnableIf< IsNumeric<Other>, DenseRow >::Type&
2032  operator/=( Other rhs );
2034  //**********************************************************************************************
2035 
2036  //**Utility functions***************************************************************************
2039  inline size_t size() const;
2040  inline size_t capacity() const;
2041  inline size_t nonZeros() const;
2042  inline void reset();
2043  template< typename Other > inline DenseRow& scale( const Other& scalar );
2045  //**********************************************************************************************
2046 
2047  public:
2048  //**Expression template evaluation functions****************************************************
2051  template< typename Other > inline bool canAlias ( const Other* alias ) const;
2052  template< typename Other > inline bool isAliased ( const Other* alias ) const;
2053  template< typename VT > inline void assign ( const DenseVector <VT,true>& rhs );
2054  template< typename VT > inline void assign ( const SparseVector<VT,true>& rhs );
2055  template< typename VT > inline void addAssign ( const DenseVector <VT,true>& rhs );
2056  template< typename VT > inline void addAssign ( const SparseVector<VT,true>& rhs );
2057  template< typename VT > inline void subAssign ( const DenseVector <VT,true>& rhs );
2058  template< typename VT > inline void subAssign ( const SparseVector<VT,true>& rhs );
2059  template< typename VT > inline void multAssign( const DenseVector <VT,true>& rhs );
2060  template< typename VT > inline void multAssign( const SparseVector<VT,true>& rhs );
2062  //**********************************************************************************************
2063 
2064  private:
2065  //**Member variables****************************************************************************
2069  const size_t row_;
2070 
2071  //**********************************************************************************************
2072 
2073  //**Compile time checks*************************************************************************
2080  //**********************************************************************************************
2081 };
2083 //*************************************************************************************************
2084 
2085 
2086 
2087 
2088 //=================================================================================================
2089 //
2090 // CONSTRUCTOR
2091 //
2092 //=================================================================================================
2093 
2094 //*************************************************************************************************
2102 template< typename MT > // Type of the dense matrix
2103 inline DenseRow<MT,false>::DenseRow( MT& matrix, size_t index )
2104  : matrix_( matrix ) // The dense matrix containing the row
2105  , row_ ( index ) // The index of the row in the matrix
2106 {
2107  if( matrix_.rows() <= index )
2108  throw std::invalid_argument( "Invalid row access index" );
2109 }
2111 //*************************************************************************************************
2112 
2113 
2114 
2115 
2116 //=================================================================================================
2117 //
2118 // DATA ACCESS FUNCTIONS
2119 //
2120 //=================================================================================================
2121 
2122 //*************************************************************************************************
2129 template< typename MT > // Type of the dense matrix
2130 inline typename DenseRow<MT,false>::Reference DenseRow<MT,false>::operator[]( size_t index )
2131 {
2132  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2133  return matrix_(row_,index);
2134 }
2136 //*************************************************************************************************
2137 
2138 
2139 //*************************************************************************************************
2146 template< typename MT > // Type of the dense matrix
2147 inline typename DenseRow<MT,false>::ConstReference DenseRow<MT,false>::operator[]( size_t index ) const
2148 {
2149  BLAZE_USER_ASSERT( index < size(), "Invalid row access index" );
2150  return matrix_(row_,index);
2151 }
2153 //*************************************************************************************************
2154 
2155 
2156 //*************************************************************************************************
2164 template< typename MT > // Type of the dense matrix
2165 inline typename DenseRow<MT,false>::Iterator DenseRow<MT,false>::begin()
2166 {
2167  return Iterator( matrix_, row_, 0UL );
2168 }
2170 //*************************************************************************************************
2171 
2172 
2173 //*************************************************************************************************
2181 template< typename MT > // Type of the dense matrix
2182 inline typename DenseRow<MT,false>::ConstIterator DenseRow<MT,false>::begin() const
2183 {
2184  return ConstIterator( matrix_, row_, 0UL );
2185 }
2187 //*************************************************************************************************
2188 
2189 
2190 //*************************************************************************************************
2198 template< typename MT > // Type of the dense matrix
2199 inline typename DenseRow<MT,false>::ConstIterator DenseRow<MT,false>::cbegin() const
2200 {
2201  return ConstIterator( matrix_, row_, 0UL );
2202 }
2204 //*************************************************************************************************
2205 
2206 
2207 //*************************************************************************************************
2215 template< typename MT > // Type of the dense matrix
2216 inline typename DenseRow<MT,false>::Iterator DenseRow<MT,false>::end()
2217 {
2218  return Iterator( matrix_, row_, size() );
2219 }
2221 //*************************************************************************************************
2222 
2223 
2224 //*************************************************************************************************
2232 template< typename MT > // Type of the dense matrix
2233 inline typename DenseRow<MT,false>::ConstIterator DenseRow<MT,false>::end() const
2234 {
2235  return ConstIterator( matrix_, row_, size() );
2236 }
2238 //*************************************************************************************************
2239 
2240 
2241 //*************************************************************************************************
2249 template< typename MT > // Type of the dense matrix
2250 inline typename DenseRow<MT,false>::ConstIterator DenseRow<MT,false>::cend() const
2251 {
2252  return ConstIterator( matrix_, row_, size() );
2253 }
2255 //*************************************************************************************************
2256 
2257 
2258 
2259 
2260 //=================================================================================================
2261 //
2262 // ASSIGNMENT OPERATORS
2263 //
2264 //=================================================================================================
2265 
2266 //*************************************************************************************************
2273 template< typename MT > // Type of the dense matrix
2274 inline DenseRow<MT,false>& DenseRow<MT,false>::operator=( const ElementType& rhs )
2275 {
2276  const size_t columns( size() );
2277 
2278  for( size_t j=0UL; j<columns; ++j )
2279  matrix_(row_,j) = rhs;
2280 
2281  return *this;
2282 }
2284 //*************************************************************************************************
2285 
2286 
2287 //*************************************************************************************************
2298 template< typename MT > // Type of the dense matrix
2299 inline DenseRow<MT,false>& DenseRow<MT,false>::operator=( const DenseRow& rhs )
2300 {
2301  if( &rhs == this ) return *this;
2302 
2303  if( size() != rhs.size() )
2304  throw std::invalid_argument( "Row sizes do not match" );
2305 
2306  const size_t columns( size() );
2307 
2308  for( size_t j=0UL; j<columns; ++j )
2309  matrix_(row_,j) = rhs[j];
2310 
2311  return *this;
2312 }
2314 //*************************************************************************************************
2315 
2316 
2317 //*************************************************************************************************
2328 template< typename MT > // Type of the dense matrix
2329 template< typename VT > // Type of the right-hand side vector
2330 inline DenseRow<MT,false>& DenseRow<MT,false>::operator=( const Vector<VT,true>& rhs )
2331 {
2332  using blaze::assign;
2333 
2337 
2338  if( size() != (~rhs).size() )
2339  throw std::invalid_argument( "Vector sizes do not match" );
2340 
2341  if( (~rhs).canAlias( &matrix_ ) ) {
2342  const ResultType tmp( ~rhs );
2343  assign( *this, tmp );
2344  }
2345  else {
2346  if( IsSparseVector<VT>::value )
2347  reset();
2348  assign( *this, ~rhs );
2349  }
2350 
2351  return *this;
2352 }
2354 //*************************************************************************************************
2355 
2356 
2357 //*************************************************************************************************
2368 template< typename MT > // Type of the dense matrix
2369 template< typename VT > // Type of the right-hand side vector
2370 inline DenseRow<MT,false>& DenseRow<MT,false>::operator+=( const Vector<VT,true>& rhs )
2371 {
2372  using blaze::addAssign;
2373 
2376 
2377  if( size() != (~rhs).size() )
2378  throw std::invalid_argument( "Vector sizes do not match" );
2379 
2380  if( (~rhs).canAlias( &matrix_ ) ) {
2381  const typename VT::ResultType tmp( ~rhs );
2382  addAssign( *this, tmp );
2383  }
2384  else {
2385  addAssign( *this, ~rhs );
2386  }
2387 
2388  return *this;
2389 }
2391 //*************************************************************************************************
2392 
2393 
2394 //*************************************************************************************************
2405 template< typename MT > // Type of the dense matrix
2406 template< typename VT > // Type of the right-hand side vector
2407 inline DenseRow<MT,false>& DenseRow<MT,false>::operator-=( const Vector<VT,true>& rhs )
2408 {
2409  using blaze::subAssign;
2410 
2413 
2414  if( size() != (~rhs).size() )
2415  throw std::invalid_argument( "Vector sizes do not match" );
2416 
2417  if( (~rhs).canAlias( &matrix_ ) ) {
2418  const typename VT::ResultType tmp( ~rhs );
2419  subAssign( *this, tmp );
2420  }
2421  else {
2422  subAssign( *this, ~rhs );
2423  }
2424 
2425  return *this;
2426 }
2428 //*************************************************************************************************
2429 
2430 
2431 //*************************************************************************************************
2443 template< typename MT > // Type of the dense matrix
2444 template< typename VT > // Type of the right-hand side vector
2445 inline DenseRow<MT,false>& DenseRow<MT,false>::operator*=( const Vector<VT,true>& rhs )
2446 {
2447  using blaze::multAssign;
2448 
2451 
2452  if( size() != (~rhs).size() )
2453  throw std::invalid_argument( "Vector sizes do not match" );
2454 
2455  if( (~rhs).canAlias( &matrix_ ) || IsSparseVector<VT>::value ) {
2456  const typename VT::ResultType tmp( ~rhs );
2457  multAssign( *this, tmp );
2458  }
2459  else {
2460  multAssign( *this, ~rhs );
2461  }
2462 
2463  return *this;
2464 }
2466 //*************************************************************************************************
2467 
2468 
2469 //*************************************************************************************************
2477 template< typename MT > // Type of the dense matrix
2478 template< typename Other > // Data type of the right-hand side scalar
2479 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false> >::Type&
2480  DenseRow<MT,false>::operator*=( Other rhs )
2481 {
2482  for( size_t j=0UL; j<size(); ++j )
2483  matrix_(row_,j) *= rhs;
2484  return *this;
2485 }
2487 //*************************************************************************************************
2488 
2489 
2490 //*************************************************************************************************
2500 template< typename MT > // Type of the dense matrix
2501 template< typename Other > // Data type of the right-hand side scalar
2502 inline typename EnableIf< IsNumeric<Other>, DenseRow<MT,false> >::Type&
2503  DenseRow<MT,false>::operator/=( Other rhs )
2504 {
2505  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2506 
2507  typedef typename DivTrait<ElementType,Other>::Type DT;
2508  typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2509 
2510  // Depending on the two involved data types, an integer division is applied or a
2511  // floating point division is selected.
2512  if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2513  const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2514  for( size_t j=0UL; j<size(); ++j )
2515  matrix_(row_,j) *= tmp;
2516  }
2517  else {
2518  for( size_t j=0UL; j<size(); ++j )
2519  matrix_(row_,j) /= rhs;
2520  }
2521 
2522  return *this;
2523 }
2525 //*************************************************************************************************
2526 
2527 
2528 
2529 
2530 //=================================================================================================
2531 //
2532 // UTILITY FUNCTIONS
2533 //
2534 //=================================================================================================
2535 
2536 //*************************************************************************************************
2542 template< typename MT > // Type of the dense matrix
2543 inline size_t DenseRow<MT,false>::size() const
2544 {
2545  return matrix_.columns();
2546 }
2548 //*************************************************************************************************
2549 
2550 
2551 //*************************************************************************************************
2557 template< typename MT > // Type of the dense matrix
2558 inline size_t DenseRow<MT,false>::capacity() const
2559 {
2560  return matrix_.columns();
2561 }
2563 //*************************************************************************************************
2564 
2565 
2566 //*************************************************************************************************
2575 template< typename MT > // Type of the dense matrix
2576 inline size_t DenseRow<MT,false>::nonZeros() const
2577 {
2578  const size_t columns( size() );
2579  size_t nonzeros( 0UL );
2580 
2581  for( size_t j=0UL; j<columns; ++j )
2582  if( !isDefault( matrix_(row_,j) ) )
2583  ++nonzeros;
2584 
2585  return nonzeros;
2586 }
2588 //*************************************************************************************************
2589 
2590 
2591 //*************************************************************************************************
2597 template< typename MT > // Type of the dense matrix
2598 inline void DenseRow<MT,false>::reset()
2599 {
2600  using blaze::reset;
2601  const size_t columns( size() );
2602  for( size_t j=0UL; j<columns; ++j )
2603  reset( matrix_(row_,j) );
2604 }
2606 //*************************************************************************************************
2607 
2608 
2609 //*************************************************************************************************
2616 template< typename MT > // Type of the dense matrix
2617 template< typename Other > // Data type of the scalar value
2618 inline DenseRow<MT,false>& DenseRow<MT,false>::scale( const Other& scalar )
2619 {
2620  for( size_t j=0UL; j<size(); ++j ) {
2621  matrix_(row_,j) *= scalar;
2622  }
2623  return *this;
2624 }
2626 //*************************************************************************************************
2627 
2628 
2629 
2630 
2631 //=================================================================================================
2632 //
2633 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2634 //
2635 //=================================================================================================
2636 
2637 //*************************************************************************************************
2648 template< typename MT > // Type of the dense matrix
2649 template< typename Other > // Data type of the foreign expression
2650 inline bool DenseRow<MT,false>::canAlias( const Other* alias ) const
2651 {
2652  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
2653 }
2655 //*************************************************************************************************
2656 
2657 
2658 //*************************************************************************************************
2669 template< typename MT > // Type of the dense matrix
2670 template< typename Other > // Data type of the foreign expression
2671 inline bool DenseRow<MT,false>::isAliased( const Other* alias ) const
2672 {
2673  return static_cast<const void*>( &matrix_ ) == static_cast<const void*>( alias );
2674 }
2676 //*************************************************************************************************
2677 
2678 
2679 //*************************************************************************************************
2691 template< typename MT > // Type of the dense matrix
2692 template< typename VT > // Type of the right-hand side dense vector
2693 inline void DenseRow<MT,false>::assign( const DenseVector<VT,true>& rhs )
2694 {
2695  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2696 
2697  const size_t jend( (~rhs).size() & size_t(-2) );
2698  for( size_t j=0UL; j<jend; j+=2UL ) {
2699  matrix_(row_,j ) = (~rhs)[j ];
2700  matrix_(row_,j+1UL) = (~rhs)[j+1UL];
2701  }
2702  if( jend < (~rhs).size() )
2703  matrix_(row_,jend) = (~rhs)[jend];
2704 }
2706 //*************************************************************************************************
2707 
2708 
2709 //*************************************************************************************************
2721 template< typename MT > // Type of the dense matrix
2722 template< typename VT > // Type of the right-hand side sparse vector
2723 inline void DenseRow<MT,false>::assign( const SparseVector<VT,true>& rhs )
2724 {
2725  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2726 
2727  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2728  matrix_(row_,element->index()) = element->value();
2729 }
2731 //*************************************************************************************************
2732 
2733 
2734 //*************************************************************************************************
2746 template< typename MT > // Type of the dense matrix
2747 template< typename VT > // Type of the right-hand side dense vector
2748 inline void DenseRow<MT,false>::addAssign( const DenseVector<VT,true>& rhs )
2749 {
2750  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2751 
2752  const size_t jend( (~rhs).size() & size_t(-2) );
2753  for( size_t j=0UL; j<jend; j+=2UL ) {
2754  matrix_(row_,j ) += (~rhs)[j ];
2755  matrix_(row_,j+1UL) += (~rhs)[j+1UL];
2756  }
2757  if( jend < (~rhs).size() )
2758  matrix_(row_,jend) += (~rhs)[jend];
2759 }
2761 //*************************************************************************************************
2762 
2763 
2764 //*************************************************************************************************
2776 template< typename MT > // Type of the dense matrix
2777 template< typename VT > // Type of the right-hand side sparse vector
2778 inline void DenseRow<MT,false>::addAssign( const SparseVector<VT,true>& rhs )
2779 {
2780  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2781 
2782  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2783  matrix_(row_,element->index()) += element->value();
2784 }
2786 //*************************************************************************************************
2787 
2788 
2789 //*************************************************************************************************
2801 template< typename MT > // Type of the dense matrix
2802 template< typename VT > // Type of the right-hand side dense vector
2803 inline void DenseRow<MT,false>::subAssign( const DenseVector<VT,true>& rhs )
2804 {
2805  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2806 
2807  const size_t jend( (~rhs).size() & size_t(-2) );
2808  for( size_t j=0UL; j<jend; j+=2UL ) {
2809  matrix_(row_,j ) -= (~rhs)[j ];
2810  matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
2811  }
2812  if( jend < (~rhs).size() )
2813  matrix_(row_,jend) -= (~rhs)[jend];
2814 }
2816 //*************************************************************************************************
2817 
2818 
2819 //*************************************************************************************************
2831 template< typename MT > // Type of the dense matrix
2832 template< typename VT > // Type of the right-hand side sparse vector
2833 inline void DenseRow<MT,false>::subAssign( const SparseVector<VT,true>& rhs )
2834 {
2835  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2836 
2837  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2838  matrix_(row_,element->index()) -= element->value();
2839 }
2841 //*************************************************************************************************
2842 
2843 
2844 //*************************************************************************************************
2856 template< typename MT > // Type of the dense matrix
2857 template< typename VT > // Type of the right-hand side dense vector
2858 inline void DenseRow<MT,false>::multAssign( const DenseVector<VT,true>& rhs )
2859 {
2860  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2861 
2862  const size_t jend( (~rhs).size() & size_t(-2) );
2863  for( size_t j=0UL; j<jend; j+=2UL ) {
2864  matrix_(row_,j ) *= (~rhs)[j ];
2865  matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
2866  }
2867  if( jend < (~rhs).size() )
2868  matrix_(row_,jend) *= (~rhs)[jend];
2869 }
2871 //*************************************************************************************************
2872 
2873 
2874 //*************************************************************************************************
2886 template< typename MT > // Type of the dense matrix
2887 template< typename VT > // Type of the right-hand side sparse vector
2888 inline void DenseRow<MT,false>::multAssign( const SparseVector<VT,true>& rhs )
2889 {
2890  BLAZE_INTERNAL_ASSERT( size() == (~rhs).size(), "Invalid vector sizes" );
2891 
2892  const ResultType tmp( *this );
2893 
2894  reset();
2895 
2896  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2897  matrix_(row_,element->index()) = tmp[element->index()] * element->value();
2898 }
2900 //*************************************************************************************************
2901 
2902 
2903 
2904 
2905 
2906 
2907 
2908 
2909 //=================================================================================================
2910 //
2911 // DENSEROW OPERATORS
2912 //
2913 //=================================================================================================
2914 
2915 //*************************************************************************************************
2918 template< typename MT, bool SO >
2919 inline void reset( DenseRow<MT,SO>& row );
2920 
2921 template< typename MT, bool SO >
2922 inline void clear( DenseRow<MT,SO>& row );
2923 
2924 template< typename MT, bool SO >
2925 inline bool isDefault( const DenseRow<MT,SO>& row );
2927 //*************************************************************************************************
2928 
2929 
2930 //*************************************************************************************************
2937 template< typename MT // Type of the dense matrix
2938  , bool SO > // Storage order
2939 inline void reset( DenseRow<MT,SO>& row )
2940 {
2941  row.reset();
2942 }
2943 //*************************************************************************************************
2944 
2945 
2946 //*************************************************************************************************
2955 template< typename MT // Type of the dense matrix
2956  , bool SO > // Storage order
2957 inline void clear( DenseRow<MT,SO>& row )
2958 {
2959  row.reset();
2960 }
2961 //*************************************************************************************************
2962 
2963 
2964 //*************************************************************************************************
2982 template< typename MT // Type of the dense matrix
2983  , bool SO > // Storage order
2984 inline bool isDefault( const DenseRow<MT,SO>& row )
2985 {
2986  for( size_t i=0UL; i<row.size(); ++i )
2987  if( !isDefault( row[i] ) ) return false;
2988  return true;
2989 }
2990 //*************************************************************************************************
2991 
2992 
2993 
2994 
2995 //=================================================================================================
2996 //
2997 // GLOBAL FUNCTION
2998 //
2999 //=================================================================================================
3000 
3001 //*************************************************************************************************
3022 template< typename MT // Type of the dense matrix
3023  , bool SO > // Storage order
3024 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >, DenseRow<MT> >::Type
3025  row( DenseMatrix<MT,SO>& dm, size_t index )
3026 {
3028 
3029  return DenseRow<MT>( ~dm, index );
3030 }
3031 //*************************************************************************************************
3032 
3033 
3034 //*************************************************************************************************
3055 template< typename MT // Type of the dense matrix
3056  , bool SO > // Storage order
3057 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >, DenseRow<const MT> >::Type
3058  row( const DenseMatrix<MT,SO>& dm, size_t index )
3059 {
3061 
3062  return DenseRow<const MT>( ~dm, index );
3063 }
3064 //*************************************************************************************************
3065 
3066 
3067 
3068 
3069 //=================================================================================================
3070 //
3071 // SUBVECTORTRAIT SPECIALIZATIONS
3072 //
3073 //=================================================================================================
3074 
3075 //*************************************************************************************************
3077 template< typename MT, bool SO >
3078 struct SubvectorTrait< DenseRow<MT,SO> >
3079 {
3080  typedef typename SubvectorTrait< typename DenseRow<MT,SO>::ResultType >::Type Type;
3081 };
3083 //*************************************************************************************************
3084 
3085 } // namespace blaze
3086 
3087 #endif
Constraint on the data type.
Constraint on the data type.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, DenseColumn< MT > >::Type column(DenseMatrix< MT, SO > &dm, size_t index)
Creating a view on a specific column of the given dense matrix.
Definition: DenseColumn.h:3026
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseRow.h:336
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4512
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:222
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:3703
Header file for the View base class.
Header file for the row trait.
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4555
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
#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
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
Iterator end()
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:705
IT::Type IntrinsicType
Intrinsic type of the row elements.
Definition: DenseRow.h:335
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
Header file for the DenseVector base class.
bool canAlias(const Other *alias) const
Returns whether the dense row can alias with the given address alias.
Definition: DenseRow.h:1095
bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:442
const size_t row_
The first row of the submatrix.
Definition: DenseSubmatrix.h:2793
#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
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4528
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseRow.h:333
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: DenseRow.h:343
Constraint on the data type.
Base template for the RowTrait class.
Definition: RowTrait.h:114
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DenseRow.h:352
Header file for nested template disabiguation.
Header file for the IsFloatingPoint type trait.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1136
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2379
Header file for the Or class template.
DenseRow & operator=(const ElementType &rhs)
Homogenous assignment to all row elements.
Definition: DenseRow.h:760
void storeu(size_t index, const IntrinsicType &value)
Unligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1201
Header file for the subvector trait.
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:179
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseRow.h:332
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
Constraint on the data type.
Constraint on the data type.
ConstIterator cend() const
Returns an iterator just past the last element of the row.
Definition: DenseRow.h:737
Reference operator[](size_t index)
Subscript operator for the direct access to the row elements.
Definition: DenseRow.h:592
Operand matrix_
The dense matrix containing the column.
Definition: DenseColumn.h:2069
#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
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: DenseRow.h:689
Constraints on the storage order of matrix types.
Constraint on the data type.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2373
MT::ElementType ElementType
Type of the row elements.
Definition: DenseRow.h:334
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:269
Constraint on the data type.
const size_t column_
The first column of the submatrix.
Definition: DenseSubmatrix.h:2794
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2377
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
size_t nonZeros() const
Returns the number of non-zero elements in the row.
Definition: DenseRow.h:1034
ColumnIterator< const MT > ConstIterator
Iterator over constant elements.
Definition: DenseColumn.h:1972
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a constant row value.
Definition: DenseRow.h:349
Header file for the IsNumeric type trait.
size_t size() const
Returns the current size/dimension of the row.
Definition: DenseRow.h:1003
Operand matrix_
The dense matrix containing the row.
Definition: DenseRow.h:532
const size_t row_
The index of the row in the matrix.
Definition: DenseRow.h:2069
Header file for the IsSparseVector type trait.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2374
Header file for the IsConst type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:648
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: DenseRow.h:340
Header file for run time assertion macros.
const size_t row_
The index of the row in the matrix.
Definition: DenseRow.h:533
Iterator begin()
Returns an iterator to the first element of the row.
Definition: DenseRow.h:657
void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense row.
Definition: DenseRow.h:1223
Header file for the division trait.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:209
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense row.
Definition: DenseRow.h:1157
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Header file for the reset shim.
Reference to a specific row of a dense matrix.The DenseRow template represents a reference to a speci...
Definition: DenseRow.h:306
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, DenseRow< MT > >::Type row(DenseMatrix< MT, SO > &dm, size_t index)
Creating a view on a specific row of the given dense matrix.
Definition: DenseRow.h:3025
Header file for the cache size of the target architecture.
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: DenseRow.h:355
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:239
void reset()
Reset to the default initial values.
Definition: DenseRow.h:1048
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2378
#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
void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the dense row.
Definition: DenseRow.h:1179
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
Header file for all intrinsic functionality.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:79
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseRow.h:346
const DenseRow & CompositeType
Data type for composite expression templates.
Definition: DenseRow.h:337
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:147
Base class for all views.The View class serves as a tag for all views (subvectors, submatrices, rows, columns, ...). All classes that represent a view and that are used within the expression template environment of the Blaze library have to derive from this class in order to qualify as a view. Only in case a class is derived from the View base class, the IsView type trait recognizes the class as valid view.
Definition: View.h:64
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the row element type.
Definition: DenseRow.h:315
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:247
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
DenseRow(MT &matrix, size_t index)
The constructor for DenseRow.
Definition: DenseRow.h:566
DenseRow< MT, SO > This
Type of this DenseRow instance.
Definition: DenseRow.h:331
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2370
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: TransposeFlag.h:81
size_t capacity() const
Returns the maximum capacity of the dense row.
Definition: DenseRow.h:1017
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2376
SelectType< useConst, ConstIterator, ColumnIterator< MT > >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:1980
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
bool isAliased(const Other *alias) const
Returns whether the dense row is aliased with the given address alias.
Definition: DenseRow.h:1115
Pointer data()
Low-level data access to the row elements.
Definition: DenseRow.h:625
#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
Operand matrix_
The dense matrix containing the submatrix.
Definition: DenseSubmatrix.h:2792
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseRow.h:312