35 #ifndef _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_ 36 #define _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_ 202 template<
typename Type
230 template<
typename NewType >
239 template<
size_t NewM
266 explicit inline DynamicMatrix(
size_t m,
size_t n,
const Type& init );
269 template<
typename Other >
272 template<
typename Other,
size_t M,
size_t N >
291 inline Reference
operator()(
size_t i,
size_t j ) noexcept;
292 inline ConstReference
operator()(
size_t i,
size_t j )
const noexcept;
293 inline Reference
at(
size_t i,
size_t j );
294 inline ConstReference
at(
size_t i,
size_t j )
const;
295 inline Pointer
data () noexcept;
296 inline ConstPointer
data ()
const noexcept;
297 inline Pointer
data (
size_t i ) noexcept;
298 inline ConstPointer
data (
size_t i )
const noexcept;
299 inline Iterator
begin (
size_t i ) noexcept;
300 inline ConstIterator
begin (
size_t i )
const noexcept;
301 inline ConstIterator
cbegin(
size_t i )
const noexcept;
302 inline Iterator
end (
size_t i ) noexcept;
303 inline ConstIterator
end (
size_t i )
const noexcept;
304 inline ConstIterator
cend (
size_t i )
const noexcept;
311 inline DynamicMatrix&
operator=(
const Type& rhs );
314 template<
typename Other,
size_t M,
size_t N >
317 inline DynamicMatrix&
operator=(
const DynamicMatrix& rhs );
318 inline DynamicMatrix&
operator=( DynamicMatrix&& rhs ) noexcept;
325 template<
typename Other >
328 template<
typename Other >
336 inline size_t rows()
const noexcept;
337 inline size_t columns()
const noexcept;
338 inline size_t spacing()
const noexcept;
339 inline size_t capacity()
const noexcept;
340 inline size_t capacity(
size_t i )
const noexcept;
342 inline size_t nonZeros(
size_t i )
const;
344 inline void reset(
size_t i );
346 void resize (
size_t m,
size_t n,
bool preserve=
true );
347 inline void extend (
size_t m,
size_t n,
bool preserve=
true );
348 inline void reserve(
size_t elements );
349 inline void swap( DynamicMatrix& m ) noexcept;
359 template<
typename Other >
inline DynamicMatrix& scale(
const Other& scalar );
366 template<
typename MT >
368 struct VectorizedAssign {
370 simdEnabled && MT::simdEnabled &&
378 template<
typename MT >
380 struct VectorizedAddAssign {
382 simdEnabled && MT::simdEnabled &&
392 template<
typename MT >
394 struct VectorizedSubAssign {
396 simdEnabled && MT::simdEnabled &&
413 inline bool isIntact()
const noexcept;
420 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
421 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
435 template<
typename MT >
438 template<
typename MT >
445 template<
typename MT >
448 template<
typename MT >
455 template<
typename MT >
458 template<
typename MT >
471 inline size_t adjustColumns(
size_t minColumns )
const noexcept;
518 template<
typename Type
539 template<
typename Type
549 for(
size_t i=0UL; i<
m_; ++i ) {
550 for(
size_t j=
n_; j<
nn_; ++j ) {
551 v_[i*nn_+j] = Type();
570 template<
typename Type
579 for(
size_t i=0UL; i<m; ++i ) {
580 for(
size_t j=0UL; j<
n_; ++j )
584 for(
size_t j=n_; j<
nn_; ++j )
585 v_[i*nn_+j] = Type();
614 template<
typename Type
625 for(
const auto& rowList : list ) {
626 std::fill( std::copy( rowList.begin(), rowList.end(),
v_+i*
nn_ ),
v_+(i+1UL)*
nn_, Type() );
658 template<
typename Type
660 template<
typename Other >
668 for(
size_t i=0UL; i<m; ++i ) {
669 for(
size_t j=0UL; j<n; ++j )
670 v_[i*
nn_+j] = array[i*n+j];
673 for(
size_t j=n; j<
nn_; ++j )
674 v_[i*nn_+j] = Type();
704 template<
typename Type
706 template<
typename Other
716 for(
size_t i=0UL; i<M; ++i ) {
717 for(
size_t j=0UL; j<N; ++j )
718 v_[i*
nn_+j] = array[i][j];
721 for(
size_t j=N; j<
nn_; ++j )
722 v_[i*nn_+j] = Type();
739 template<
typename Type
763 template<
typename Type
786 template<
typename Type
788 template<
typename MT
797 for(
size_t i=0UL; i<
m_; ++i ) {
799 j<( IsVectorizable<Type>::value ?
nn_ :
n_ ); ++j ) {
800 v_[i*
nn_+j] = Type();
822 template<
typename Type
849 template<
typename Type
871 template<
typename Type
894 template<
typename Type
921 template<
typename Type
949 template<
typename Type
971 template<
typename Type
989 template<
typename Type
1008 template<
typename Type
1030 template<
typename Type
1052 template<
typename Type
1074 template<
typename Type
1096 template<
typename Type
1118 template<
typename Type
1140 template<
typename Type
1165 template<
typename Type
1169 for(
size_t i=0UL; i<
m_; ++i )
1170 for(
size_t j=0UL; j<
n_; ++j )
1199 template<
typename Type
1208 for(
const auto& rowList : list ) {
1209 std::fill( std::copy( rowList.begin(), rowList.end(),
v_+i*
nn_ ),
v_+(i+1UL)*
nn_, Type() );
1239 template<
typename Type
1241 template<
typename Other
1248 for(
size_t i=0UL; i<M; ++i )
1249 for(
size_t j=0UL; j<N; ++j )
1250 v_[i*
nn_+j] = array[i][j];
1266 template<
typename Type
1270 if( &rhs ==
this )
return *
this;
1288 template<
typename Type
1303 rhs.capacity_ = 0UL;
1320 template<
typename Type
1322 template<
typename MT
1364 template<
typename Type
1366 template<
typename MT
1399 template<
typename Type
1401 template<
typename MT
1434 template<
typename Type
1436 template<
typename MT
1440 if( (~rhs).
rows() !=
n_ ) {
1459 template<
typename Type
1461 template<
typename Other >
1481 template<
typename Type
1483 template<
typename Other >
1511 template<
typename Type
1525 template<
typename Type
1544 template<
typename Type
1558 template<
typename Type
1578 template<
typename Type
1594 template<
typename Type
1598 size_t nonzeros( 0UL );
1600 for(
size_t i=0UL; i<
m_; ++i )
1601 for(
size_t j=0UL; j<
n_; ++j )
1621 template<
typename Type
1627 const size_t jend( i*
nn_ +
n_ );
1628 size_t nonzeros( 0UL );
1630 for(
size_t j=i*
nn_; j<jend; ++j )
1644 template<
typename Type
1650 for(
size_t i=0UL; i<
m_; ++i )
1651 for(
size_t j=0UL; j<
n_; ++j )
1668 template<
typename Type
1675 for(
size_t j=0UL; j<
n_; ++j )
1688 template<
typename Type
1692 resize( 0UL, 0UL,
false );
1731 template<
typename Type
1737 if( m ==
m_ && n ==
n_ )
return;
1744 const size_t min_m(
min( m,
m_ ) );
1745 const size_t min_n(
min( n,
n_ ) );
1747 for(
size_t i=0UL; i<min_m; ++i ) {
1763 for(
size_t i=0UL; i<m; ++i )
1764 for(
size_t j=n; j<nn; ++j )
1765 v_[i*nn+j] = Type();
1789 template<
typename Type
1807 template<
typename Type
1820 for(
size_t i=
capacity_; i<elements; ++i )
1839 template<
typename Type
1858 template<
typename Type
1863 return nextMultiple<size_t>( minColumns, SIMDSIZE );
1864 else return minColumns;
1882 template<
typename Type
1888 constexpr
size_t block( BLOCK_SIZE );
1892 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1893 const size_t iend(
min( ii+block, m_ ) );
1894 for(
size_t jj=0UL; jj<=ii; jj+=block ) {
1895 for(
size_t i=ii; i<iend; ++i ) {
1896 const size_t jend(
min( jj+block,
n_, i ) );
1897 for(
size_t j=jj; j<jend; ++j ) {
1920 template<
typename Type
1924 constexpr
size_t block( BLOCK_SIZE );
1928 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1929 const size_t iend(
min( ii+block, m_ ) );
1930 for(
size_t jj=0UL; jj<ii; jj+=block ) {
1931 const size_t jend(
min( jj+block,
n_ ) );
1932 for(
size_t i=ii; i<iend; ++i ) {
1933 for(
size_t j=jj; j<jend; ++j ) {
1938 for(
size_t i=ii; i<iend; ++i ) {
1939 for(
size_t j=ii; j<i; ++j ) {
1963 template<
typename Type
1965 template<
typename Other >
1968 for(
size_t i=0UL; i<
m_; ++i )
1969 for(
size_t j=0UL; j<
n_; ++j )
1970 v_[i*
nn_+j] *= scalar;
1994 template<
typename Type
2002 for(
size_t i=0UL; i<
m_; ++i ) {
2003 for(
size_t j=
n_; j<
nn_; ++j ) {
2004 if(
v_[i*nn_+j] != Type() )
2033 template<
typename Type
2035 template<
typename Other >
2038 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2053 template<
typename Type
2055 template<
typename Other >
2058 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2072 template<
typename Type
2091 template<
typename Type
2095 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
2115 template<
typename Type
2121 return loada( i, j );
2123 return loadu( i, j );
2143 template<
typename Type
2178 template<
typename Type
2212 template<
typename Type
2241 template<
typename Type
2277 template<
typename Type
2312 template<
typename Type
2343 template<
typename Type
2345 template<
typename MT >
2352 const size_t jpos(
n_ &
size_t(-2) );
2355 for(
size_t i=0UL; i<
m_; ++i ) {
2356 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2357 v_[i*
nn_+j ] = (~rhs)(i,j );
2358 v_[i*
nn_+j+1UL] = (~rhs)(i,j+1UL);
2361 v_[i*
nn_+jpos] = (~rhs)(i,jpos);
2379 template<
typename Type
2381 template<
typename MT >
2392 const size_t jpos( ( remainder )?(
n_ &
size_t(-SIMDSIZE) ):(
n_ ) );
2398 for(
size_t i=0UL; i<
m_; ++i )
2404 for( ; j<jpos; j+=SIMDSIZE, left+=SIMDSIZE, right+=SIMDSIZE ) {
2405 left.stream( right.load() );
2407 for( ; remainder && j<
n_; ++j, ++left, ++right ) {
2414 for(
size_t i=0UL; i<
m_; ++i )
2420 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2421 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2422 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2423 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2424 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2426 for( ; j<jpos; j+=SIMDSIZE ) {
2427 left.
store( right.load() ); left+=SIMDSIZE, right+=SIMDSIZE;
2429 for( ; remainder && j<
n_; ++j ) {
2430 *left = *right; ++left; ++right;
2449 template<
typename Type
2451 template<
typename MT >
2459 constexpr
size_t block( BLOCK_SIZE );
2461 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2462 const size_t iend(
min( m_, ii+block ) );
2463 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2464 const size_t jend(
min( n_, jj+block ) );
2465 for(
size_t i=ii; i<iend; ++i ) {
2466 for(
size_t j=jj; j<jend; ++j ) {
2467 v_[i*
nn_+j] = (~rhs)(i,j);
2487 template<
typename Type
2489 template<
typename MT >
2495 for(
size_t i=0UL; i<
m_; ++i )
2497 v_[i*
nn_+element->index()] = element->value();
2513 template<
typename Type
2515 template<
typename MT >
2523 for(
size_t j=0UL; j<
n_; ++j )
2525 v_[element->index()*
nn_+j] = element->value();
2541 template<
typename Type
2543 template<
typename MT >
2550 for(
size_t i=0UL; i<
m_; ++i )
2554 v_[i*
nn_+i] += (~rhs)(i,i);
2568 for( ; (j+2UL) <= jend; j+=2UL ) {
2569 v_[i*
nn_+j ] += (~rhs)(i,j );
2570 v_[i*
nn_+j+1UL] += (~rhs)(i,j+1UL);
2573 v_[i*
nn_+j] += (~rhs)(i,j);
2592 template<
typename Type
2594 template<
typename MT >
2606 for(
size_t i=0UL; i<
m_; ++i )
2616 const size_t jpos( ( remainder )?( jend &
size_t(-SIMDSIZE) ):( jend ) );
2617 BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos,
"Invalid end calculation" );
2623 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2624 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2625 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2626 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2627 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2629 for( ; j<jpos; j+=SIMDSIZE ) {
2630 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2632 for( ; remainder && j<jend; ++j ) {
2633 *left += *right; ++left; ++right;
2651 template<
typename Type
2653 template<
typename MT >
2661 constexpr
size_t block( BLOCK_SIZE );
2663 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2664 const size_t iend(
min( m_, ii+block ) );
2665 for(
size_t jj=0UL; jj<
n_; jj+=block )
2670 for(
size_t i=ii; i<iend; ++i )
2677 :(
min( n_, jj+block ) ) );
2680 for(
size_t j=jbegin; j<jend; ++j ) {
2681 v_[i*
nn_+j] += (~rhs)(i,j);
2701 template<
typename Type
2703 template<
typename MT >
2709 for(
size_t i=0UL; i<
m_; ++i )
2711 v_[i*
nn_+element->index()] += element->value();
2727 template<
typename Type
2729 template<
typename MT >
2737 for(
size_t j=0UL; j<
n_; ++j )
2739 v_[element->index()*
nn_+j] += element->value();
2755 template<
typename Type
2757 template<
typename MT >
2764 for(
size_t i=0UL; i<
m_; ++i )
2768 v_[i*
nn_+i] -= (~rhs)(i,i);
2782 for( ; (j+2UL) <= jend; j+=2UL ) {
2783 v_[i*
nn_+j ] -= (~rhs)(i,j );
2784 v_[i*
nn_+j+1UL] -= (~rhs)(i,j+1UL);
2787 v_[i*
nn_+j] -= (~rhs)(i,j);
2806 template<
typename Type
2808 template<
typename MT >
2820 for(
size_t i=0UL; i<
m_; ++i )
2830 const size_t jpos( ( remainder )?( jend &
size_t(-SIMDSIZE) ):( jend ) );
2831 BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos,
"Invalid end calculation" );
2837 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2838 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2839 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2840 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2841 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2843 for( ; j<jpos; j+=SIMDSIZE ) {
2844 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2846 for( ; remainder && j<jend; ++j ) {
2847 *left -= *right; ++left; ++right;
2865 template<
typename Type
2867 template<
typename MT >
2875 constexpr
size_t block( BLOCK_SIZE );
2877 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2878 const size_t iend(
min( m_, ii+block ) );
2879 for(
size_t jj=0UL; jj<
n_; jj+=block )
2884 for(
size_t i=ii; i<iend; ++i )
2891 :(
min( n_, jj+block ) ) );
2894 for(
size_t j=jbegin; j<jend; ++j ) {
2895 v_[i*
nn_+j] -= (~rhs)(i,j);
2915 template<
typename Type
2917 template<
typename MT >
2923 for(
size_t i=0UL; i<
m_; ++i )
2925 v_[i*
nn_+element->index()] -= element->value();
2941 template<
typename Type
2943 template<
typename MT >
2951 for(
size_t j=0UL; j<
n_; ++j )
2953 v_[element->index()*
nn_+j] -= element->value();
2978 template<
typename Type >
3005 template<
typename NewType >
3014 template<
size_t NewM
3041 explicit inline DynamicMatrix(
size_t m,
size_t n,
const Type& init );
3044 template<
typename Other >
explicit inline DynamicMatrix(
size_t m,
size_t n,
const Other* array );
3046 template<
typename Other,
size_t M,
size_t N >
3047 explicit inline DynamicMatrix(
const Other (&array)[M][N] );
3065 inline Reference
operator()(
size_t i,
size_t j ) noexcept;
3066 inline ConstReference
operator()(
size_t i,
size_t j )
const noexcept;
3067 inline Reference
at(
size_t i,
size_t j );
3068 inline ConstReference
at(
size_t i,
size_t j )
const;
3069 inline Pointer
data () noexcept;
3070 inline ConstPointer
data ()
const noexcept;
3071 inline Pointer
data (
size_t j ) noexcept;
3072 inline ConstPointer
data (
size_t j )
const noexcept;
3073 inline Iterator
begin (
size_t j ) noexcept;
3074 inline ConstIterator
begin (
size_t j )
const noexcept;
3075 inline ConstIterator
cbegin(
size_t j )
const noexcept;
3076 inline Iterator
end (
size_t j ) noexcept;
3077 inline ConstIterator
end (
size_t j )
const noexcept;
3078 inline ConstIterator
cend (
size_t j )
const noexcept;
3085 inline DynamicMatrix&
operator=(
const Type& rhs );
3088 template<
typename Other,
size_t M,
size_t N >
3089 inline DynamicMatrix&
operator=(
const Other (&array)[M][N] );
3091 inline DynamicMatrix&
operator=(
const DynamicMatrix& rhs );
3092 inline DynamicMatrix&
operator=( DynamicMatrix&& rhs );
3099 template<
typename Other >
3100 inline EnableIf_<IsNumeric<Other>, DynamicMatrix >& operator*=( Other rhs );
3102 template<
typename Other >
3103 inline EnableIf_<IsNumeric<Other>, DynamicMatrix >&
operator/=( Other rhs );
3110 inline size_t rows()
const noexcept;
3111 inline size_t columns()
const noexcept;
3112 inline size_t spacing()
const noexcept;
3113 inline size_t capacity()
const noexcept;
3114 inline size_t capacity(
size_t j )
const noexcept;
3116 inline size_t nonZeros(
size_t j )
const;
3117 inline void reset();
3118 inline void reset(
size_t j );
3119 inline void clear();
3120 void resize (
size_t m,
size_t n,
bool preserve=
true );
3121 inline void extend (
size_t m,
size_t n,
bool preserve=
true );
3122 inline void reserve(
size_t elements );
3123 inline void swap( DynamicMatrix& m ) noexcept;
3133 template<
typename Other >
inline DynamicMatrix& scale(
const Other& scalar );
3140 template<
typename MT >
3141 struct VectorizedAssign {
3143 simdEnabled && MT::simdEnabled &&
3150 template<
typename MT >
3151 struct VectorizedAddAssign {
3153 simdEnabled && MT::simdEnabled &&
3162 template<
typename MT >
3163 struct VectorizedSubAssign {
3165 simdEnabled && MT::simdEnabled &&
3181 inline bool isIntact()
const noexcept;
3188 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
3189 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
3191 inline bool isAligned ()
const noexcept;
3203 template<
typename MT >
3206 template<
typename MT >
3213 template<
typename MT >
3216 template<
typename MT >
3223 template<
typename MT >
3226 template<
typename MT >
3239 inline size_t adjustRows(
size_t minRows )
const noexcept;
3279 template<
typename Type >
3301 template<
typename Type >
3304 , mm_ ( adjustRows( m ) )
3310 for(
size_t j=0UL; j<
n_; ++j ) {
3311 for(
size_t i=
m_; i<mm_; ++i ) {
3312 v_[i+j*mm_] = Type();
3333 template<
typename Type >
3336 , mm_ ( adjustRows( m ) )
3341 for(
size_t j=0UL; j<
n_; ++j ) {
3342 for(
size_t i=0UL; i<
m_; ++i )
3346 for(
size_t i=m_; i<mm_; ++i )
3347 v_[i+j*mm_] = Type();
3378 template<
typename Type >
3380 :
m_ ( list.size() )
3381 , mm_ ( adjustRows(
m_ ) )
3388 for(
const auto& rowList : list ) {
3390 for(
const auto& element : rowList ) {
3391 v_[i+j*mm_] = element;
3394 for( ; j<
n_; ++j ) {
3395 v_[i+j*mm_] = Type();
3403 for( ; i<mm_; ++i ) {
3404 for(
size_t j=0UL; j<
n_; ++j ) {
3405 v_[i+j*mm_] = Type();
3440 template<
typename Type >
3441 template<
typename Other >
3444 , mm_ ( adjustRows( m ) )
3449 for(
size_t j=0UL; j<n; ++j ) {
3450 for(
size_t i=0UL; i<m; ++i )
3451 v_[i+j*mm_] = array[i+j*m];
3454 for(
size_t i=m; i<mm_; ++i )
3455 v_[i+j*mm_] = Type();
3487 template<
typename Type >
3488 template<
typename Other
3493 , mm_ ( adjustRows( M ) )
3498 for(
size_t j=0UL; j<N; ++j ) {
3499 for(
size_t i=0UL; i<M; ++i )
3500 v_[i+j*mm_] = array[i][j];
3503 for(
size_t i=M; i<mm_; ++i )
3504 v_[i+j*mm_] = Type();
3523 template<
typename Type >
3548 template<
typename Type >
3572 template<
typename Type >
3573 template<
typename MT
3577 , mm_ ( adjustRows(
m_ ) )
3582 for(
size_t j=0UL; j<
n_; ++j ) {
3584 i<( IsVectorizable<Type>::value ? mm_ :
m_ ); ++i ) {
3585 v_[i+j*mm_] = Type();
3609 template<
typename Type >
3637 template<
typename Type >
3660 template<
typename Type >
3684 template<
typename Type >
3694 return (*
this)(i,j);
3712 template<
typename Type >
3722 return (*
this)(i,j);
3740 template<
typename Type >
3762 template<
typename Type >
3781 template<
typename Type >
3801 template<
typename Type >
3819 template<
typename Type >
3837 template<
typename Type >
3855 template<
typename Type >
3873 template<
typename Type >
3891 template<
typename Type >
3909 template<
typename Type >
3935 template<
typename Type >
3938 for(
size_t j=0UL; j<
n_; ++j )
3939 for(
size_t i=0UL; i<
m_; ++i )
3970 template<
typename Type >
3978 for(
const auto& rowList : list ) {
3980 for(
const auto& element : rowList ) {
3981 v_[i+j*mm_] = element;
3984 for( ; j<
n_; ++j ) {
3985 v_[i+j*mm_] = Type();
4018 template<
typename Type >
4019 template<
typename Other
4026 for(
size_t j=0UL; j<N; ++j )
4027 for(
size_t i=0UL; i<M; ++i )
4028 v_[i+j*mm_] = array[i][j];
4046 template<
typename Type >
4049 if( &rhs ==
this )
return *
this;
4069 template<
typename Type >
4102 template<
typename Type >
4103 template<
typename MT
4147 template<
typename Type >
4148 template<
typename MT
4183 template<
typename Type >
4184 template<
typename MT
4219 template<
typename Type >
4220 template<
typename MT
4224 if( (~rhs).
rows() != n_ ) {
4247 template<
typename Type >
4248 template<
typename Other >
4270 template<
typename Type >
4271 template<
typename Other >
4301 template<
typename Type >
4316 template<
typename Type >
4334 template<
typename Type >
4349 template<
typename Type >
4365 template<
typename Type >
4382 template<
typename Type >
4385 size_t nonzeros( 0UL );
4387 for(
size_t j=0UL; j<
n_; ++j )
4388 for(
size_t i=0UL; i<
m_; ++i )
4405 template<
typename Type >
4410 const size_t iend( j*mm_ +
m_ );
4411 size_t nonzeros( 0UL );
4413 for(
size_t i=j*mm_; i<iend; ++i )
4429 template<
typename Type >
4434 for(
size_t j=0UL; j<
n_; ++j )
4435 for(
size_t i=0UL; i<
m_; ++i )
4452 template<
typename Type >
4458 for(
size_t i=0UL; i<
m_; ++i )
4473 template<
typename Type >
4476 resize( 0UL, 0UL,
false );
4517 template<
typename Type >
4522 if( m ==
m_ && n == n_ )
return;
4524 const size_t mm( adjustRows( m ) );
4529 const size_t min_m(
min( m,
m_ ) );
4530 const size_t min_n(
min( n, n_ ) );
4532 for(
size_t j=0UL; j<min_n; ++j ) {
4548 for(
size_t j=0UL; j<n; ++j )
4549 for(
size_t i=m; i<mm; ++i )
4550 v_[i+j*mm] = Type();
4576 template<
typename Type >
4595 template<
typename Type >
4607 for(
size_t i=
capacity_; i<elements; ++i )
4628 template<
typename Type >
4648 template<
typename Type >
4652 return nextMultiple<size_t>( minRows, SIMDSIZE );
4653 else return minRows;
4673 template<
typename Type >
4678 constexpr
size_t block( BLOCK_SIZE );
4682 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4683 const size_t jend(
min( jj+block, n_ ) );
4684 for(
size_t ii=0UL; ii<=jj; ii+=block ) {
4685 for(
size_t j=jj; j<jend; ++j ) {
4686 const size_t iend(
min( ii+block,
m_, j ) );
4687 for(
size_t i=ii; i<iend; ++i ) {
4712 template<
typename Type >
4715 constexpr
size_t block( BLOCK_SIZE );
4719 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4720 const size_t jend(
min( jj+block, n_ ) );
4721 for(
size_t ii=0UL; ii<jj; ii+=block ) {
4722 const size_t iend(
min( ii+block,
m_ ) );
4723 for(
size_t j=jj; j<jend; ++j ) {
4724 for(
size_t i=ii; i<iend; ++i ) {
4729 for(
size_t j=jj; j<jend; ++j ) {
4730 for(
size_t i=jj; i<j; ++i ) {
4756 template<
typename Type >
4757 template<
typename Other >
4760 for(
size_t j=0UL; j<
n_; ++j )
4761 for(
size_t i=0UL; i<
m_; ++i )
4762 v_[i+j*mm_] *= scalar;
4788 template<
typename Type >
4795 for(
size_t j=0UL; j<
n_; ++j ) {
4796 for(
size_t i=
m_; i<mm_; ++i ) {
4797 if(
v_[i+j*mm_] != Type() )
4828 template<
typename Type >
4829 template<
typename Other >
4832 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4849 template<
typename Type >
4850 template<
typename Other >
4853 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4869 template<
typename Type >
4889 template<
typename Type >
4892 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
4913 template<
typename Type >
4918 return loada( i, j );
4920 return loadu( i, j );
4941 template<
typename Type >
4976 template<
typename Type >
5010 template<
typename Type >
5039 template<
typename Type >
5075 template<
typename Type >
5110 template<
typename Type >
5142 template<
typename Type >
5143 template<
typename MT >
5150 const size_t ipos(
m_ &
size_t(-2) );
5153 for(
size_t j=0UL; j<
n_; ++j ) {
5154 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5155 v_[i +j*mm_] = (~rhs)(i ,j);
5156 v_[i+1UL+j*mm_] = (~rhs)(i+1UL,j);
5159 v_[ipos+j*mm_] = (~rhs)(ipos,j);
5179 template<
typename Type >
5180 template<
typename MT >
5191 const size_t ipos( ( remainder )?(
m_ &
size_t(-SIMDSIZE) ):(
m_ ) );
5197 for(
size_t j=0UL; j<
n_; ++j )
5203 for( ; i<ipos; i+=SIMDSIZE ) {
5204 left.
stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5206 for( ; remainder && i<
m_; ++i ) {
5207 *left = *right; ++left; ++right;
5213 for(
size_t j=0UL; j<
n_; ++j )
5219 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5220 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5221 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5222 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5223 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5225 for( ; i<ipos; i+=SIMDSIZE ) {
5226 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5228 for( ; remainder && i<
m_; ++i ) {
5229 *left = *right; ++left; ++right;
5250 template<
typename Type >
5251 template<
typename MT >
5259 constexpr
size_t block( BLOCK_SIZE );
5261 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5262 const size_t jend(
min( n_, jj+block ) );
5263 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
5264 const size_t iend(
min( m_, ii+block ) );
5265 for(
size_t j=jj; j<jend; ++j ) {
5266 for(
size_t i=ii; i<iend; ++i ) {
5267 v_[i+j*mm_] = (~rhs)(i,j);
5289 template<
typename Type >
5290 template<
typename MT >
5296 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5298 v_[element->index()+j*mm_] = element->value();
5316 template<
typename Type >
5317 template<
typename MT >
5325 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5327 v_[i+element->index()*mm_] = element->value();
5345 template<
typename Type >
5346 template<
typename MT >
5353 for(
size_t j=0UL; j<
n_; ++j )
5357 v_[j+j*mm_] += (~rhs)(j,j);
5371 for( ; (i+2UL) <= iend; i+=2UL ) {
5372 v_[i +j*mm_] += (~rhs)(i ,j);
5373 v_[i+1UL+j*mm_] += (~rhs)(i+1UL,j);
5376 v_[i+j*mm_] += (~rhs)(i,j);
5397 template<
typename Type >
5398 template<
typename MT >
5410 for(
size_t j=0UL; j<
n_; ++j )
5420 const size_t ipos( ( remainder )?( iend &
size_t(-SIMDSIZE) ):( iend ) );
5421 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5427 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5428 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5429 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5430 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5431 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5433 for( ; i<ipos; i+=SIMDSIZE ) {
5434 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5436 for( ; remainder && i<iend; ++i ) {
5437 *left += *right; ++left; ++right;
5457 template<
typename Type >
5458 template<
typename MT >
5466 constexpr
size_t block( BLOCK_SIZE );
5468 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5469 const size_t jend(
min( n_, jj+block ) );
5470 for(
size_t ii=0UL; ii<
m_; ii+=block )
5475 for(
size_t j=jj; j<jend; ++j )
5482 :(
min( m_, ii+block ) ) );
5485 for(
size_t i=ibegin; i<iend; ++i ) {
5486 v_[i+j*mm_] += (~rhs)(i,j);
5508 template<
typename Type >
5509 template<
typename MT >
5515 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5517 v_[element->index()+j*mm_] += element->value();
5535 template<
typename Type >
5536 template<
typename MT >
5544 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5546 v_[i+element->index()*mm_] += element->value();
5564 template<
typename Type >
5565 template<
typename MT >
5572 for(
size_t j=0UL; j<
n_; ++j )
5576 v_[j+j*mm_] -= (~rhs)(j,j);
5590 for( ; (i+2UL) <= iend; i+=2UL ) {
5591 v_[i +j*mm_] -= (~rhs)(i ,j);
5592 v_[i+1+j*mm_] -= (~rhs)(i+1,j);
5595 v_[i+j*mm_] -= (~rhs)(i,j);
5616 template<
typename Type >
5617 template<
typename MT >
5629 for(
size_t j=0UL; j<
n_; ++j )
5639 const size_t ipos( ( remainder )?( iend &
size_t(-SIMDSIZE) ):( iend ) );
5640 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5646 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5647 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5648 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5649 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5650 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5652 for( ; i<ipos; i+=SIMDSIZE ) {
5653 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5655 for( ; remainder && i<iend; ++i ) {
5656 *left -= *right; ++left; ++right;
5676 template<
typename Type >
5677 template<
typename MT >
5685 constexpr
size_t block( BLOCK_SIZE );
5687 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5688 const size_t jend(
min( n_, jj+block ) );
5689 for(
size_t ii=0UL; ii<
m_; ii+=block )
5694 for(
size_t j=jj; j<jend; ++j )
5701 :(
min( m_, ii+block ) ) );
5704 for(
size_t i=ibegin; i<iend; ++i ) {
5705 v_[i+j*mm_] -= (~rhs)(i,j);
5727 template<
typename Type >
5728 template<
typename MT >
5734 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5736 v_[element->index()+j*mm_] -= element->value();
5754 template<
typename Type >
5755 template<
typename MT >
5763 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5765 v_[i+element->index()*mm_] -= element->value();
5786 template<
typename Type,
bool SO >
5789 template<
typename Type,
bool SO >
5792 template<
typename Type,
bool SO >
5795 template<
bool RF,
typename Type,
bool SO >
5798 template<
typename Type,
bool SO >
5801 template<
typename Type,
bool SO >
5814 template<
typename Type
5836 template<
typename Type
5852 template<
typename Type
5914 template<
typename Type
5931 template<
typename Type
5950 template<
typename T,
bool SO >
5967 template<
typename T,
bool SO >
5984 template<
typename T,
bool SO >
6001 template<
typename T,
bool SO >
6018 template<
typename T,
bool SO >
6035 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6036 struct AddTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6041 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6042 struct AddTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6047 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6048 struct AddTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6053 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6054 struct AddTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6059 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6060 struct AddTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6065 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6066 struct AddTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6071 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6072 struct AddTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6077 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6078 struct AddTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6083 template<
typename T1,
bool SO,
typename T2 >
6084 struct AddTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6089 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6090 struct AddTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6108 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6109 struct SubTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6114 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6115 struct SubTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6120 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6121 struct SubTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6126 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6127 struct SubTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6132 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6133 struct SubTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6138 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6139 struct SubTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6144 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6145 struct SubTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6150 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6151 struct SubTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6156 template<
typename T1,
bool SO,
typename T2 >
6157 struct SubTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6162 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6163 struct SubTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6181 template<
typename T1,
bool SO,
typename T2 >
6182 struct MultTrait< DynamicMatrix<T1,SO>, T2, EnableIf_<IsNumeric<T2> > >
6187 template<
typename T1,
typename T2,
bool SO >
6188 struct MultTrait< T1, DynamicMatrix<T2,SO>, EnableIf_<IsNumeric<T1> > >
6193 template<
typename T1,
bool SO,
typename T2,
size_t N >
6194 struct MultTrait< DynamicMatrix<T1,SO>, StaticVector<T2,N,false> >
6199 template<
typename T1,
size_t N,
typename T2,
bool SO >
6200 struct MultTrait< StaticVector<T1,N,true>, DynamicMatrix<T2,SO> >
6205 template<
typename T1,
bool SO,
typename T2,
size_t N >
6206 struct MultTrait< DynamicMatrix<T1,SO>, HybridVector<T2,N,false> >
6211 template<
typename T1,
size_t N,
typename T2,
bool SO >
6212 struct MultTrait< HybridVector<T1,N,true>, DynamicMatrix<T2,SO> >
6217 template<
typename T1,
bool SO,
typename T2 >
6218 struct MultTrait< DynamicMatrix<T1,SO>, DynamicVector<T2,false> >
6223 template<
typename T1,
typename T2,
bool SO >
6224 struct MultTrait< DynamicVector<T1,true>, DynamicMatrix<T2,SO> >
6229 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
6230 struct MultTrait< DynamicMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
6235 template<
typename T1,
bool AF,
bool PF,
typename T2,
bool SO >
6236 struct MultTrait< CustomVector<T1,AF,PF,true>, DynamicMatrix<T2,SO> >
6241 template<
typename T1,
bool SO,
typename T2 >
6242 struct MultTrait< DynamicMatrix<T1,SO>, CompressedVector<T2,false> >
6247 template<
typename T1,
typename T2,
bool SO >
6248 struct MultTrait< CompressedVector<T1,true>, DynamicMatrix<T2,SO> >
6253 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6254 struct MultTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6259 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6260 struct MultTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6265 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6266 struct MultTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6271 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6272 struct MultTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6277 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6278 struct MultTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6296 template<
typename T1,
bool SO,
typename T2 >
6297 struct DivTrait< DynamicMatrix<T1,SO>, T2, EnableIf_<IsNumeric<T2> > >
6315 template<
typename T1,
bool SO,
typename T2 >
6316 struct HighType< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6334 template<
typename T1,
bool SO,
typename T2 >
6335 struct LowType< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6353 template<
typename T1,
bool SO >
6372 template<
typename T1,
bool SO >
6373 struct RowTrait< DynamicMatrix<T1,SO> >
6391 template<
typename T1,
bool SO >
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:133
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
size_t n_
The current number of columns of the matrix.
Definition: DynamicMatrix.h:479
Header file for auxiliary alias declarations.
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:2280
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:163
Header file for mathematical functions.
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
bool isAligned() const noexcept
Returns whether the matrix is properly aligned in memory.
Definition: DynamicMatrix.h:2074
void reserve(size_t elements)
Setting the minimum capacity of the matrix.
Definition: DynamicMatrix.h:1809
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:1513
Header file for the UNUSED_PARAMETER function template.
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:2118
Header file for basic type definitions.
const SIMDType load() const noexcept
Load of the SIMD element at the current iterator position.
Definition: DenseIterator.h:403
size_t adjustColumns(size_t minColumns) const noexcept
Adjusting the number columns of the matrix according to its data type Type.
Definition: DynamicMatrix.h:1860
Header file for the row trait.
Type *BLAZE_RESTRICT v_
The dynamically allocated matrix elements.
Definition: DynamicMatrix.h:482
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:118
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:2181
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:117
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:160
Header file for the IsSparseMatrix type trait.
DynamicMatrix & operator=(const Type &rhs)
Homogenous assignment to all matrix elements.
Definition: DynamicMatrix.h:1167
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the matrix.
Definition: DynamicMatrix.h:1733
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:261
const CTransExprTrait_< MT > ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatForEachExpr.h:1251
constexpr size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
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:520
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Header file for the IsSame and IsStrictlySame type traits.
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:2215
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:315
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Algorithm.h:71
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:163
#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:1143
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:138
DenseMatrix< This, SO > BaseType
Base type of this DynamicMatrix instance.
Definition: DynamicMatrix.h:209
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:177
Header file for memory allocation and deallocation functionality.
System settings for performance optimizations.
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation ...
Definition: DynamicMatrix.h:204
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
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:323
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
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:129
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:2315
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:71
const This & CompositeType
Data type for composite expression templates.
Definition: DynamicMatrix.h:216
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:119
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: DynamicMatrix.h:2093
Constraint on the data type.
~DynamicMatrix()
The destructor for DynamicMatrix.
Definition: DynamicMatrix.h:824
This ResultType
Result type for expression template evaluations.
Definition: DynamicMatrix.h:210
Header file for the std::initializer_list aliases.
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:150
size_t spacing() const noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DynamicMatrix.h:1546
Base template for the RowTrait class.
Definition: RowTrait.h:117
DenseIterator< Type, usePadding > Iterator
Iterator over non-constant elements.
Definition: DynamicMatrix.h:223
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:143
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.
typename CTransExprTrait< T >::Type CTransExprTrait_
Auxiliary alias declaration for the CTransExprTrait class template.The CTransExprTrait_ alias declara...
Definition: CTransExprTrait.h:143
DynamicMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: DynamicMatrix.h:1922
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5635
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: DynamicMatrix.h:2056
constexpr bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
Type ElementType
Type of the matrix elements.
Definition: DynamicMatrix.h:213
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:98
#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
DynamicMatrix< Type, SO > This
Type of this DynamicMatrix instance.
Definition: DynamicMatrix.h:208
Header file for the HasSIMDAdd type trait.
DynamicMatrix< NewType, SO > Other
The type of the other DynamicMatrix.
Definition: DynamicMatrix.h:232
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:531
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicMatrix.h:215
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:468
#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:90
void extend(size_t m, size_t n, bool preserve=true)
Extending the size of the matrix.
Definition: DynamicMatrix.h:1791
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:1646
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:119
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DynamicMatrix.h:1527
Headerfile for generic algorithms.
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:553
Header file for the IsPadded type trait.
DynamicMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DynamicMatrix.h:211
SIMDTrait_< ElementType > SIMDType
SIMD type of the matrix elements.
Definition: DynamicMatrix.h:214
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:2244
Header file for the IsVectorizable type trait.
Pointer data() noexcept
Low-level data access to the matrix elements.
Definition: DynamicMatrix.h:952
Reference operator()(size_t i, size_t j) noexcept
2D-access to the matrix elements.
Definition: DynamicMatrix.h:852
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:480
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
Type * Pointer
Pointer to a non-constant matrix value.
Definition: DynamicMatrix.h:220
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
DynamicMatrix< Type, SO > Other
The type of the other DynamicMatrix.
Definition: DynamicMatrix.h:242
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:1285
size_t determineColumns(initializer_list< initializer_list< Type > > list) noexcept
Determine the maximum number of columns specified by the given initializer list.
Definition: InitializerList.h:80
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:143
Base template for the MultTrait class.
Definition: MultTrait.h:143
Iterator begin(size_t i) noexcept
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:1033
Header file for the addition trait.
void clear()
Clearing the matrix.
Definition: DynamicMatrix.h:1690
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: DynamicMatrix.h:221
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:1077
Constraint on the data type.
size_t m_
The current number of rows of the matrix.
Definition: DynamicMatrix.h:478
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:2036
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:94
Constraint on the data type.
void swap(DynamicMatrix &m) noexcept
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:1841
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.
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: DynamicMatrix.h:1596
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:225
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Base template for the DivTrait class.
Definition: DivTrait.h:143
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
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
Type & Reference
Reference to a non-constant matrix value.
Definition: DynamicMatrix.h:218
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
constexpr bool usePadding
Configuration of the padding of dense vectors and matrices.This configuration switch enables/disables...
Definition: Optimizations.h:52
DenseIterator< const Type, usePadding > ConstIterator
Iterator over constant elements.
Definition: DynamicMatrix.h:224
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:2146
Iterator end(size_t i) noexcept
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:1099
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
Initializer list type of the Blaze library.
bool isIntact() const noexcept
Returns whether the invariants of the dynamic matrix are intact.
Definition: DynamicMatrix.h:1996
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:134
size_t capacity_
The maximum capacity of the matrix.
Definition: DynamicMatrix.h:481
Header file for the IntegralConstant class template.
Resize mechanism to obtain a DynamicMatrix with different fixed dimensions.
Definition: DynamicMatrix.h:241
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:78
Rebind mechanism to obtain a DynamicMatrix with different data/element type.
Definition: DynamicMatrix.h:231
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Base template for the SubTrait class.
Definition: SubTrait.h:143
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:1303
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:1560
Header file for the CTransExprTrait class template.
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: DynamicMatrix.h:897
Header file for the IsResizable type trait.
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
DynamicMatrix & transpose()
In-place transpose of the matrix.
Definition: DynamicMatrix.h:1884
const Type & ConstReference
Reference to a constant matrix value.
Definition: DynamicMatrix.h:219
DynamicMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: DynamicMatrix.h:212
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
constexpr bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56