35 #ifndef _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_
36 #define _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_
201 template<
typename Type
229 template<
typename ET >
255 explicit inline
DynamicMatrix(
size_t m,
size_t n, const Type& init );
256 explicit inline
DynamicMatrix( initializer_list< initializer_list<Type> > list );
258 template< typename Other >
259 explicit inline
DynamicMatrix(
size_t m,
size_t n, const Other* array );
261 template< typename Other,
size_t M,
size_t N >
266 template< typename MT,
bool SO2 > inline
DynamicMatrix( const Matrix<MT,SO2>& m );
280 inline Reference operator()(
size_t i,
size_t j ) noexcept;
281 inline ConstReference operator()(
size_t i,
size_t j ) const noexcept;
282 inline Reference
at(
size_t i,
size_t j );
283 inline ConstReference
at(
size_t i,
size_t j ) const;
284 inline Pointer
data () noexcept;
285 inline ConstPointer
data () const noexcept;
286 inline Pointer
data (
size_t i ) noexcept;
287 inline ConstPointer
data (
size_t i ) const noexcept;
288 inline Iterator
begin (
size_t i ) noexcept;
289 inline ConstIterator
begin (
size_t i ) const noexcept;
290 inline ConstIterator
cbegin(
size_t i ) const noexcept;
291 inline Iterator
end (
size_t i ) noexcept;
292 inline ConstIterator
end (
size_t i ) const noexcept;
293 inline ConstIterator
cend (
size_t i ) const noexcept;
300 inline DynamicMatrix& operator=( const Type& rhs );
301 inline DynamicMatrix& operator=( initializer_list< initializer_list<Type> > list );
303 template< typename Other,
size_t M,
size_t N >
304 inline DynamicMatrix& operator=( const Other (&array)[M][N] );
306 inline DynamicMatrix& operator=( const DynamicMatrix& rhs );
307 inline DynamicMatrix& operator=( DynamicMatrix&& rhs ) noexcept;
309 template< typename MT,
bool SO2 > inline DynamicMatrix& operator= ( const Matrix<MT,SO2>& rhs );
310 template< typename MT,
bool SO2 > inline DynamicMatrix& operator+=( const Matrix<MT,SO2>& rhs );
311 template< typename MT,
bool SO2 > inline DynamicMatrix& operator-=( const Matrix<MT,SO2>& rhs );
312 template< typename MT,
bool SO2 > inline DynamicMatrix& operator*=( const Matrix<MT,SO2>& rhs );
314 template< typename Other >
315 inline
EnableIf_<IsNumeric<Other>, DynamicMatrix >& operator*=( Other rhs );
317 template< typename Other >
318 inline
EnableIf_<IsNumeric<Other>, DynamicMatrix >& operator/=( Other rhs );
325 inline
size_t rows() const noexcept;
326 inline
size_t columns() const noexcept;
327 inline
size_t spacing() const noexcept;
328 inline
size_t capacity() const noexcept;
329 inline
size_t capacity(
size_t i ) const noexcept;
331 inline
size_t nonZeros(
size_t i ) const;
333 inline
void reset(
size_t i );
335 void resize (
size_t m,
size_t n,
bool preserve=true );
336 inline
void extend (
size_t m,
size_t n,
bool preserve=true );
337 inline
void reserve(
size_t elements );
340 template< typename Other > inline DynamicMatrix& scale( const Other& scalar );
341 inline
void swap( DynamicMatrix& m ) noexcept;
348 template< typename MT >
350 struct VectorizedAssign {
352 simdEnabled && MT::simdEnabled &&
353 AreSIMDCombinable< Type, ElementType_<MT> >::value };
360 template<
typename MT >
362 struct VectorizedAddAssign {
364 simdEnabled && MT::simdEnabled &&
365 AreSIMDCombinable< Type, ElementType_<MT> >::value &&
366 HasSIMDAdd< Type, ElementType_<MT> >::value &&
367 !IsDiagonal<MT>::value };
374 template<
typename MT >
376 struct VectorizedSubAssign {
378 simdEnabled && MT::simdEnabled &&
379 AreSIMDCombinable< Type, ElementType_<MT> >::value &&
380 HasSIMDSub< Type, ElementType_<MT> >::value &&
381 !IsDiagonal<MT>::value };
395 inline bool isIntact() const noexcept;
402 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
403 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
417 template< typename MT >
418 inline
DisableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO>& rhs );
420 template< typename MT >
421 inline
EnableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO>& rhs );
423 template< typename MT > inline
void assign( const DenseMatrix<MT,!SO>& rhs );
424 template< typename MT > inline
void assign( const SparseMatrix<MT,SO>& rhs );
425 template< typename MT > inline
void assign( const SparseMatrix<MT,!SO>& rhs );
427 template< typename MT >
428 inline
DisableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO>& rhs );
430 template< typename MT >
431 inline
EnableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO>& rhs );
433 template< typename MT > inline
void addAssign( const DenseMatrix<MT,!SO>& rhs );
434 template< typename MT > inline
void addAssign( const SparseMatrix<MT,SO>& rhs );
435 template< typename MT > inline
void addAssign( const SparseMatrix<MT,!SO>& rhs );
437 template< typename MT >
438 inline
DisableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO>& rhs );
440 template< typename MT >
441 inline
EnableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO>& rhs );
443 template< typename MT > inline
void subAssign( const DenseMatrix<MT,!SO>& rhs );
444 template< typename MT > inline
void subAssign( const SparseMatrix<MT,SO>& rhs );
445 template< typename MT > inline
void subAssign( const SparseMatrix<MT,!SO>& rhs );
453 inline
size_t adjustColumns(
size_t minColumns ) const noexcept;
500 template< typename Type
521 template<
typename Type
531 for(
size_t i=0UL; i<
m_; ++i ) {
532 for(
size_t j=
n_; j<
nn_; ++j ) {
533 v_[i*nn_+j] = Type();
552 template<
typename Type
557 , nn_ ( adjustColumns( n ) )
561 for(
size_t i=0UL; i<m; ++i ) {
562 for(
size_t j=0UL; j<
n_; ++j )
566 for(
size_t j=n_; j<
nn_; ++j )
567 v_[i*nn_+j] = Type();
596 template<
typename Type
601 , nn_ ( adjustColumns(
n_ ) )
607 for(
const auto& rowList : list ) {
608 std::fill( std::copy( rowList.begin(), rowList.end(),
v_+i*
nn_ ),
v_+(i+1UL)*
nn_, Type() );
640 template<
typename Type
642 template<
typename Other >
646 , nn_ ( adjustColumns( n ) )
650 for(
size_t i=0UL; i<m; ++i ) {
651 for(
size_t j=0UL; j<n; ++j )
652 v_[i*
nn_+j] = array[i*n+j];
655 for(
size_t j=n; j<
nn_; ++j )
656 v_[i*nn_+j] = Type();
686 template<
typename Type
688 template<
typename Other
694 , nn_ ( adjustColumns( N ) )
698 for(
size_t i=0UL; i<M; ++i ) {
699 for(
size_t j=0UL; j<N; ++j )
700 v_[i*
nn_+j] = array[i][j];
703 for(
size_t j=N; j<
nn_; ++j )
704 v_[i*nn_+j] = Type();
721 template<
typename Type
745 template<
typename Type
768 template<
typename Type
770 template<
typename MT
775 , nn_ ( adjustColumns(
n_ ) )
779 for(
size_t i=0UL; i<
m_; ++i ) {
781 j<( IsVectorizable<Type>::value ?
nn_ :
n_ ); ++j ) {
782 v_[i*
nn_+j] = Type();
804 template<
typename Type
831 template<
typename Type
853 template<
typename Type
876 template<
typename Type
903 template<
typename Type
931 template<
typename Type
953 template<
typename Type
971 template<
typename Type
990 template<
typename Type
1012 template<
typename Type
1034 template<
typename Type
1056 template<
typename Type
1078 template<
typename Type
1100 template<
typename Type
1122 template<
typename Type
1147 template<
typename Type
1151 for(
size_t i=0UL; i<
m_; ++i )
1152 for(
size_t j=0UL; j<
n_; ++j )
1181 template<
typename Type
1190 for(
const auto& rowList : list ) {
1191 std::fill( std::copy( rowList.begin(), rowList.end(), v_+i*nn_ ), v_+(i+1UL)*nn_, Type() );
1221 template<
typename Type
1223 template<
typename Other
1230 for(
size_t i=0UL; i<M; ++i )
1231 for(
size_t j=0UL; j<N; ++j )
1232 v_[i*nn_+j] = array[i][j];
1248 template<
typename Type
1252 if( &rhs ==
this )
return *
this;
1270 template<
typename Type
1285 rhs.capacity_ = 0UL;
1302 template<
typename Type
1304 template<
typename MT
1346 template<
typename Type
1348 template<
typename MT
1356 if( (~rhs).canAlias(
this ) ) {
1381 template<
typename Type
1383 template<
typename MT
1391 if( (~rhs).canAlias(
this ) ) {
1416 template<
typename Type
1418 template<
typename MT
1422 if( (~rhs).
rows() !=
n_ ) {
1441 template<
typename Type
1443 template<
typename Other >
1463 template<
typename Type
1465 template<
typename Other >
1493 template<
typename Type
1507 template<
typename Type
1526 template<
typename Type
1540 template<
typename Type
1560 template<
typename Type
1576 template<
typename Type
1580 size_t nonzeros( 0UL );
1582 for(
size_t i=0UL; i<
m_; ++i )
1583 for(
size_t j=0UL; j<
n_; ++j )
1603 template<
typename Type
1609 const size_t jend( i*nn_ +
n_ );
1610 size_t nonzeros( 0UL );
1612 for(
size_t j=i*nn_; j<jend; ++j )
1626 template<
typename Type
1632 for(
size_t i=0UL; i<
m_; ++i )
1633 for(
size_t j=0UL; j<
n_; ++j )
1634 clear( v_[i*nn_+j] );
1650 template<
typename Type
1657 for(
size_t j=0UL; j<
n_; ++j )
1658 clear( v_[i*nn_+j] );
1670 template<
typename Type
1674 resize( 0UL, 0UL,
false );
1713 template<
typename Type
1719 if( m ==
m_ && n ==
n_ )
return;
1721 const size_t nn( adjustColumns( n ) );
1726 const size_t min_m(
min( m,
m_ ) );
1727 const size_t min_n(
min( n,
n_ ) );
1729 for(
size_t i=0UL; i<min_m; ++i ) {
1730 transfer( v_+i*nn_, v_+i*nn_+min_n, v+i*nn );
1745 for(
size_t i=0UL; i<m; ++i )
1746 for(
size_t j=n; j<nn; ++j )
1747 v_[i*nn+j] = Type();
1771 template<
typename Type
1789 template<
typename Type
1802 for(
size_t i=
capacity_; i<elements; ++i )
1820 template<
typename Type
1826 const size_t block( BLOCK_SIZE );
1830 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1831 const size_t iend(
min( ii+block, m_ ) );
1832 for(
size_t jj=0UL; jj<=ii; jj+=block ) {
1833 for(
size_t i=ii; i<iend; ++i ) {
1834 const size_t jend(
min( jj+block,
n_, i ) );
1835 for(
size_t j=jj; j<jend; ++j ) {
1836 swap( v_[i*nn_+j], v_[j*nn_+i] );
1858 template<
typename Type
1862 const size_t block( BLOCK_SIZE );
1866 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1867 const size_t iend(
min( ii+block, m_ ) );
1868 for(
size_t jj=0UL; jj<ii; jj+=block ) {
1869 const size_t jend(
min( jj+block,
n_ ) );
1870 for(
size_t i=ii; i<iend; ++i ) {
1871 for(
size_t j=jj; j<jend; ++j ) {
1872 cswap( v_[i*nn_+j], v_[j*nn_+i] );
1876 for(
size_t i=ii; i<iend; ++i ) {
1877 for(
size_t j=ii; j<i; ++j ) {
1878 cswap( v_[i*nn_+j], v_[j*nn_+i] );
1901 template<
typename Type
1903 template<
typename Other >
1906 for(
size_t i=0UL; i<
m_; ++i )
1907 for(
size_t j=0UL; j<
n_; ++j )
1908 v_[i*nn_+j] *= scalar;
1921 template<
typename Type
1940 template<
typename Type
1945 return nextMultiple<size_t>( minColumns, SIMDSIZE );
1946 else return minColumns;
1968 template<
typename Type
1976 for(
size_t i=0UL; i<
m_; ++i ) {
1977 for(
size_t j=
n_; j<nn_; ++j ) {
1978 if( v_[i*nn_+j] != Type() )
2007 template<
typename Type
2009 template<
typename Other >
2012 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2027 template<
typename Type
2029 template<
typename Other >
2032 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2046 template<
typename Type
2065 template<
typename Type
2069 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
2089 template<
typename Type
2095 return loada( i, j );
2097 return loadu( i, j );
2117 template<
typename Type
2132 return loada( v_+i*nn_+j );
2152 template<
typename Type
2165 return loadu( v_+i*nn_+j );
2186 template<
typename Type
2215 template<
typename Type
2230 storea( v_+i*nn_+j, value );
2251 template<
typename Type
2264 storeu( v_+i*nn_+j, value );
2286 template<
typename Type
2301 stream( v_+i*nn_+j, value );
2317 template<
typename Type
2319 template<
typename MT >
2326 const size_t jpos(
n_ &
size_t(-2) );
2329 for(
size_t i=0UL; i<
m_; ++i ) {
2330 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2331 v_[i*nn_+j ] = (~rhs)(i,j );
2332 v_[i*nn_+j+1UL] = (~rhs)(i,j+1UL);
2335 v_[i*nn_+jpos] = (~rhs)(i,jpos);
2353 template<
typename Type
2355 template<
typename MT >
2366 const size_t jpos( ( remainder )?(
n_ &
size_t(-SIMDSIZE) ):(
n_ ) );
2370 (
m_*
n_ > (
cacheSize / (
sizeof(Type) * 3UL ) ) ) && !(~rhs).isAliased(
this ) )
2372 for(
size_t i=0UL; i<
m_; ++i )
2375 Iterator left(
begin(i) );
2378 for( ; j<jpos; j+=SIMDSIZE, left+=SIMDSIZE, right+=SIMDSIZE ) {
2379 left.stream( right.load() );
2381 for( ; remainder && j<
n_; ++j, ++left, ++right ) {
2388 for(
size_t i=0UL; i<
m_; ++i )
2391 Iterator left(
begin(i) );
2394 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2395 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2396 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2397 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2398 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2400 for( ; j<jpos; j+=SIMDSIZE ) {
2401 left.
store( right.load() ); left+=SIMDSIZE, right+=SIMDSIZE;
2403 for( ; remainder && j<
n_; ++j ) {
2404 *left = *right; ++left; ++right;
2423 template<
typename Type
2425 template<
typename MT >
2433 const size_t block( BLOCK_SIZE );
2435 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2436 const size_t iend(
min( m_, ii+block ) );
2437 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2438 const size_t jend(
min( n_, jj+block ) );
2439 for(
size_t i=ii; i<iend; ++i ) {
2440 for(
size_t j=jj; j<jend; ++j ) {
2441 v_[i*nn_+j] = (~rhs)(i,j);
2461 template<
typename Type
2463 template<
typename MT >
2469 for(
size_t i=0UL; i<
m_; ++i )
2471 v_[i*nn_+element->index()] = element->value();
2487 template<
typename Type
2489 template<
typename MT >
2497 for(
size_t j=0UL; j<
n_; ++j )
2499 v_[element->index()*nn_+j] = element->value();
2515 template<
typename Type
2517 template<
typename MT >
2524 for(
size_t i=0UL; i<
m_; ++i )
2528 v_[i*nn_+i] += (~rhs)(i,i);
2542 for( ; (j+2UL) <= jend; j+=2UL ) {
2543 v_[i*nn_+j ] += (~rhs)(i,j );
2544 v_[i*nn_+j+1UL] += (~rhs)(i,j+1UL);
2547 v_[i*nn_+j] += (~rhs)(i,j);
2566 template<
typename Type
2568 template<
typename MT >
2580 for(
size_t i=0UL; i<
m_; ++i )
2590 const size_t jpos( ( remainder )?( jend &
size_t(-SIMDSIZE) ):( jend ) );
2591 BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos,
"Invalid end calculation" );
2594 Iterator left(
begin(i) + jbegin );
2597 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2598 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2599 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2600 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2601 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2603 for( ; j<jpos; j+=SIMDSIZE ) {
2604 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2606 for( ; remainder && j<jend; ++j ) {
2607 *left += *right; ++left; ++right;
2625 template<
typename Type
2627 template<
typename MT >
2635 const size_t block( BLOCK_SIZE );
2637 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2638 const size_t iend(
min( m_, ii+block ) );
2639 for(
size_t jj=0UL; jj<
n_; jj+=block )
2644 for(
size_t i=ii; i<iend; ++i )
2651 :(
min( n_, jj+block ) ) );
2654 for(
size_t j=jbegin; j<jend; ++j ) {
2655 v_[i*nn_+j] += (~rhs)(i,j);
2675 template<
typename Type
2677 template<
typename MT >
2683 for(
size_t i=0UL; i<
m_; ++i )
2685 v_[i*nn_+element->index()] += element->value();
2701 template<
typename Type
2703 template<
typename MT >
2711 for(
size_t j=0UL; j<
n_; ++j )
2713 v_[element->index()*nn_+j] += element->value();
2729 template<
typename Type
2731 template<
typename MT >
2738 for(
size_t i=0UL; i<
m_; ++i )
2742 v_[i*nn_+i] -= (~rhs)(i,i);
2756 for( ; (j+2UL) <= jend; j+=2UL ) {
2757 v_[i*nn_+j ] -= (~rhs)(i,j );
2758 v_[i*nn_+j+1UL] -= (~rhs)(i,j+1UL);
2761 v_[i*nn_+j] -= (~rhs)(i,j);
2780 template<
typename Type
2782 template<
typename MT >
2794 for(
size_t i=0UL; i<
m_; ++i )
2804 const size_t jpos( ( remainder )?( jend &
size_t(-SIMDSIZE) ):( jend ) );
2805 BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos,
"Invalid end calculation" );
2808 Iterator left(
begin(i) + jbegin );
2811 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2812 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2813 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2814 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2815 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2817 for( ; j<jpos; j+=SIMDSIZE ) {
2818 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2820 for( ; remainder && j<jend; ++j ) {
2821 *left -= *right; ++left; ++right;
2839 template<
typename Type
2841 template<
typename MT >
2849 const size_t block( BLOCK_SIZE );
2851 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2852 const size_t iend(
min( m_, ii+block ) );
2853 for(
size_t jj=0UL; jj<
n_; jj+=block )
2858 for(
size_t i=ii; i<iend; ++i )
2865 :(
min( n_, jj+block ) ) );
2868 for(
size_t j=jbegin; j<jend; ++j ) {
2869 v_[i*nn_+j] -= (~rhs)(i,j);
2889 template<
typename Type
2891 template<
typename MT >
2897 for(
size_t i=0UL; i<
m_; ++i )
2899 v_[i*nn_+element->index()] -= element->value();
2915 template<
typename Type
2917 template<
typename MT >
2925 for(
size_t j=0UL; j<
n_; ++j )
2927 v_[element->index()*nn_+j] -= element->value();
2952 template<
typename Type >
2979 template<
typename ET >
2991 enum :
bool { simdEnabled = IsVectorizable<Type>::value };
2997 enum :
bool { smpAssignable = !IsSMPAssignable<Type>::value };
3005 explicit inline
DynamicMatrix(
size_t m,
size_t n, const Type& init );
3006 explicit inline
DynamicMatrix( initializer_list< initializer_list<Type> > list );
3008 template< typename Other > explicit inline
DynamicMatrix(
size_t m,
size_t n, const Other* array );
3010 template< typename Other,
size_t M,
size_t N >
3011 explicit inline
DynamicMatrix( const Other (&array)[M][N] );
3015 template< typename MT,
bool SO > inline
DynamicMatrix( const Matrix<MT,SO>& m );
3029 inline Reference operator()(
size_t i,
size_t j ) noexcept;
3030 inline ConstReference operator()(
size_t i,
size_t j ) const noexcept;
3031 inline Reference
at(
size_t i,
size_t j );
3032 inline ConstReference
at(
size_t i,
size_t j ) const;
3033 inline Pointer
data () noexcept;
3034 inline ConstPointer
data () const noexcept;
3035 inline Pointer
data (
size_t j ) noexcept;
3036 inline ConstPointer
data (
size_t j ) const noexcept;
3037 inline Iterator
begin (
size_t j ) noexcept;
3038 inline ConstIterator
begin (
size_t j ) const noexcept;
3039 inline ConstIterator
cbegin(
size_t j ) const noexcept;
3040 inline Iterator
end (
size_t j ) noexcept;
3041 inline ConstIterator
end (
size_t j ) const noexcept;
3042 inline ConstIterator
cend (
size_t j ) const noexcept;
3049 inline DynamicMatrix& operator=( const Type& rhs );
3050 inline DynamicMatrix& operator=( initializer_list< initializer_list<Type> > list );
3052 template< typename Other,
size_t M,
size_t N >
3053 inline DynamicMatrix& operator=( const Other (&array)[M][N] );
3055 inline DynamicMatrix& operator=( const DynamicMatrix& rhs );
3056 inline DynamicMatrix& operator=( DynamicMatrix&& rhs );
3058 template< typename MT,
bool SO > inline DynamicMatrix& operator= ( const Matrix<MT,SO>& rhs );
3059 template< typename MT,
bool SO > inline DynamicMatrix& operator+=( const Matrix<MT,SO>& rhs );
3060 template< typename MT,
bool SO > inline DynamicMatrix& operator-=( const Matrix<MT,SO>& rhs );
3061 template< typename MT,
bool SO > inline DynamicMatrix& operator*=( const Matrix<MT,SO>& rhs );
3063 template< typename Other >
3064 inline
EnableIf_<IsNumeric<Other>, DynamicMatrix >& operator*=( Other rhs );
3066 template< typename Other >
3067 inline
EnableIf_<IsNumeric<Other>, DynamicMatrix >& operator/=( Other rhs );
3074 inline
size_t rows() const noexcept;
3075 inline
size_t columns() const noexcept;
3076 inline
size_t spacing() const noexcept;
3077 inline
size_t capacity() const noexcept;
3078 inline
size_t capacity(
size_t j ) const noexcept;
3080 inline
size_t nonZeros(
size_t j ) const;
3081 inline
void reset();
3082 inline
void reset(
size_t j );
3083 inline
void clear();
3084 void resize (
size_t m,
size_t n,
bool preserve=true );
3085 inline
void extend (
size_t m,
size_t n,
bool preserve=true );
3086 inline
void reserve(
size_t elements );
3089 template< typename Other > inline DynamicMatrix& scale( const Other& scalar );
3090 inline
void swap( DynamicMatrix& m ) noexcept;
3097 template< typename MT >
3098 struct VectorizedAssign {
3100 simdEnabled && MT::simdEnabled &&
3101 AreSIMDCombinable< Type, ElementType_<MT> >::value };
3107 template<
typename MT >
3108 struct VectorizedAddAssign {
3110 simdEnabled && MT::simdEnabled &&
3111 AreSIMDCombinable< Type, ElementType_<MT> >::value &&
3112 HasSIMDAdd< Type, ElementType_<MT> >::value &&
3113 !IsDiagonal<MT>::value };
3119 template<
typename MT >
3120 struct VectorizedSubAssign {
3122 simdEnabled && MT::simdEnabled &&
3123 AreSIMDCombinable< Type, ElementType_<MT> >::value &&
3124 HasSIMDSub< Type, ElementType_<MT> >::value &&
3125 !IsDiagonal<MT>::value };
3138 inline bool isIntact() const noexcept;
3145 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
3146 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
3148 inline
bool isAligned () const noexcept;
3160 template< typename MT >
3161 inline
DisableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,true>& rhs );
3163 template< typename MT >
3164 inline
EnableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,true>& rhs );
3166 template< typename MT > inline
void assign( const DenseMatrix<MT,false>& rhs );
3167 template< typename MT > inline
void assign( const SparseMatrix<MT,true>& rhs );
3168 template< typename MT > inline
void assign( const SparseMatrix<MT,false>& rhs );
3170 template< typename MT >
3171 inline
DisableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,true>& rhs );
3173 template< typename MT >
3174 inline
EnableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,true>& rhs );
3176 template< typename MT > inline
void addAssign( const DenseMatrix<MT,false>& rhs );
3177 template< typename MT > inline
void addAssign( const SparseMatrix<MT,true>& rhs );
3178 template< typename MT > inline
void addAssign( const SparseMatrix<MT,false>& rhs );
3180 template< typename MT >
3181 inline
DisableIf_<VectorizedSubAssign<MT> > subAssign ( const DenseMatrix<MT,true>& rhs );
3183 template< typename MT >
3184 inline
EnableIf_<VectorizedSubAssign<MT> > subAssign ( const DenseMatrix<MT,true>& rhs );
3186 template< typename MT > inline
void subAssign( const DenseMatrix<MT,false>& rhs );
3187 template< typename MT > inline
void subAssign( const SparseMatrix<MT,true>& rhs );
3188 template< typename MT > inline
void subAssign( const SparseMatrix<MT,false>& rhs );
3196 inline
size_t adjustRows(
size_t minRows ) const noexcept;
3236 template< typename Type >
3258 template<
typename Type >
3261 , mm_ ( adjustRows( m ) )
3266 if( IsVectorizable<Type>::value ) {
3267 for(
size_t j=0UL; j<
n_; ++j ) {
3268 for(
size_t i=
m_; i<mm_; ++i ) {
3269 v_[i+j*mm_] = Type();
3290 template<
typename Type >
3293 , mm_ ( adjustRows( m ) )
3298 for(
size_t j=0UL; j<
n_; ++j ) {
3299 for(
size_t i=0UL; i<
m_; ++i )
3302 if( IsVectorizable<Type>::value ) {
3303 for(
size_t i=m_; i<mm_; ++i )
3304 v_[i+j*mm_] = Type();
3335 template<
typename Type >
3337 : m_ ( list.
size() )
3338 , mm_ ( adjustRows( m_ ) )
3345 for(
const auto& rowList : list ) {
3347 for(
const auto& element : rowList ) {
3348 v_[i+j*mm_] = element;
3351 for( ; j<
n_; ++j ) {
3352 v_[i+j*mm_] = Type();
3359 if( IsVectorizable<Type>::value ) {
3360 for( ; i<mm_; ++i ) {
3361 for(
size_t j=0UL; j<
n_; ++j ) {
3362 v_[i+j*mm_] = Type();
3397 template<
typename Type >
3398 template<
typename Other >
3401 , mm_ ( adjustRows( m ) )
3406 for(
size_t j=0UL; j<n; ++j ) {
3407 for(
size_t i=0UL; i<m; ++i )
3408 v_[i+j*mm_] = array[i+j*m];
3410 if( IsVectorizable<Type>::value ) {
3411 for(
size_t i=m; i<mm_; ++i )
3412 v_[i+j*mm_] = Type();
3444 template<
typename Type >
3445 template<
typename Other
3450 , mm_ ( adjustRows( M ) )
3455 for(
size_t j=0UL; j<N; ++j ) {
3456 for(
size_t i=0UL; i<M; ++i )
3457 v_[i+j*mm_] = array[i][j];
3459 if( IsVectorizable<Type>::value ) {
3460 for(
size_t i=M; i<mm_; ++i )
3461 v_[i+j*mm_] = Type();
3480 template<
typename Type >
3505 template<
typename Type >
3510 , capacity_( m.capacity_ )
3529 template<
typename Type >
3530 template<
typename MT
3533 : m_ ( (~m).
rows() )
3534 , mm_ ( adjustRows( m_ ) )
3536 , capacity_( mm_*n_ )
3537 , v_ (
allocate<Type>( capacity_ ) )
3539 for(
size_t j=0UL; j<
n_; ++j ) {
3540 for(
size_t i=( IsSparseMatrix<MT>::value ? 0UL : m_ );
3541 i<( IsVectorizable<Type>::value ? mm_ :
m_ ); ++i ) {
3542 v_[i+j*mm_] = Type();
3566 template<
typename Type >
3594 template<
typename Type >
3617 template<
typename Type >
3641 template<
typename Type >
3651 return (*
this)(i,j);
3669 template<
typename Type >
3679 return (*
this)(i,j);
3697 template<
typename Type >
3698 inline typename DynamicMatrix<Type,true>::Pointer
3719 template<
typename Type >
3720 inline typename DynamicMatrix<Type,true>::ConstPointer
3738 template<
typename Type >
3739 inline typename DynamicMatrix<Type,true>::Pointer
3758 template<
typename Type >
3759 inline typename DynamicMatrix<Type,true>::ConstPointer
3776 template<
typename Type >
3794 template<
typename Type >
3812 template<
typename Type >
3830 template<
typename Type >
3835 return Iterator( v_ + j*mm_ + m_ );
3848 template<
typename Type >
3866 template<
typename Type >
3892 template<
typename Type >
3895 for(
size_t j=0UL; j<
n_; ++j )
3896 for(
size_t i=0UL; i<
m_; ++i )
3927 template<
typename Type >
3928 inline DynamicMatrix<Type,true>&
3935 for(
const auto& rowList : list ) {
3937 for(
const auto& element : rowList ) {
3938 v_[i+j*mm_] = element;
3941 for( ; j<
n_; ++j ) {
3942 v_[i+j*mm_] = Type();
3975 template<
typename Type >
3976 template<
typename Other
3983 for(
size_t j=0UL; j<N; ++j )
3984 for(
size_t i=0UL; i<M; ++i )
3985 v_[i+j*mm_] = array[i][j];
4003 template<
typename Type >
4006 if( &rhs ==
this )
return *
this;
4008 resize( rhs.m_, rhs.n_,
false );
4026 template<
typename Type >
4034 capacity_ = rhs.capacity_;
4040 rhs.capacity_ = 0UL;
4059 template<
typename Type >
4060 template<
typename MT
4064 typedef TransExprTrait_<This> TT;
4065 typedef CTransExprTrait_<This> CT;
4066 typedef InvExprTrait_<This> IT;
4068 if( IsSame<MT,TT>::value && (~rhs).isAliased(
this ) ) {
4071 else if( IsSame<MT,CT>::value && (~rhs).isAliased(
this ) ) {
4074 else if( !IsSame<MT,IT>::value && (~rhs).canAlias(
this ) ) {
4075 DynamicMatrix tmp( ~rhs );
4080 if( IsSparseMatrix<MT>::value )
4104 template<
typename Type >
4105 template<
typename MT
4109 if( (~rhs).
rows() != m_ || (~rhs).
columns() != n_ ) {
4113 if( (~rhs).canAlias(
this ) ) {
4114 const ResultType_<MT> tmp( ~rhs );
4140 template<
typename Type >
4141 template<
typename MT
4145 if( (~rhs).
rows() != m_ || (~rhs).
columns() != n_ ) {
4149 if( (~rhs).canAlias(
this ) ) {
4150 const ResultType_<MT> tmp( ~rhs );
4176 template<
typename Type >
4177 template<
typename MT
4181 if( (~rhs).
rows() != n_ ) {
4185 DynamicMatrix tmp( *
this * (~rhs) );
4204 template<
typename Type >
4205 template<
typename Other >
4206 inline EnableIf_<IsNumeric<Other>, DynamicMatrix<Type,true> >&
4227 template<
typename Type >
4228 template<
typename Other >
4229 inline EnableIf_<IsNumeric<Other>, DynamicMatrix<Type,true> >&
4258 template<
typename Type >
4273 template<
typename Type >
4291 template<
typename Type >
4306 template<
typename Type >
4322 template<
typename Type >
4339 template<
typename Type >
4342 size_t nonzeros( 0UL );
4344 for(
size_t j=0UL; j<
n_; ++j )
4345 for(
size_t i=0UL; i<
m_; ++i )
4362 template<
typename Type >
4367 const size_t iend( j*mm_ + m_ );
4368 size_t nonzeros( 0UL );
4370 for(
size_t i=j*mm_; i<iend; ++i )
4386 template<
typename Type >
4391 for(
size_t j=0UL; j<
n_; ++j )
4392 for(
size_t i=0UL; i<
m_; ++i )
4393 clear( v_[i+j*mm_] );
4409 template<
typename Type >
4415 for(
size_t i=0UL; i<
m_; ++i )
4416 clear( v_[i+j*mm_] );
4430 template<
typename Type >
4433 resize( 0UL, 0UL,
false );
4474 template<
typename Type >
4479 if( m == m_ && n == n_ )
return;
4481 const size_t mm( adjustRows( m ) );
4486 const size_t min_m(
min( m, m_ ) );
4487 const size_t min_n(
min( n, n_ ) );
4489 for(
size_t j=0UL; j<min_n; ++j ) {
4490 transfer( v_+j*mm_, v_+min_m+j*mm_, v+j*mm );
4497 else if( mm*n > capacity_ ) {
4504 if( IsVectorizable<Type>::value ) {
4505 for(
size_t j=0UL; j<n; ++j )
4506 for(
size_t i=m; i<mm; ++i )
4507 v_[i+j*mm] = Type();
4533 template<
typename Type >
4536 resize( m_+m, n_+n, preserve );
4552 template<
typename Type >
4555 if( elements > capacity_ )
4563 if( IsVectorizable<Type>::value ) {
4564 for(
size_t i=capacity_; i<elements; ++i )
4571 capacity_ = elements;
4584 template<
typename Type >
4589 const size_t block( BLOCK_SIZE );
4593 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4594 const size_t jend(
min( jj+block, n_ ) );
4595 for(
size_t ii=0UL; ii<=jj; ii+=block ) {
4596 for(
size_t j=jj; j<jend; ++j ) {
4597 const size_t iend(
min( ii+block, m_, j ) );
4598 for(
size_t i=ii; i<iend; ++i ) {
4599 swap( v_[i+j*mm_], v_[j+i*mm_] );
4607 DynamicMatrix tmp(
trans(*
this) );
4623 template<
typename Type >
4626 const size_t block( BLOCK_SIZE );
4630 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4631 const size_t jend(
min( jj+block, n_ ) );
4632 for(
size_t ii=0UL; ii<jj; ii+=block ) {
4633 const size_t iend(
min( ii+block, m_ ) );
4634 for(
size_t j=jj; j<jend; ++j ) {
4635 for(
size_t i=ii; i<iend; ++i ) {
4636 cswap( v_[i+j*mm_], v_[j+i*mm_] );
4640 for(
size_t j=jj; j<jend; ++j ) {
4641 for(
size_t i=jj; i<j; ++i ) {
4642 cswap( v_[i+j*mm_], v_[j+i*mm_] );
4650 DynamicMatrix tmp(
ctrans(*
this) );
4667 template<
typename Type >
4668 template<
typename Other >
4669 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::scale(
const Other& scalar )
4671 for(
size_t j=0UL; j<
n_; ++j )
4672 for(
size_t i=0UL; i<
m_; ++i )
4673 v_[i+j*mm_] *= scalar;
4688 template<
typename Type >
4708 template<
typename Type >
4709 inline size_t DynamicMatrix<Type,true>::adjustRows(
size_t minRows )
const noexcept
4711 if(
usePadding && IsVectorizable<Type>::value )
4712 return nextMultiple<size_t>( minRows, SIMDSIZE );
4713 else return minRows;
4737 template<
typename Type >
4740 if( m_ * n_ > capacity_ )
4743 if( IsVectorizable<Type>::value ) {
4744 for(
size_t j=0UL; j<
n_; ++j ) {
4745 for(
size_t i=m_; i<mm_; ++i ) {
4746 if( v_[i+j*mm_] != Type() )
4777 template<
typename Type >
4778 template<
typename Other >
4781 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4798 template<
typename Type >
4799 template<
typename Other >
4802 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4818 template<
typename Type >
4838 template<
typename Type >
4841 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
4862 template<
typename Type >
4867 return loada( i, j );
4869 return loadu( i, j );
4890 template<
typename Type >
4904 return loada( v_+i+j*mm_ );
4925 template<
typename Type >
4937 return loadu( v_+i+j*mm_ );
4959 template<
typename Type >
4988 template<
typename Type >
5002 storea( v_+i+j*mm_, value );
5024 template<
typename Type >
5036 storeu( v_+i+j*mm_, value );
5059 template<
typename Type >
5073 stream( v_+i+j*mm_, value );
5091 template<
typename Type >
5092 template<
typename MT >
5093 inline DisableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >
5094 DynamicMatrix<Type,true>::assign(
const DenseMatrix<MT,true>& rhs )
5099 const size_t ipos( m_ &
size_t(-2) );
5102 for(
size_t j=0UL; j<
n_; ++j ) {
5103 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5104 v_[i +j*mm_] = (~rhs)(i ,j);
5105 v_[i+1UL+j*mm_] = (~rhs)(i+1UL,j);
5108 v_[ipos+j*mm_] = (~rhs)(ipos,j);
5128 template<
typename Type >
5129 template<
typename MT >
5130 inline EnableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >
5131 DynamicMatrix<Type,true>::assign(
const DenseMatrix<MT,true>& rhs )
5138 const bool remainder( !
usePadding || !IsPadded<MT>::value );
5140 const size_t ipos( ( remainder )?( m_ &
size_t(-SIMDSIZE) ):( m_ ) );
5141 BLAZE_INTERNAL_ASSERT( !remainder || ( m_ - ( m_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5144 ( m_*n_ > (
cacheSize / (
sizeof(Type) * 3UL ) ) ) && !(~rhs).isAliased(
this ) )
5146 for(
size_t j=0UL; j<
n_; ++j )
5149 Iterator left(
begin(j) );
5150 ConstIterator_<MT> right( (~rhs).
begin(j) );
5152 for( ; i<ipos; i+=SIMDSIZE ) {
5153 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5155 for( ; remainder && i<
m_; ++i ) {
5156 *left = *right; ++left; ++right;
5162 for(
size_t j=0UL; j<
n_; ++j )
5165 Iterator left(
begin(j) );
5166 ConstIterator_<MT> right( (~rhs).
begin(j) );
5168 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5169 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5170 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5171 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5172 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5174 for( ; i<ipos; i+=SIMDSIZE ) {
5175 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5177 for( ; remainder && i<
m_; ++i ) {
5178 *left = *right; ++left; ++right;
5199 template<
typename Type >
5200 template<
typename MT >
5201 inline void DynamicMatrix<Type,true>::assign(
const DenseMatrix<MT,false>& rhs )
5208 const size_t block( BLOCK_SIZE );
5210 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5211 const size_t jend(
min( n_, jj+block ) );
5212 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
5213 const size_t iend(
min( m_, ii+block ) );
5214 for(
size_t j=jj; j<jend; ++j ) {
5215 for(
size_t i=ii; i<iend; ++i ) {
5216 v_[i+j*mm_] = (~rhs)(i,j);
5238 template<
typename Type >
5239 template<
typename MT >
5240 inline void DynamicMatrix<Type,true>::assign(
const SparseMatrix<MT,true>& rhs )
5245 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5246 for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5247 v_[element->index()+j*mm_] = element->value();
5265 template<
typename Type >
5266 template<
typename MT >
5267 inline void DynamicMatrix<Type,true>::assign(
const SparseMatrix<MT,false>& rhs )
5274 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5275 for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5276 v_[i+element->index()*mm_] = element->value();
5294 template<
typename Type >
5295 template<
typename MT >
5296 inline DisableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
5297 DynamicMatrix<Type,true>::addAssign(
const DenseMatrix<MT,true>& rhs )
5302 for(
size_t j=0UL; j<
n_; ++j )
5304 if( IsDiagonal<MT>::value )
5306 v_[j+j*mm_] += (~rhs)(j,j);
5310 const size_t ibegin( ( IsLower<MT>::value )
5311 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5313 const size_t iend ( ( IsUpper<MT>::value )
5314 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5320 for( ; (i+2UL) <= iend; i+=2UL ) {
5321 v_[i +j*mm_] += (~rhs)(i ,j);
5322 v_[i+1UL+j*mm_] += (~rhs)(i+1UL,j);
5325 v_[i+j*mm_] += (~rhs)(i,j);
5346 template<
typename Type >
5347 template<
typename MT >
5348 inline EnableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
5349 DynamicMatrix<Type,true>::addAssign(
const DenseMatrix<MT,true>& rhs )
5357 const bool remainder( !
usePadding || !IsPadded<MT>::value );
5359 for(
size_t j=0UL; j<
n_; ++j )
5361 const size_t ibegin( ( IsLower<MT>::value )
5362 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-SIMDSIZE) )
5364 const size_t iend ( ( IsUpper<MT>::value )
5365 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5369 const size_t ipos( ( remainder )?( iend &
size_t(-SIMDSIZE) ):( iend ) );
5370 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5373 Iterator left(
begin(j) + ibegin );
5374 ConstIterator_<MT> right( (~rhs).
begin(j) + ibegin );
5376 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5377 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5378 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5379 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5380 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5382 for( ; i<ipos; i+=SIMDSIZE ) {
5383 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5385 for( ; remainder && i<iend; ++i ) {
5386 *left += *right; ++left; ++right;
5406 template<
typename Type >
5407 template<
typename MT >
5408 inline void DynamicMatrix<Type,true>::addAssign(
const DenseMatrix<MT,false>& rhs )
5415 const size_t block( BLOCK_SIZE );
5417 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5418 const size_t jend(
min( n_, jj+block ) );
5419 for(
size_t ii=0UL; ii<
m_; ii+=block )
5421 if( IsLower<MT>::value && ii < jj )
continue;
5422 if( IsUpper<MT>::value && ii > jj )
break;
5424 for(
size_t j=jj; j<jend; ++j )
5426 const size_t ibegin( ( IsLower<MT>::value )
5427 ?(
max( ( IsStrictlyLower<MT>::value ? j+1UL : j ), ii ) )
5429 const size_t iend ( ( IsUpper<MT>::value )
5430 ?(
min( ( IsStrictlyUpper<MT>::value ? j : j+1UL ), m_, ii+block ) )
5431 :(
min( m_, ii+block ) ) );
5434 for(
size_t i=ibegin; i<iend; ++i ) {
5435 v_[i+j*mm_] += (~rhs)(i,j);
5457 template<
typename Type >
5458 template<
typename MT >
5459 inline void DynamicMatrix<Type,true>::addAssign(
const SparseMatrix<MT,true>& rhs )
5464 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5465 for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5466 v_[element->index()+j*mm_] += element->value();
5484 template<
typename Type >
5485 template<
typename MT >
5486 inline void DynamicMatrix<Type,true>::addAssign(
const SparseMatrix<MT,false>& rhs )
5493 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5494 for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5495 v_[i+element->index()*mm_] += element->value();
5513 template<
typename Type >
5514 template<
typename MT >
5515 inline DisableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
5516 DynamicMatrix<Type,true>::subAssign(
const DenseMatrix<MT,true>& rhs )
5521 for(
size_t j=0UL; j<
n_; ++j )
5523 if( IsDiagonal<MT>::value )
5525 v_[j+j*mm_] -= (~rhs)(j,j);
5529 const size_t ibegin( ( IsLower<MT>::value )
5530 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5532 const size_t iend ( ( IsUpper<MT>::value )
5533 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5539 for( ; (i+2UL) <= iend; i+=2UL ) {
5540 v_[i +j*mm_] -= (~rhs)(i ,j);
5541 v_[i+1+j*mm_] -= (~rhs)(i+1,j);
5544 v_[i+j*mm_] -= (~rhs)(i,j);
5565 template<
typename Type >
5566 template<
typename MT >
5567 inline EnableIf_<typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
5568 DynamicMatrix<Type,true>::subAssign(
const DenseMatrix<MT,true>& rhs )
5576 const bool remainder( !
usePadding || !IsPadded<MT>::value );
5578 for(
size_t j=0UL; j<
n_; ++j )
5580 const size_t ibegin( ( IsLower<MT>::value )
5581 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-SIMDSIZE) )
5583 const size_t iend ( ( IsUpper<MT>::value )
5584 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5588 const size_t ipos( ( remainder )?( iend &
size_t(-SIMDSIZE) ):( iend ) );
5589 BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
5592 Iterator left(
begin(j) + ibegin );
5593 ConstIterator_<MT> right( (~rhs).
begin(j) + ibegin );
5595 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5596 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5597 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5598 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5599 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5601 for( ; i<ipos; i+=SIMDSIZE ) {
5602 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5604 for( ; remainder && i<iend; ++i ) {
5605 *left -= *right; ++left; ++right;
5625 template<
typename Type >
5626 template<
typename MT >
5627 inline void DynamicMatrix<Type,true>::subAssign(
const DenseMatrix<MT,false>& rhs )
5634 const size_t block( BLOCK_SIZE );
5636 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5637 const size_t jend(
min( n_, jj+block ) );
5638 for(
size_t ii=0UL; ii<
m_; ii+=block )
5640 if( IsLower<MT>::value && ii < jj )
continue;
5641 if( IsUpper<MT>::value && ii > jj )
break;
5643 for(
size_t j=jj; j<jend; ++j )
5645 const size_t ibegin( ( IsLower<MT>::value )
5646 ?(
max( ( IsStrictlyLower<MT>::value ? j+1UL : j ), ii ) )
5648 const size_t iend ( ( IsUpper<MT>::value )
5649 ?(
min( ( IsStrictlyUpper<MT>::value ? j : j+1UL ), m_, ii+block ) )
5650 :(
min( m_, ii+block ) ) );
5653 for(
size_t i=ibegin; i<iend; ++i ) {
5654 v_[i+j*mm_] -= (~rhs)(i,j);
5676 template<
typename Type >
5677 template<
typename MT >
5678 inline void DynamicMatrix<Type,true>::subAssign(
const SparseMatrix<MT,true>& rhs )
5683 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
5684 for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5685 v_[element->index()+j*mm_] -= element->value();
5703 template<
typename Type >
5704 template<
typename MT >
5705 inline void DynamicMatrix<Type,true>::subAssign(
const SparseMatrix<MT,false>& rhs )
5712 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
5713 for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5714 v_[i+element->index()*mm_] -= element->value();
5735 template<
typename Type,
bool SO >
5736 inline void reset( DynamicMatrix<Type,SO>& m );
5738 template<
typename Type,
bool SO >
5739 inline void reset( DynamicMatrix<Type,SO>& m,
size_t i );
5741 template<
typename Type,
bool SO >
5742 inline void clear( DynamicMatrix<Type,SO>& m );
5744 template<
typename Type,
bool SO >
5745 inline bool isDefault(
const DynamicMatrix<Type,SO>& m );
5747 template<
typename Type,
bool SO >
5748 inline bool isIntact(
const DynamicMatrix<Type,SO>& m ) noexcept;
5750 template<
typename Type,
bool SO >
5751 inline void swap( DynamicMatrix<Type,SO>& a, DynamicMatrix<Type,SO>& b ) noexcept;
5763 template<
typename Type
5785 template<
typename Type
5801 template<
typename Type
5828 template<
typename Type
5855 template<
typename Type
5859 return m.isIntact();
5872 template<
typename Type
5891 template<
typename T,
bool SO >
5892 struct HasConstDataAccess< DynamicMatrix<T,SO> > :
public TrueType
5908 template<
typename T,
bool SO >
5909 struct HasMutableDataAccess< DynamicMatrix<T,SO> > :
public TrueType
5925 template<
typename T,
bool SO >
5926 struct IsAligned< DynamicMatrix<T,SO> > :
public BoolConstant<usePadding>
5942 template<
typename T,
bool SO >
5943 struct IsPadded< DynamicMatrix<T,SO> > :
public BoolConstant<usePadding>
5959 template<
typename T,
bool SO >
5960 struct IsResizable< DynamicMatrix<T,SO> > :
public TrueType
5976 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5977 struct AddTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
5979 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
5982 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5983 struct AddTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5985 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N,
false >;
5988 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5989 struct AddTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
5991 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
5994 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5995 struct AddTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5997 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N,
false >;
6000 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6001 struct AddTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6003 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
6006 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6007 struct AddTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6009 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N,
false >;
6012 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6013 struct AddTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6015 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
6018 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6019 struct AddTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6021 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N,
false >;
6024 template<
typename T1,
bool SO,
typename T2 >
6025 struct AddTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6027 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
6030 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6031 struct AddTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6033 using Type = DynamicMatrix< AddTrait_<T1,T2>,
false >;
6049 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6050 struct SubTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6052 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6055 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6056 struct SubTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6058 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N,
false >;
6061 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6062 struct SubTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6064 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6067 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6068 struct SubTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6070 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N,
false >;
6073 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6074 struct SubTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6076 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
6079 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6080 struct SubTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6082 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N,
false >;
6085 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6086 struct SubTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
6088 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
6091 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6092 struct SubTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6094 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N,
false >;
6097 template<
typename T1,
bool SO,
typename T2 >
6098 struct SubTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6100 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
6103 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6104 struct SubTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6106 using Type = DynamicMatrix< SubTrait_<T1,T2>,
false >;
6122 template<
typename T1,
bool SO,
typename T2 >
6123 struct MultTrait< DynamicMatrix<T1,SO>, T2,
EnableIf_<IsNumeric<T2> > >
6125 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO >;
6128 template<
typename T1,
typename T2,
bool SO >
6129 struct MultTrait< T1, DynamicMatrix<T2,SO>,
EnableIf_<IsNumeric<T1> > >
6131 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO >;
6134 template<
typename T1,
bool SO,
typename T2,
size_t N >
6135 struct MultTrait< DynamicMatrix<T1,SO>, StaticVector<T2,N,false> >
6137 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6140 template<
typename T1,
size_t N,
typename T2,
bool SO >
6141 struct MultTrait< StaticVector<T1,N,true>, DynamicMatrix<T2,SO> >
6143 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6146 template<
typename T1,
bool SO,
typename T2,
size_t N >
6147 struct MultTrait< DynamicMatrix<T1,SO>, HybridVector<T2,N,false> >
6149 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6152 template<
typename T1,
size_t N,
typename T2,
bool SO >
6153 struct MultTrait< HybridVector<T1,N,true>, DynamicMatrix<T2,SO> >
6155 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6158 template<
typename T1,
bool SO,
typename T2 >
6159 struct MultTrait< DynamicMatrix<T1,SO>, DynamicVector<T2,false> >
6161 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6164 template<
typename T1,
typename T2,
bool SO >
6165 struct MultTrait< DynamicVector<T1,true>, DynamicMatrix<T2,SO> >
6167 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6170 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
6171 struct MultTrait< DynamicMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
6173 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6176 template<
typename T1,
bool AF,
bool PF,
typename T2,
bool SO >
6177 struct MultTrait< CustomVector<T1,AF,PF,true>, DynamicMatrix<T2,SO> >
6179 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6182 template<
typename T1,
bool SO,
typename T2 >
6183 struct MultTrait< DynamicMatrix<T1,SO>, CompressedVector<T2,false> >
6185 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6188 template<
typename T1,
typename T2,
bool SO >
6189 struct MultTrait< CompressedVector<T1,true>, DynamicMatrix<T2,SO> >
6191 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6194 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6195 struct MultTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6197 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6200 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6201 struct MultTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6203 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6206 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6207 struct MultTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6209 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6212 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6213 struct MultTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
6215 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6218 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6219 struct MultTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6221 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6237 template<
typename T1,
bool SO,
typename T2 >
6238 struct DivTrait< DynamicMatrix<T1,SO>, T2,
EnableIf_<IsNumeric<T2> > >
6240 using Type = DynamicMatrix< DivTrait_<T1,T2>, SO >;
6256 template<
typename T1,
bool SO,
typename T2 >
6257 struct MathTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6259 using HighType = DynamicMatrix< typename MathTrait<T1,T2>::HighType, SO >;
6260 using LowType = DynamicMatrix< typename MathTrait<T1,T2>::LowType , SO >;
6276 template<
typename T1,
bool SO >
6277 struct SubmatrixTrait< DynamicMatrix<T1,SO> >
6279 using Type = DynamicMatrix<T1,SO>;
6295 template<
typename T1,
bool SO >
6296 struct RowTrait< DynamicMatrix<T1,SO> >
6298 using Type = DynamicVector<T1,true>;
6314 template<
typename T1,
bool SO >
6315 struct ColumnTrait< DynamicMatrix<T1,SO> >
6317 using Type = DynamicVector<T1,false>;
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:461
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:2254
Header file for kernel specific block sizes.
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
void reserve(size_t elements)
Setting the minimum capacity of the matrix.
Definition: DynamicMatrix.h:1791
#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
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: DynamicMatrix.h:2030
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:2155
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the row trait.
bool isIntact() const noexcept
Returns whether the invariants of the dynamic matrix are intact.
Definition: DynamicMatrix.h:1970
Type *BLAZE_RESTRICT v_
The dynamically allocated matrix elements.
Definition: DynamicMatrix.h:464
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.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DynamicMatrix.h:1509
DynamicMatrix & operator=(const Type &rhs)
Homogenous assignment to all matrix elements.
Definition: DynamicMatrix.h:1149
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the matrix.
Definition: DynamicMatrix.h:1715
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:258
const CTransExprTrait_< MT > ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatForEachExpr.h:1195
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
DynamicMatrix() noexcept
The default constructor for DynamicMatrix.
Definition: DynamicMatrix.h:502
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:2189
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:315
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: DynamicMatrix.h:2067
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2805
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:1669
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:590
#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
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:2120
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:208
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
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
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:203
bool isAligned() const noexcept
Returns whether the matrix is properly aligned in memory.
Definition: DynamicMatrix.h:2048
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
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:1716
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:2289
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
const This & CompositeType
Data type for composite expression templates.
Definition: DynamicMatrix.h:215
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2807
~DynamicMatrix()
The destructor for DynamicMatrix.
Definition: DynamicMatrix.h:806
This ResultType
Result type for expression template evaluations.
Definition: DynamicMatrix.h:209
Header file for the std::initializer_list aliases.
Header file for the SparseMatrix base class.
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: DynamicMatrix.h:1578
EnableIf_< IsBuiltin< T >, T * > allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:150
DenseIterator< Type, usePadding > Iterator
Iterator over non-constant elements.
Definition: DynamicMatrix.h:222
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 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:1860
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:5148
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:212
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#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:207
Header file for the HasSIMDAdd type trait.
Header file for the DenseMatrix base class.
Header file for the DenseIterator class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicMatrix.h:214
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
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
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
void extend(size_t m, size_t n, bool preserve=true)
Extending the size of the matrix.
Definition: DynamicMatrix.h:1773
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:1628
size_t spacing() const noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DynamicMatrix.h:1528
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
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
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:210
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: DynamicMatrix.h:2010
SIMDTrait_< ElementType > SIMDType
SIMD type of the matrix elements.
Definition: DynamicMatrix.h:213
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:2218
Header file for the IsVectorizable type trait.
Pointer data() noexcept
Low-level data access to the matrix elements.
Definition: DynamicMatrix.h:934
Reference operator()(size_t i, size_t j) noexcept
2D-access to the matrix elements.
Definition: DynamicMatrix.h:834
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:462
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
BLAZE_ALWAYS_INLINE SIMDType load(size_t i, size_t j) const noexcept
Load of a SIMD element of the matrix.
Definition: DynamicMatrix.h:2092
Type * Pointer
Pointer to a non-constant matrix value.
Definition: DynamicMatrix.h:219
#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
size_t adjustColumns(size_t minColumns) const noexcept
Adjusting the number columns of the matrix according to its data type Type.
Definition: DynamicMatrix.h:1942
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.
Iterator begin(size_t i) noexcept
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:1015
Header file for the addition trait.
void clear()
Clearing the matrix.
Definition: DynamicMatrix.h:1672
const SIMDType load() const noexcept
Load of the SIMD element at the current iterator position.
Definition: DenseIterator.h:403
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: DynamicMatrix.h:220
Header file for the division trait.
Header file for the InvExprTrait class template.
Header file for the submatrix trait.
Constraint on the data type.
size_t m_
The current number of rows of the matrix.
Definition: DynamicMatrix.h:460
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
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
Header file for the column trait.
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:258
System settings for the restrict keyword.
Header file for the TransExprTrait class template.
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:89
Constraint on the data type.
void swap(DynamicMatrix &m) noexcept
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:1923
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.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
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
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
Header file for the mathematical trait.
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:217
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2806
Header file for the AreSIMDCombinable type trait.
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:223
Iterator end(size_t i) noexcept
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:1081
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
Initializer list type of the Blaze library.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DynamicMatrix.h:1495
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:463
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
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:230
size_t capacity() const noexcept
Returns the maximum capacity of the matrix.
Definition: DynamicMatrix.h:1542
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2654
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.
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:1125
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the CTransExprTrait class template.
void store(const SIMDType &value) const noexcept
Store of the SIMD element at the current iterator position.
Definition: DenseIterator.h:468
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: DynamicMatrix.h:879
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< ET, SO > Other
The type of the other DynamicMatrix.
Definition: DynamicMatrix.h:231
DynamicMatrix & transpose()
In-place transpose of the matrix.
Definition: DynamicMatrix.h:1822
const Type & ConstReference
Reference to a constant matrix value.
Definition: DynamicMatrix.h:218
DynamicMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: DynamicMatrix.h:211
Header file for the TrueType type/value trait base class.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:564
ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:1059
constexpr bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56