35 #ifndef _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_ 36 #define _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_ 218 template<
typename Type
219 ,
bool SO = defaultStorageOrder >
247 template<
typename NewType >
256 template<
size_t NewM
283 explicit inline
DynamicMatrix(
size_t m,
size_t n, const Type& init );
286 template< typename Other >
287 explicit inline
DynamicMatrix(
size_t m,
size_t n, const Other* array );
289 template< typename Other,
size_t Rows,
size_t Cols >
290 explicit inline
DynamicMatrix( const Other (&array)[Rows][Cols] );
308 inline
Reference operator()(
size_t i,
size_t j ) noexcept;
309 inline
ConstReference operator()(
size_t i,
size_t j ) const noexcept;
331 template< typename Other,
size_t Rows,
size_t Cols >
332 inline
DynamicMatrix& operator=( const Other (&array)[Rows][Cols] );
337 template< typename MT,
bool SO2 > inline
DynamicMatrix& operator= ( const
Matrix<MT,SO2>& rhs );
338 template< typename MT,
bool SO2 > inline
DynamicMatrix& operator+=( const
Matrix<MT,SO2>& rhs );
339 template< typename MT,
bool SO2 > inline
DynamicMatrix& operator-=( const
Matrix<MT,SO2>& rhs );
340 template< typename MT,
bool SO2 > inline
DynamicMatrix& operator%=( const
Matrix<MT,SO2>& rhs );
347 inline
size_t rows() const noexcept;
348 inline
size_t columns() const noexcept;
349 inline
size_t spacing() const noexcept;
350 inline
size_t capacity() const noexcept;
351 inline
size_t capacity(
size_t i ) const noexcept;
353 inline
size_t nonZeros(
size_t i ) const;
355 inline
void reset(
size_t i );
357 void resize (
size_t m,
size_t n,
bool preserve=true );
358 inline
void extend (
size_t m,
size_t n,
bool preserve=true );
371 template< typename Other > inline
DynamicMatrix& scale( const Other& scalar );
378 template< typename MT >
380 static constexpr
bool VectorizedAssign_v =
381 ( useOptimizedKernels &&
389 template< typename MT >
391 static constexpr
bool VectorizedAddAssign_v =
392 ( useOptimizedKernels &&
402 template< typename MT >
404 static constexpr
bool VectorizedSubAssign_v =
405 ( useOptimizedKernels &&
415 template< typename MT >
417 static constexpr
bool VectorizedSchurAssign_v =
418 ( useOptimizedKernels &&
434 inline
bool isIntact() const noexcept;
441 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
442 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
456 template< typename MT >
459 template< typename MT >
466 template< typename MT >
469 template< typename MT >
476 template< typename MT >
479 template< typename MT >
486 template< typename MT >
489 template< typename MT >
502 inline
size_t addPadding(
size_t value ) const noexcept;
549 template< typename Type
570 template<
typename Type
579 if( IsVectorizable_v<Type> ) {
580 for(
size_t i=0UL; i<
m_; ++i ) {
581 for(
size_t j=
n_; j<
nn_; ++j ) {
582 v_[i*
nn_+j] = Type();
601 template<
typename Type
606 for(
size_t i=0UL; i<m; ++i ) {
607 for(
size_t j=0UL; j<
n_; ++j ) {
637 template<
typename Type
644 for(
const auto& rowList : list ) {
645 std::fill( std::copy( rowList.begin(), rowList.end(),
begin(i) ),
end(i), Type() );
677 template<
typename Type
679 template<
typename Other >
683 for(
size_t i=0UL; i<m; ++i ) {
684 for(
size_t j=0UL; j<n; ++j ) {
685 v_[i*
nn_+j] = array[i*n+j];
715 template<
typename Type
717 template<
typename Other
723 for(
size_t i=0UL; i<Rows; ++i ) {
724 for(
size_t j=0UL; j<Cols; ++j ) {
725 v_[i*
nn_+j] = array[i][j];
742 template<
typename Type
761 template<
typename Type
784 template<
typename Type
786 template<
typename MT
791 if( IsSparseMatrix_v<MT> ) {
813 template<
typename Type
840 template<
typename Type
862 template<
typename Type
885 template<
typename Type
912 template<
typename Type
940 template<
typename Type
962 template<
typename Type
980 template<
typename Type
999 template<
typename Type
1021 template<
typename Type
1043 template<
typename Type
1065 template<
typename Type
1087 template<
typename Type
1109 template<
typename Type
1131 template<
typename Type
1156 template<
typename Type
1160 for(
size_t i=0UL; i<
m_; ++i )
1161 for(
size_t j=0UL; j<
n_; ++j )
1190 template<
typename Type
1199 for(
const auto& rowList : list ) {
1200 std::fill( std::copy( rowList.begin(), rowList.end(), v_+i*nn_ ), v_+(i+1UL)*nn_, Type() );
1230 template<
typename Type
1232 template<
typename Other
1237 resize( Rows, Cols,
false );
1239 for(
size_t i=0UL; i<Rows; ++i )
1240 for(
size_t j=0UL; j<Cols; ++j )
1241 v_[i*nn_+j] = array[i][j];
1257 template<
typename Type
1261 if( &rhs ==
this )
return *
this;
1279 template<
typename Type
1294 rhs.capacity_ = 0UL;
1311 template<
typename Type
1313 template<
typename MT
1317 using TT = decltype(
trans( *
this ) );
1318 using CT = decltype(
ctrans( *
this ) );
1319 using IT = decltype(
inv( *
this ) );
1321 if( IsSame_v<MT,TT> && (~rhs).isAliased(
this ) ) {
1324 else if( IsSame_v<MT,CT> && (~rhs).isAliased(
this ) ) {
1327 else if( !IsSame_v<MT,IT> && (~rhs).canAlias(
this ) ) {
1333 if( IsSparseMatrix_v<MT> )
1355 template<
typename Type
1357 template<
typename MT
1365 if( (~rhs).canAlias(
this ) ) {
1390 template<
typename Type
1392 template<
typename MT
1400 if( (~rhs).canAlias(
this ) ) {
1425 template<
typename Type
1427 template<
typename MT
1435 if( (~rhs).canAlias(
this ) ) {
1463 template<
typename Type
1477 template<
typename Type
1496 template<
typename Type
1510 template<
typename Type
1530 template<
typename Type
1546 template<
typename Type
1550 size_t nonzeros( 0UL );
1552 for(
size_t i=0UL; i<
m_; ++i )
1553 for(
size_t j=0UL; j<
n_; ++j )
1573 template<
typename Type
1579 const size_t jend( i*nn_ +
n_ );
1580 size_t nonzeros( 0UL );
1582 for(
size_t j=i*nn_; j<jend; ++j )
1596 template<
typename Type
1602 for(
size_t i=0UL; i<
m_; ++i )
1603 for(
size_t j=0UL; j<
n_; ++j )
1604 clear( v_[i*nn_+j] );
1620 template<
typename Type
1627 for(
size_t j=0UL; j<
n_; ++j )
1628 clear( v_[i*nn_+j] );
1640 template<
typename Type
1644 resize( 0UL, 0UL,
false );
1683 template<
typename Type
1690 if( m ==
m_ && n ==
n_ )
return;
1692 const size_t nn( addPadding( n ) );
1697 const size_t min_m(
min( m,
m_ ) );
1698 const size_t min_n(
min( n,
n_ ) );
1700 for(
size_t i=0UL; i<min_m; ++i ) {
1701 transfer( v_+i*nn_, v_+i*nn_+min_n, v+i*nn );
1715 if( IsVectorizable_v<Type> ) {
1716 for(
size_t i=0UL; i<m; ++i )
1717 for(
size_t j=n; j<nn; ++j )
1718 v_[i*nn+j] = Type();
1742 template<
typename Type
1760 template<
typename Type
1774 if( IsVectorizable_v<Type> ) {
1798 template<
typename Type
1815 template<
typename Type
1839 template<
typename Type
1843 if( usePadding && IsVectorizable_v<Type> )
1844 return nextMultiple<size_t>( value, SIMDSIZE );
1863 template<
typename Type
1869 constexpr
size_t block( BLOCK_SIZE );
1873 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1874 const size_t iend(
min( ii+block,
m_ ) );
1875 for(
size_t jj=0UL; jj<=ii; jj+=block ) {
1876 for(
size_t i=ii; i<iend; ++i ) {
1877 const size_t jend(
min( jj+block,
n_, i ) );
1878 for(
size_t j=jj; j<jend; ++j ) {
1879 swap( v_[i*nn_+j], v_[j*nn_+i] );
1901 template<
typename Type
1905 constexpr
size_t block( BLOCK_SIZE );
1909 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1910 const size_t iend(
min( ii+block,
m_ ) );
1911 for(
size_t jj=0UL; jj<ii; jj+=block ) {
1912 const size_t jend(
min( jj+block,
n_ ) );
1913 for(
size_t i=ii; i<iend; ++i ) {
1914 for(
size_t j=jj; j<jend; ++j ) {
1915 cswap( v_[i*nn_+j], v_[j*nn_+i] );
1919 for(
size_t i=ii; i<iend; ++i ) {
1920 for(
size_t j=ii; j<i; ++j ) {
1921 cswap( v_[i*nn_+j], v_[j*nn_+i] );
1955 template<
typename Type
1957 template<
typename Other >
1960 for(
size_t i=0UL; i<
m_; ++i )
1961 for(
size_t j=0UL; j<
n_; ++j )
1962 v_[i*nn_+j] *= scalar;
1986 template<
typename Type
1993 if( IsVectorizable_v<Type> ) {
1994 for(
size_t i=0UL; i<
m_; ++i ) {
1995 for(
size_t j=
n_; j<nn_; ++j ) {
1996 if( v_[i*nn_+j] != Type() )
2025 template<
typename Type
2027 template<
typename Other >
2030 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2045 template<
typename Type
2047 template<
typename Other >
2050 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2064 template<
typename Type
2068 return ( usePadding ||
columns() % SIMDSIZE == 0UL );
2083 template<
typename Type
2087 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
2107 template<
typename Type
2113 return loada( i, j );
2115 return loadu( i, j );
2135 template<
typename Type
2150 return loada( v_+i*nn_+j );
2170 template<
typename Type
2183 return loadu( v_+i*nn_+j );
2204 template<
typename Type
2233 template<
typename Type
2248 storea( v_+i*nn_+j, value );
2269 template<
typename Type
2282 storeu( v_+i*nn_+j, value );
2304 template<
typename Type
2319 stream( v_+i*nn_+j, value );
2335 template<
typename Type
2337 template<
typename MT >
2344 const size_t jpos(
n_ &
size_t(-2) );
2347 for(
size_t i=0UL; i<
m_; ++i ) {
2348 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2349 v_[i*nn_+j ] = (~rhs)(i,j );
2350 v_[i*nn_+j+1UL] = (~rhs)(i,j+1UL);
2353 v_[i*nn_+jpos] = (~rhs)(i,jpos);
2371 template<
typename Type
2373 template<
typename MT >
2382 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
2384 const size_t jpos( ( remainder )?(
n_ &
size_t(-SIMDSIZE) ):(
n_ ) );
2387 if( usePadding && useStreaming &&
2388 (
m_*
n_ > ( cacheSize / (
sizeof(Type) * 3UL ) ) ) && !(~rhs).isAliased(
this ) )
2390 for(
size_t i=0UL; i<
m_; ++i )
2396 for( ; j<jpos; j+=SIMDSIZE, left+=SIMDSIZE, right+=SIMDSIZE ) {
2397 left.stream( right.load() );
2399 for( ; remainder && j<
n_; ++j, ++left, ++right ) {
2406 for(
size_t i=0UL; i<
m_; ++i )
2410 ConstIterator_t<MT> right( (~rhs).
begin(i) );
2412 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2413 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2414 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2415 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2416 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2418 for( ; j<jpos; j+=SIMDSIZE ) {
2419 left.store( right.load() ); left+=SIMDSIZE, right+=SIMDSIZE;
2421 for( ; remainder && j<
n_; ++j ) {
2422 *left = *right; ++left; ++right;
2441 template<
typename Type
2443 template<
typename MT >
2451 constexpr
size_t block( BLOCK_SIZE );
2453 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2454 const size_t iend(
min(
m_, ii+block ) );
2455 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2456 const size_t jend(
min(
n_, jj+block ) );
2457 for(
size_t i=ii; i<iend; ++i ) {
2458 for(
size_t j=jj; j<jend; ++j ) {
2459 v_[i*nn_+j] = (~rhs)(i,j);
2479 template<
typename Type
2481 template<
typename MT >
2487 for(
size_t i=0UL; i<
m_; ++i )
2488 for(
auto element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2489 v_[i*nn_+element->index()] = element->value();
2505 template<
typename Type
2507 template<
typename MT >
2515 for(
size_t j=0UL; j<
n_; ++j )
2516 for(
auto element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2517 v_[element->index()*nn_+j] = element->value();
2533 template<
typename Type
2535 template<
typename MT >
2542 for(
size_t i=0UL; i<
m_; ++i )
2544 if( IsDiagonal_v<MT> )
2546 v_[i*nn_+i] += (~rhs)(i,i);
2550 const size_t jbegin( ( IsUpper_v<MT> )
2551 ?( IsStrictlyUpper_v<MT> ? i+1UL : i )
2553 const size_t jend ( ( IsLower_v<MT> )
2554 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
2560 for( ; (j+2UL) <= jend; j+=2UL ) {
2561 v_[i*nn_+j ] += (~rhs)(i,j );
2562 v_[i*nn_+j+1UL] += (~rhs)(i,j+1UL);
2565 v_[i*nn_+j] += (~rhs)(i,j);
2584 template<
typename Type
2586 template<
typename MT >
2596 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
2598 for(
size_t i=0UL; i<
m_; ++i )
2600 const size_t jbegin( ( IsUpper_v<MT> )
2601 ?( ( IsStrictlyUpper_v<MT> ? i+1UL : i ) &
size_t(-SIMDSIZE) )
2603 const size_t jend ( ( IsLower_v<MT> )
2604 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
2608 const size_t jpos( ( remainder )?( jend &
size_t(-SIMDSIZE) ):( jend ) );
2609 BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos,
"Invalid end calculation" );
2615 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2616 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2617 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2618 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2619 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2621 for( ; j<jpos; j+=SIMDSIZE ) {
2622 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2624 for( ; remainder && j<jend; ++j ) {
2625 *left += *right; ++left; ++right;
2643 template<
typename Type
2645 template<
typename MT >
2653 constexpr
size_t block( BLOCK_SIZE );
2655 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2656 const size_t iend(
min(
m_, ii+block ) );
2657 for(
size_t jj=0UL; jj<
n_; jj+=block )
2659 if( IsLower_v<MT> && ii < jj )
break;
2660 if( IsUpper_v<MT> && ii > jj )
continue;
2662 for(
size_t i=ii; i<iend; ++i )
2664 const size_t jbegin( ( IsUpper_v<MT> )
2665 ?(
max( ( IsStrictlyUpper_v<MT> ? i+1UL : i ), jj ) )
2667 const size_t jend ( ( IsLower_v<MT> )
2668 ?(
min( ( IsStrictlyLower_v<MT> ? i : i+1UL ),
n_, jj+block ) )
2669 :(
min(
n_, jj+block ) ) );
2672 for(
size_t j=jbegin; j<jend; ++j ) {
2673 v_[i*nn_+j] += (~rhs)(i,j);
2693 template<
typename Type
2695 template<
typename MT >
2701 for(
size_t i=0UL; i<
m_; ++i )
2702 for(
auto element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2703 v_[i*nn_+element->index()] += element->value();
2719 template<
typename Type
2721 template<
typename MT >
2729 for(
size_t j=0UL; j<
n_; ++j )
2730 for(
auto element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2731 v_[element->index()*nn_+j] += element->value();
2747 template<
typename Type
2749 template<
typename MT >
2756 for(
size_t i=0UL; i<
m_; ++i )
2758 if( IsDiagonal_v<MT> )
2760 v_[i*nn_+i] -= (~rhs)(i,i);
2764 const size_t jbegin( ( IsUpper_v<MT> )
2765 ?( IsStrictlyUpper_v<MT> ? i+1UL : i )
2767 const size_t jend ( ( IsLower_v<MT> )
2768 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
2774 for( ; (j+2UL) <= jend; j+=2UL ) {
2775 v_[i*nn_+j ] -= (~rhs)(i,j );
2776 v_[i*nn_+j+1UL] -= (~rhs)(i,j+1UL);
2779 v_[i*nn_+j] -= (~rhs)(i,j);
2798 template<
typename Type
2800 template<
typename MT >
2810 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
2812 for(
size_t i=0UL; i<
m_; ++i )
2814 const size_t jbegin( ( IsUpper_v<MT> )
2815 ?( ( IsStrictlyUpper_v<MT> ? i+1UL : i ) &
size_t(-SIMDSIZE) )
2817 const size_t jend ( ( IsLower_v<MT> )
2818 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
2822 const size_t jpos( ( remainder )?( jend &
size_t(-SIMDSIZE) ):( jend ) );
2823 BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos,
"Invalid end calculation" );
2829 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2830 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2831 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2832 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2833 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2835 for( ; j<jpos; j+=SIMDSIZE ) {
2836 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2838 for( ; remainder && j<jend; ++j ) {
2839 *left -= *right; ++left; ++right;
2857 template<
typename Type
2859 template<
typename MT >
2867 constexpr
size_t block( BLOCK_SIZE );
2869 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2870 const size_t iend(
min(
m_, ii+block ) );
2871 for(
size_t jj=0UL; jj<
n_; jj+=block )
2873 if( IsLower_v<MT> && ii < jj )
break;
2874 if( IsUpper_v<MT> && ii > jj )
continue;
2876 for(
size_t i=ii; i<iend; ++i )
2878 const size_t jbegin( ( IsUpper_v<MT> )
2879 ?(
max( ( IsStrictlyUpper_v<MT> ? i+1UL : i ), jj ) )
2881 const size_t jend ( ( IsLower_v<MT> )
2882 ?(
min( ( IsStrictlyLower_v<MT> ? i : i+1UL ),
n_, jj+block ) )
2883 :(
min(
n_, jj+block ) ) );
2886 for(
size_t j=jbegin; j<jend; ++j ) {
2887 v_[i*nn_+j] -= (~rhs)(i,j);
2907 template<
typename Type
2909 template<
typename MT >
2915 for(
size_t i=0UL; i<
m_; ++i )
2916 for(
auto element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2917 v_[i*nn_+element->index()] -= element->value();
2933 template<
typename Type
2935 template<
typename MT >
2943 for(
size_t j=0UL; j<
n_; ++j )
2944 for(
auto element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2945 v_[element->index()*nn_+j] -= element->value();
2961 template<
typename Type
2963 template<
typename MT >
2970 const size_t jpos(
n_ &
size_t(-2) );
2973 for(
size_t i=0UL; i<
m_; ++i ) {
2974 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2975 v_[i*nn_+j ] *= (~rhs)(i,j );
2976 v_[i*nn_+j+1UL] *= (~rhs)(i,j+1UL);
2979 v_[i*nn_+jpos] *= (~rhs)(i,jpos);
2997 template<
typename Type
2999 template<
typename MT >
3008 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
3010 for(
size_t i=0UL; i<
m_; ++i )
3012 const size_t jpos( ( remainder )?(
n_ &
size_t(-SIMDSIZE) ):(
n_ ) );
3019 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
3020 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3021 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3022 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3023 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3025 for( ; j<jpos; j+=SIMDSIZE ) {
3026 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
3028 for( ; remainder && j<
n_; ++j ) {
3029 *left *= *right; ++left; ++right;
3047 template<
typename Type
3049 template<
typename MT >
3057 constexpr
size_t block( BLOCK_SIZE );
3059 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
3060 const size_t iend(
min(
m_, ii+block ) );
3061 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
3062 const size_t jend(
min(
n_, jj+block ) );
3063 for(
size_t i=ii; i<iend; ++i ) {
3064 for(
size_t j=jj; j<jend; ++j ) {
3065 v_[i*nn_+j] *= (~rhs)(i,j);
3085 template<
typename Type
3087 template<
typename MT >
3095 for(
size_t i=0UL; i<
m_; ++i )
3099 for(
auto element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
3100 for( ; j<element->index(); ++j )
3101 reset( v_[i*nn_+j] );
3102 v_[i*nn_+j] *= element->value();
3106 for( ; j<
n_; ++j ) {
3107 reset( v_[i*nn_+j] );
3125 template<
typename Type
3127 template<
typename MT >
3137 for(
size_t j=0UL; j<
n_; ++j )
3141 for(
auto element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
3142 for( ; i<element->index(); ++i )
3143 reset( v_[i*nn_+j] );
3144 v_[i*nn_+j] *= element->value();
3148 for( ; i<
m_; ++i ) {
3149 reset( v_[i*nn_+j] );
3176 template<
typename Type >
3178 :
public DenseMatrix< DynamicMatrix<Type,true>, true >
3204 template<
typename NewType >
3213 template<
size_t NewM
3216 using Other = DynamicMatrix<Type,true>;
3226 static constexpr
bool simdEnabled = IsVectorizable_v<Type>;
3232 static constexpr
bool smpAssignable = !IsSMPAssignable_v<Type>;
3240 explicit inline
DynamicMatrix(
size_t m,
size_t n, const Type& init );
3241 explicit inline
DynamicMatrix( initializer_list< initializer_list<Type> > list );
3243 template< typename Other > explicit inline
DynamicMatrix(
size_t m,
size_t n, const Other* array );
3245 template< typename Other,
size_t Rows,
size_t Cols >
3246 explicit inline
DynamicMatrix( const Other (&array)[Rows][Cols] );
3250 template< typename MT,
bool SO > inline
DynamicMatrix( const Matrix<MT,SO>& m );
3264 inline
Reference operator()(
size_t i,
size_t j ) noexcept;
3265 inline
ConstReference operator()(
size_t i,
size_t j ) const noexcept;
3285 inline
DynamicMatrix& operator=( initializer_list< initializer_list<Type> > list );
3287 template< typename Other,
size_t Rows,
size_t Cols >
3288 inline
DynamicMatrix& operator=( const Other (&array)[Rows][Cols] );
3293 template< typename MT,
bool SO > inline
DynamicMatrix& operator= ( const Matrix<MT,SO>& rhs );
3294 template< typename MT,
bool SO > inline
DynamicMatrix& operator+=( const Matrix<MT,SO>& rhs );
3295 template< typename MT,
bool SO > inline
DynamicMatrix& operator-=( const Matrix<MT,SO>& rhs );
3296 template< typename MT,
bool SO > inline
DynamicMatrix& operator%=( const Matrix<MT,SO>& rhs );
3303 inline
size_t rows() const noexcept;
3304 inline
size_t columns() const noexcept;
3305 inline
size_t spacing() const noexcept;
3306 inline
size_t capacity() const noexcept;
3307 inline
size_t capacity(
size_t j ) const noexcept;
3309 inline
size_t nonZeros(
size_t j ) const;
3310 inline
void reset();
3311 inline
void reset(
size_t j );
3312 inline
void clear();
3313 void resize (
size_t m,
size_t n,
bool preserve=true );
3314 inline
void extend (
size_t m,
size_t n,
bool preserve=true );
3327 template< typename Other > inline
DynamicMatrix& scale( const Other& scalar );
3334 template< typename MT >
3335 static constexpr
bool VectorizedAssign_v =
3336 ( useOptimizedKernels &&
3343 template< typename MT >
3344 static constexpr
bool VectorizedAddAssign_v =
3345 ( useOptimizedKernels &&
3354 template< typename MT >
3355 static constexpr
bool VectorizedSubAssign_v =
3356 ( useOptimizedKernels &&
3365 template< typename MT >
3366 static constexpr
bool VectorizedSchurAssign_v =
3367 ( useOptimizedKernels &&
3382 inline
bool isIntact() const noexcept;
3389 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
3390 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
3392 inline
bool isAligned () const noexcept;
3404 template< typename MT >
3405 inline auto
assign( const DenseMatrix<MT,true>& rhs ) ->
DisableIf_t< VectorizedAssign_v<MT> >;
3407 template< typename MT >
3408 inline auto
assign( const DenseMatrix<MT,true>& rhs ) ->
EnableIf_t< VectorizedAssign_v<MT> >;
3410 template< typename MT > inline
void assign( const DenseMatrix<MT,false>& rhs );
3411 template< typename MT > inline
void assign( const SparseMatrix<MT,true>& rhs );
3412 template< typename MT > inline
void assign( const SparseMatrix<MT,false>& rhs );
3414 template< typename MT >
3415 inline auto
addAssign( const DenseMatrix<MT,true>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<MT> >;
3417 template< typename MT >
3418 inline auto
addAssign( const DenseMatrix<MT,true>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<MT> >;
3420 template< typename MT > inline
void addAssign( const DenseMatrix<MT,false>& rhs );
3421 template< typename MT > inline
void addAssign( const SparseMatrix<MT,true>& rhs );
3422 template< typename MT > inline
void addAssign( const SparseMatrix<MT,false>& rhs );
3424 template< typename MT >
3425 inline auto
subAssign ( const DenseMatrix<MT,true>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<MT> >;
3427 template< typename MT >
3428 inline auto
subAssign ( const DenseMatrix<MT,true>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<MT> >;
3430 template< typename MT > inline
void subAssign( const DenseMatrix<MT,false>& rhs );
3431 template< typename MT > inline
void subAssign( const SparseMatrix<MT,true>& rhs );
3432 template< typename MT > inline
void subAssign( const SparseMatrix<MT,false>& rhs );
3434 template< typename MT >
3435 inline auto
schurAssign ( const DenseMatrix<MT,true>& rhs ) ->
DisableIf_t< VectorizedSchurAssign_v<MT> >;
3437 template< typename MT >
3438 inline auto
schurAssign ( const DenseMatrix<MT,true>& rhs ) ->
EnableIf_t< VectorizedSchurAssign_v<MT> >;
3440 template< typename MT > inline
void schurAssign( const DenseMatrix<MT,false>& rhs );
3441 template< typename MT > inline
void schurAssign( const SparseMatrix<MT,true>& rhs );
3442 template< typename MT > inline
void schurAssign( const SparseMatrix<MT,false>& rhs );
3450 inline
size_t addPadding(
size_t minRows ) const noexcept;
3490 template< typename Type >
3512 template<
typename Type >
3520 if( IsVectorizable_v<Type> ) {
3521 for(
size_t j=0UL; j<
n_; ++j ) {
3522 for(
size_t i=
m_; i<mm_; ++i ) {
3523 v_[i+j*mm_] = Type();
3544 template<
typename Type >
3546 : DynamicMatrix( m, n )
3548 for(
size_t j=0UL; j<
n_; ++j ) {
3549 for(
size_t i=0UL; i<
m_; ++i ) {
3581 template<
typename Type >
3587 for(
const auto& rowList : list ) {
3589 for(
const auto& element : rowList ) {
3590 v_[i+j*mm_] = element;
3593 for( ; j<
n_; ++j ) {
3594 v_[i+j*mm_] = Type();
3630 template<
typename Type >
3631 template<
typename Other >
3633 : DynamicMatrix( m, n )
3635 for(
size_t j=0UL; j<n; ++j ) {
3636 for(
size_t i=0UL; i<m; ++i ) {
3637 v_[i+j*mm_] = array[i+j*m];
3669 template<
typename Type >
3670 template<
typename Other
3674 : DynamicMatrix( Rows, Cols )
3676 for(
size_t j=0UL; j<Cols; ++j ) {
3677 for(
size_t i=0UL; i<Rows; ++i ) {
3678 v_[i+j*mm_] = array[i][j];
3697 template<
typename Type >
3699 : DynamicMatrix( m.
m_, m.
n_ )
3717 template<
typename Type >
3741 template<
typename Type >
3742 template<
typename MT
3747 if( IsSparseMatrix_v<MT> ) {
3771 template<
typename Type >
3799 template<
typename Type >
3822 template<
typename Type >
3846 template<
typename Type >
3856 return (*
this)(i,j);
3874 template<
typename Type >
3884 return (*
this)(i,j);
3902 template<
typename Type >
3924 template<
typename Type >
3943 template<
typename Type >
3963 template<
typename Type >
3981 template<
typename Type >
3999 template<
typename Type >
4017 template<
typename Type >
4035 template<
typename Type >
4053 template<
typename Type >
4071 template<
typename Type >
4097 template<
typename Type >
4100 for(
size_t j=0UL; j<
n_; ++j )
4101 for(
size_t i=0UL; i<
m_; ++i )
4132 template<
typename Type >
4133 inline DynamicMatrix<Type,true>&
4140 for(
const auto& rowList : list ) {
4142 for(
const auto& element : rowList ) {
4143 v_[i+j*mm_] = element;
4146 for( ; j<
n_; ++j ) {
4147 v_[i+j*mm_] = Type();
4180 template<
typename Type >
4181 template<
typename Other
4186 resize( Rows, Cols,
false );
4188 for(
size_t j=0UL; j<Cols; ++j )
4189 for(
size_t i=0UL; i<Rows; ++i )
4190 v_[i+j*mm_] = array[i][j];
4208 template<
typename Type >
4211 if( &rhs ==
this )
return *
this;
4213 resize( rhs.m_, rhs.n_,
false );
4231 template<
typename Type >
4245 rhs.capacity_ = 0UL;
4264 template<
typename Type >
4265 template<
typename MT
4269 using TT = decltype(
trans( *
this ) );
4270 using CT = decltype(
ctrans( *
this ) );
4271 using IT = decltype(
inv( *
this ) );
4273 if( IsSame_v<MT,TT> && (~rhs).isAliased(
this ) ) {
4276 else if( IsSame_v<MT,CT> && (~rhs).isAliased(
this ) ) {
4279 else if( !IsSame_v<MT,IT> && (~rhs).canAlias(
this ) ) {
4280 DynamicMatrix tmp( ~rhs );
4285 if( IsSparseMatrix_v<MT> )
4309 template<
typename Type >
4310 template<
typename MT
4312 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator+=(
const Matrix<MT,SO>& rhs )
4318 if( (~rhs).canAlias(
this ) ) {
4319 const ResultType_t<MT> tmp( ~rhs );
4345 template<
typename Type >
4346 template<
typename MT
4348 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator-=(
const Matrix<MT,SO>& rhs )
4354 if( (~rhs).canAlias(
this ) ) {
4355 const ResultType_t<MT> tmp( ~rhs );
4381 template<
typename Type >
4382 template<
typename MT
4384 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator%=(
const Matrix<MT,SO>& rhs )
4390 if( (~rhs).canAlias(
this ) ) {
4391 const ResultType_t<MT> tmp( ~rhs );
4420 template<
typename Type >
4435 template<
typename Type >
4453 template<
typename Type >
4468 template<
typename Type >
4484 template<
typename Type >
4501 template<
typename Type >
4504 size_t nonzeros( 0UL );
4506 for(
size_t j=0UL; j<
n_; ++j )
4507 for(
size_t i=0UL; i<
m_; ++i )
4524 template<
typename Type >
4529 const size_t iend( j*mm_ +
m_ );
4530 size_t nonzeros( 0UL );
4532 for(
size_t i=j*mm_; i<iend; ++i )
4548 template<
typename Type >
4553 for(
size_t j=0UL; j<
n_; ++j )
4554 for(
size_t i=0UL; i<
m_; ++i )
4555 clear( v_[i+j*mm_] );
4571 template<
typename Type >
4577 for(
size_t i=0UL; i<
m_; ++i )
4578 clear( v_[i+j*mm_] );
4592 template<
typename Type >
4595 resize( 0UL, 0UL,
false );
4636 template<
typename Type >
4642 if( m ==
m_ && n ==
n_ )
return;
4644 const size_t mm( addPadding( m ) );
4649 const size_t min_m(
min( m,
m_ ) );
4650 const size_t min_n(
min( n,
n_ ) );
4652 for(
size_t j=0UL; j<min_n; ++j ) {
4653 transfer( v_+j*mm_, v_+min_m+j*mm_, v+j*mm );
4667 if( IsVectorizable_v<Type> ) {
4668 for(
size_t j=0UL; j<n; ++j )
4669 for(
size_t i=m; i<mm; ++i )
4670 v_[i+j*mm] = Type();
4696 template<
typename Type >
4715 template<
typename Type >
4728 if( IsVectorizable_v<Type> ) {
4754 template<
typename Type >
4758 DynamicMatrix( *this ).swap( *
this );
4772 template<
typename Type >
4797 template<
typename Type >
4800 if( usePadding && IsVectorizable_v<Type> )
4801 return nextMultiple<size_t>( values, SIMDSIZE );
4822 template<
typename Type >
4827 constexpr
size_t block( BLOCK_SIZE );
4831 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4832 const size_t jend(
min( jj+block,
n_ ) );
4833 for(
size_t ii=0UL; ii<=jj; ii+=block ) {
4834 for(
size_t j=jj; j<jend; ++j ) {
4835 const size_t iend(
min( ii+block,
m_, j ) );
4836 for(
size_t i=ii; i<iend; ++i ) {
4837 swap( v_[i+j*mm_], v_[j+i*mm_] );
4845 DynamicMatrix tmp(
trans(*
this) );
4861 template<
typename Type >
4864 constexpr
size_t block( BLOCK_SIZE );
4868 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4869 const size_t jend(
min( jj+block,
n_ ) );
4870 for(
size_t ii=0UL; ii<jj; ii+=block ) {
4871 const size_t iend(
min( ii+block,
m_ ) );
4872 for(
size_t j=jj; j<jend; ++j ) {
4873 for(
size_t i=ii; i<iend; ++i ) {
4874 cswap( v_[i+j*mm_], v_[j+i*mm_] );
4878 for(
size_t j=jj; j<jend; ++j ) {
4879 for(
size_t i=jj; i<j; ++i ) {
4880 cswap( v_[i+j*mm_], v_[j+i*mm_] );
4888 DynamicMatrix tmp(
ctrans(*
this) );
4916 template<
typename Type >
4917 template<
typename Other >
4918 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::scale(
const Other& scalar )
4920 for(
size_t j=0UL; j<
n_; ++j )
4921 for(
size_t i=0UL; i<
m_; ++i )
4922 v_[i+j*mm_] *= scalar;
4948 template<
typename Type >
4954 if( IsVectorizable_v<Type> ) {
4955 for(
size_t j=0UL; j<
n_; ++j ) {
4956 for(
size_t i=
m_; i<mm_; ++i ) {
4957 if( v_[i+j*mm_] != Type() )
4988 template<
typename Type >
4989 template<
typename Other >
4992 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5009 template<
typename Type >
5010 template<
typename Other >
5013 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5029 template<
typename Type >
5032 return ( usePadding ||
rows() % SIMDSIZE == 0UL );
5049 template<
typename Type >
5052 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
5073 template<
typename Type >
5078 return loada( i, j );
5080 return loadu( i, j );
5101 template<
typename Type >
5115 return loada( v_+i+j*mm_ );
5136 template<
typename Type >
5148 return loadu( v_+i+j*mm_ );
5170 template<
typename Type >
5199 template<
typename Type >
5213 storea( v_+i+j*mm_, value );
5235 template<
typename Type >
5247 storeu( v_+i+j*mm_, value );
5270 template<
typename Type >
5284 stream( v_+i+j*mm_, value );
5302 template<
typename Type >
5303 template<
typename MT >
5305 -> DisableIf_t< VectorizedAssign_v<MT> >
5310 const size_t ipos(
m_ &
size_t(-2) );
5313 for(
size_t j=0UL; j<
n_; ++j ) {
5314 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5315 v_[i +j*mm_] = (~rhs)(i ,j);
5316 v_[i+1UL+j*mm_] = (~rhs)(i+1UL,j);
5319 v_[ipos+j*mm_] = (~rhs)(ipos,j);
5339 template<
typename Type >
5340 template<
typename MT >
5342 -> EnableIf_t< VectorizedAssign_v<MT> >
5349 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
5351 const size_t ipos( ( remainder )?(
m_ &
size_t(-SIMDSIZE) ):(
m_ ) );
5354 if( usePadding && useStreaming &&
5355 (
m_*
n_ > ( cacheSize / (
sizeof(Type) * 3UL ) ) ) && !(~rhs).isAliased(
this ) )
5357 for(
size_t j=0UL; j<
n_; ++j )
5361 ConstIterator_t<MT> right( (~rhs).
begin(j) );
5363 for( ; i<ipos; i+=SIMDSIZE ) {
5364 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5366 for( ; remainder && i<
m_; ++i ) {
5367 *left = *right; ++left; ++right;
5373 for(
size_t j=0UL; j<
n_; ++j )
5377 ConstIterator_t<MT> right( (~rhs).
begin(j) );
5379 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5380 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5381 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5382 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5383 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5385 for( ; i<ipos; i+=SIMDSIZE ) {
5386 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5388 for( ; remainder && i<
m_; ++i ) {
5389 *left = *right; ++left; ++right;
5410 template<
typename Type >
5411 template<
typename MT >
5419 constexpr
size_t block( BLOCK_SIZE );
5421 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5422 const size_t jend(
min(
n_, jj+block ) );
5423 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
5424 const size_t iend(
min(
m_, ii+block ) );
5425 for(
size_t j=jj; j<jend; ++j ) {
5426 for(
size_t i=ii; i<iend; ++i ) {
5427 v_[i+j*mm_] = (~rhs)(i,j);
5449 template<
typename Type >
5450 template<
typename MT >
5456 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5457 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5458 v_[element->index()+j*mm_] = element->value();
5476 template<
typename Type >
5477 template<
typename MT >
5485 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5486 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5487 v_[i+element->index()*mm_] = element->value();
5505 template<
typename Type >
5506 template<
typename MT >
5508 -> DisableIf_t< VectorizedAddAssign_v<MT> >
5513 for(
size_t j=0UL; j<
n_; ++j )
5515 if( IsDiagonal_v<MT> )
5517 v_[j+j*mm_] += (~rhs)(j,j);
5521 const size_t ibegin( ( IsLower_v<MT> )
5522 ?( IsStrictlyLower_v<MT> ? j+1UL : j )
5524 const size_t iend ( ( IsUpper_v<MT> )
5525 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
5531 for( ; (i+2UL) <= iend; i+=2UL ) {
5532 v_[i +j*mm_] += (~rhs)(i ,j);
5533 v_[i+1UL+j*mm_] += (~rhs)(i+1UL,j);
5536 v_[i+j*mm_] += (~rhs)(i,j);
5557 template<
typename Type >
5558 template<
typename MT >
5560 -> EnableIf_t< VectorizedAddAssign_v<MT> >
5568 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
5570 for(
size_t j=0UL; j<
n_; ++j )
5572 const size_t ibegin( ( IsLower_v<MT> )
5573 ?( ( IsStrictlyLower_v<MT> ? j+1UL : j ) &
size_t(-SIMDSIZE) )
5575 const size_t iend ( ( IsUpper_v<MT> )
5576 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
5580 const size_t ipos( ( remainder )?( iend &
size_t(-SIMDSIZE) ):( iend ) );
5581 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5585 ConstIterator_t<MT> right( (~rhs).
begin(j) + ibegin );
5587 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5588 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5589 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5590 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5591 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5593 for( ; i<ipos; i+=SIMDSIZE ) {
5594 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5596 for( ; remainder && i<iend; ++i ) {
5597 *left += *right; ++left; ++right;
5617 template<
typename Type >
5618 template<
typename MT >
5626 constexpr
size_t block( BLOCK_SIZE );
5628 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5629 const size_t jend(
min(
n_, jj+block ) );
5630 for(
size_t ii=0UL; ii<
m_; ii+=block )
5632 if( IsLower_v<MT> && ii < jj )
continue;
5633 if( IsUpper_v<MT> && ii > jj )
break;
5635 for(
size_t j=jj; j<jend; ++j )
5637 const size_t ibegin( ( IsLower_v<MT> )
5638 ?(
max( ( IsStrictlyLower_v<MT> ? j+1UL : j ), ii ) )
5640 const size_t iend ( ( IsUpper_v<MT> )
5641 ?(
min( ( IsStrictlyUpper_v<MT> ? j : j+1UL ),
m_, ii+block ) )
5642 :(
min(
m_, ii+block ) ) );
5645 for(
size_t i=ibegin; i<iend; ++i ) {
5646 v_[i+j*mm_] += (~rhs)(i,j);
5668 template<
typename Type >
5669 template<
typename MT >
5675 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5676 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5677 v_[element->index()+j*mm_] += element->value();
5695 template<
typename Type >
5696 template<
typename MT >
5704 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5705 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5706 v_[i+element->index()*mm_] += element->value();
5724 template<
typename Type >
5725 template<
typename MT >
5727 -> DisableIf_t< VectorizedSubAssign_v<MT> >
5732 for(
size_t j=0UL; j<
n_; ++j )
5734 if( IsDiagonal_v<MT> )
5736 v_[j+j*mm_] -= (~rhs)(j,j);
5740 const size_t ibegin( ( IsLower_v<MT> )
5741 ?( IsStrictlyLower_v<MT> ? j+1UL : j )
5743 const size_t iend ( ( IsUpper_v<MT> )
5744 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
5750 for( ; (i+2UL) <= iend; i+=2UL ) {
5751 v_[i +j*mm_] -= (~rhs)(i ,j);
5752 v_[i+1+j*mm_] -= (~rhs)(i+1,j);
5755 v_[i+j*mm_] -= (~rhs)(i,j);
5776 template<
typename Type >
5777 template<
typename MT >
5779 -> EnableIf_t< VectorizedSubAssign_v<MT> >
5787 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
5789 for(
size_t j=0UL; j<
n_; ++j )
5791 const size_t ibegin( ( IsLower_v<MT> )
5792 ?( ( IsStrictlyLower_v<MT> ? j+1UL : j ) &
size_t(-SIMDSIZE) )
5794 const size_t iend ( ( IsUpper_v<MT> )
5795 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
5799 const size_t ipos( ( remainder )?( iend &
size_t(-SIMDSIZE) ):( iend ) );
5800 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5804 ConstIterator_t<MT> right( (~rhs).
begin(j) + ibegin );
5806 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5807 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5808 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5809 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5810 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5812 for( ; i<ipos; i+=SIMDSIZE ) {
5813 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5815 for( ; remainder && i<iend; ++i ) {
5816 *left -= *right; ++left; ++right;
5836 template<
typename Type >
5837 template<
typename MT >
5845 constexpr
size_t block( BLOCK_SIZE );
5847 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5848 const size_t jend(
min(
n_, jj+block ) );
5849 for(
size_t ii=0UL; ii<
m_; ii+=block )
5851 if( IsLower_v<MT> && ii < jj )
continue;
5852 if( IsUpper_v<MT> && ii > jj )
break;
5854 for(
size_t j=jj; j<jend; ++j )
5856 const size_t ibegin( ( IsLower_v<MT> )
5857 ?(
max( ( IsStrictlyLower_v<MT> ? j+1UL : j ), ii ) )
5859 const size_t iend ( ( IsUpper_v<MT> )
5860 ?(
min( ( IsStrictlyUpper_v<MT> ? j : j+1UL ),
m_, ii+block ) )
5861 :(
min(
m_, ii+block ) ) );
5864 for(
size_t i=ibegin; i<iend; ++i ) {
5865 v_[i+j*mm_] -= (~rhs)(i,j);
5887 template<
typename Type >
5888 template<
typename MT >
5894 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5895 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5896 v_[element->index()+j*mm_] -= element->value();
5914 template<
typename Type >
5915 template<
typename MT >
5923 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5924 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5925 v_[i+element->index()*mm_] -= element->value();
5943 template<
typename Type >
5944 template<
typename MT >
5946 -> DisableIf_t< VectorizedSchurAssign_v<MT> >
5951 const size_t ipos(
m_ &
size_t(-2) );
5954 for(
size_t j=0UL; j<
n_; ++j ) {
5955 for(
size_t i=0UL; (i+2UL) <= ipos; i+=2UL ) {
5956 v_[i +j*mm_] *= (~rhs)(i ,j);
5957 v_[i+1+j*mm_] *= (~rhs)(i+1,j);
5960 v_[ipos+j*mm_] *= (~rhs)(ipos,j);
5980 template<
typename Type >
5981 template<
typename MT >
5983 -> EnableIf_t< VectorizedSchurAssign_v<MT> >
5990 constexpr
bool remainder( !usePadding || !IsPadded_v<MT> );
5992 for(
size_t j=0UL; j<
n_; ++j )
5994 const size_t ipos( ( remainder )?(
m_ &
size_t(-SIMDSIZE) ):(
m_ ) );
5999 ConstIterator_t<MT> right( (~rhs).
begin(j) );
6001 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6002 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6003 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6004 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6005 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6007 for( ; i<ipos; i+=SIMDSIZE ) {
6008 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6010 for( ; remainder && i<
m_; ++i ) {
6011 *left *= *right; ++left; ++right;
6031 template<
typename Type >
6032 template<
typename MT >
6040 constexpr
size_t block( BLOCK_SIZE );
6042 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
6043 const size_t jend(
min(
n_, jj+block ) );
6044 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
6045 const size_t iend(
min(
m_, ii+block ) );
6046 for(
size_t j=jj; j<jend; ++j ) {
6047 for(
size_t i=ii; i<iend; ++i ) {
6048 v_[i+j*mm_] *= (~rhs)(i,j);
6070 template<
typename Type >
6071 template<
typename MT >
6079 for(
size_t j=0UL; j<
n_; ++j )
6083 for(
auto element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
6084 for( ; i<element->index(); ++i )
6085 reset( v_[i+j*mm_] );
6086 v_[i+j*mm_] *= element->value();
6090 for( ; i<
m_; ++i ) {
6091 reset( v_[i+j*mm_] );
6111 template<
typename Type >
6112 template<
typename MT >
6122 for(
size_t i=0UL; i<
m_; ++i )
6126 for(
auto element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
6127 for( ; j<element->index(); ++j )
6128 reset( v_[i+j*mm_] );
6129 v_[i+j*mm_] *= element->value();
6133 for( ; j<
n_; ++j ) {
6134 reset( v_[i+j*mm_] );
6157 template<
typename Type,
bool SO >
6158 void reset( DynamicMatrix<Type,SO>& m );
6160 template<
typename Type,
bool SO >
6161 void reset( DynamicMatrix<Type,SO>& m,
size_t i );
6163 template<
typename Type,
bool SO >
6164 void clear( DynamicMatrix<Type,SO>& m );
6166 template<
bool RF,
typename Type,
bool SO >
6167 bool isDefault(
const DynamicMatrix<Type,SO>& m );
6169 template<
typename Type,
bool SO >
6170 bool isIntact(
const DynamicMatrix<Type,SO>& m ) noexcept;
6172 template<
typename Type,
bool SO >
6173 void swap( DynamicMatrix<Type,SO>& a, DynamicMatrix<Type,SO>& b ) noexcept;
6185 template<
typename Type
6207 template<
typename Type
6223 template<
typename Type
6285 template<
typename Type
6289 return m.isIntact();
6302 template<
typename Type
6321 template<
typename T,
bool SO >
6322 struct HasConstDataAccess< DynamicMatrix<T,SO> >
6339 template<
typename T,
bool SO >
6340 struct HasMutableDataAccess< DynamicMatrix<T,SO> >
6357 template<
typename T,
bool SO >
6358 struct IsAligned< DynamicMatrix<T,SO> >
6375 template<
typename T,
bool SO >
6376 struct IsContiguous< DynamicMatrix<T,SO> >
6393 template<
typename T,
bool SO >
6394 struct IsPadded< DynamicMatrix<T,SO> >
6411 template<
typename T,
bool SO >
6412 struct IsResizable< DynamicMatrix<T,SO> >
6429 template<
typename T,
bool SO >
6430 struct IsShrinkable< DynamicMatrix<T,SO> >
6447 template<
typename T1,
typename T2 >
6448 struct AddTraitEval2< T1, T2
6451 ( IsDenseMatrix_v<T1> || IsDenseMatrix_v<T2> ) &&
6461 using ET1 = ElementType_t<T1>;
6462 using ET2 = ElementType_t<T2>;
6464 static constexpr
bool SO1 = StorageOrder_v<T1>;
6465 static constexpr
bool SO2 = StorageOrder_v<T2>;
6467 static constexpr
bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
6468 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
6469 ? ( IsSymmetric_v<T1>
6477 using Type = DynamicMatrix< AddTrait_t<ET1,ET2>, SO >;
6493 template<
typename T1,
typename T2 >
6494 struct SubTraitEval2< T1, T2
6497 ( IsDenseMatrix_v<T1> || IsDenseMatrix_v<T2> ) &&
6507 using ET1 = ElementType_t<T1>;
6508 using ET2 = ElementType_t<T2>;
6510 static constexpr
bool SO1 = StorageOrder_v<T1>;
6511 static constexpr
bool SO2 = StorageOrder_v<T2>;
6513 static constexpr
bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
6514 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
6515 ? ( IsSymmetric_v<T1>
6523 using Type = DynamicMatrix< SubTrait_t<ET1,ET2>, SO >;
6539 template<
typename T1,
typename T2 >
6540 struct SchurTraitEval2< T1, T2
6542 IsDenseMatrix_v<T2> &&
6552 using ET1 = ElementType_t<T1>;
6553 using ET2 = ElementType_t<T2>;
6555 static constexpr
bool SO1 = StorageOrder_v<T1>;
6556 static constexpr
bool SO2 = StorageOrder_v<T2>;
6558 static constexpr
bool SO = ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
6559 ? ( IsSymmetric_v<T1>
6564 using Type = DynamicMatrix< MultTrait_t<ET1,ET2>, SO >;
6580 template<
typename T1,
typename T2 >
6581 struct MultTraitEval2< T1, T2
6589 using ET1 = ElementType_t<T1>;
6591 using Type = DynamicMatrix< MultTrait_t<ET1,T2>, StorageOrder_v<T1> >;
6594 template<
typename T1,
typename T2 >
6595 struct MultTraitEval2< T1, T2
6597 IsDenseMatrix_v<T2> &&
6603 using ET2 = ElementType_t<T2>;
6605 using Type = DynamicMatrix< MultTrait_t<T1,ET2>, StorageOrder_v<T2> >;
6608 template<
typename T1,
typename T2 >
6609 struct MultTraitEval2< T1, T2
6611 IsDenseVector_v<T2> &&
6612 IsColumnVector_v<T1> &&
6613 IsRowVector_v<T2> &&
6619 using ET1 = ElementType_t<T1>;
6620 using ET2 = ElementType_t<T2>;
6622 using Type = DynamicMatrix< MultTrait_t<ET1,ET2>,
false >;
6625 template<
typename T1,
typename T2 >
6626 struct MultTraitEval2< T1, T2
6629 ( IsDenseMatrix_v<T1> || IsDenseMatrix_v<T2> ) &&
6633 ( !IsSquare_v<T2> || Size_v<T1,1UL> ==
DefaultSize_v ) ) ) &&
6639 using ET1 = ElementType_t<T1>;
6640 using ET2 = ElementType_t<T2>;
6642 static constexpr
bool SO = ( IsSparseMatrix_v<T1> ? StorageOrder_v<T2> : StorageOrder_v<T1> );
6644 using Type = DynamicMatrix< MultTrait_t<ET1,ET2>, SO >;
6660 template<
typename T1,
typename T2 >
6661 struct DivTraitEval2< T1, T2
6669 using ET1 = ElementType_t<T1>;
6671 using Type = DynamicMatrix< DivTrait_t<ET1,T2>, StorageOrder_v<T1> >;
6687 template<
typename T,
typename OP >
6688 struct UnaryMapTraitEval2< T, OP
6695 using ET = ElementType_t<T>;
6697 using Type = DynamicMatrix< MapTrait_t<ET,OP>, StorageOrder_v<T> >;
6705 template<
typename T1,
typename T2,
typename OP >
6706 struct BinaryMapTraitEval2< T1, T2, OP
6718 using ET1 = ElementType_t<T1>;
6719 using ET2 = ElementType_t<T2>;
6721 static constexpr
bool SO1 = StorageOrder_v<T1>;
6722 static constexpr
bool SO2 = StorageOrder_v<T2>;
6724 static constexpr
bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
6725 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
6726 ? ( IsSymmetric_v<T1>
6734 using Type = DynamicMatrix< MapTrait_t<ET1,ET2,OP>, SO >;
6750 template<
typename T
6752 struct ExpandTraitEval2< T, E
6760 using Type = DynamicMatrix< ElementType_t<T>, TF >;
6776 template<
typename T1,
bool SO,
typename T2 >
6777 struct HighType< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6779 using Type = DynamicMatrix< typename HighType<T1,T2>::Type, SO >;
6795 template<
typename T1,
bool SO,
typename T2 >
6796 struct LowType< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6798 using Type = DynamicMatrix< typename LowType<T1,T2>::Type, SO >;
6814 template<
typename MT >
6822 using Type = DynamicMatrix< RemoveConst_t< ElementType_t<MT> >, StorageOrder_v<MT> >;
6838 template<
typename MT,
size_t M >
6839 struct RowsTraitEval2< MT, M
6844 using Type = DynamicMatrix< RemoveConst_t< ElementType_t<MT> >,
false >;
6860 template<
typename MT,
size_t N >
6861 struct ColumnsTraitEval2< MT, N
6866 using Type = DynamicMatrix< RemoveConst_t< ElementType_t<MT> >,
true >;
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:510
size_t addPadding(size_t value) const noexcept
Add the necessary amount of padding to the given value.
Definition: DynamicMatrix.h:1841
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:2272
Header file for kernel specific block sizes.
Header file for the Schur product trait.
bool isAligned() const noexcept
Returns whether the matrix is properly aligned in memory.
Definition: DynamicMatrix.h:2066
void reserve(size_t elements)
Setting the minimum capacity of the matrix.
Definition: DynamicMatrix.h:1762
Header file for the nextMultiple shim.
#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:1465
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:2110
Header file for basic type definitions.
auto subAssign(const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedSubAssign_v< MT > >
Default implementation of the subtraction assignment of a row-major dense matrix. ...
Definition: DynamicMatrix.h:2750
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:188
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Type *BLAZE_RESTRICT v_
The dynamically allocated matrix elements.
Definition: DynamicMatrix.h:513
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:2173
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the IsSparseMatrix type trait.
DynamicMatrix & operator=(const Type &rhs)
Homogenous assignment to all matrix elements.
Definition: DynamicMatrix.h:1158
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:224
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the matrix.
Definition: DynamicMatrix.h:1685
Header file for the IsDiagonal type trait.
DynamicMatrix() noexcept
The default constructor for DynamicMatrix.
Definition: DynamicMatrix.h:551
Header file for the IsSame and IsStrictlySame type traits.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
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:2207
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Type ElementType
Type of the matrix elements.
Definition: DynamicMatrix.h:230
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:3289
Header file for the IsRowVector type trait.
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
#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:1134
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:101
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b) noexcept(IsNumeric_v< T >)
Swapping two conjugated values/objects.
Definition: Conjugate.h:195
Header file for the reset shim.
Type & Reference
Reference to a non-constant matrix value.
Definition: DynamicMatrix.h:235
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
Header file for memory allocation and deallocation functionality.
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
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:220
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the MaxSize type trait.
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:2307
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
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:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: DynamicMatrix.h:2085
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:3291
Header file for the IsMatrix type trait.
~DynamicMatrix()
The destructor for DynamicMatrix.
Definition: DynamicMatrix.h:815
Header file for the SparseMatrix base class.
size_t spacing() const noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DynamicMatrix.h:1498
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the LowType type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
constexpr ptrdiff_t DefaultMaxSize_v
Default size of the MaxSize type trait.
Definition: MaxSize.h:72
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
Header file for the IsSymmetric type trait.
DynamicMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: DynamicMatrix.h:1903
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:1364
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: DynamicMatrix.h:1800
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: DynamicMatrix.h:2048
Header file for the IsShrinkable type trait.
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:189
DynamicMatrix< NewType, SO > Other
The type of the other DynamicMatrix.
Definition: DynamicMatrix.h:249
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.
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
Header file for the expand trait.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#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:237
Header file for the HasSIMDAdd type trait.
Header file for the DenseMatrix base class.
Header file for the DenseIterator class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
decltype(auto) inv(const DenseMatrix< MT, SO > &dm)
Calculation of the inverse of the given dense matrix.
Definition: DMatInvExpr.h:423
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
#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
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: DynamicMatrix.h:275
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.The IsDenseVector_v variable template pr...
Definition: IsDenseVector.h:139
void extend(size_t m, size_t n, bool preserve=true)
Extending the size of the matrix.
Definition: DynamicMatrix.h:1744
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
#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:1598
auto addAssign(const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedAddAssign_v< MT > >
Default implementation of the addition assignment of a row-major dense matrix.
Definition: DynamicMatrix.h:2536
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:135
SIMDTrait_t< ElementType > SIMDType
SIMD type of the matrix elements.
Definition: DynamicMatrix.h:231
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DynamicMatrix.h:1479
Header file for the IsDenseMatrix type trait.
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:611
Header file for the IsPadded type trait.
const Type & ConstReference
Reference to a constant matrix value.
Definition: DynamicMatrix.h:236
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:2236
Header file for the IsVectorizable type trait.
Pointer data() noexcept
Low-level data access to the matrix elements.
Definition: DynamicMatrix.h:943
Reference operator()(size_t i, size_t j) noexcept
2D-access to the matrix elements.
Definition: DynamicMatrix.h:843
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
size_t nn_
The alignment adjusted number of columns.
Definition: DynamicMatrix.h:511
Header file for the RemoveConst type trait.
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.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Header file for run time assertion macros.
auto schurAssign(const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedSchurAssign_v< MT > >
Default implementation of the Schur product assignment of a row-major dense matrix.
Definition: DynamicMatrix.h:2964
Iterator begin(size_t i) noexcept
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:1024
Header file for the addition trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
void clear()
Clearing the matrix.
Definition: DynamicMatrix.h:1642
Header file for the division trait.
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:1068
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:509
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DynamicMatrix.h:427
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
Header file for the cache size of the target architecture.
#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 isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
System settings for the restrict keyword.
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: DynamicMatrix.h:2028
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
auto assign(const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedAssign_v< MT > >
Default implementation of the assignment of a row-major dense matrix.
Definition: DynamicMatrix.h:2338
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:109
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Constraint on the data type.
void swap(DynamicMatrix &m) noexcept
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:1817
Constraint on the data type.
Header file for the HasSIMDSub type trait.
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.The IsDenseMatrix_v variable template pr...
Definition: IsDenseMatrix.h:139
Header file for the HasMutableDataAccess type trait.
DenseIterator< Type, usePadding > Iterator
Iterator over non-constant elements.
Definition: DynamicMatrix.h:240
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: DynamicMatrix.h:1548
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.The IsDiagonal_v variable template provides...
Definition: IsDiagonal.h:148
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
Header file for the IsDenseVector type trait.
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.
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< 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:74
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:3290
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:2138
Iterator end(size_t i) noexcept
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:1090
DynamicMatrix< Type, SO > This
Type of this DynamicMatrix instance.
Definition: DynamicMatrix.h:225
DynamicMatrix< Type, SO > Other
The type of the other DynamicMatrix.
Definition: DynamicMatrix.h:259
EnableIf_t< IsBuiltin_v< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:224
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
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:1988
Header file for the alignment check function.
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:188
size_t capacity_
The maximum capacity of the matrix.
Definition: DynamicMatrix.h:512
Header file for the StorageOrder type trait.
Header file for the IntegralConstant class template.
Resize mechanism to obtain a DynamicMatrix with different fixed dimensions.
Definition: DynamicMatrix.h:258
constexpr Infinity inf
Global Infinity instance.The blaze::inf instance can be used wherever a built-in data type is expecte...
Definition: Infinity.h:1080
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
Rebind mechanism to obtain a DynamicMatrix with different data/element type.
Definition: DynamicMatrix.h:248
DenseIterator< const Type, usePadding > ConstIterator
Iterator over constant elements.
Definition: DynamicMatrix.h:241
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:3093
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
size_t capacity() const noexcept
Returns the maximum capacity of the matrix.
Definition: DynamicMatrix.h:1512
Header file for the IsColumnVector type trait.
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:888
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
EnableIf_t< IsBuiltin_v< T >, T *> allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:156
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
static constexpr bool simdEnabled
Compilation flag for SIMD optimization.
Definition: DynamicMatrix.h:269
#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:232
DynamicMatrix & transpose()
In-place transpose of the matrix.
Definition: DynamicMatrix.h:1865
constexpr 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:108
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
Header file for the clear shim.
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: DynamicMatrix.h:238
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825