DynamicMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_
36 #define _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
53 #include <blaze/math/Forward.h>
54 #include <blaze/math/Functions.h>
56 #include <blaze/math/shims/Clear.h>
59 #include <blaze/math/shims/Reset.h>
60 #include <blaze/math/SIMD.h>
97 #include <blaze/system/Blocking.h>
98 #include <blaze/system/CacheSize.h>
99 #include <blaze/system/Inline.h>
101 #include <blaze/system/Restrict.h>
103 #include <blaze/system/Thresholds.h>
109 #include <blaze/util/Assert.h>
115 #include <blaze/util/DisableIf.h>
116 #include <blaze/util/EnableIf.h>
118 #include <blaze/util/Memory.h>
119 #include <blaze/util/Template.h>
120 #include <blaze/util/TrueType.h>
121 #include <blaze/util/Types.h>
125 #include <blaze/util/Unused.h>
126 
127 
128 namespace blaze {
129 
130 //=================================================================================================
131 //
132 // CLASS DEFINITION
133 //
134 //=================================================================================================
135 
136 //*************************************************************************************************
215 template< typename Type // Data type of the matrix
216  , bool SO = defaultStorageOrder > // Storage order
218  : public DenseMatrix< DynamicMatrix<Type,SO>, SO >
219 {
220  public:
221  //**Type definitions****************************************************************************
224  using ResultType = This;
227  using ElementType = Type;
229  using ReturnType = const Type&;
230  using CompositeType = const This&;
231 
232  using Reference = Type&;
233  using ConstReference = const Type&;
234  using Pointer = Type*;
235  using ConstPointer = const Type*;
236 
239  //**********************************************************************************************
240 
241  //**Rebind struct definition********************************************************************
244  template< typename NewType > // Data type of the other matrix
245  struct Rebind {
247  };
248  //**********************************************************************************************
249 
250  //**Resize struct definition********************************************************************
253  template< size_t NewM // Number of rows of the other matrix
254  , size_t NewN > // Number of columns of the other matrix
255  struct Resize {
257  };
258  //**********************************************************************************************
259 
260  //**Compilation flags***************************************************************************
262 
266  enum : bool { simdEnabled = IsVectorizable<Type>::value };
267 
269 
272  enum : bool { smpAssignable = !IsSMPAssignable<Type>::value };
273  //**********************************************************************************************
274 
275  //**Constructors********************************************************************************
278  explicit inline DynamicMatrix() noexcept;
279  explicit inline DynamicMatrix( size_t m, size_t n );
280  explicit inline DynamicMatrix( size_t m, size_t n, const Type& init );
281  explicit inline DynamicMatrix( initializer_list< initializer_list<Type> > list );
282 
283  template< typename Other >
284  explicit inline DynamicMatrix( size_t m, size_t n, const Other* array );
285 
286  template< typename Other, size_t Rows, size_t Cols >
287  explicit inline DynamicMatrix( const Other (&array)[Rows][Cols] );
288 
289  inline DynamicMatrix( const DynamicMatrix& m );
290  inline DynamicMatrix( DynamicMatrix&& m ) noexcept;
291  template< typename MT, bool SO2 > inline DynamicMatrix( const Matrix<MT,SO2>& m );
293  //**********************************************************************************************
294 
295  //**Destructor**********************************************************************************
298  inline ~DynamicMatrix();
300  //**********************************************************************************************
301 
302  //**Data access functions***********************************************************************
305  inline Reference operator()( size_t i, size_t j ) noexcept;
306  inline ConstReference operator()( size_t i, size_t j ) const noexcept;
307  inline Reference at( size_t i, size_t j );
308  inline ConstReference at( size_t i, size_t j ) const;
309  inline Pointer data () noexcept;
310  inline ConstPointer data () const noexcept;
311  inline Pointer data ( size_t i ) noexcept;
312  inline ConstPointer data ( size_t i ) const noexcept;
313  inline Iterator begin ( size_t i ) noexcept;
314  inline ConstIterator begin ( size_t i ) const noexcept;
315  inline ConstIterator cbegin( size_t i ) const noexcept;
316  inline Iterator end ( size_t i ) noexcept;
317  inline ConstIterator end ( size_t i ) const noexcept;
318  inline ConstIterator cend ( size_t i ) const noexcept;
320  //**********************************************************************************************
321 
322  //**Assignment operators************************************************************************
325  inline DynamicMatrix& operator=( const Type& rhs );
326  inline DynamicMatrix& operator=( initializer_list< initializer_list<Type> > list );
327 
328  template< typename Other, size_t Rows, size_t Cols >
329  inline DynamicMatrix& operator=( const Other (&array)[Rows][Cols] );
330 
331  inline DynamicMatrix& operator=( const DynamicMatrix& rhs );
332  inline DynamicMatrix& operator=( DynamicMatrix&& rhs ) noexcept;
333 
334  template< typename MT, bool SO2 > inline DynamicMatrix& operator= ( const Matrix<MT,SO2>& rhs );
335  template< typename MT, bool SO2 > inline DynamicMatrix& operator+=( const Matrix<MT,SO2>& rhs );
336  template< typename MT, bool SO2 > inline DynamicMatrix& operator-=( const Matrix<MT,SO2>& rhs );
337  template< typename MT, bool SO2 > inline DynamicMatrix& operator%=( const Matrix<MT,SO2>& rhs );
339  //**********************************************************************************************
340 
341  //**Utility functions***************************************************************************
344  inline size_t rows() const noexcept;
345  inline size_t columns() const noexcept;
346  inline size_t spacing() const noexcept;
347  inline size_t capacity() const noexcept;
348  inline size_t capacity( size_t i ) const noexcept;
349  inline size_t nonZeros() const;
350  inline size_t nonZeros( size_t i ) const;
351  inline void reset();
352  inline void reset( size_t i );
353  inline void clear();
354  void resize ( size_t m, size_t n, bool preserve=true );
355  inline void extend ( size_t m, size_t n, bool preserve=true );
356  inline void reserve( size_t elements );
357  inline void shrinkToFit();
358  inline void swap( DynamicMatrix& m ) noexcept;
360  //**********************************************************************************************
361 
362  //**Numeric functions***************************************************************************
365  inline DynamicMatrix& transpose();
366  inline DynamicMatrix& ctranspose();
367 
368  template< typename Other > inline DynamicMatrix& scale( const Other& scalar );
370  //**********************************************************************************************
371 
372  private:
373  //**********************************************************************************************
375  template< typename MT >
377  struct VectorizedAssign {
378  enum : bool { value = useOptimizedKernels &&
379  simdEnabled && MT::simdEnabled &&
381  };
383  //**********************************************************************************************
384 
385  //**********************************************************************************************
387  template< typename MT >
389  struct VectorizedAddAssign {
390  enum : bool { value = useOptimizedKernels &&
391  simdEnabled && MT::simdEnabled &&
395  };
397  //**********************************************************************************************
398 
399  //**********************************************************************************************
401  template< typename MT >
403  struct VectorizedSubAssign {
404  enum : bool { value = useOptimizedKernels &&
405  simdEnabled && MT::simdEnabled &&
409  };
411  //**********************************************************************************************
412 
413  //**********************************************************************************************
415  template< typename MT >
417  struct VectorizedSchurAssign {
418  enum : bool { value = useOptimizedKernels &&
419  simdEnabled && MT::simdEnabled &&
422  };
424  //**********************************************************************************************
425 
426  //**********************************************************************************************
428  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
429  //**********************************************************************************************
430 
431  public:
432  //**Debugging functions*************************************************************************
435  inline bool isIntact() const noexcept;
437  //**********************************************************************************************
438 
439  //**Expression template evaluation functions****************************************************
442  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
443  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
444 
445  inline bool isAligned () const noexcept;
446  inline bool canSMPAssign() const noexcept;
447 
448  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
449  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
450  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
451 
452  BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
453  BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
454  BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
455  BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
456 
457  template< typename MT >
458  inline DisableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO>& rhs );
459 
460  template< typename MT >
461  inline EnableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO>& rhs );
462 
463  template< typename MT > inline void assign( const DenseMatrix<MT,!SO>& rhs );
464  template< typename MT > inline void assign( const SparseMatrix<MT,SO>& rhs );
465  template< typename MT > inline void assign( const SparseMatrix<MT,!SO>& rhs );
466 
467  template< typename MT >
468  inline DisableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO>& rhs );
469 
470  template< typename MT >
471  inline EnableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO>& rhs );
472 
473  template< typename MT > inline void addAssign( const DenseMatrix<MT,!SO>& rhs );
474  template< typename MT > inline void addAssign( const SparseMatrix<MT,SO>& rhs );
475  template< typename MT > inline void addAssign( const SparseMatrix<MT,!SO>& rhs );
476 
477  template< typename MT >
478  inline DisableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO>& rhs );
479 
480  template< typename MT >
481  inline EnableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO>& rhs );
482 
483  template< typename MT > inline void subAssign( const DenseMatrix<MT,!SO>& rhs );
484  template< typename MT > inline void subAssign( const SparseMatrix<MT,SO>& rhs );
485  template< typename MT > inline void subAssign( const SparseMatrix<MT,!SO>& rhs );
486 
487  template< typename MT >
488  inline DisableIf_<VectorizedSchurAssign<MT> > schurAssign( const DenseMatrix<MT,SO>& rhs );
489 
490  template< typename MT >
491  inline EnableIf_<VectorizedSchurAssign<MT> > schurAssign( const DenseMatrix<MT,SO>& rhs );
492 
493  template< typename MT > inline void schurAssign( const DenseMatrix<MT,!SO>& rhs );
494  template< typename MT > inline void schurAssign( const SparseMatrix<MT,SO>& rhs );
495  template< typename MT > inline void schurAssign( const SparseMatrix<MT,!SO>& rhs );
497  //**********************************************************************************************
498 
499  private:
500  //**Utility functions***************************************************************************
503  inline size_t addPadding( size_t value ) const noexcept;
505  //**********************************************************************************************
506 
507  //**Member variables****************************************************************************
510  size_t m_;
511  size_t n_;
512  size_t nn_;
513  size_t capacity_;
515 
525  //**********************************************************************************************
526 
527  //**Compile time checks*************************************************************************
534  //**********************************************************************************************
535 };
536 //*************************************************************************************************
537 
538 
539 
540 
541 //=================================================================================================
542 //
543 // CONSTRUCTORS
544 //
545 //=================================================================================================
546 
547 //*************************************************************************************************
550 template< typename Type // Data type of the matrix
551  , bool SO > // Storage order
553  : m_ ( 0UL ) // The current number of rows of the matrix
554  , n_ ( 0UL ) // The current number of columns of the matrix
555  , nn_ ( 0UL ) // The alignment adjusted number of columns
556  , capacity_( 0UL ) // The maximum capacity of the matrix
557  , v_ ( nullptr ) // The matrix elements
558 {}
559 //*************************************************************************************************
560 
561 
562 //*************************************************************************************************
571 template< typename Type // Data type of the matrix
572  , bool SO > // Storage order
573 inline DynamicMatrix<Type,SO>::DynamicMatrix( size_t m, size_t n )
574  : m_ ( m ) // The current number of rows of the matrix
575  , n_ ( n ) // The current number of columns of the matrix
576  , nn_ ( addPadding( n ) ) // The alignment adjusted number of columns
577  , capacity_( m_*nn_ ) // The maximum capacity of the matrix
578  , v_ ( allocate<Type>( capacity_ ) ) // The matrix elements
579 {
581  for( size_t i=0UL; i<m_; ++i ) {
582  for( size_t j=n_; j<nn_; ++j ) {
583  v_[i*nn_+j] = Type();
584  }
585  }
586  }
587 
588  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
589 }
590 //*************************************************************************************************
591 
592 
593 //*************************************************************************************************
602 template< typename Type // Data type of the matrix
603  , bool SO > // Storage order
604 inline DynamicMatrix<Type,SO>::DynamicMatrix( size_t m, size_t n, const Type& init )
605  : DynamicMatrix( m, n )
606 {
607  for( size_t i=0UL; i<m; ++i ) {
608  for( size_t j=0UL; j<n_; ++j ) {
609  v_[i*nn_+j] = init;
610  }
611  }
612 
613  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
614 }
615 //*************************************************************************************************
616 
617 
618 //*************************************************************************************************
638 template< typename Type // Data type of the matrix
639  , bool SO > // Storage order
641  : DynamicMatrix( list.size(), determineColumns( list ) )
642 {
643  size_t i( 0UL );
644 
645  for( const auto& rowList : list ) {
646  std::fill( std::copy( rowList.begin(), rowList.end(), begin(i) ), end(i), Type() );
647  ++i;
648  }
649 
650  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
651 }
652 //*************************************************************************************************
653 
654 
655 //*************************************************************************************************
678 template< typename Type // Data type of the matrix
679  , bool SO > // Storage order
680 template< typename Other > // Data type of the initialization array
681 inline DynamicMatrix<Type,SO>::DynamicMatrix( size_t m, size_t n, const Other* array )
682  : DynamicMatrix( m, n )
683 {
684  for( size_t i=0UL; i<m; ++i ) {
685  for( size_t j=0UL; j<n; ++j ) {
686  v_[i*nn_+j] = array[i*n+j];
687  }
688  }
689 
690  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
691 }
692 //*************************************************************************************************
693 
694 
695 //*************************************************************************************************
716 template< typename Type // Data type of the matrix
717  , bool SO > // Storage order
718 template< typename Other // Data type of the initialization array
719  , size_t Rows // Number of rows of the initialization array
720  , size_t Cols > // Number of columns of the initialization array
721 inline DynamicMatrix<Type,SO>::DynamicMatrix( const Other (&array)[Rows][Cols] )
722  : DynamicMatrix( Rows, Cols )
723 {
724  for( size_t i=0UL; i<Rows; ++i ) {
725  for( size_t j=0UL; j<Cols; ++j ) {
726  v_[i*nn_+j] = array[i][j];
727  }
728  }
729 
730  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
731 }
732 //*************************************************************************************************
733 
734 
735 //*************************************************************************************************
743 template< typename Type // Data type of the matrix
744  , bool SO > // Storage order
746  : DynamicMatrix( m.m_, m.n_ )
747 {
748  BLAZE_INTERNAL_ASSERT( capacity_ <= m.capacity_, "Invalid capacity estimation" );
749 
750  smpAssign( *this, m );
751 
752  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
753 }
754 //*************************************************************************************************
755 
756 
757 //*************************************************************************************************
762 template< typename Type // Data type of the matrix
763  , bool SO > // Storage order
765  : m_ ( m.m_ ) // The current number of rows of the matrix
766  , n_ ( m.n_ ) // The current number of columns of the matrix
767  , nn_ ( m.nn_ ) // The alignment adjusted number of columns
768  , capacity_( m.capacity_ ) // The maximum capacity of the matrix
769  , v_ ( m.v_ ) // The matrix elements
770 {
771  m.m_ = 0UL;
772  m.n_ = 0UL;
773  m.nn_ = 0UL;
774  m.capacity_ = 0UL;
775  m.v_ = nullptr;
776 }
777 //*************************************************************************************************
778 
779 
780 //*************************************************************************************************
785 template< typename Type // Data type of the matrix
786  , bool SO > // Storage order
787 template< typename MT // Type of the foreign matrix
788  , bool SO2 > // Storage order of the foreign matrix
790  : DynamicMatrix( (~m).rows(), (~m).columns() )
791 {
793  for( size_t i=0UL; i<m_; ++i ) {
794  for( size_t j=0UL; j<n_; ++j ) {
795  v_[i*nn_+j] = Type();
796  }
797  }
798  }
799 
800  smpAssign( *this, ~m );
801 
802  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
803 }
804 //*************************************************************************************************
805 
806 
807 
808 
809 //=================================================================================================
810 //
811 // DESTRUCTOR
812 //
813 //=================================================================================================
814 
815 //*************************************************************************************************
818 template< typename Type // Data type of the matrix
819  , bool SO > // Storage order
821 {
822  deallocate( v_ );
823 }
824 //*************************************************************************************************
825 
826 
827 
828 
829 //=================================================================================================
830 //
831 // DATA ACCESS FUNCTIONS
832 //
833 //=================================================================================================
834 
835 //*************************************************************************************************
845 template< typename Type // Data type of the matrix
846  , bool SO > // Storage order
847 inline typename DynamicMatrix<Type,SO>::Reference
848  DynamicMatrix<Type,SO>::operator()( size_t i, size_t j ) noexcept
849 {
850  BLAZE_USER_ASSERT( i<m_, "Invalid row access index" );
851  BLAZE_USER_ASSERT( j<n_, "Invalid column access index" );
852  return v_[i*nn_+j];
853 }
854 //*************************************************************************************************
855 
856 
857 //*************************************************************************************************
867 template< typename Type // Data type of the matrix
868  , bool SO > // Storage order
870  DynamicMatrix<Type,SO>::operator()( size_t i, size_t j ) const noexcept
871 {
872  BLAZE_USER_ASSERT( i<m_, "Invalid row access index" );
873  BLAZE_USER_ASSERT( j<n_, "Invalid column access index" );
874  return v_[i*nn_+j];
875 }
876 //*************************************************************************************************
877 
878 
879 //*************************************************************************************************
890 template< typename Type // Data type of the matrix
891  , bool SO > // Storage order
892 inline typename DynamicMatrix<Type,SO>::Reference
893  DynamicMatrix<Type,SO>::at( size_t i, size_t j )
894 {
895  if( i >= m_ ) {
896  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
897  }
898  if( j >= n_ ) {
899  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
900  }
901  return (*this)(i,j);
902 }
903 //*************************************************************************************************
904 
905 
906 //*************************************************************************************************
917 template< typename Type // Data type of the matrix
918  , bool SO > // Storage order
920  DynamicMatrix<Type,SO>::at( size_t i, size_t j ) const
921 {
922  if( i >= m_ ) {
923  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
924  }
925  if( j >= n_ ) {
926  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
927  }
928  return (*this)(i,j);
929 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
945 template< typename Type // Data type of the matrix
946  , bool SO > // Storage order
947 inline typename DynamicMatrix<Type,SO>::Pointer
949 {
950  return v_;
951 }
952 //*************************************************************************************************
953 
954 
955 //*************************************************************************************************
967 template< typename Type // Data type of the matrix
968  , bool SO > // Storage order
971 {
972  return v_;
973 }
974 //*************************************************************************************************
975 
976 
977 //*************************************************************************************************
985 template< typename Type // Data type of the matrix
986  , bool SO > // Storage order
987 inline typename DynamicMatrix<Type,SO>::Pointer
988  DynamicMatrix<Type,SO>::data( size_t i ) noexcept
989 {
990  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
991  return v_ + i*nn_;
992 }
993 //*************************************************************************************************
994 
995 
996 //*************************************************************************************************
1004 template< typename Type // Data type of the matrix
1005  , bool SO > // Storage order
1007  DynamicMatrix<Type,SO>::data( size_t i ) const noexcept
1008 {
1009  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1010  return v_ + i*nn_;
1011 }
1012 //*************************************************************************************************
1013 
1014 
1015 //*************************************************************************************************
1026 template< typename Type // Data type of the matrix
1027  , bool SO > // Storage order
1028 inline typename DynamicMatrix<Type,SO>::Iterator
1029  DynamicMatrix<Type,SO>::begin( size_t i ) noexcept
1030 {
1031  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1032  return Iterator( v_ + i*nn_ );
1033 }
1034 //*************************************************************************************************
1035 
1036 
1037 //*************************************************************************************************
1048 template< typename Type // Data type of the matrix
1049  , bool SO > // Storage order
1051  DynamicMatrix<Type,SO>::begin( size_t i ) const noexcept
1052 {
1053  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1054  return ConstIterator( v_ + i*nn_ );
1055 }
1056 //*************************************************************************************************
1057 
1058 
1059 //*************************************************************************************************
1070 template< typename Type // Data type of the matrix
1071  , bool SO > // Storage order
1073  DynamicMatrix<Type,SO>::cbegin( size_t i ) const noexcept
1074 {
1075  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1076  return ConstIterator( v_ + i*nn_ );
1077 }
1078 //*************************************************************************************************
1079 
1080 
1081 //*************************************************************************************************
1092 template< typename Type // Data type of the matrix
1093  , bool SO > // Storage order
1094 inline typename DynamicMatrix<Type,SO>::Iterator
1095  DynamicMatrix<Type,SO>::end( size_t i ) noexcept
1096 {
1097  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1098  return Iterator( v_ + i*nn_ + n_ );
1099 }
1100 //*************************************************************************************************
1101 
1102 
1103 //*************************************************************************************************
1114 template< typename Type // Data type of the matrix
1115  , bool SO > // Storage order
1117  DynamicMatrix<Type,SO>::end( size_t i ) const noexcept
1118 {
1119  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1120  return ConstIterator( v_ + i*nn_ + n_ );
1121 }
1122 //*************************************************************************************************
1123 
1124 
1125 //*************************************************************************************************
1136 template< typename Type // Data type of the matrix
1137  , bool SO > // Storage order
1139  DynamicMatrix<Type,SO>::cend( size_t i ) const noexcept
1140 {
1141  BLAZE_USER_ASSERT( i < m_, "Invalid dense matrix row access index" );
1142  return ConstIterator( v_ + i*nn_ + n_ );
1143 }
1144 //*************************************************************************************************
1145 
1146 
1147 
1148 
1149 //=================================================================================================
1150 //
1151 // ASSIGNMENT OPERATORS
1152 //
1153 //=================================================================================================
1154 
1155 //*************************************************************************************************
1161 template< typename Type // Data type of the matrix
1162  , bool SO > // Storage order
1164 {
1165  for( size_t i=0UL; i<m_; ++i )
1166  for( size_t j=0UL; j<n_; ++j )
1167  v_[i*nn_+j] = rhs;
1168 
1169  return *this;
1170 }
1171 //*************************************************************************************************
1172 
1173 
1174 //*************************************************************************************************
1195 template< typename Type // Data type of the matrix
1196  , bool SO > // Storage order
1197 inline DynamicMatrix<Type,SO>&
1199 {
1200  resize( list.size(), determineColumns( list ), false );
1201 
1202  size_t i( 0UL );
1203 
1204  for( const auto& rowList : list ) {
1205  std::fill( std::copy( rowList.begin(), rowList.end(), v_+i*nn_ ), v_+(i+1UL)*nn_, Type() );
1206  ++i;
1207  }
1208 
1209  return *this;
1210 }
1211 //*************************************************************************************************
1212 
1213 
1214 //*************************************************************************************************
1235 template< typename Type // Data type of the matrix
1236  , bool SO > // Storage order
1237 template< typename Other // Data type of the initialization array
1238  , size_t Rows // Number of rows of the initialization array
1239  , size_t Cols > // Number of columns of the initialization array
1240 inline DynamicMatrix<Type,SO>& DynamicMatrix<Type,SO>::operator=( const Other (&array)[Rows][Cols] )
1241 {
1242  resize( Rows, Cols, false );
1243 
1244  for( size_t i=0UL; i<Rows; ++i )
1245  for( size_t j=0UL; j<Cols; ++j )
1246  v_[i*nn_+j] = array[i][j];
1247 
1248  return *this;
1249 }
1250 //*************************************************************************************************
1251 
1252 
1253 //*************************************************************************************************
1262 template< typename Type // Data type of the matrix
1263  , bool SO > // Storage order
1265 {
1266  if( &rhs == this ) return *this;
1267 
1268  resize( rhs.m_, rhs.n_, false );
1269  smpAssign( *this, ~rhs );
1270 
1271  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1272 
1273  return *this;
1274 }
1275 //*************************************************************************************************
1276 
1277 
1278 //*************************************************************************************************
1284 template< typename Type // Data type of the matrix
1285  , bool SO > // Storage order
1287 {
1288  deallocate( v_ );
1289 
1290  m_ = rhs.m_;
1291  n_ = rhs.n_;
1292  nn_ = rhs.nn_;
1293  capacity_ = rhs.capacity_;
1294  v_ = rhs.v_;
1295 
1296  rhs.m_ = 0UL;
1297  rhs.n_ = 0UL;
1298  rhs.nn_ = 0UL;
1299  rhs.capacity_ = 0UL;
1300  rhs.v_ = nullptr;
1301 
1302  return *this;
1303 }
1304 //*************************************************************************************************
1305 
1306 
1307 //*************************************************************************************************
1316 template< typename Type // Data type of the matrix
1317  , bool SO > // Storage order
1318 template< typename MT // Type of the right-hand side matrix
1319  , bool SO2 > // Storage order of the right-hand side matrix
1321 {
1322  using TT = TransExprTrait_<This>;
1323  using CT = CTransExprTrait_<This>;
1324  using IT = InvExprTrait_<This>;
1325 
1326  if( IsSame<MT,TT>::value && (~rhs).isAliased( this ) ) {
1327  transpose();
1328  }
1329  else if( IsSame<MT,CT>::value && (~rhs).isAliased( this ) ) {
1330  ctranspose();
1331  }
1332  else if( !IsSame<MT,IT>::value && (~rhs).canAlias( this ) ) {
1333  DynamicMatrix tmp( ~rhs );
1334  swap( tmp );
1335  }
1336  else {
1337  resize( (~rhs).rows(), (~rhs).columns(), false );
1339  reset();
1340  smpAssign( *this, ~rhs );
1341  }
1342 
1343  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1344 
1345  return *this;
1346 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1360 template< typename Type // Data type of the matrix
1361  , bool SO > // Storage order
1362 template< typename MT // Type of the right-hand side matrix
1363  , bool SO2 > // Storage order of the right-hand side matrix
1365 {
1366  if( (~rhs).rows() != m_ || (~rhs).columns() != n_ ) {
1367  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1368  }
1369 
1370  if( (~rhs).canAlias( this ) ) {
1371  const ResultType_<MT> tmp( ~rhs );
1372  smpAddAssign( *this, tmp );
1373  }
1374  else {
1375  smpAddAssign( *this, ~rhs );
1376  }
1377 
1378  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1379 
1380  return *this;
1381 }
1382 //*************************************************************************************************
1383 
1384 
1385 //*************************************************************************************************
1395 template< typename Type // Data type of the matrix
1396  , bool SO > // Storage order
1397 template< typename MT // Type of the right-hand side matrix
1398  , bool SO2 > // Storage order of the right-hand side matrix
1400 {
1401  if( (~rhs).rows() != m_ || (~rhs).columns() != n_ ) {
1402  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1403  }
1404 
1405  if( (~rhs).canAlias( this ) ) {
1406  const ResultType_<MT> tmp( ~rhs );
1407  smpSubAssign( *this, tmp );
1408  }
1409  else {
1410  smpSubAssign( *this, ~rhs );
1411  }
1412 
1413  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1414 
1415  return *this;
1416 }
1417 //*************************************************************************************************
1418 
1419 
1420 //*************************************************************************************************
1430 template< typename Type // Data type of the matrix
1431  , bool SO > // Storage order
1432 template< typename MT // Type of the right-hand side matrix
1433  , bool SO2 > // Storage order of the right-hand side matrix
1435 {
1436  if( (~rhs).rows() != m_ || (~rhs).columns() != n_ ) {
1437  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1438  }
1439 
1440  if( (~rhs).canAlias( this ) ) {
1441  const ResultType_<MT> tmp( ~rhs );
1442  smpSchurAssign( *this, tmp );
1443  }
1444  else {
1445  smpSchurAssign( *this, ~rhs );
1446  }
1447 
1448  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1449 
1450  return *this;
1451 }
1452 //*************************************************************************************************
1453 
1454 
1455 
1456 
1457 //=================================================================================================
1458 //
1459 // UTILITY FUNCTIONS
1460 //
1461 //=================================================================================================
1462 
1463 //*************************************************************************************************
1468 template< typename Type // Data type of the matrix
1469  , bool SO > // Storage order
1470 inline size_t DynamicMatrix<Type,SO>::rows() const noexcept
1471 {
1472  return m_;
1473 }
1474 //*************************************************************************************************
1475 
1476 
1477 //*************************************************************************************************
1482 template< typename Type // Data type of the matrix
1483  , bool SO > // Storage order
1484 inline size_t DynamicMatrix<Type,SO>::columns() const noexcept
1485 {
1486  return n_;
1487 }
1488 //*************************************************************************************************
1489 
1490 
1491 //*************************************************************************************************
1501 template< typename Type // Data type of the matrix
1502  , bool SO > // Storage order
1503 inline size_t DynamicMatrix<Type,SO>::spacing() const noexcept
1504 {
1505  return nn_;
1506 }
1507 //*************************************************************************************************
1508 
1509 
1510 //*************************************************************************************************
1515 template< typename Type // Data type of the matrix
1516  , bool SO > // Storage order
1517 inline size_t DynamicMatrix<Type,SO>::capacity() const noexcept
1518 {
1519  return capacity_;
1520 }
1521 //*************************************************************************************************
1522 
1523 
1524 //*************************************************************************************************
1535 template< typename Type // Data type of the matrix
1536  , bool SO > // Storage order
1537 inline size_t DynamicMatrix<Type,SO>::capacity( size_t i ) const noexcept
1538 {
1539  UNUSED_PARAMETER( i );
1540  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1541  return nn_;
1542 }
1543 //*************************************************************************************************
1544 
1545 
1546 //*************************************************************************************************
1551 template< typename Type // Data type of the matrix
1552  , bool SO > // Storage order
1554 {
1555  size_t nonzeros( 0UL );
1556 
1557  for( size_t i=0UL; i<m_; ++i )
1558  for( size_t j=0UL; j<n_; ++j )
1559  if( !isDefault( v_[i*nn_+j] ) )
1560  ++nonzeros;
1561 
1562  return nonzeros;
1563 }
1564 //*************************************************************************************************
1565 
1566 
1567 //*************************************************************************************************
1578 template< typename Type // Data type of the matrix
1579  , bool SO > // Storage order
1580 inline size_t DynamicMatrix<Type,SO>::nonZeros( size_t i ) const
1581 {
1582  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1583 
1584  const size_t jend( i*nn_ + n_ );
1585  size_t nonzeros( 0UL );
1586 
1587  for( size_t j=i*nn_; j<jend; ++j )
1588  if( !isDefault( v_[j] ) )
1589  ++nonzeros;
1590 
1591  return nonzeros;
1592 }
1593 //*************************************************************************************************
1594 
1595 
1596 //*************************************************************************************************
1601 template< typename Type // Data type of the matrix
1602  , bool SO > // Storage order
1604 {
1605  using blaze::clear;
1606 
1607  for( size_t i=0UL; i<m_; ++i )
1608  for( size_t j=0UL; j<n_; ++j )
1609  clear( v_[i*nn_+j] );
1610 }
1611 //*************************************************************************************************
1612 
1613 
1614 //*************************************************************************************************
1625 template< typename Type // Data type of the matrix
1626  , bool SO > // Storage order
1627 inline void DynamicMatrix<Type,SO>::reset( size_t i )
1628 {
1629  using blaze::clear;
1630 
1631  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1632  for( size_t j=0UL; j<n_; ++j )
1633  clear( v_[i*nn_+j] );
1634 }
1635 //*************************************************************************************************
1636 
1637 
1638 //*************************************************************************************************
1645 template< typename Type // Data type of the matrix
1646  , bool SO > // Storage order
1648 {
1649  resize( 0UL, 0UL, false );
1650 }
1651 //*************************************************************************************************
1652 
1653 
1654 //*************************************************************************************************
1688 template< typename Type // Data type of the matrix
1689  , bool SO > // Storage order
1690 void DynamicMatrix<Type,SO>::resize( size_t m, size_t n, bool preserve )
1691 {
1692  using std::swap;
1693  using blaze::min;
1694 
1695  if( m == m_ && n == n_ ) return;
1696 
1697  const size_t nn( addPadding( n ) );
1698 
1699  if( preserve )
1700  {
1701  Type* BLAZE_RESTRICT v = allocate<Type>( m*nn );
1702  const size_t min_m( min( m, m_ ) );
1703  const size_t min_n( min( n, n_ ) );
1704 
1705  for( size_t i=0UL; i<min_m; ++i ) {
1706  transfer( v_+i*nn_, v_+i*nn_+min_n, v+i*nn );
1707  }
1708 
1709  swap( v_, v );
1710  deallocate( v );
1711  capacity_ = m*nn;
1712  }
1713  else if( m*nn > capacity_ ) {
1714  Type* BLAZE_RESTRICT v = allocate<Type>( m*nn );
1715  swap( v_, v );
1716  deallocate( v );
1717  capacity_ = m*nn;
1718  }
1719 
1721  for( size_t i=0UL; i<m; ++i )
1722  for( size_t j=n; j<nn; ++j )
1723  v_[i*nn+j] = Type();
1724  }
1725 
1726  m_ = m;
1727  n_ = n;
1728  nn_ = nn;
1729 }
1730 //*************************************************************************************************
1731 
1732 
1733 //*************************************************************************************************
1747 template< typename Type // Data type of the matrix
1748  , bool SO > // Storage order
1749 inline void DynamicMatrix<Type,SO>::extend( size_t m, size_t n, bool preserve )
1750 {
1751  resize( m_+m, n_+n, preserve );
1752 }
1753 //*************************************************************************************************
1754 
1755 
1756 //*************************************************************************************************
1765 template< typename Type // Data type of the matrix
1766  , bool SO > // Storage order
1768 {
1769  using std::swap;
1770 
1771  if( elements > capacity_ )
1772  {
1773  // Allocating a new array
1774  Type* BLAZE_RESTRICT tmp = allocate<Type>( elements );
1775 
1776  // Initializing the new array
1777  transfer( v_, v_+capacity_, tmp );
1778 
1780  for( size_t i=capacity_; i<elements; ++i )
1781  tmp[i] = Type();
1782  }
1783 
1784  // Replacing the old array
1785  swap( tmp, v_ );
1786  deallocate( tmp );
1787  capacity_ = elements;
1788  }
1789 }
1790 //*************************************************************************************************
1791 
1792 
1793 //*************************************************************************************************
1803 template< typename Type // Data type of the matrix
1804  , bool SO > // Storage order
1806 {
1807  if( ( m_ * nn_ ) < capacity_ ) {
1808  DynamicMatrix( *this ).swap( *this );
1809  }
1810 }
1811 //*************************************************************************************************
1812 
1813 
1814 //*************************************************************************************************
1820 template< typename Type // Data type of the matrix
1821  , bool SO > // Storage order
1823 {
1824  using std::swap;
1825 
1826  swap( m_ , m.m_ );
1827  swap( n_ , m.n_ );
1828  swap( nn_, m.nn_ );
1829  swap( capacity_, m.capacity_ );
1830  swap( v_ , m.v_ );
1831 }
1832 //*************************************************************************************************
1833 
1834 
1835 //*************************************************************************************************
1844 template< typename Type // Data type of the matrix
1845  , bool SO > // Storage order
1846 inline size_t DynamicMatrix<Type,SO>::addPadding( size_t value ) const noexcept
1847 {
1848  if( usePadding && IsVectorizable<Type>::value )
1849  return nextMultiple<size_t>( value, SIMDSIZE );
1850  else return value;
1851 }
1852 //*************************************************************************************************
1853 
1854 
1855 
1856 
1857 //=================================================================================================
1858 //
1859 // NUMERIC FUNCTIONS
1860 //
1861 //=================================================================================================
1862 
1863 //*************************************************************************************************
1868 template< typename Type // Data type of the matrix
1869  , bool SO > // Storage order
1871 {
1872  using std::swap;
1873 
1874  constexpr size_t block( BLOCK_SIZE );
1875 
1876  if( m_ == n_ )
1877  {
1878  for( size_t ii=0UL; ii<m_; ii+=block ) {
1879  const size_t iend( min( ii+block, m_ ) );
1880  for( size_t jj=0UL; jj<=ii; jj+=block ) {
1881  for( size_t i=ii; i<iend; ++i ) {
1882  const size_t jend( min( jj+block, n_, i ) );
1883  for( size_t j=jj; j<jend; ++j ) {
1884  swap( v_[i*nn_+j], v_[j*nn_+i] );
1885  }
1886  }
1887  }
1888  }
1889  }
1890  else
1891  {
1892  DynamicMatrix tmp( trans(*this) );
1893  this->swap( tmp );
1894  }
1895 
1896  return *this;
1897 }
1898 //*************************************************************************************************
1899 
1900 
1901 //*************************************************************************************************
1906 template< typename Type // Data type of the matrix
1907  , bool SO > // Storage order
1909 {
1910  constexpr size_t block( BLOCK_SIZE );
1911 
1912  if( m_ == n_ )
1913  {
1914  for( size_t ii=0UL; ii<m_; ii+=block ) {
1915  const size_t iend( min( ii+block, m_ ) );
1916  for( size_t jj=0UL; jj<ii; jj+=block ) {
1917  const size_t jend( min( jj+block, n_ ) );
1918  for( size_t i=ii; i<iend; ++i ) {
1919  for( size_t j=jj; j<jend; ++j ) {
1920  cswap( v_[i*nn_+j], v_[j*nn_+i] );
1921  }
1922  }
1923  }
1924  for( size_t i=ii; i<iend; ++i ) {
1925  for( size_t j=ii; j<i; ++j ) {
1926  cswap( v_[i*nn_+j], v_[j*nn_+i] );
1927  }
1928  conjugate( v_[i*nn_+i] );
1929  }
1930  }
1931  }
1932  else
1933  {
1934  DynamicMatrix tmp( ctrans(*this) );
1935  swap( tmp );
1936  }
1937 
1938  return *this;
1939 }
1940 //*************************************************************************************************
1941 
1942 
1943 //*************************************************************************************************
1960 template< typename Type // Data type of the matrix
1961  , bool SO > // Storage order
1962 template< typename Other > // Data type of the scalar value
1964 {
1965  for( size_t i=0UL; i<m_; ++i )
1966  for( size_t j=0UL; j<n_; ++j )
1967  v_[i*nn_+j] *= scalar;
1968 
1969  return *this;
1970 }
1971 //*************************************************************************************************
1972 
1973 
1974 
1975 
1976 //=================================================================================================
1977 //
1978 // DEBUGGING FUNCTIONS
1979 //
1980 //=================================================================================================
1981 
1982 //*************************************************************************************************
1991 template< typename Type // Data type of the matrix
1992  , bool SO > // Storage order
1993 inline bool DynamicMatrix<Type,SO>::isIntact() const noexcept
1994 {
1995  if( m_ * n_ > capacity_ )
1996  return false;
1997 
1999  for( size_t i=0UL; i<m_; ++i ) {
2000  for( size_t j=n_; j<nn_; ++j ) {
2001  if( v_[i*nn_+j] != Type() )
2002  return false;
2003  }
2004  }
2005  }
2006 
2007  return true;
2008 }
2009 //*************************************************************************************************
2010 
2011 
2012 
2013 
2014 //=================================================================================================
2015 //
2016 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2017 //
2018 //=================================================================================================
2019 
2020 //*************************************************************************************************
2030 template< typename Type // Data type of the matrix
2031  , bool SO > // Storage order
2032 template< typename Other > // Data type of the foreign expression
2033 inline bool DynamicMatrix<Type,SO>::canAlias( const Other* alias ) const noexcept
2034 {
2035  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2036 }
2037 //*************************************************************************************************
2038 
2039 
2040 //*************************************************************************************************
2050 template< typename Type // Data type of the matrix
2051  , bool SO > // Storage order
2052 template< typename Other > // Data type of the foreign expression
2053 inline bool DynamicMatrix<Type,SO>::isAliased( const Other* alias ) const noexcept
2054 {
2055  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2056 }
2057 //*************************************************************************************************
2058 
2059 
2060 //*************************************************************************************************
2069 template< typename Type // Data type of the matrix
2070  , bool SO > // Storage order
2071 inline bool DynamicMatrix<Type,SO>::isAligned() const noexcept
2072 {
2073  return ( usePadding || columns() % SIMDSIZE == 0UL );
2074 }
2075 //*************************************************************************************************
2076 
2077 
2078 //*************************************************************************************************
2088 template< typename Type // Data type of the matrix
2089  , bool SO > // Storage order
2090 inline bool DynamicMatrix<Type,SO>::canSMPAssign() const noexcept
2091 {
2092  return ( rows() * columns() >= SMP_DMATASSIGN_THRESHOLD );
2093 }
2094 //*************************************************************************************************
2095 
2096 
2097 //*************************************************************************************************
2112 template< typename Type // Data type of the matrix
2113  , bool SO > // Storage order
2115  DynamicMatrix<Type,SO>::load( size_t i, size_t j ) const noexcept
2116 {
2117  if( usePadding )
2118  return loada( i, j );
2119  else
2120  return loadu( i, j );
2121 }
2122 //*************************************************************************************************
2123 
2124 
2125 //*************************************************************************************************
2140 template< typename Type // Data type of the matrix
2141  , bool SO > // Storage order
2143  DynamicMatrix<Type,SO>::loada( size_t i, size_t j ) const noexcept
2144 {
2145  using blaze::loada;
2146 
2148 
2149  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
2150  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
2151  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= nn_, "Invalid column access index" );
2152  BLAZE_INTERNAL_ASSERT( !usePadding || j % SIMDSIZE == 0UL, "Invalid column access index" );
2153  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+i*nn_+j ), "Invalid alignment detected" );
2154 
2155  return loada( v_+i*nn_+j );
2156 }
2157 //*************************************************************************************************
2158 
2159 
2160 //*************************************************************************************************
2175 template< typename Type // Data type of the matrix
2176  , bool SO > // Storage order
2178  DynamicMatrix<Type,SO>::loadu( size_t i, size_t j ) const noexcept
2179 {
2180  using blaze::loadu;
2181 
2183 
2184  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
2185  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
2186  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= nn_, "Invalid column access index" );
2187 
2188  return loadu( v_+i*nn_+j );
2189 }
2190 //*************************************************************************************************
2191 
2192 
2193 //*************************************************************************************************
2209 template< typename Type // Data type of the matrix
2210  , bool SO > // Storage order
2212  DynamicMatrix<Type,SO>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2213 {
2214  if( usePadding )
2215  storea( i, j, value );
2216  else
2217  storeu( i, j, value );
2218 }
2219 //*************************************************************************************************
2220 
2221 
2222 //*************************************************************************************************
2238 template< typename Type // Data type of the matrix
2239  , bool SO > // Storage order
2241  DynamicMatrix<Type,SO>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2242 {
2243  using blaze::storea;
2244 
2246 
2247  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
2248  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
2249  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= nn_, "Invalid column access index" );
2250  BLAZE_INTERNAL_ASSERT( !usePadding || j % SIMDSIZE == 0UL, "Invalid column access index" );
2251  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+i*nn_+j ), "Invalid alignment detected" );
2252 
2253  storea( v_+i*nn_+j, value );
2254 }
2255 //*************************************************************************************************
2256 
2257 
2258 //*************************************************************************************************
2274 template< typename Type // Data type of the matrix
2275  , bool SO > // Storage order
2277  DynamicMatrix<Type,SO>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2278 {
2279  using blaze::storeu;
2280 
2282 
2283  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
2284  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
2285  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= nn_, "Invalid column access index" );
2286 
2287  storeu( v_+i*nn_+j, value );
2288 }
2289 //*************************************************************************************************
2290 
2291 
2292 //*************************************************************************************************
2309 template< typename Type // Data type of the matrix
2310  , bool SO > // Storage order
2312  DynamicMatrix<Type,SO>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2313 {
2314  using blaze::stream;
2315 
2317 
2318  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
2319  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
2320  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= nn_, "Invalid column access index" );
2321  BLAZE_INTERNAL_ASSERT( !usePadding || j % SIMDSIZE == 0UL, "Invalid column access index" );
2322  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+i*nn_+j ), "Invalid alignment detected" );
2323 
2324  stream( v_+i*nn_+j, value );
2325 }
2326 //*************************************************************************************************
2327 
2328 
2329 //*************************************************************************************************
2340 template< typename Type // Data type of the matrix
2341  , bool SO > // Storage order
2342 template< typename MT > // Type of the right-hand side dense matrix
2345 {
2346  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2347  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2348 
2349  const size_t jpos( n_ & size_t(-2) );
2350  BLAZE_INTERNAL_ASSERT( ( n_ - ( n_ % 2UL ) ) == jpos, "Invalid end calculation" );
2351 
2352  for( size_t i=0UL; i<m_; ++i ) {
2353  for( size_t j=0UL; j<jpos; j+=2UL ) {
2354  v_[i*nn_+j ] = (~rhs)(i,j );
2355  v_[i*nn_+j+1UL] = (~rhs)(i,j+1UL);
2356  }
2357  if( jpos < n_ ) {
2358  v_[i*nn_+jpos] = (~rhs)(i,jpos);
2359  }
2360  }
2361 }
2362 //*************************************************************************************************
2363 
2364 
2365 //*************************************************************************************************
2376 template< typename Type // Data type of the matrix
2377  , bool SO > // Storage order
2378 template< typename MT > // Type of the right-hand side dense matrix
2381 {
2383 
2384  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2385  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2386 
2387  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2388 
2389  const size_t jpos( ( remainder )?( n_ & size_t(-SIMDSIZE) ):( n_ ) );
2390  BLAZE_INTERNAL_ASSERT( !remainder || ( n_ - ( n_ % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2391 
2392  if( usePadding && useStreaming &&
2393  ( m_*n_ > ( cacheSize / ( sizeof(Type) * 3UL ) ) ) && !(~rhs).isAliased( this ) )
2394  {
2395  for( size_t i=0UL; i<m_; ++i )
2396  {
2397  size_t j( 0UL );
2398  Iterator left( begin(i) );
2399  ConstIterator_<MT> right( (~rhs).begin(i) );
2400 
2401  for( ; j<jpos; j+=SIMDSIZE, left+=SIMDSIZE, right+=SIMDSIZE ) {
2402  left.stream( right.load() );
2403  }
2404  for( ; remainder && j<n_; ++j, ++left, ++right ) {
2405  *left = *right;
2406  }
2407  }
2408  }
2409  else
2410  {
2411  for( size_t i=0UL; i<m_; ++i )
2412  {
2413  size_t j( 0UL );
2414  Iterator left( begin(i) );
2415  ConstIterator_<MT> right( (~rhs).begin(i) );
2416 
2417  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2418  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2419  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2420  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2421  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2422  }
2423  for( ; j<jpos; j+=SIMDSIZE ) {
2424  left.store( right.load() ); left+=SIMDSIZE, right+=SIMDSIZE;
2425  }
2426  for( ; remainder && j<n_; ++j ) {
2427  *left = *right; ++left; ++right;
2428  }
2429  }
2430  }
2431 }
2432 //*************************************************************************************************
2433 
2434 
2435 //*************************************************************************************************
2446 template< typename Type // Data type of the matrix
2447  , bool SO > // Storage order
2448 template< typename MT > // Type of the right-hand side dense matrix
2450 {
2452 
2453  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2454  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2455 
2456  constexpr size_t block( BLOCK_SIZE );
2457 
2458  for( size_t ii=0UL; ii<m_; ii+=block ) {
2459  const size_t iend( min( m_, ii+block ) );
2460  for( size_t jj=0UL; jj<n_; jj+=block ) {
2461  const size_t jend( min( n_, jj+block ) );
2462  for( size_t i=ii; i<iend; ++i ) {
2463  for( size_t j=jj; j<jend; ++j ) {
2464  v_[i*nn_+j] = (~rhs)(i,j);
2465  }
2466  }
2467  }
2468  }
2469 }
2470 //*************************************************************************************************
2471 
2472 
2473 //*************************************************************************************************
2484 template< typename Type // Data type of the matrix
2485  , bool SO > // Storage order
2486 template< typename MT > // Type of the right-hand side sparse matrix
2488 {
2489  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2490  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2491 
2492  for( size_t i=0UL; i<m_; ++i )
2493  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2494  v_[i*nn_+element->index()] = element->value();
2495 }
2496 //*************************************************************************************************
2497 
2498 
2499 //*************************************************************************************************
2510 template< typename Type // Data type of the matrix
2511  , bool SO > // Storage order
2512 template< typename MT > // Type of the right-hand side sparse matrix
2514 {
2516 
2517  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2518  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2519 
2520  for( size_t j=0UL; j<n_; ++j )
2521  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2522  v_[element->index()*nn_+j] = element->value();
2523 }
2524 //*************************************************************************************************
2525 
2526 
2527 //*************************************************************************************************
2538 template< typename Type // Data type of the matrix
2539  , bool SO > // Storage order
2540 template< typename MT > // Type of the right-hand side dense matrix
2541 inline DisableIf_<typename DynamicMatrix<Type,SO>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
2543 {
2544  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2545  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2546 
2547  for( size_t i=0UL; i<m_; ++i )
2548  {
2549  if( IsDiagonal<MT>::value )
2550  {
2551  v_[i*nn_+i] += (~rhs)(i,i);
2552  }
2553  else
2554  {
2555  const size_t jbegin( ( IsUpper<MT>::value )
2556  ?( IsStrictlyUpper<MT>::value ? i+1UL : i )
2557  :( 0UL ) );
2558  const size_t jend ( ( IsLower<MT>::value )
2559  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2560  :( n_ ) );
2561  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2562 
2563  size_t j( jbegin );
2564 
2565  for( ; (j+2UL) <= jend; j+=2UL ) {
2566  v_[i*nn_+j ] += (~rhs)(i,j );
2567  v_[i*nn_+j+1UL] += (~rhs)(i,j+1UL);
2568  }
2569  if( j < jend ) {
2570  v_[i*nn_+j] += (~rhs)(i,j);
2571  }
2572  }
2573  }
2574 }
2575 //*************************************************************************************************
2576 
2577 
2578 //*************************************************************************************************
2589 template< typename Type // Data type of the matrix
2590  , bool SO > // Storage order
2591 template< typename MT > // Type of the right-hand side dense matrix
2592 inline EnableIf_<typename DynamicMatrix<Type,SO>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
2594 {
2597 
2598  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2599  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2600 
2601  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2602 
2603  for( size_t i=0UL; i<m_; ++i )
2604  {
2605  const size_t jbegin( ( IsUpper<MT>::value )
2606  ?( ( IsStrictlyUpper<MT>::value ? i+1UL : i ) & size_t(-SIMDSIZE) )
2607  :( 0UL ) );
2608  const size_t jend ( ( IsLower<MT>::value )
2609  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2610  :( n_ ) );
2611  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2612 
2613  const size_t jpos( ( remainder )?( jend & size_t(-SIMDSIZE) ):( jend ) );
2614  BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2615 
2616  size_t j( jbegin );
2617  Iterator left( begin(i) + jbegin );
2618  ConstIterator_<MT> right( (~rhs).begin(i) + jbegin );
2619 
2620  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2621  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2622  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2623  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2624  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2625  }
2626  for( ; j<jpos; j+=SIMDSIZE ) {
2627  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2628  }
2629  for( ; remainder && j<jend; ++j ) {
2630  *left += *right; ++left; ++right;
2631  }
2632  }
2633 }
2634 //*************************************************************************************************
2635 
2636 
2637 //*************************************************************************************************
2648 template< typename Type // Data type of the matrix
2649  , bool SO > // Storage order
2650 template< typename MT > // Type of the right-hand side dense matrix
2652 {
2654 
2655  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2656  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2657 
2658  constexpr size_t block( BLOCK_SIZE );
2659 
2660  for( size_t ii=0UL; ii<m_; ii+=block ) {
2661  const size_t iend( min( m_, ii+block ) );
2662  for( size_t jj=0UL; jj<n_; jj+=block )
2663  {
2664  if( IsLower<MT>::value && ii < jj ) break;
2665  if( IsUpper<MT>::value && ii > jj ) continue;
2666 
2667  for( size_t i=ii; i<iend; ++i )
2668  {
2669  const size_t jbegin( ( IsUpper<MT>::value )
2670  ?( max( ( IsStrictlyUpper<MT>::value ? i+1UL : i ), jj ) )
2671  :( jj ) );
2672  const size_t jend ( ( IsLower<MT>::value )
2673  ?( min( ( IsStrictlyLower<MT>::value ? i : i+1UL ), n_, jj+block ) )
2674  :( min( n_, jj+block ) ) );
2675  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2676 
2677  for( size_t j=jbegin; j<jend; ++j ) {
2678  v_[i*nn_+j] += (~rhs)(i,j);
2679  }
2680  }
2681  }
2682  }
2683 }
2684 //*************************************************************************************************
2685 
2686 
2687 //*************************************************************************************************
2698 template< typename Type // Data type of the matrix
2699  , bool SO > // Storage order
2700 template< typename MT > // Type of the right-hand side sparse matrix
2702 {
2703  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2704  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2705 
2706  for( size_t i=0UL; i<m_; ++i )
2707  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2708  v_[i*nn_+element->index()] += element->value();
2709 }
2710 //*************************************************************************************************
2711 
2712 
2713 //*************************************************************************************************
2724 template< typename Type // Data type of the matrix
2725  , bool SO > // Storage order
2726 template< typename MT > // Type of the right-hand side sparse matrix
2728 {
2730 
2731  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2732  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2733 
2734  for( size_t j=0UL; j<n_; ++j )
2735  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2736  v_[element->index()*nn_+j] += element->value();
2737 }
2738 //*************************************************************************************************
2739 
2740 
2741 //*************************************************************************************************
2752 template< typename Type // Data type of the matrix
2753  , bool SO > // Storage order
2754 template< typename MT > // Type of the right-hand side dense matrix
2755 inline DisableIf_<typename DynamicMatrix<Type,SO>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
2757 {
2758  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2759  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2760 
2761  for( size_t i=0UL; i<m_; ++i )
2762  {
2763  if( IsDiagonal<MT>::value )
2764  {
2765  v_[i*nn_+i] -= (~rhs)(i,i);
2766  }
2767  else
2768  {
2769  const size_t jbegin( ( IsUpper<MT>::value )
2770  ?( IsStrictlyUpper<MT>::value ? i+1UL : i )
2771  :( 0UL ) );
2772  const size_t jend ( ( IsLower<MT>::value )
2773  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2774  :( n_ ) );
2775  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2776 
2777  size_t j( jbegin );
2778 
2779  for( ; (j+2UL) <= jend; j+=2UL ) {
2780  v_[i*nn_+j ] -= (~rhs)(i,j );
2781  v_[i*nn_+j+1UL] -= (~rhs)(i,j+1UL);
2782  }
2783  if( j < jend ) {
2784  v_[i*nn_+j] -= (~rhs)(i,j);
2785  }
2786  }
2787  }
2788 }
2789 //*************************************************************************************************
2790 
2791 
2792 //*************************************************************************************************
2803 template< typename Type // Data type of the matrix
2804  , bool SO > // Storage order
2805 template< typename MT > // Type of the right-hand side dense matrix
2806 inline EnableIf_<typename DynamicMatrix<Type,SO>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
2808 {
2811 
2812  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2813  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2814 
2815  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2816 
2817  for( size_t i=0UL; i<m_; ++i )
2818  {
2819  const size_t jbegin( ( IsUpper<MT>::value )
2820  ?( ( IsStrictlyUpper<MT>::value ? i+1UL : i ) & size_t(-SIMDSIZE) )
2821  :( 0UL ) );
2822  const size_t jend ( ( IsLower<MT>::value )
2823  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2824  :( n_ ) );
2825  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2826 
2827  const size_t jpos( ( remainder )?( jend & size_t(-SIMDSIZE) ):( jend ) );
2828  BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2829 
2830  size_t j( jbegin );
2831  Iterator left( begin(i) + jbegin );
2832  ConstIterator_<MT> right( (~rhs).begin(i) + jbegin );
2833 
2834  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2835  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2836  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2837  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2838  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2839  }
2840  for( ; j<jpos; j+=SIMDSIZE ) {
2841  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2842  }
2843  for( ; remainder && j<jend; ++j ) {
2844  *left -= *right; ++left; ++right;
2845  }
2846  }
2847 }
2848 //*************************************************************************************************
2849 
2850 
2851 //*************************************************************************************************
2862 template< typename Type // Data type of the matrix
2863  , bool SO > // Storage order
2864 template< typename MT > // Type of the right-hand side dense matrix
2866 {
2868 
2869  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2870  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2871 
2872  constexpr size_t block( BLOCK_SIZE );
2873 
2874  for( size_t ii=0UL; ii<m_; ii+=block ) {
2875  const size_t iend( min( m_, ii+block ) );
2876  for( size_t jj=0UL; jj<n_; jj+=block )
2877  {
2878  if( IsLower<MT>::value && ii < jj ) break;
2879  if( IsUpper<MT>::value && ii > jj ) continue;
2880 
2881  for( size_t i=ii; i<iend; ++i )
2882  {
2883  const size_t jbegin( ( IsUpper<MT>::value )
2884  ?( max( ( IsStrictlyUpper<MT>::value ? i+1UL : i ), jj ) )
2885  :( jj ) );
2886  const size_t jend ( ( IsLower<MT>::value )
2887  ?( min( ( IsStrictlyLower<MT>::value ? i : i+1UL ), n_, jj+block ) )
2888  :( min( n_, jj+block ) ) );
2889  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2890 
2891  for( size_t j=jbegin; j<jend; ++j ) {
2892  v_[i*nn_+j] -= (~rhs)(i,j);
2893  }
2894  }
2895  }
2896  }
2897 }
2898 //*************************************************************************************************
2899 
2900 
2901 //*************************************************************************************************
2912 template< typename Type // Data type of the matrix
2913  , bool SO > // Storage order
2914 template< typename MT > // Type of the right-hand side sparse matrix
2916 {
2917  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2918  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2919 
2920  for( size_t i=0UL; i<m_; ++i )
2921  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2922  v_[i*nn_+element->index()] -= element->value();
2923 }
2924 //*************************************************************************************************
2925 
2926 
2927 //*************************************************************************************************
2938 template< typename Type // Data type of the matrix
2939  , bool SO > // Storage order
2940 template< typename MT > // Type of the right-hand side sparse matrix
2942 {
2944 
2945  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2946  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2947 
2948  for( size_t j=0UL; j<n_; ++j )
2949  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2950  v_[element->index()*nn_+j] -= element->value();
2951 }
2952 //*************************************************************************************************
2953 
2954 
2955 //*************************************************************************************************
2966 template< typename Type // Data type of the matrix
2967  , bool SO > // Storage order
2968 template< typename MT > // Type of the right-hand side dense matrix
2969 inline DisableIf_<typename DynamicMatrix<Type,SO>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
2971 {
2972  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
2973  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
2974 
2975  const size_t jpos( n_ & size_t(-2) );
2976  BLAZE_INTERNAL_ASSERT( ( n_ - ( n_ % 2UL ) ) == jpos, "Invalid end calculation" );
2977 
2978  for( size_t i=0UL; i<m_; ++i ) {
2979  for( size_t j=0UL; j<jpos; j+=2UL ) {
2980  v_[i*nn_+j ] *= (~rhs)(i,j );
2981  v_[i*nn_+j+1UL] *= (~rhs)(i,j+1UL);
2982  }
2983  if( jpos < n_ ) {
2984  v_[i*nn_+jpos] *= (~rhs)(i,jpos);
2985  }
2986  }
2987 }
2988 //*************************************************************************************************
2989 
2990 
2991 //*************************************************************************************************
3002 template< typename Type // Data type of the matrix
3003  , bool SO > // Storage order
3004 template< typename MT > // Type of the right-hand side dense matrix
3005 inline EnableIf_<typename DynamicMatrix<Type,SO>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
3007 {
3009 
3010  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
3011  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
3012 
3013  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
3014 
3015  for( size_t i=0UL; i<m_; ++i )
3016  {
3017  const size_t jpos( ( remainder )?( n_ & size_t(-SIMDSIZE) ):( n_ ) );
3018  BLAZE_INTERNAL_ASSERT( !remainder || ( n_ - ( n_ % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
3019 
3020  size_t j( 0UL );
3021  Iterator left( begin(i) );
3022  ConstIterator_<MT> right( (~rhs).begin(i) );
3023 
3024  for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
3025  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3026  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3027  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3028  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3029  }
3030  for( ; j<jpos; j+=SIMDSIZE ) {
3031  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3032  }
3033  for( ; remainder && j<n_; ++j ) {
3034  *left *= *right; ++left; ++right;
3035  }
3036  }
3037 }
3038 //*************************************************************************************************
3039 
3040 
3041 //*************************************************************************************************
3052 template< typename Type // Data type of the matrix
3053  , bool SO > // Storage order
3054 template< typename MT > // Type of the right-hand side dense matrix
3056 {
3058 
3059  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
3060  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
3061 
3062  constexpr size_t block( BLOCK_SIZE );
3063 
3064  for( size_t ii=0UL; ii<m_; ii+=block ) {
3065  const size_t iend( min( m_, ii+block ) );
3066  for( size_t jj=0UL; jj<n_; jj+=block ) {
3067  const size_t jend( min( n_, jj+block ) );
3068  for( size_t i=ii; i<iend; ++i ) {
3069  for( size_t j=jj; j<jend; ++j ) {
3070  v_[i*nn_+j] *= (~rhs)(i,j);
3071  }
3072  }
3073  }
3074  }
3075 }
3076 //*************************************************************************************************
3077 
3078 
3079 //*************************************************************************************************
3090 template< typename Type // Data type of the matrix
3091  , bool SO > // Storage order
3092 template< typename MT > // Type of the right-hand side sparse matrix
3094 {
3095  using blaze::reset;
3096 
3097  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
3098  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
3099 
3100  for( size_t i=0UL; i<m_; ++i )
3101  {
3102  size_t j( 0UL );
3103 
3104  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
3105  for( ; j<element->index(); ++j )
3106  reset( v_[i*nn_+j] );
3107  v_[i*nn_+j] *= element->value();
3108  ++j;
3109  }
3110 
3111  for( ; j<n_; ++j ) {
3112  reset( v_[i*nn_+j] );
3113  }
3114  }
3115 }
3116 //*************************************************************************************************
3117 
3118 
3119 //*************************************************************************************************
3130 template< typename Type // Data type of the matrix
3131  , bool SO > // Storage order
3132 template< typename MT > // Type of the right-hand side sparse matrix
3134 {
3135  using blaze::reset;
3136 
3138 
3139  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
3140  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
3141 
3142  for( size_t j=0UL; j<n_; ++j )
3143  {
3144  size_t i( 0UL );
3145 
3146  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
3147  for( ; i<element->index(); ++i )
3148  reset( v_[i*nn_+j] );
3149  v_[i*nn_+j] *= element->value();
3150  ++i;
3151  }
3152 
3153  for( ; i<m_; ++i ) {
3154  reset( v_[i*nn_+j] );
3155  }
3156  }
3157 }
3158 //*************************************************************************************************
3159 
3160 
3161 
3162 
3163 
3164 
3165 
3166 
3167 //=================================================================================================
3168 //
3169 // CLASS TEMPLATE SPECIALIZATION FOR COLUMN-MAJOR MATRICES
3170 //
3171 //=================================================================================================
3172 
3173 //*************************************************************************************************
3181 template< typename Type > // Data type of the matrix
3182 class DynamicMatrix<Type,true>
3183  : public DenseMatrix< DynamicMatrix<Type,true>, true >
3184 {
3185  public:
3186  //**Type definitions****************************************************************************
3187  using This = DynamicMatrix<Type,true>;
3189  using ResultType = This;
3192  using ElementType = Type;
3194  using ReturnType = const Type&;
3195  using CompositeType = const This&;
3196 
3197  using Reference = Type&;
3198  using ConstReference = const Type&;
3199  using Pointer = Type*;
3200  using ConstPointer = const Type*;
3201 
3204  //**********************************************************************************************
3205 
3206  //**Rebind struct definition********************************************************************
3209  template< typename NewType > // Data type of the other matrix
3210  struct Rebind {
3211  using Other = DynamicMatrix<NewType,true>;
3212  };
3213  //**********************************************************************************************
3214 
3215  //**Resize struct definition********************************************************************
3218  template< size_t NewM // Number of rows of the other matrix
3219  , size_t NewN > // Number of columns of the other matrix
3220  struct Resize {
3221  using Other = DynamicMatrix<Type,true>;
3222  };
3223  //**********************************************************************************************
3224 
3225  //**Compilation flags***************************************************************************
3227 
3231  enum : bool { simdEnabled = IsVectorizable<Type>::value };
3232 
3234 
3237  enum : bool { smpAssignable = !IsSMPAssignable<Type>::value };
3238  //**********************************************************************************************
3239 
3240  //**Constructors********************************************************************************
3243  explicit inline DynamicMatrix() noexcept;
3244  explicit inline DynamicMatrix( size_t m, size_t n );
3245  explicit inline DynamicMatrix( size_t m, size_t n, const Type& init );
3246  explicit inline DynamicMatrix( initializer_list< initializer_list<Type> > list );
3247 
3248  template< typename Other > explicit inline DynamicMatrix( size_t m, size_t n, const Other* array );
3249 
3250  template< typename Other, size_t Rows, size_t Cols >
3251  explicit inline DynamicMatrix( const Other (&array)[Rows][Cols] );
3252 
3253  inline DynamicMatrix( const DynamicMatrix& m );
3254  inline DynamicMatrix( DynamicMatrix&& m );
3255  template< typename MT, bool SO > inline DynamicMatrix( const Matrix<MT,SO>& m );
3257  //**********************************************************************************************
3258 
3259  //**Destructor**********************************************************************************
3262  inline ~DynamicMatrix();
3264  //**********************************************************************************************
3265 
3266  //**Data access functions***********************************************************************
3269  inline Reference operator()( size_t i, size_t j ) noexcept;
3270  inline ConstReference operator()( size_t i, size_t j ) const noexcept;
3271  inline Reference at( size_t i, size_t j );
3272  inline ConstReference at( size_t i, size_t j ) const;
3273  inline Pointer data () noexcept;
3274  inline ConstPointer data () const noexcept;
3275  inline Pointer data ( size_t j ) noexcept;
3276  inline ConstPointer data ( size_t j ) const noexcept;
3277  inline Iterator begin ( size_t j ) noexcept;
3278  inline ConstIterator begin ( size_t j ) const noexcept;
3279  inline ConstIterator cbegin( size_t j ) const noexcept;
3280  inline Iterator end ( size_t j ) noexcept;
3281  inline ConstIterator end ( size_t j ) const noexcept;
3282  inline ConstIterator cend ( size_t j ) const noexcept;
3284  //**********************************************************************************************
3285 
3286  //**Assignment operators************************************************************************
3289  inline DynamicMatrix& operator=( const Type& rhs );
3290  inline DynamicMatrix& operator=( initializer_list< initializer_list<Type> > list );
3291 
3292  template< typename Other, size_t Rows, size_t Cols >
3293  inline DynamicMatrix& operator=( const Other (&array)[Rows][Cols] );
3294 
3295  inline DynamicMatrix& operator=( const DynamicMatrix& rhs );
3296  inline DynamicMatrix& operator=( DynamicMatrix&& rhs );
3297 
3298  template< typename MT, bool SO > inline DynamicMatrix& operator= ( const Matrix<MT,SO>& rhs );
3299  template< typename MT, bool SO > inline DynamicMatrix& operator+=( const Matrix<MT,SO>& rhs );
3300  template< typename MT, bool SO > inline DynamicMatrix& operator-=( const Matrix<MT,SO>& rhs );
3301  template< typename MT, bool SO > inline DynamicMatrix& operator%=( const Matrix<MT,SO>& rhs );
3303  //**********************************************************************************************
3304 
3305  //**Utility functions***************************************************************************
3308  inline size_t rows() const noexcept;
3309  inline size_t columns() const noexcept;
3310  inline size_t spacing() const noexcept;
3311  inline size_t capacity() const noexcept;
3312  inline size_t capacity( size_t j ) const noexcept;
3313  inline size_t nonZeros() const;
3314  inline size_t nonZeros( size_t j ) const;
3315  inline void reset();
3316  inline void reset( size_t j );
3317  inline void clear();
3318  void resize ( size_t m, size_t n, bool preserve=true );
3319  inline void extend ( size_t m, size_t n, bool preserve=true );
3320  inline void reserve( size_t elements );
3321  inline void shrinkToFit();
3322  inline void swap( DynamicMatrix& m ) noexcept;
3324  //**********************************************************************************************
3325 
3326  //**Numeric functions***************************************************************************
3329  inline DynamicMatrix& transpose();
3330  inline DynamicMatrix& ctranspose();
3331 
3332  template< typename Other > inline DynamicMatrix& scale( const Other& scalar );
3334  //**********************************************************************************************
3335 
3336  private:
3337  //**********************************************************************************************
3339  template< typename MT >
3340  struct VectorizedAssign {
3341  enum : bool { value = useOptimizedKernels &&
3342  simdEnabled && MT::simdEnabled &&
3344  };
3345  //**********************************************************************************************
3346 
3347  //**********************************************************************************************
3349  template< typename MT >
3350  struct VectorizedAddAssign {
3351  enum : bool { value = useOptimizedKernels &&
3352  simdEnabled && MT::simdEnabled &&
3356  };
3357  //**********************************************************************************************
3358 
3359  //**********************************************************************************************
3361  template< typename MT >
3362  struct VectorizedSubAssign {
3363  enum : bool { value = useOptimizedKernels &&
3364  simdEnabled && MT::simdEnabled &&
3368  };
3369  //**********************************************************************************************
3370 
3371  //**********************************************************************************************
3373  template< typename MT >
3374  struct VectorizedSchurAssign {
3375  enum : bool { value = useOptimizedKernels &&
3376  simdEnabled && MT::simdEnabled &&
3379  };
3380  //**********************************************************************************************
3381 
3382  //**********************************************************************************************
3384  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
3385  //**********************************************************************************************
3386 
3387  public:
3388  //**Debugging functions*************************************************************************
3391  inline bool isIntact() const noexcept;
3393  //**********************************************************************************************
3394 
3395  //**Expression template evaluation functions****************************************************
3398  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
3399  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
3400 
3401  inline bool isAligned () const noexcept;
3402  inline bool canSMPAssign() const noexcept;
3403 
3404  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
3405  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
3406  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
3407 
3408  BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
3409  BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
3410  BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
3411  BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
3412 
3413  template< typename MT >
3414  inline DisableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,true>& rhs );
3415 
3416  template< typename MT >
3417  inline EnableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,true>& rhs );
3418 
3419  template< typename MT > inline void assign( const DenseMatrix<MT,false>& rhs );
3420  template< typename MT > inline void assign( const SparseMatrix<MT,true>& rhs );
3421  template< typename MT > inline void assign( const SparseMatrix<MT,false>& rhs );
3422 
3423  template< typename MT >
3424  inline DisableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,true>& rhs );
3425 
3426  template< typename MT >
3427  inline EnableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,true>& rhs );
3428 
3429  template< typename MT > inline void addAssign( const DenseMatrix<MT,false>& rhs );
3430  template< typename MT > inline void addAssign( const SparseMatrix<MT,true>& rhs );
3431  template< typename MT > inline void addAssign( const SparseMatrix<MT,false>& rhs );
3432 
3433  template< typename MT >
3434  inline DisableIf_<VectorizedSubAssign<MT> > subAssign ( const DenseMatrix<MT,true>& rhs );
3435 
3436  template< typename MT >
3437  inline EnableIf_<VectorizedSubAssign<MT> > subAssign ( const DenseMatrix<MT,true>& rhs );
3438 
3439  template< typename MT > inline void subAssign( const DenseMatrix<MT,false>& rhs );
3440  template< typename MT > inline void subAssign( const SparseMatrix<MT,true>& rhs );
3441  template< typename MT > inline void subAssign( const SparseMatrix<MT,false>& rhs );
3442 
3443  template< typename MT >
3444  inline DisableIf_<VectorizedSchurAssign<MT> > schurAssign ( const DenseMatrix<MT,true>& rhs );
3445 
3446  template< typename MT >
3447  inline EnableIf_<VectorizedSchurAssign<MT> > schurAssign ( const DenseMatrix<MT,true>& rhs );
3448 
3449  template< typename MT > inline void schurAssign( const DenseMatrix<MT,false>& rhs );
3450  template< typename MT > inline void schurAssign( const SparseMatrix<MT,true>& rhs );
3451  template< typename MT > inline void schurAssign( const SparseMatrix<MT,false>& rhs );
3453  //**********************************************************************************************
3454 
3455  private:
3456  //**Utility functions***************************************************************************
3459  inline size_t addPadding( size_t minRows ) const noexcept;
3461  //**********************************************************************************************
3462 
3463  //**Member variables****************************************************************************
3466  size_t m_;
3467  size_t mm_;
3468  size_t n_;
3469  size_t capacity_;
3470  Type* BLAZE_RESTRICT v_;
3471 
3474  //**********************************************************************************************
3475 
3476  //**Compile time checks*************************************************************************
3481  //**********************************************************************************************
3482 };
3484 //*************************************************************************************************
3485 
3486 
3487 
3488 
3489 //=================================================================================================
3490 //
3491 // CONSTRUCTORS
3492 //
3493 //=================================================================================================
3494 
3495 //*************************************************************************************************
3499 template< typename Type > // Data type of the matrix
3501  : m_ ( 0UL ) // The current number of rows of the matrix
3502  , mm_ ( 0UL ) // The alignment adjusted number of rows
3503  , n_ ( 0UL ) // The current number of columns of the matrix
3504  , capacity_( 0UL ) // The maximum capacity of the matrix
3505  , v_ ( nullptr ) // The matrix elements
3506 {}
3508 //*************************************************************************************************
3509 
3510 
3511 //*************************************************************************************************
3521 template< typename Type > // Data type of the matrix
3522 inline DynamicMatrix<Type,true>::DynamicMatrix( size_t m, size_t n )
3523  : m_ ( m ) // The current number of rows of the matrix
3524  , mm_ ( addPadding( m ) ) // The alignment adjusted number of rows
3525  , n_ ( n ) // The current number of columns of the matrix
3526  , capacity_( mm_*n_ ) // The maximum capacity of the matrix
3527  , v_ ( allocate<Type>( capacity_ ) ) // The matrix elements
3528 {
3530  for( size_t j=0UL; j<n_; ++j ) {
3531  for( size_t i=m_; i<mm_; ++i ) {
3532  v_[i+j*mm_] = Type();
3533  }
3534  }
3535  }
3536 
3537  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3538 }
3540 //*************************************************************************************************
3541 
3542 
3543 //*************************************************************************************************
3553 template< typename Type > // Data type of the matrix
3554 inline DynamicMatrix<Type,true>::DynamicMatrix( size_t m, size_t n, const Type& init )
3555  : DynamicMatrix( m, n )
3556 {
3557  for( size_t j=0UL; j<n_; ++j ) {
3558  for( size_t i=0UL; i<m_; ++i ) {
3559  v_[i+j*mm_] = init;
3560  }
3561  }
3562 
3563  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3564 }
3566 //*************************************************************************************************
3567 
3568 
3569 //*************************************************************************************************
3590 template< typename Type > // Data type of the matrix
3592  : DynamicMatrix( list.size(), determineColumns( list ) )
3593 {
3594  size_t i( 0UL );
3595 
3596  for( const auto& rowList : list ) {
3597  size_t j( 0UL );
3598  for( const auto& element : rowList ) {
3599  v_[i+j*mm_] = element;
3600  ++j;
3601  }
3602  for( ; j<n_; ++j ) {
3603  v_[i+j*mm_] = Type();
3604  }
3605  ++i;
3606  }
3607 
3608  BLAZE_INTERNAL_ASSERT( i == m_, "Invalid number of elements detected" );
3609  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3610 }
3612 //*************************************************************************************************
3613 
3614 
3615 //*************************************************************************************************
3639 template< typename Type > // Data type of the matrix
3640 template< typename Other > // Data type of the initialization array
3641 inline DynamicMatrix<Type,true>::DynamicMatrix( size_t m, size_t n, const Other* array )
3642  : DynamicMatrix( m, n )
3643 {
3644  for( size_t j=0UL; j<n; ++j ) {
3645  for( size_t i=0UL; i<m; ++i ) {
3646  v_[i+j*mm_] = array[i+j*m];
3647  }
3648  }
3649 
3650  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3651 }
3653 //*************************************************************************************************
3654 
3655 
3656 //*************************************************************************************************
3678 template< typename Type > // Data type of the matrix
3679 template< typename Other // Data type of the initialization array
3680  , size_t Rows // Number of rows of the initialization array
3681  , size_t Cols > // Number of columns of the initialization array
3682 inline DynamicMatrix<Type,true>::DynamicMatrix( const Other (&array)[Rows][Cols] )
3683  : DynamicMatrix( Rows, Cols )
3684 {
3685  for( size_t j=0UL; j<Cols; ++j ) {
3686  for( size_t i=0UL; i<Rows; ++i ) {
3687  v_[i+j*mm_] = array[i][j];
3688  }
3689  }
3690 
3691  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3692 }
3694 //*************************************************************************************************
3695 
3696 
3697 //*************************************************************************************************
3706 template< typename Type > // Data type of the matrix
3708  : DynamicMatrix( m.m_, m.n_ )
3709 {
3710  BLAZE_INTERNAL_ASSERT( capacity_ <= m.capacity_, "Invalid capacity estimation" );
3711 
3712  smpAssign( *this, m );
3713 
3714  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3715 }
3717 //*************************************************************************************************
3718 
3719 
3720 //*************************************************************************************************
3726 template< typename Type > // Data type of the matrix
3728  : m_ ( m.m_ ) // The current number of rows of the matrix
3729  , mm_ ( m.mm_ ) // The alignment adjusted number of rows
3730  , n_ ( m.n_ ) // The current number of columns of the matrix
3731  , capacity_( m.capacity_ ) // The maximum capacity of the matrix
3732  , v_ ( m.v_ ) // The matrix elements
3733 {
3734  m.m_ = 0UL;
3735  m.mm_ = 0UL;
3736  m.n_ = 0UL;
3737  m.capacity_ = 0UL;
3738  m.v_ = nullptr;
3739 }
3741 //*************************************************************************************************
3742 
3743 
3744 //*************************************************************************************************
3750 template< typename Type > // Data type of the matrix
3751 template< typename MT // Type of the foreign matrix
3752  , bool SO > // Storage order of the foreign matrix
3754  : DynamicMatrix( (~m).rows(), (~m).columns() )
3755 {
3757  for( size_t j=0UL; j<n_; ++j ) {
3758  for( size_t i=0UL; i<m_; ++i ) {
3759  v_[i+j*mm_] = Type();
3760  }
3761  }
3762  }
3763 
3764  smpAssign( *this, ~m );
3765 
3766  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3767 }
3769 //*************************************************************************************************
3770 
3771 
3772 
3773 
3774 //=================================================================================================
3775 //
3776 // DESTRUCTOR
3777 //
3778 //=================================================================================================
3779 
3780 //*************************************************************************************************
3784 template< typename Type > // Data type of the matrix
3786 {
3787  deallocate( v_ );
3788 }
3790 //*************************************************************************************************
3791 
3792 
3793 
3794 
3795 //=================================================================================================
3796 //
3797 // DATA ACCESS FUNCTIONS
3798 //
3799 //=================================================================================================
3800 
3801 //*************************************************************************************************
3812 template< typename Type > // Data type of the matrix
3814  DynamicMatrix<Type,true>::operator()( size_t i, size_t j ) noexcept
3815 {
3816  BLAZE_USER_ASSERT( i<m_, "Invalid row access index" );
3817  BLAZE_USER_ASSERT( j<n_, "Invalid column access index" );
3818  return v_[i+j*mm_];
3819 }
3821 //*************************************************************************************************
3822 
3823 
3824 //*************************************************************************************************
3835 template< typename Type > // Data type of the matrix
3837  DynamicMatrix<Type,true>::operator()( size_t i, size_t j ) const noexcept
3838 {
3839  BLAZE_USER_ASSERT( i<m_, "Invalid row access index" );
3840  BLAZE_USER_ASSERT( j<n_, "Invalid column access index" );
3841  return v_[i+j*mm_];
3842 }
3844 //*************************************************************************************************
3845 
3846 
3847 //*************************************************************************************************
3859 template< typename Type > // Data type of the matrix
3861  DynamicMatrix<Type,true>::at( size_t i, size_t j )
3862 {
3863  if( i >= m_ ) {
3864  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
3865  }
3866  if( j >= n_ ) {
3867  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
3868  }
3869  return (*this)(i,j);
3870 }
3872 //*************************************************************************************************
3873 
3874 
3875 //*************************************************************************************************
3887 template< typename Type > // Data type of the matrix
3889  DynamicMatrix<Type,true>::at( size_t i, size_t j ) const
3890 {
3891  if( i >= m_ ) {
3892  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
3893  }
3894  if( j >= n_ ) {
3895  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
3896  }
3897  return (*this)(i,j);
3898 }
3900 //*************************************************************************************************
3901 
3902 
3903 //*************************************************************************************************
3915 template< typename Type > // Data type of the matrix
3916 inline typename DynamicMatrix<Type,true>::Pointer
3918 {
3919  return v_;
3920 }
3922 //*************************************************************************************************
3923 
3924 
3925 //*************************************************************************************************
3937 template< typename Type > // Data type of the matrix
3939  DynamicMatrix<Type,true>::data() const noexcept
3940 {
3941  return v_;
3942 }
3944 //*************************************************************************************************
3945 
3946 
3947 //*************************************************************************************************
3956 template< typename Type > // Data type of the matrix
3957 inline typename DynamicMatrix<Type,true>::Pointer
3958  DynamicMatrix<Type,true>::data( size_t j ) noexcept
3959 {
3960  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
3961  return v_ + j*mm_;
3962 }
3964 //*************************************************************************************************
3965 
3966 
3967 //*************************************************************************************************
3976 template< typename Type > // Data type of the matrix
3978  DynamicMatrix<Type,true>::data( size_t j ) const noexcept
3979 {
3980  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
3981  return v_ + j*mm_;
3982 }
3984 //*************************************************************************************************
3985 
3986 
3987 //*************************************************************************************************
3994 template< typename Type > // Data type of the matrix
3995 inline typename DynamicMatrix<Type,true>::Iterator
3996  DynamicMatrix<Type,true>::begin( size_t j ) noexcept
3997 {
3998  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
3999  return Iterator( v_ + j*mm_ );
4000 }
4002 //*************************************************************************************************
4003 
4004 
4005 //*************************************************************************************************
4012 template< typename Type > // Data type of the matrix
4014  DynamicMatrix<Type,true>::begin( size_t j ) const noexcept
4015 {
4016  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
4017  return ConstIterator( v_ + j*mm_ );
4018 }
4020 //*************************************************************************************************
4021 
4022 
4023 //*************************************************************************************************
4030 template< typename Type > // Data type of the matrix
4032  DynamicMatrix<Type,true>::cbegin( size_t j ) const noexcept
4033 {
4034  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
4035  return ConstIterator( v_ + j*mm_ );
4036 }
4038 //*************************************************************************************************
4039 
4040 
4041 //*************************************************************************************************
4048 template< typename Type > // Data type of the matrix
4049 inline typename DynamicMatrix<Type,true>::Iterator
4050  DynamicMatrix<Type,true>::end( size_t j ) noexcept
4051 {
4052  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
4053  return Iterator( v_ + j*mm_ + m_ );
4054 }
4056 //*************************************************************************************************
4057 
4058 
4059 //*************************************************************************************************
4066 template< typename Type > // Data type of the matrix
4068  DynamicMatrix<Type,true>::end( size_t j ) const noexcept
4069 {
4070  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
4071  return ConstIterator( v_ + j*mm_ + m_ );
4072 }
4074 //*************************************************************************************************
4075 
4076 
4077 //*************************************************************************************************
4084 template< typename Type > // Data type of the matrix
4086  DynamicMatrix<Type,true>::cend( size_t j ) const noexcept
4087 {
4088  BLAZE_USER_ASSERT( j < n_, "Invalid dense matrix column access index" );
4089  return ConstIterator( v_ + j*mm_ + m_ );
4090 }
4092 //*************************************************************************************************
4093 
4094 
4095 
4096 
4097 //=================================================================================================
4098 //
4099 // ASSIGNMENT OPERATORS
4100 //
4101 //=================================================================================================
4102 
4103 //*************************************************************************************************
4110 template< typename Type > // Data type of the matrix
4112 {
4113  for( size_t j=0UL; j<n_; ++j )
4114  for( size_t i=0UL; i<m_; ++i )
4115  v_[i+j*mm_] = rhs;
4116 
4117  return *this;
4118 }
4120 //*************************************************************************************************
4121 
4122 
4123 //*************************************************************************************************
4145 template< typename Type > // Data type of the matrix
4148 {
4149  resize( list.size(), determineColumns( list ), false );
4150 
4151  size_t i( 0UL );
4152 
4153  for( const auto& rowList : list ) {
4154  size_t j( 0UL );
4155  for( const auto& element : rowList ) {
4156  v_[i+j*mm_] = element;
4157  ++j;
4158  }
4159  for( ; j<n_; ++j ) {
4160  v_[i+j*mm_] = Type();
4161  }
4162  ++i;
4163  }
4164 
4165  return *this;
4166 }
4168 //*************************************************************************************************
4169 
4170 
4171 //*************************************************************************************************
4193 template< typename Type > // Data type of the matrix
4194 template< typename Other // Data type of the initialization array
4195  , size_t Rows // Number of rows of the initialization array
4196  , size_t Cols > // Number of columns of the initialization array
4197 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator=( const Other (&array)[Rows][Cols] )
4198 {
4199  resize( Rows, Cols, false );
4200 
4201  for( size_t j=0UL; j<Cols; ++j )
4202  for( size_t i=0UL; i<Rows; ++i )
4203  v_[i+j*mm_] = array[i][j];
4204 
4205  return *this;
4206 }
4208 //*************************************************************************************************
4209 
4210 
4211 //*************************************************************************************************
4221 template< typename Type > // Data type of the matrix
4223 {
4224  if( &rhs == this ) return *this;
4225 
4226  resize( rhs.m_, rhs.n_, false );
4227  smpAssign( *this, ~rhs );
4228 
4229  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4230 
4231  return *this;
4232 }
4234 //*************************************************************************************************
4235 
4236 
4237 //*************************************************************************************************
4244 template< typename Type > // Data type of the matrix
4246 {
4247  deallocate( v_ );
4248 
4249  m_ = rhs.m_;
4250  mm_ = rhs.mm_;
4251  n_ = rhs.n_;
4252  capacity_ = rhs.capacity_;
4253  v_ = rhs.v_;
4254 
4255  rhs.m_ = 0UL;
4256  rhs.mm_ = 0UL;
4257  rhs.n_ = 0UL;
4258  rhs.capacity_ = 0UL;
4259  rhs.v_ = nullptr;
4260 
4261  return *this;
4262 }
4264 //*************************************************************************************************
4265 
4266 
4267 //*************************************************************************************************
4277 template< typename Type > // Data type of the matrix
4278 template< typename MT // Type of the right-hand side matrix
4279  , bool SO > // Storage order of the right-hand side matrix
4281 {
4282  using TT = TransExprTrait_<This>;
4283  using CT = CTransExprTrait_<This>;
4284  using IT = InvExprTrait_<This>;
4285 
4286  if( IsSame<MT,TT>::value && (~rhs).isAliased( this ) ) {
4287  transpose();
4288  }
4289  else if( IsSame<MT,CT>::value && (~rhs).isAliased( this ) ) {
4290  ctranspose();
4291  }
4292  else if( !IsSame<MT,IT>::value && (~rhs).canAlias( this ) ) {
4293  DynamicMatrix tmp( ~rhs );
4294  swap( tmp );
4295  }
4296  else {
4297  resize( (~rhs).rows(), (~rhs).columns(), false );
4299  reset();
4300  smpAssign( *this, ~rhs );
4301  }
4302 
4303  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4304 
4305  return *this;
4306 }
4308 //*************************************************************************************************
4309 
4310 
4311 //*************************************************************************************************
4322 template< typename Type > // Data type of the matrix
4323 template< typename MT // Type of the right-hand side matrix
4324  , bool SO > // Storage order of the right-hand side matrix
4326 {
4327  if( (~rhs).rows() != m_ || (~rhs).columns() != n_ ) {
4328  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4329  }
4330 
4331  if( (~rhs).canAlias( this ) ) {
4332  const ResultType_<MT> tmp( ~rhs );
4333  smpAddAssign( *this, tmp );
4334  }
4335  else {
4336  smpAddAssign( *this, ~rhs );
4337  }
4338 
4339  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4340 
4341  return *this;
4342 }
4344 //*************************************************************************************************
4345 
4346 
4347 //*************************************************************************************************
4358 template< typename Type > // Data type of the matrix
4359 template< typename MT // Type of the right-hand side matrix
4360  , bool SO > // Storage order of the right-hand side matrix
4362 {
4363  if( (~rhs).rows() != m_ || (~rhs).columns() != n_ ) {
4364  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4365  }
4366 
4367  if( (~rhs).canAlias( this ) ) {
4368  const ResultType_<MT> tmp( ~rhs );
4369  smpSubAssign( *this, tmp );
4370  }
4371  else {
4372  smpSubAssign( *this, ~rhs );
4373  }
4374 
4375  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4376 
4377  return *this;
4378 }
4380 //*************************************************************************************************
4381 
4382 
4383 //*************************************************************************************************
4394 template< typename Type > // Data type of the matrix
4395 template< typename MT // Type of the right-hand side matrix
4396  , bool SO > // Storage order of the right-hand side matrix
4398 {
4399  if( (~rhs).rows() != m_ || (~rhs).columns() != n_ ) {
4400  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4401  }
4402 
4403  if( (~rhs).canAlias( this ) ) {
4404  const ResultType_<MT> tmp( ~rhs );
4405  smpSchurAssign( *this, tmp );
4406  }
4407  else {
4408  smpSchurAssign( *this, ~rhs );
4409  }
4410 
4411  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4412 
4413  return *this;
4414 }
4416 //*************************************************************************************************
4417 
4418 
4419 
4420 
4421 //=================================================================================================
4422 //
4423 // UTILITY FUNCTIONS
4424 //
4425 //=================================================================================================
4426 
4427 //*************************************************************************************************
4433 template< typename Type > // Data type of the matrix
4434 inline size_t DynamicMatrix<Type,true>::rows() const noexcept
4435 {
4436  return m_;
4437 }
4439 //*************************************************************************************************
4440 
4441 
4442 //*************************************************************************************************
4448 template< typename Type > // Data type of the matrix
4449 inline size_t DynamicMatrix<Type,true>::columns() const noexcept
4450 {
4451  return n_;
4452 }
4454 //*************************************************************************************************
4455 
4456 
4457 //*************************************************************************************************
4466 template< typename Type > // Data type of the matrix
4467 inline size_t DynamicMatrix<Type,true>::spacing() const noexcept
4468 {
4469  return mm_;
4470 }
4472 //*************************************************************************************************
4473 
4474 
4475 //*************************************************************************************************
4481 template< typename Type > // Data type of the matrix
4482 inline size_t DynamicMatrix<Type,true>::capacity() const noexcept
4483 {
4484  return capacity_;
4485 }
4487 //*************************************************************************************************
4488 
4489 
4490 //*************************************************************************************************
4497 template< typename Type > // Data type of the matrix
4498 inline size_t DynamicMatrix<Type,true>::capacity( size_t j ) const noexcept
4499 {
4500  UNUSED_PARAMETER( j );
4501  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4502  return mm_;
4503 }
4505 //*************************************************************************************************
4506 
4507 
4508 //*************************************************************************************************
4514 template< typename Type > // Data type of the matrix
4515 inline size_t DynamicMatrix<Type,true>::nonZeros() const
4516 {
4517  size_t nonzeros( 0UL );
4518 
4519  for( size_t j=0UL; j<n_; ++j )
4520  for( size_t i=0UL; i<m_; ++i )
4521  if( !isDefault( v_[i+j*mm_] ) )
4522  ++nonzeros;
4523 
4524  return nonzeros;
4525 }
4527 //*************************************************************************************************
4528 
4529 
4530 //*************************************************************************************************
4537 template< typename Type > // Data type of the matrix
4538 inline size_t DynamicMatrix<Type,true>::nonZeros( size_t j ) const
4539 {
4540  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4541 
4542  const size_t iend( j*mm_ + m_ );
4543  size_t nonzeros( 0UL );
4544 
4545  for( size_t i=j*mm_; i<iend; ++i )
4546  if( !isDefault( v_[i] ) )
4547  ++nonzeros;
4548 
4549  return nonzeros;
4550 }
4552 //*************************************************************************************************
4553 
4554 
4555 //*************************************************************************************************
4561 template< typename Type > // Data type of the matrix
4562 inline void DynamicMatrix<Type,true>::reset()
4563 {
4564  using blaze::clear;
4565 
4566  for( size_t j=0UL; j<n_; ++j )
4567  for( size_t i=0UL; i<m_; ++i )
4568  clear( v_[i+j*mm_] );
4569 }
4571 //*************************************************************************************************
4572 
4573 
4574 //*************************************************************************************************
4584 template< typename Type > // Data type of the matrix
4585 inline void DynamicMatrix<Type,true>::reset( size_t j )
4586 {
4587  using blaze::clear;
4588 
4589  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4590  for( size_t i=0UL; i<m_; ++i )
4591  clear( v_[i+j*mm_] );
4592 }
4594 //*************************************************************************************************
4595 
4596 
4597 //*************************************************************************************************
4605 template< typename Type > // Data type of the matrix
4606 inline void DynamicMatrix<Type,true>::clear()
4607 {
4608  resize( 0UL, 0UL, false );
4609 }
4611 //*************************************************************************************************
4612 
4613 
4614 //*************************************************************************************************
4649 template< typename Type > // Data type of the matrix
4650 void DynamicMatrix<Type,true>::resize( size_t m, size_t n, bool preserve )
4651 {
4652  using std::swap;
4653  using blaze::min;
4654 
4655  if( m == m_ && n == n_ ) return;
4656 
4657  const size_t mm( addPadding( m ) );
4658 
4659  if( preserve )
4660  {
4661  Type* BLAZE_RESTRICT v = allocate<Type>( mm*n );
4662  const size_t min_m( min( m, m_ ) );
4663  const size_t min_n( min( n, n_ ) );
4664 
4665  for( size_t j=0UL; j<min_n; ++j ) {
4666  transfer( v_+j*mm_, v_+min_m+j*mm_, v+j*mm );
4667  }
4668 
4669  swap( v_, v );
4670  deallocate( v );
4671  capacity_ = mm*n;
4672  }
4673  else if( mm*n > capacity_ ) {
4674  Type* BLAZE_RESTRICT v = allocate<Type>( mm*n );
4675  swap( v_, v );
4676  deallocate( v );
4677  capacity_ = mm*n;
4678  }
4679 
4681  for( size_t j=0UL; j<n; ++j )
4682  for( size_t i=m; i<mm; ++i )
4683  v_[i+j*mm] = Type();
4684  }
4685 
4686  m_ = m;
4687  mm_ = mm;
4688  n_ = n;
4689 }
4691 //*************************************************************************************************
4692 
4693 
4694 //*************************************************************************************************
4709 template< typename Type > // Data type of the matrix
4710 inline void DynamicMatrix<Type,true>::extend( size_t m, size_t n, bool preserve )
4711 {
4712  resize( m_+m, n_+n, preserve );
4713 }
4715 //*************************************************************************************************
4716 
4717 
4718 //*************************************************************************************************
4728 template< typename Type > // Data type of the matrix
4729 inline void DynamicMatrix<Type,true>::reserve( size_t elements )
4730 {
4731  using std::swap;
4732 
4733  if( elements > capacity_ )
4734  {
4735  // Allocating a new array
4736  Type* BLAZE_RESTRICT tmp = allocate<Type>( elements );
4737 
4738  // Initializing the new array
4739  transfer( v_, v_+capacity_, tmp );
4740 
4742  for( size_t i=capacity_; i<elements; ++i )
4743  tmp[i] = Type();
4744  }
4745 
4746  // Replacing the old array
4747  swap( tmp, v_ );
4748  deallocate( tmp );
4749  capacity_ = elements;
4750  }
4751 }
4753 //*************************************************************************************************
4754 
4755 
4756 //*************************************************************************************************
4767 template< typename Type > // Data type of the matrix
4769 {
4770  if( ( mm_ * n_ ) < capacity_ ) {
4771  DynamicMatrix( *this ).swap( *this );
4772  }
4773 }
4775 //*************************************************************************************************
4776 
4777 
4778 //*************************************************************************************************
4785 template< typename Type > // Data type of the matrix
4786 inline void DynamicMatrix<Type,true>::swap( DynamicMatrix& m ) noexcept
4787 {
4788  using std::swap;
4789 
4790  swap( m_ , m.m_ );
4791  swap( mm_, m.mm_ );
4792  swap( n_ , m.n_ );
4793  swap( capacity_, m.capacity_ );
4794  swap( v_ , m.v_ );
4795 }
4797 //*************************************************************************************************
4798 
4799 
4800 //*************************************************************************************************
4810 template< typename Type > // Data type of the matrix
4811 inline size_t DynamicMatrix<Type,true>::addPadding( size_t values ) const noexcept
4812 {
4813  if( usePadding && IsVectorizable<Type>::value )
4814  return nextMultiple<size_t>( values, SIMDSIZE );
4815  else return values;
4816 }
4818 //*************************************************************************************************
4819 
4820 
4821 
4822 
4823 //=================================================================================================
4824 //
4825 // NUMERIC FUNCTIONS
4826 //
4827 //=================================================================================================
4828 
4829 //*************************************************************************************************
4835 template< typename Type > // Data type of the matrix
4837 {
4838  using std::swap;
4839 
4840  constexpr size_t block( BLOCK_SIZE );
4841 
4842  if( m_ == n_ )
4843  {
4844  for( size_t jj=0UL; jj<n_; jj+=block ) {
4845  const size_t jend( min( jj+block, n_ ) );
4846  for( size_t ii=0UL; ii<=jj; ii+=block ) {
4847  for( size_t j=jj; j<jend; ++j ) {
4848  const size_t iend( min( ii+block, m_, j ) );
4849  for( size_t i=ii; i<iend; ++i ) {
4850  swap( v_[i+j*mm_], v_[j+i*mm_] );
4851  }
4852  }
4853  }
4854  }
4855  }
4856  else
4857  {
4858  DynamicMatrix tmp( trans(*this) );
4859  this->swap( tmp );
4860  }
4861 
4862  return *this;
4863 }
4865 //*************************************************************************************************
4866 
4867 
4868 //*************************************************************************************************
4874 template< typename Type > // Data type of the matrix
4876 {
4877  constexpr size_t block( BLOCK_SIZE );
4878 
4879  if( m_ == n_ )
4880  {
4881  for( size_t jj=0UL; jj<n_; jj+=block ) {
4882  const size_t jend( min( jj+block, n_ ) );
4883  for( size_t ii=0UL; ii<jj; ii+=block ) {
4884  const size_t iend( min( ii+block, m_ ) );
4885  for( size_t j=jj; j<jend; ++j ) {
4886  for( size_t i=ii; i<iend; ++i ) {
4887  cswap( v_[i+j*mm_], v_[j+i*mm_] );
4888  }
4889  }
4890  }
4891  for( size_t j=jj; j<jend; ++j ) {
4892  for( size_t i=jj; i<j; ++i ) {
4893  cswap( v_[i+j*mm_], v_[j+i*mm_] );
4894  }
4895  conjugate( v_[j+j*mm_] );
4896  }
4897  }
4898  }
4899  else
4900  {
4901  DynamicMatrix tmp( ctrans(*this) );
4902  this->swap( tmp );
4903  }
4904 
4905  return *this;
4906 }
4908 //*************************************************************************************************
4909 
4910 
4911 //*************************************************************************************************
4929 template< typename Type > // Data type of the matrix
4930 template< typename Other > // Data type of the scalar value
4931 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::scale( const Other& scalar )
4932 {
4933  for( size_t j=0UL; j<n_; ++j )
4934  for( size_t i=0UL; i<m_; ++i )
4935  v_[i+j*mm_] *= scalar;
4936 
4937  return *this;
4938 }
4940 //*************************************************************************************************
4941 
4942 
4943 
4944 
4945 //=================================================================================================
4946 //
4947 // DEBUGGING FUNCTIONS
4948 //
4949 //=================================================================================================
4950 
4951 //*************************************************************************************************
4961 template< typename Type > // Data type of the matrix
4962 inline bool DynamicMatrix<Type,true>::isIntact() const noexcept
4963 {
4964  if( m_ * n_ > capacity_ )
4965  return false;
4966 
4968  for( size_t j=0UL; j<n_; ++j ) {
4969  for( size_t i=m_; i<mm_; ++i ) {
4970  if( v_[i+j*mm_] != Type() )
4971  return false;
4972  }
4973  }
4974  }
4975 
4976  return true;
4977 }
4979 //*************************************************************************************************
4980 
4981 
4982 
4983 
4984 //=================================================================================================
4985 //
4986 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
4987 //
4988 //=================================================================================================
4989 
4990 //*************************************************************************************************
5001 template< typename Type > // Data type of the matrix
5002 template< typename Other > // Data type of the foreign expression
5003 inline bool DynamicMatrix<Type,true>::canAlias( const Other* alias ) const noexcept
5004 {
5005  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5006 }
5008 //*************************************************************************************************
5009 
5010 
5011 //*************************************************************************************************
5022 template< typename Type > // Data type of the matrix
5023 template< typename Other > // Data type of the foreign expression
5024 inline bool DynamicMatrix<Type,true>::isAliased( const Other* alias ) const noexcept
5025 {
5026  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5027 }
5029 //*************************************************************************************************
5030 
5031 
5032 //*************************************************************************************************
5042 template< typename Type > // Data type of the matrix
5043 inline bool DynamicMatrix<Type,true>::isAligned() const noexcept
5044 {
5045  return ( usePadding || rows() % SIMDSIZE == 0UL );
5046 }
5048 //*************************************************************************************************
5049 
5050 
5051 //*************************************************************************************************
5062 template< typename Type > // Data type of the matrix
5063 inline bool DynamicMatrix<Type,true>::canSMPAssign() const noexcept
5064 {
5065  return ( rows() * columns() >= SMP_DMATASSIGN_THRESHOLD );
5066 }
5068 //*************************************************************************************************
5069 
5070 
5071 //*************************************************************************************************
5086 template< typename Type > // Data type of the matrix
5088  DynamicMatrix<Type,true>::load( size_t i, size_t j ) const noexcept
5089 {
5090  if( usePadding )
5091  return loada( i, j );
5092  else
5093  return loadu( i, j );
5094 }
5096 //*************************************************************************************************
5097 
5098 
5099 //*************************************************************************************************
5114 template< typename Type > // Data type of the matrix
5116  DynamicMatrix<Type,true>::loada( size_t i, size_t j ) const noexcept
5117 {
5118  using blaze::loada;
5119 
5121 
5122  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
5123  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= mm_, "Invalid row access index" );
5124  BLAZE_INTERNAL_ASSERT( !usePadding || i % SIMDSIZE == 0UL, "Invalid row access index" );
5125  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
5126  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+i+j*mm_ ), "Invalid alignment detected" );
5127 
5128  return loada( v_+i+j*mm_ );
5129 }
5131 //*************************************************************************************************
5132 
5133 
5134 //*************************************************************************************************
5149 template< typename Type > // Data type of the matrix
5151  DynamicMatrix<Type,true>::loadu( size_t i, size_t j ) const noexcept
5152 {
5153  using blaze::loadu;
5154 
5156 
5157  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
5158  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= mm_, "Invalid row access index" );
5159  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
5160 
5161  return loadu( v_+i+j*mm_ );
5162 }
5164 //*************************************************************************************************
5165 
5166 
5167 //*************************************************************************************************
5183 template< typename Type > // Data type of the matrix
5185  DynamicMatrix<Type,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
5186 {
5187  if( usePadding )
5188  storea( i, j, value );
5189  else
5190  storeu( i, j, value );
5191 }
5193 //*************************************************************************************************
5194 
5195 
5196 //*************************************************************************************************
5212 template< typename Type > // Data type of the matrix
5214  DynamicMatrix<Type,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
5215 {
5216  using blaze::storea;
5217 
5219 
5220  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
5221  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= mm_, "Invalid row access index" );
5222  BLAZE_INTERNAL_ASSERT( !usePadding || i % SIMDSIZE == 0UL, "Invalid row access index" );
5223  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
5224  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+i+j*mm_ ), "Invalid alignment detected" );
5225 
5226  storea( v_+i+j*mm_, value );
5227 }
5229 //*************************************************************************************************
5230 
5231 
5232 //*************************************************************************************************
5248 template< typename Type > // Data type of the matrix
5250  DynamicMatrix<Type,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
5251 {
5252  using blaze::storeu;
5253 
5255 
5256  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
5257  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= mm_, "Invalid row access index" );
5258  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
5259 
5260  storeu( v_+i+j*mm_, value );
5261 }
5263 //*************************************************************************************************
5264 
5265 
5266 //*************************************************************************************************
5283 template< typename Type > // Data type of the matrix
5285  DynamicMatrix<Type,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
5286 {
5287  using blaze::stream;
5288 
5290 
5291  BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
5292  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= mm_, "Invalid row access index" );
5293  BLAZE_INTERNAL_ASSERT( !usePadding || i % SIMDSIZE == 0UL, "Invalid row access index" );
5294  BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
5295  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+i+j*mm_ ), "Invalid alignment detected" );
5296 
5297  stream( v_+i+j*mm_, value );
5298 }
5300 //*************************************************************************************************
5301 
5302 
5303 //*************************************************************************************************
5315 template< typename Type > // Data type of the matrix
5316 template< typename MT > // Type of the right-hand side dense matrix
5319 {
5320  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5321  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5322 
5323  const size_t ipos( m_ & size_t(-2) );
5324  BLAZE_INTERNAL_ASSERT( ( m_ - ( m_ % 2UL ) ) == ipos, "Invalid end calculation" );
5325 
5326  for( size_t j=0UL; j<n_; ++j ) {
5327  for( size_t i=0UL; i<ipos; i+=2UL ) {
5328  v_[i +j*mm_] = (~rhs)(i ,j);
5329  v_[i+1UL+j*mm_] = (~rhs)(i+1UL,j);
5330  }
5331  if( ipos < m_ ) {
5332  v_[ipos+j*mm_] = (~rhs)(ipos,j);
5333  }
5334  }
5335 }
5337 //*************************************************************************************************
5338 
5339 
5340 //*************************************************************************************************
5352 template< typename Type > // Data type of the matrix
5353 template< typename MT > // Type of the right-hand side dense matrix
5356 {
5358 
5359  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5360  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5361 
5362  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5363 
5364  const size_t ipos( ( remainder )?( m_ & size_t(-SIMDSIZE) ):( m_ ) );
5365  BLAZE_INTERNAL_ASSERT( !remainder || ( m_ - ( m_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5366 
5367  if( usePadding && useStreaming &&
5368  ( m_*n_ > ( cacheSize / ( sizeof(Type) * 3UL ) ) ) && !(~rhs).isAliased( this ) )
5369  {
5370  for( size_t j=0UL; j<n_; ++j )
5371  {
5372  size_t i( 0UL );
5373  Iterator left( begin(j) );
5374  ConstIterator_<MT> right( (~rhs).begin(j) );
5375 
5376  for( ; i<ipos; i+=SIMDSIZE ) {
5377  left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5378  }
5379  for( ; remainder && i<m_; ++i ) {
5380  *left = *right; ++left; ++right;
5381  }
5382  }
5383  }
5384  else
5385  {
5386  for( size_t j=0UL; j<n_; ++j )
5387  {
5388  size_t i( 0UL );
5389  Iterator left( begin(j) );
5390  ConstIterator_<MT> right( (~rhs).begin(j) );
5391 
5392  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5393  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5394  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5395  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5396  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5397  }
5398  for( ; i<ipos; i+=SIMDSIZE ) {
5399  left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5400  }
5401  for( ; remainder && i<m_; ++i ) {
5402  *left = *right; ++left; ++right;
5403  }
5404  }
5405  }
5406 }
5408 //*************************************************************************************************
5409 
5410 
5411 //*************************************************************************************************
5423 template< typename Type > // Data type of the matrix
5424 template< typename MT > // Type of the right-hand side dense matrix
5426 {
5428 
5429  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5430  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5431 
5432  constexpr size_t block( BLOCK_SIZE );
5433 
5434  for( size_t jj=0UL; jj<n_; jj+=block ) {
5435  const size_t jend( min( n_, jj+block ) );
5436  for( size_t ii=0UL; ii<m_; ii+=block ) {
5437  const size_t iend( min( m_, ii+block ) );
5438  for( size_t j=jj; j<jend; ++j ) {
5439  for( size_t i=ii; i<iend; ++i ) {
5440  v_[i+j*mm_] = (~rhs)(i,j);
5441  }
5442  }
5443  }
5444  }
5445 }
5447 //*************************************************************************************************
5448 
5449 
5450 //*************************************************************************************************
5462 template< typename Type > // Data type of the matrix
5463 template< typename MT > // Type of the right-hand side sparse matrix
5465 {
5466  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5467  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5468 
5469  for( size_t j=0UL; j<(~rhs).columns(); ++j )
5470  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5471  v_[element->index()+j*mm_] = element->value();
5472 }
5474 //*************************************************************************************************
5475 
5476 
5477 //*************************************************************************************************
5489 template< typename Type > // Data type of the matrix
5490 template< typename MT > // Type of the right-hand side sparse matrix
5492 {
5494 
5495  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5496  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5497 
5498  for( size_t i=0UL; i<(~rhs).rows(); ++i )
5499  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5500  v_[i+element->index()*mm_] = element->value();
5501 }
5503 //*************************************************************************************************
5504 
5505 
5506 //*************************************************************************************************
5518 template< typename Type > // Data type of the matrix
5519 template< typename MT > // Type of the right-hand side dense matrix
5520 inline DisableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
5522 {
5523  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5524  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5525 
5526  for( size_t j=0UL; j<n_; ++j )
5527  {
5528  if( IsDiagonal<MT>::value )
5529  {
5530  v_[j+j*mm_] += (~rhs)(j,j);
5531  }
5532  else
5533  {
5534  const size_t ibegin( ( IsLower<MT>::value )
5535  ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5536  :( 0UL ) );
5537  const size_t iend ( ( IsUpper<MT>::value )
5538  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5539  :( m_ ) );
5540  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5541 
5542  size_t i( ibegin );
5543 
5544  for( ; (i+2UL) <= iend; i+=2UL ) {
5545  v_[i +j*mm_] += (~rhs)(i ,j);
5546  v_[i+1UL+j*mm_] += (~rhs)(i+1UL,j);
5547  }
5548  if( i < iend ) {
5549  v_[i+j*mm_] += (~rhs)(i,j);
5550  }
5551  }
5552  }
5553 }
5555 //*************************************************************************************************
5556 
5557 
5558 //*************************************************************************************************
5570 template< typename Type > // Data type of the matrix
5571 template< typename MT > // Type of the right-hand side dense matrix
5572 inline EnableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
5574 {
5577 
5578  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5579  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5580 
5581  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5582 
5583  for( size_t j=0UL; j<n_; ++j )
5584  {
5585  const size_t ibegin( ( IsLower<MT>::value )
5586  ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) & size_t(-SIMDSIZE) )
5587  :( 0UL ) );
5588  const size_t iend ( ( IsUpper<MT>::value )
5589  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5590  :( m_ ) );
5591  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5592 
5593  const size_t ipos( ( remainder )?( iend & size_t(-SIMDSIZE) ):( iend ) );
5594  BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5595 
5596  size_t i( ibegin );
5597  Iterator left( begin(j) + ibegin );
5598  ConstIterator_<MT> right( (~rhs).begin(j) + ibegin );
5599 
5600  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5601  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5602  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5603  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5604  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5605  }
5606  for( ; i<ipos; i+=SIMDSIZE ) {
5607  left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5608  }
5609  for( ; remainder && i<iend; ++i ) {
5610  *left += *right; ++left; ++right;
5611  }
5612  }
5613 }
5615 //*************************************************************************************************
5616 
5617 
5618 //*************************************************************************************************
5630 template< typename Type > // Data type of the matrix
5631 template< typename MT > // Type of the right-hand side dense matrix
5633 {
5635 
5636  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5637  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5638 
5639  constexpr size_t block( BLOCK_SIZE );
5640 
5641  for( size_t jj=0UL; jj<n_; jj+=block ) {
5642  const size_t jend( min( n_, jj+block ) );
5643  for( size_t ii=0UL; ii<m_; ii+=block )
5644  {
5645  if( IsLower<MT>::value && ii < jj ) continue;
5646  if( IsUpper<MT>::value && ii > jj ) break;
5647 
5648  for( size_t j=jj; j<jend; ++j )
5649  {
5650  const size_t ibegin( ( IsLower<MT>::value )
5651  ?( max( ( IsStrictlyLower<MT>::value ? j+1UL : j ), ii ) )
5652  :( ii ) );
5653  const size_t iend ( ( IsUpper<MT>::value )
5654  ?( min( ( IsStrictlyUpper<MT>::value ? j : j+1UL ), m_, ii+block ) )
5655  :( min( m_, ii+block ) ) );
5656  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5657 
5658  for( size_t i=ibegin; i<iend; ++i ) {
5659  v_[i+j*mm_] += (~rhs)(i,j);
5660  }
5661  }
5662  }
5663  }
5664 }
5666 //*************************************************************************************************
5667 
5668 
5669 //*************************************************************************************************
5681 template< typename Type > // Data type of the matrix
5682 template< typename MT > // Type of the right-hand side sparse matrix
5684 {
5685  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5686  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5687 
5688  for( size_t j=0UL; j<(~rhs).columns(); ++j )
5689  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5690  v_[element->index()+j*mm_] += element->value();
5691 }
5693 //*************************************************************************************************
5694 
5695 
5696 //*************************************************************************************************
5708 template< typename Type > // Data type of the matrix
5709 template< typename MT > // Type of the right-hand side sparse matrix
5711 {
5713 
5714  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5715  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5716 
5717  for( size_t i=0UL; i<(~rhs).rows(); ++i )
5718  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5719  v_[i+element->index()*mm_] += element->value();
5720 }
5722 //*************************************************************************************************
5723 
5724 
5725 //*************************************************************************************************
5737 template< typename Type > // Data type of the matrix
5738 template< typename MT > // Type of the right-hand side dense matrix
5739 inline DisableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
5741 {
5742  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5743  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5744 
5745  for( size_t j=0UL; j<n_; ++j )
5746  {
5747  if( IsDiagonal<MT>::value )
5748  {
5749  v_[j+j*mm_] -= (~rhs)(j,j);
5750  }
5751  else
5752  {
5753  const size_t ibegin( ( IsLower<MT>::value )
5754  ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5755  :( 0UL ) );
5756  const size_t iend ( ( IsUpper<MT>::value )
5757  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5758  :( m_ ) );
5759  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5760 
5761  size_t i( ibegin );
5762 
5763  for( ; (i+2UL) <= iend; i+=2UL ) {
5764  v_[i +j*mm_] -= (~rhs)(i ,j);
5765  v_[i+1+j*mm_] -= (~rhs)(i+1,j);
5766  }
5767  if( i < iend ) {
5768  v_[i+j*mm_] -= (~rhs)(i,j);
5769  }
5770  }
5771  }
5772 }
5774 //*************************************************************************************************
5775 
5776 
5777 //*************************************************************************************************
5789 template< typename Type > // Data type of the matrix
5790 template< typename MT > // Type of the right-hand side dense matrix
5791 inline EnableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
5793 {
5796 
5797  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5798  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5799 
5800  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5801 
5802  for( size_t j=0UL; j<n_; ++j )
5803  {
5804  const size_t ibegin( ( IsLower<MT>::value )
5805  ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) & size_t(-SIMDSIZE) )
5806  :( 0UL ) );
5807  const size_t iend ( ( IsUpper<MT>::value )
5808  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5809  :( m_ ) );
5810  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5811 
5812  const size_t ipos( ( remainder )?( iend & size_t(-SIMDSIZE) ):( iend ) );
5813  BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5814 
5815  size_t i( ibegin );
5816  Iterator left( begin(j) + ibegin );
5817  ConstIterator_<MT> right( (~rhs).begin(j) + ibegin );
5818 
5819  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5820  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5821  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5822  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5823  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5824  }
5825  for( ; i<ipos; i+=SIMDSIZE ) {
5826  left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5827  }
5828  for( ; remainder && i<iend; ++i ) {
5829  *left -= *right; ++left; ++right;
5830  }
5831  }
5832 }
5834 //*************************************************************************************************
5835 
5836 
5837 //*************************************************************************************************
5849 template< typename Type > // Data type of the matrix
5850 template< typename MT > // Type of the right-hand side dense matrix
5852 {
5854 
5855  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5856  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5857 
5858  constexpr size_t block( BLOCK_SIZE );
5859 
5860  for( size_t jj=0UL; jj<n_; jj+=block ) {
5861  const size_t jend( min( n_, jj+block ) );
5862  for( size_t ii=0UL; ii<m_; ii+=block )
5863  {
5864  if( IsLower<MT>::value && ii < jj ) continue;
5865  if( IsUpper<MT>::value && ii > jj ) break;
5866 
5867  for( size_t j=jj; j<jend; ++j )
5868  {
5869  const size_t ibegin( ( IsLower<MT>::value )
5870  ?( max( ( IsStrictlyLower<MT>::value ? j+1UL : j ), ii ) )
5871  :( ii ) );
5872  const size_t iend ( ( IsUpper<MT>::value )
5873  ?( min( ( IsStrictlyUpper<MT>::value ? j : j+1UL ), m_, ii+block ) )
5874  :( min( m_, ii+block ) ) );
5875  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5876 
5877  for( size_t i=ibegin; i<iend; ++i ) {
5878  v_[i+j*mm_] -= (~rhs)(i,j);
5879  }
5880  }
5881  }
5882  }
5883 }
5885 //*************************************************************************************************
5886 
5887 
5888 //*************************************************************************************************
5900 template< typename Type > // Data type of the matrix
5901 template< typename MT > // Type of the right-hand side sparse matrix
5903 {
5904  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5905  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5906 
5907  for( size_t j=0UL; j<(~rhs).columns(); ++j )
5908  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5909  v_[element->index()+j*mm_] -= element->value();
5910 }
5912 //*************************************************************************************************
5913 
5914 
5915 //*************************************************************************************************
5927 template< typename Type > // Data type of the matrix
5928 template< typename MT > // Type of the right-hand side sparse matrix
5930 {
5932 
5933  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5934  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5935 
5936  for( size_t i=0UL; i<(~rhs).rows(); ++i )
5937  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5938  v_[i+element->index()*mm_] -= element->value();
5939 }
5941 //*************************************************************************************************
5942 
5943 
5944 //*************************************************************************************************
5956 template< typename Type > // Data type of the matrix
5957 template< typename MT > // Type of the right-hand side dense matrix
5958 inline DisableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
5960 {
5961  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
5962  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
5963 
5964  const size_t ipos( m_ & size_t(-2) );
5965  BLAZE_INTERNAL_ASSERT( ( m_ - ( m_ % 2UL ) ) == ipos, "Invalid end calculation" );
5966 
5967  for( size_t j=0UL; j<n_; ++j ) {
5968  for( size_t i=0UL; (i+2UL) <= ipos; i+=2UL ) {
5969  v_[i +j*mm_] *= (~rhs)(i ,j);
5970  v_[i+1+j*mm_] *= (~rhs)(i+1,j);
5971  }
5972  if( ipos < m_ ) {
5973  v_[ipos+j*mm_] *= (~rhs)(ipos,j);
5974  }
5975  }
5976 }
5978 //*************************************************************************************************
5979 
5980 
5981 //*************************************************************************************************
5993 template< typename Type > // Data type of the matrix
5994 template< typename MT > // Type of the right-hand side dense matrix
5995 inline EnableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
5997 {
5999 
6000  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
6001  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
6002 
6003  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
6004 
6005  for( size_t j=0UL; j<n_; ++j )
6006  {
6007  const size_t ipos( ( remainder )?( m_ & size_t(-SIMDSIZE) ):( m_ ) );
6008  BLAZE_INTERNAL_ASSERT( !remainder || ( m_ - ( m_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
6009 
6010  size_t i( 0UL );
6011  Iterator left( begin(j) );
6012  ConstIterator_<MT> right( (~rhs).begin(j) );
6013 
6014  for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6015  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6016  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6017  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6018  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6019  }
6020  for( ; i<ipos; i+=SIMDSIZE ) {
6021  left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6022  }
6023  for( ; remainder && i<m_; ++i ) {
6024  *left *= *right; ++left; ++right;
6025  }
6026  }
6027 }
6029 //*************************************************************************************************
6030 
6031 
6032 //*************************************************************************************************
6044 template< typename Type > // Data type of the matrix
6045 template< typename MT > // Type of the right-hand side dense matrix
6047 {
6049 
6050  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
6051  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
6052 
6053  constexpr size_t block( BLOCK_SIZE );
6054 
6055  for( size_t jj=0UL; jj<n_; jj+=block ) {
6056  const size_t jend( min( n_, jj+block ) );
6057  for( size_t ii=0UL; ii<m_; ii+=block ) {
6058  const size_t iend( min( m_, ii+block ) );
6059  for( size_t j=jj; j<jend; ++j ) {
6060  for( size_t i=ii; i<iend; ++i ) {
6061  v_[i+j*mm_] *= (~rhs)(i,j);
6062  }
6063  }
6064  }
6065  }
6066 }
6068 //*************************************************************************************************
6069 
6070 
6071 //*************************************************************************************************
6083 template< typename Type > // Data type of the matrix
6084 template< typename MT > // Type of the right-hand side sparse matrix
6086 {
6087  using blaze::reset;
6088 
6089  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
6090  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
6091 
6092  for( size_t j=0UL; j<n_; ++j )
6093  {
6094  size_t i( 0UL );
6095 
6096  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
6097  for( ; i<element->index(); ++i )
6098  reset( v_[i+j*mm_] );
6099  v_[i+j*mm_] *= element->value();
6100  ++i;
6101  }
6102 
6103  for( ; i<m_; ++i ) {
6104  reset( v_[i+j*mm_] );
6105  }
6106  }
6107 }
6109 //*************************************************************************************************
6110 
6111 
6112 //*************************************************************************************************
6124 template< typename Type > // Data type of the matrix
6125 template< typename MT > // Type of the right-hand side sparse matrix
6127 {
6128  using blaze::reset;
6129 
6131 
6132  BLAZE_INTERNAL_ASSERT( m_ == (~rhs).rows() , "Invalid number of rows" );
6133  BLAZE_INTERNAL_ASSERT( n_ == (~rhs).columns(), "Invalid number of columns" );
6134 
6135  for( size_t i=0UL; i<m_; ++i )
6136  {
6137  size_t j( 0UL );
6138 
6139  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
6140  for( ; j<element->index(); ++j )
6141  reset( v_[i+j*mm_] );
6142  v_[i+j*mm_] *= element->value();
6143  ++j;
6144  }
6145 
6146  for( ; j<n_; ++j ) {
6147  reset( v_[i+j*mm_] );
6148  }
6149  }
6150 }
6152 //*************************************************************************************************
6153 
6154 
6155 
6156 
6157 
6158 
6159 
6160 
6161 //=================================================================================================
6162 //
6163 // DYNAMICMATRIX OPERATORS
6164 //
6165 //=================================================================================================
6166 
6167 //*************************************************************************************************
6170 template< typename Type, bool SO >
6171 inline void reset( DynamicMatrix<Type,SO>& m );
6172 
6173 template< typename Type, bool SO >
6174 inline void reset( DynamicMatrix<Type,SO>& m, size_t i );
6175 
6176 template< typename Type, bool SO >
6177 inline void clear( DynamicMatrix<Type,SO>& m );
6178 
6179 template< bool RF, typename Type, bool SO >
6180 inline bool isDefault( const DynamicMatrix<Type,SO>& m );
6181 
6182 template< typename Type, bool SO >
6183 inline bool isIntact( const DynamicMatrix<Type,SO>& m ) noexcept;
6184 
6185 template< typename Type, bool SO >
6186 inline void swap( DynamicMatrix<Type,SO>& a, DynamicMatrix<Type,SO>& b ) noexcept;
6188 //*************************************************************************************************
6189 
6190 
6191 //*************************************************************************************************
6198 template< typename Type // Data type of the matrix
6199  , bool SO > // Storage order
6201 {
6202  m.reset();
6203 }
6204 //*************************************************************************************************
6205 
6206 
6207 //*************************************************************************************************
6220 template< typename Type // Data type of the matrix
6221  , bool SO > // Storage order
6222 inline void reset( DynamicMatrix<Type,SO>& m, size_t i )
6223 {
6224  m.reset( i );
6225 }
6226 //*************************************************************************************************
6227 
6228 
6229 //*************************************************************************************************
6236 template< typename Type // Data type of the matrix
6237  , bool SO > // Storage order
6239 {
6240  m.clear();
6241 }
6242 //*************************************************************************************************
6243 
6244 
6245 //*************************************************************************************************
6270 template< bool RF // Relaxation flag
6271  , typename Type // Data type of the matrix
6272  , bool SO > // Storage order
6273 inline bool isDefault( const DynamicMatrix<Type,SO>& m )
6274 {
6275  return ( m.rows() == 0UL && m.columns() == 0UL );
6276 }
6277 //*************************************************************************************************
6278 
6279 
6280 //*************************************************************************************************
6298 template< typename Type // Data type of the matrix
6299  , bool SO > // Storage order
6300 inline bool isIntact( const DynamicMatrix<Type,SO>& m ) noexcept
6301 {
6302  return m.isIntact();
6303 }
6304 //*************************************************************************************************
6305 
6306 
6307 //*************************************************************************************************
6315 template< typename Type // Data type of the matrix
6316  , bool SO > // Storage order
6318 {
6319  a.swap( b );
6320 }
6321 //*************************************************************************************************
6322 
6323 
6324 
6325 
6326 //=================================================================================================
6327 //
6328 // HASCONSTDATAACCESS SPECIALIZATIONS
6329 //
6330 //=================================================================================================
6331 
6332 //*************************************************************************************************
6334 template< typename T, bool SO >
6335 struct HasConstDataAccess< DynamicMatrix<T,SO> >
6336  : public TrueType
6337 {};
6339 //*************************************************************************************************
6340 
6341 
6342 
6343 
6344 //=================================================================================================
6345 //
6346 // HASMUTABLEDATAACCESS SPECIALIZATIONS
6347 //
6348 //=================================================================================================
6349 
6350 //*************************************************************************************************
6352 template< typename T, bool SO >
6353 struct HasMutableDataAccess< DynamicMatrix<T,SO> >
6354  : public TrueType
6355 {};
6357 //*************************************************************************************************
6358 
6359 
6360 
6361 
6362 //=================================================================================================
6363 //
6364 // ISALIGNED SPECIALIZATIONS
6365 //
6366 //=================================================================================================
6367 
6368 //*************************************************************************************************
6370 template< typename T, bool SO >
6371 struct IsAligned< DynamicMatrix<T,SO> >
6372  : public BoolConstant<usePadding>
6373 {};
6375 //*************************************************************************************************
6376 
6377 
6378 
6379 
6380 //=================================================================================================
6381 //
6382 // ISCONTIGUOUS SPECIALIZATIONS
6383 //
6384 //=================================================================================================
6385 
6386 //*************************************************************************************************
6388 template< typename T, bool SO >
6389 struct IsContiguous< DynamicMatrix<T,SO> >
6390  : public TrueType
6391 {};
6393 //*************************************************************************************************
6394 
6395 
6396 
6397 
6398 //=================================================================================================
6399 //
6400 // ISPADDED SPECIALIZATIONS
6401 //
6402 //=================================================================================================
6403 
6404 //*************************************************************************************************
6406 template< typename T, bool SO >
6407 struct IsPadded< DynamicMatrix<T,SO> >
6408  : public BoolConstant<usePadding>
6409 {};
6411 //*************************************************************************************************
6412 
6413 
6414 
6415 
6416 //=================================================================================================
6417 //
6418 // ISRESIZABLE SPECIALIZATIONS
6419 //
6420 //=================================================================================================
6421 
6422 //*************************************************************************************************
6424 template< typename T, bool SO >
6425 struct IsResizable< DynamicMatrix<T,SO> >
6426  : public TrueType
6427 {};
6429 //*************************************************************************************************
6430 
6431 
6432 
6433 
6434 //=================================================================================================
6435 //
6436 // ISSHRINKABLE SPECIALIZATIONS
6437 //
6438 //=================================================================================================
6439 
6440 //*************************************************************************************************
6442 template< typename T, bool SO >
6443 struct IsShrinkable< DynamicMatrix<T,SO> >
6444  : public TrueType
6445 {};
6447 //*************************************************************************************************
6448 
6449 
6450 
6451 
6452 //=================================================================================================
6453 //
6454 // ADDTRAIT SPECIALIZATIONS
6455 //
6456 //=================================================================================================
6457 
6458 //*************************************************************************************************
6460 template< typename T1, bool SO, typename T2, size_t M, size_t N >
6461 struct AddTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6462 {
6463  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
6464 };
6465 
6466 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6467 struct AddTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6468 {
6469  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, false >;
6470 };
6471 
6472 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6473 struct AddTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6474 {
6475  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
6476 };
6477 
6478 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6479 struct AddTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6480 {
6481  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, false >;
6482 };
6483 
6484 template< typename T1, bool SO, typename T2, size_t M, size_t N >
6485 struct AddTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6486 {
6487  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
6488 };
6489 
6490 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6491 struct AddTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6492 {
6493  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, false >;
6494 };
6495 
6496 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6497 struct AddTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6498 {
6499  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
6500 };
6501 
6502 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6503 struct AddTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6504 {
6505  using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, false >;
6506 };
6507 
6508 template< typename T1, bool SO, typename T2 >
6509 struct AddTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6510 {
6511  using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
6512 };
6513 
6514 template< typename T1, bool SO1, typename T2, bool SO2 >
6515 struct AddTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6516 {
6517  using Type = DynamicMatrix< AddTrait_<T1,T2>, false >;
6518 };
6520 //*************************************************************************************************
6521 
6522 
6523 
6524 
6525 //=================================================================================================
6526 //
6527 // SUBTRAIT SPECIALIZATIONS
6528 //
6529 //=================================================================================================
6530 
6531 //*************************************************************************************************
6533 template< typename T1, bool SO, typename T2, size_t M, size_t N >
6534 struct SubTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6535 {
6536  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6537 };
6538 
6539 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6540 struct SubTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6541 {
6542  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, false >;
6543 };
6544 
6545 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6546 struct SubTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6547 {
6548  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6549 };
6550 
6551 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6552 struct SubTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6553 {
6554  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, false >;
6555 };
6556 
6557 template< typename T1, bool SO, typename T2, size_t M, size_t N >
6558 struct SubTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6559 {
6560  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
6561 };
6562 
6563 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6564 struct SubTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6565 {
6566  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, false >;
6567 };
6568 
6569 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6570 struct SubTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6571 {
6572  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
6573 };
6574 
6575 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6576 struct SubTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6577 {
6578  using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, false >;
6579 };
6580 
6581 template< typename T1, bool SO, typename T2 >
6582 struct SubTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6583 {
6584  using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
6585 };
6586 
6587 template< typename T1, bool SO1, typename T2, bool SO2 >
6588 struct SubTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6589 {
6590  using Type = DynamicMatrix< SubTrait_<T1,T2>, false >;
6591 };
6593 //*************************************************************************************************
6594 
6595 
6596 
6597 
6598 //=================================================================================================
6599 //
6600 // SCHURTRAIT SPECIALIZATIONS
6601 //
6602 //=================================================================================================
6603 
6604 //*************************************************************************************************
6606 template< typename T1, bool SO, typename T2, size_t M, size_t N >
6607 struct SchurTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6608 {
6609  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO >;
6610 };
6611 
6612 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6613 struct SchurTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6614 {
6615  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, false >;
6616 };
6617 
6618 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6619 struct SchurTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6620 {
6621  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO >;
6622 };
6623 
6624 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6625 struct SchurTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6626 {
6627  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, false >;
6628 };
6629 
6630 template< typename T1, bool SO, typename T2, size_t M, size_t N >
6631 struct SchurTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6632 {
6633  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, SO >;
6634 };
6635 
6636 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6637 struct SchurTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6638 {
6639  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, false >;
6640 };
6641 
6642 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6643 struct SchurTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6644 {
6645  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, SO >;
6646 };
6647 
6648 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6649 struct SchurTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6650 {
6651  using Type = HybridMatrix< MultTrait_<T1,T2>, M, N, false >;
6652 };
6653 
6654 template< typename T1, bool SO, typename T2 >
6655 struct SchurTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6656 {
6657  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO >;
6658 };
6659 
6660 template< typename T1, bool SO1, typename T2, bool SO2 >
6661 struct SchurTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6662 {
6663  using Type = DynamicMatrix< MultTrait_<T1,T2>, false >;
6664 };
6666 //*************************************************************************************************
6667 
6668 
6669 
6670 
6671 //=================================================================================================
6672 //
6673 // MULTTRAIT SPECIALIZATIONS
6674 //
6675 //=================================================================================================
6676 
6677 //*************************************************************************************************
6679 template< typename T1, bool SO, typename T2 >
6680 struct MultTrait< DynamicMatrix<T1,SO>, T2, EnableIf_<IsNumeric<T2> > >
6681 {
6682  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO >;
6683 };
6684 
6685 template< typename T1, typename T2, bool SO >
6686 struct MultTrait< T1, DynamicMatrix<T2,SO>, EnableIf_<IsNumeric<T1> > >
6687 {
6688  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO >;
6689 };
6690 
6691 template< typename T1, bool SO, typename T2, size_t N >
6692 struct MultTrait< DynamicMatrix<T1,SO>, StaticVector<T2,N,false> >
6693 {
6694  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
6695 };
6696 
6697 template< typename T1, size_t N, typename T2, bool SO >
6698 struct MultTrait< StaticVector<T1,N,true>, DynamicMatrix<T2,SO> >
6699 {
6700  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
6701 };
6702 
6703 template< typename T1, bool SO, typename T2, size_t N >
6704 struct MultTrait< DynamicMatrix<T1,SO>, HybridVector<T2,N,false> >
6705 {
6706  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
6707 };
6708 
6709 template< typename T1, size_t N, typename T2, bool SO >
6710 struct MultTrait< HybridVector<T1,N,true>, DynamicMatrix<T2,SO> >
6711 {
6712  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
6713 };
6714 
6715 template< typename T1, bool SO, typename T2 >
6716 struct MultTrait< DynamicMatrix<T1,SO>, DynamicVector<T2,false> >
6717 {
6718  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
6719 };
6720 
6721 template< typename T1, typename T2, bool SO >
6722 struct MultTrait< DynamicVector<T1,true>, DynamicMatrix<T2,SO> >
6723 {
6724  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
6725 };
6726 
6727 template< typename T1, bool SO, typename T2, bool AF, bool PF >
6728 struct MultTrait< DynamicMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
6729 {
6730  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
6731 };
6732 
6733 template< typename T1, bool AF, bool PF, typename T2, bool SO >
6734 struct MultTrait< CustomVector<T1,AF,PF,true>, DynamicMatrix<T2,SO> >
6735 {
6736  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
6737 };
6738 
6739 template< typename T1, bool SO, typename T2 >
6740 struct MultTrait< DynamicMatrix<T1,SO>, CompressedVector<T2,false> >
6741 {
6742  using Type = DynamicVector< MultTrait_<T1,T2>, false >;
6743 };
6744 
6745 template< typename T1, typename T2, bool SO >
6746 struct MultTrait< CompressedVector<T1,true>, DynamicMatrix<T2,SO> >
6747 {
6748  using Type = DynamicVector< MultTrait_<T1,T2>, true >;
6749 };
6750 
6751 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6752 struct MultTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6753 {
6754  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6755 };
6756 
6757 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6758 struct MultTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6759 {
6760  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6761 };
6762 
6763 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2 >
6764 struct MultTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6765 {
6766  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6767 };
6768 
6769 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6770 struct MultTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6771 {
6772  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6773 };
6774 
6775 template< typename T1, bool SO1, typename T2, bool SO2 >
6776 struct MultTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6777 {
6778  using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6779 };
6781 //*************************************************************************************************
6782 
6783 
6784 
6785 
6786 //=================================================================================================
6787 //
6788 // DIVTRAIT SPECIALIZATIONS
6789 //
6790 //=================================================================================================
6791 
6792 //*************************************************************************************************
6794 template< typename T1, bool SO, typename T2 >
6795 struct DivTrait< DynamicMatrix<T1,SO>, T2, EnableIf_<IsNumeric<T2> > >
6796 {
6797  using Type = DynamicMatrix< DivTrait_<T1,T2>, SO >;
6798 };
6800 //*************************************************************************************************
6801 
6802 
6803 
6804 
6805 //=================================================================================================
6806 //
6807 // UNARYMAPTRAIT SPECIALIZATIONS
6808 //
6809 //=================================================================================================
6810 
6811 //*************************************************************************************************
6813 template< typename T, bool SO, typename OP >
6814 struct UnaryMapTrait< DynamicMatrix<T,SO>, OP >
6815 {
6816  using Type = DynamicMatrix< UnaryMapTrait_<T,OP>, SO >;
6817 };
6819 //*************************************************************************************************
6820 
6821 
6822 
6823 
6824 //=================================================================================================
6825 //
6826 // BINARYMAPTRAIT SPECIALIZATIONS
6827 //
6828 //=================================================================================================
6829 
6830 //*************************************************************************************************
6832 template< typename T1, bool SO, typename T2, size_t M, size_t N, typename OP >
6833 struct BinaryMapTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO>, OP >
6834 {
6835  using Type = StaticMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, SO >;
6836 };
6837 
6838 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2, typename OP >
6839 struct BinaryMapTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2>, OP >
6840 {
6841  using Type = StaticMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, false >;
6842 };
6843 
6844 template< typename T1, size_t M, size_t N, bool SO, typename T2, typename OP >
6845 struct BinaryMapTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO>, OP >
6846 {
6847  using Type = StaticMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, SO >;
6848 };
6849 
6850 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2, typename OP >
6851 struct BinaryMapTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2>, OP >
6852 {
6853  using Type = StaticMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, false >;
6854 };
6855 
6856 template< typename T1, bool SO, typename T2, size_t M, size_t N, typename OP >
6857 struct BinaryMapTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO>, OP >
6858 {
6859  using Type = HybridMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, SO >;
6860 };
6861 
6862 template< typename T1, bool SO1, typename T2, size_t M, size_t N, bool SO2, typename OP >
6863 struct BinaryMapTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2>, OP >
6864 {
6865  using Type = HybridMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, false >;
6866 };
6867 
6868 template< typename T1, size_t M, size_t N, bool SO, typename T2, typename OP >
6869 struct BinaryMapTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO>, OP >
6870 {
6871  using Type = HybridMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, SO >;
6872 };
6873 
6874 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2, typename OP >
6875 struct BinaryMapTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2>, OP >
6876 {
6877  using Type = HybridMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, false >;
6878 };
6879 
6880 template< typename T1, bool SO, typename T2, typename OP >
6881 struct BinaryMapTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO>, OP >
6882 {
6883  using Type = DynamicMatrix< BinaryMapTrait_<T1,T2,OP>, SO >;
6884 };
6885 
6886 template< typename T1, bool SO1, typename T2, bool SO2, typename OP >
6887 struct BinaryMapTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2>, OP >
6888 {
6889  using Type = DynamicMatrix< BinaryMapTrait_<T1,T2,OP>, false >;
6890 };
6892 //*************************************************************************************************
6893 
6894 
6895 
6896 
6897 //=================================================================================================
6898 //
6899 // HIGHTYPE SPECIALIZATIONS
6900 //
6901 //=================================================================================================
6902 
6903 //*************************************************************************************************
6905 template< typename T1, bool SO, typename T2 >
6906 struct HighType< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6907 {
6909 };
6911 //*************************************************************************************************
6912 
6913 
6914 
6915 
6916 //=================================================================================================
6917 //
6918 // LOWTYPE SPECIALIZATIONS
6919 //
6920 //=================================================================================================
6921 
6922 //*************************************************************************************************
6924 template< typename T1, bool SO, typename T2 >
6925 struct LowType< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6926 {
6928 };
6930 //*************************************************************************************************
6931 
6932 
6933 
6934 
6935 //=================================================================================================
6936 //
6937 // SUBMATRIXTRAIT SPECIALIZATIONS
6938 //
6939 //=================================================================================================
6940 
6941 //*************************************************************************************************
6943 template< typename T, bool SO, size_t I, size_t J, size_t M, size_t N >
6944 struct SubmatrixTrait< DynamicMatrix<T,SO>, I, J, M, N >
6945 {
6946  using Type = StaticMatrix<T,M,N,SO>;
6947 };
6948 
6949 template< typename T, bool SO >
6950 struct SubmatrixTrait< DynamicMatrix<T,SO> >
6951 {
6952  using Type = DynamicMatrix<T,SO>;
6953 };
6955 //*************************************************************************************************
6956 
6957 
6958 
6959 
6960 //=================================================================================================
6961 //
6962 // ROWTRAIT SPECIALIZATIONS
6963 //
6964 //=================================================================================================
6965 
6966 //*************************************************************************************************
6968 template< typename T, bool SO, size_t... CRAs >
6969 struct RowTrait< DynamicMatrix<T,SO>, CRAs... >
6970 {
6971  using Type = DynamicVector<T,true>;
6972 };
6974 //*************************************************************************************************
6975 
6976 
6977 
6978 
6979 //=================================================================================================
6980 //
6981 // ROWSTRAIT SPECIALIZATIONS
6982 //
6983 //=================================================================================================
6984 
6985 //*************************************************************************************************
6987 template< typename T, bool SO, size_t... CRAs >
6988 struct RowsTrait< DynamicMatrix<T,SO>, CRAs... >
6989 {
6990  using Type = DynamicMatrix<T,false>;
6991 };
6993 //*************************************************************************************************
6994 
6995 
6996 
6997 
6998 //=================================================================================================
6999 //
7000 // COLUMNTRAIT SPECIALIZATIONS
7001 //
7002 //=================================================================================================
7003 
7004 //*************************************************************************************************
7006 template< typename T, bool SO, size_t... CCAs >
7007 struct ColumnTrait< DynamicMatrix<T,SO>, CCAs... >
7008 {
7009  using Type = DynamicVector<T,false>;
7010 };
7012 //*************************************************************************************************
7013 
7014 
7015 
7016 
7017 //=================================================================================================
7018 //
7019 // COLUMNSTRAIT SPECIALIZATIONS
7020 //
7021 //=================================================================================================
7022 
7023 //*************************************************************************************************
7025 template< typename T, bool SO, size_t... CCAs >
7026 struct ColumnsTrait< DynamicMatrix<T,SO>, CCAs... >
7027 {
7028  using Type = DynamicMatrix<T,true>;
7029 };
7031 //*************************************************************************************************
7032 
7033 
7034 
7035 
7036 //=================================================================================================
7037 //
7038 // BANDTRAIT SPECIALIZATIONS
7039 //
7040 //=================================================================================================
7041 
7042 //*************************************************************************************************
7044 template< typename T, bool SO, ptrdiff_t... CBAs >
7045 struct BandTrait< DynamicMatrix<T,SO>, CBAs... >
7046 {
7048 };
7050 //*************************************************************************************************
7051 
7052 } // namespace blaze
7053 
7054 #endif
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:135
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Pointer difference type of the Blaze library.
size_t n_
The current number of columns of the matrix.
Definition: DynamicMatrix.h:511
size_t addPadding(size_t value) const noexcept
Add the necessary amount of padding to the given value.
Definition: DynamicMatrix.h:1846
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
BLAZE_ALWAYS_INLINE void storeu(size_t i, size_t j, const SIMDType &value) noexcept
Unaligned store of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2277
Header file for kernel specific block sizes.
Availability of a SIMD subtraction for the given data types.Depending on the available instruction se...
Definition: HasSIMDSub.h:171
Header file for mathematical functions.
Header file for the Schur product trait.
bool isAligned() const noexcept
Returns whether the matrix is properly aligned in memory.
Definition: DynamicMatrix.h:2071
void reserve(size_t elements)
Setting the minimum capacity of the matrix.
Definition: DynamicMatrix.h:1767
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DynamicMatrix.h:1470
Header file for the UNUSED_PARAMETER function template.
EnableIf_< IsDenseMatrix< MT1 > > smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:196
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE SIMDType load(size_t i, size_t j) const noexcept
Load of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2115
Header file for basic type definitions.
const SIMDType load() const noexcept
Load of the SIMD element at the current iterator position.
Definition: DenseIterator.h:405
Header file for the row trait.
Type *BLAZE_RESTRICT v_
The dynamically allocated matrix elements.
Definition: DynamicMatrix.h:514
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:109
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t i, size_t j) const noexcept
Unaligned load of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2178
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:108
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the IsSparseMatrix type trait.
DynamicMatrix & operator=(const Type &rhs)
Homogenous assignment to all matrix elements.
Definition: DynamicMatrix.h:1163
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the matrix.
Definition: DynamicMatrix.h:1690
Header file for the IsDiagonal type trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
DynamicMatrix() noexcept
The default constructor for DynamicMatrix.
Definition: DynamicMatrix.h:552
Header file for the IsSame and IsStrictlySame type traits.
Base template for the SchurTrait class.
Definition: SchurTrait.h:112
BLAZE_ALWAYS_INLINE void store(size_t i, size_t j, const SIMDType &value) noexcept
Store of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2212
Availability of a SIMD multiplication for the given data types.Depending on the available instruction...
Definition: HasSIMDMult.h:172
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:316
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
Type ElementType
Type of the matrix elements.
Definition: DynamicMatrix.h:227
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:171
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:1139
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:140
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
Type & Reference
Reference to a non-constant matrix value.
Definition: DynamicMatrix.h:232
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:185
Header file for memory allocation and deallocation functionality.
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation ...
Definition: DynamicMatrix.h:217
Compile time check for data types.This type trait tests whether or not the given types can be combine...
Definition: IsSIMDCombinable.h:120
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
BLAZE_ALWAYS_INLINE void stream(size_t i, size_t j, const SIMDType &value) noexcept
Aligned, non-temporal store of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2312
Base template for the RowsTrait class.
Definition: RowsTrait.h:109
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
Header file for the band trait.
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: DynamicMatrix.h:2090
Constraint on the data type.
~DynamicMatrix()
The destructor for DynamicMatrix.
Definition: DynamicMatrix.h:820
Header file for the SparseMatrix base class.
Compile time check for low-level access to mutable data.This type trait tests whether the given data ...
Definition: HasMutableDataAccess.h:75
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
EnableIf_< IsBuiltin< T >, T *> allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:155
size_t spacing() const noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DynamicMatrix.h:1503
SIMDTrait_< ElementType > SIMDType
SIMD type of the matrix elements.
Definition: DynamicMatrix.h:228
Base template for the RowTrait class.
Definition: RowTrait.h:109
Compile time check for the memory layout of data types.This type trait tests whether the given data t...
Definition: IsContiguous.h:86
Headerfile for the generic max algorithm.
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:112
Header file for the DisableIf class template.
Header file for the LowType type trait.
Base template for the HighType type trait.
Definition: HighType.h:133
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the unary map trait.
typename CTransExprTrait< T >::Type CTransExprTrait_
Auxiliary alias declaration for the CTransExprTrait class template.The CTransExprTrait_ alias declara...
Definition: CTransExprTrait.h:112
DynamicMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: DynamicMatrix.h:1908
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
Header file for nested template disabiguation.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: DynamicMatrix.h:1805
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: DynamicMatrix.h:2053
Header file for the IsShrinkable type trait.
Header file for all forward declarations of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Header file for the IsSMPAssignable type trait.
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Type * Pointer
Pointer to a non-constant matrix value.
Definition: DynamicMatrix.h:234
Header file for the HasSIMDAdd type trait.
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:60
Header file for the DenseMatrix base class.
Header file for the DenseIterator class template.
void stream(const SIMDType &value) const noexcept
Aligned, non-temporal store of the SIMD element at the current iterator position. ...
Definition: DenseIterator.h:533
Header file for all SIMD functionality.
Constraint on the data type.
void store(const SIMDType &value) const noexcept
Store of the SIMD element at the current iterator position.
Definition: DenseIterator.h:470
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a diagonal matrix type, a compilation error is created.
Definition: Diagonal.h:79
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:89
void extend(size_t m, size_t n, bool preserve=true)
Extending the size of the matrix.
Definition: DynamicMatrix.h:1749
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
#define BLAZE_RESTRICT
Platform dependent setup of the restrict keyword.
Definition: Restrict.h:81
Header file for the default storage order for all vectors of the Blaze library.
#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:61
void reset()
Reset to the default initial values.
Definition: DynamicMatrix.h:1603
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:134
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:123
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DynamicMatrix.h:1484
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the IsPadded type trait.
const Type & ConstReference
Reference to a constant matrix value.
Definition: DynamicMatrix.h:233
BLAZE_ALWAYS_INLINE void storea(size_t i, size_t j, const SIMDType &value) noexcept
Aligned store of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2241
Header file for the IsVectorizable type trait.
Pointer data() noexcept
Low-level data access to the matrix elements.
Definition: DynamicMatrix.h:948
Reference operator()(size_t i, size_t j) noexcept
2D-access to the matrix elements.
Definition: DynamicMatrix.h:848
Compile time check for shrinkable data types.This type trait tests whether the given data type is a s...
Definition: IsShrinkable.h:75
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
Base template for the LowType type trait.
Definition: LowType.h:133
Header file for the HasConstDataAccess type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
size_t nn_
The alignment adjusted number of columns.
Definition: DynamicMatrix.h:512
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
Header file for the IsSIMDCombinable type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for the HasSIMDMult type trait.
Header file for the binary map trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
size_t determineColumns(initializer_list< initializer_list< Type > > list) noexcept
Determines the maximum number of columns specified by the given initializer list. ...
Definition: InitializerList.h:107
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:119
Base template for the MultTrait class.
Definition: MultTrait.h:119
Iterator begin(size_t i) noexcept
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:1029
Header file for the addition trait.
void clear()
Clearing the matrix.
Definition: DynamicMatrix.h:1647
Header file for the division trait.
Header file for the InvExprTrait class template.
Header file for the submatrix trait.
ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:1073
Constraint on the data type.
Header file for the IsContiguous type trait.
Header file for the columns trait.
Headerfile for the generic transfer algorithm.
size_t m_
The current number of rows of the matrix.
Definition: DynamicMatrix.h:510
Header file for the reset shim.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
Header file for the cache size of the target architecture.
Efficient implementation of a dynamically sized matrix with static memory.The HybridMatrix class temp...
Definition: Forward.h:58
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
System settings for the restrict keyword.
Header file for the TransExprTrait class template.
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: DynamicMatrix.h:2033
Constraint on the data type.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Constraint on the data type.
void swap(DynamicMatrix &m) noexcept
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:1822
Constraint on the data type.
Header file for the HasSIMDSub type trait.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric< T >::value)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Header file for the HasMutableDataAccess type trait.
DenseIterator< Type, usePadding > Iterator
Iterator over non-constant elements.
Definition: DynamicMatrix.h:237
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: DynamicMatrix.h:1553
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:230
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Base template for the DivTrait class.
Definition: DivTrait.h:120
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
Header file for the rows trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b) noexcept(IsNumeric< T >::value)
Swapping two conjugated values/objects.
Definition: Conjugate.h:195
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
BLAZE_ALWAYS_INLINE SIMDType loada(size_t i, size_t j) const noexcept
Aligned load of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2143
Iterator end(size_t i) noexcept
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:1095
DynamicMatrix< Type, SO > This
Type of this DynamicMatrix instance.
Definition: DynamicMatrix.h:222
Base template for the ColumnsTrait class.
Definition: ColumnsTrait.h:109
Header file for the default transpose flag for all vectors of the Blaze library.
Initializer list type of the Blaze library.
bool isIntact() const noexcept
Returns whether the invariants of the dynamic matrix are intact.
Definition: DynamicMatrix.h:1993
Header file for the alignment check function.
typename InvExprTrait< T >::Type InvExprTrait_
Auxiliary alias declaration for the InvExprTrait class template.The InvExprTrait_ alias declaration p...
Definition: InvExprTrait.h:123
size_t capacity_
The maximum capacity of the matrix.
Definition: DynamicMatrix.h:513
Header file for the IntegralConstant class template.
Resize mechanism to obtain a DynamicMatrix with different fixed dimensions.
Definition: DynamicMatrix.h:255
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
Rebind mechanism to obtain a DynamicMatrix with different data/element type.
Definition: DynamicMatrix.h:245
DenseIterator< const Type, usePadding > ConstIterator
Iterator over constant elements.
Definition: DynamicMatrix.h:238
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
Base template for the SubTrait class.
Definition: SubTrait.h:119
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
size_t capacity() const noexcept
Returns the maximum capacity of the matrix.
Definition: DynamicMatrix.h:1517
Header file for the CTransExprTrait class template.
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Transfer.h:70
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: DynamicMatrix.h:893
Base template for the BinaryMapTrait class.
Definition: BinaryMapTrait.h:97
Header file for the IsResizable type trait.
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:95
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicMatrix.h:229
DynamicMatrix & transpose()
In-place transpose of the matrix.
Definition: DynamicMatrix.h:1870
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
Base template for the BandTrait class.
Definition: BandTrait.h:109
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: DynamicMatrix.h:235