35 #ifndef _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_
36 #define _BLAZE_MATH_DENSE_DYNAMICMATRIX_H_
185 template<
typename Type
215 template<
typename ET >
241 explicit inline DynamicMatrix(
size_t m,
size_t n,
const Type& init );
242 template<
typename Other >
explicit inline DynamicMatrix(
size_t m,
size_t n,
const Other* array );
244 template<
typename Other,
size_t M,
size_t N >
248 template<
typename MT,
bool SO2 >
inline DynamicMatrix(
const Matrix<MT,SO2>& m );
262 inline Reference
operator()(
size_t i,
size_t j );
263 inline ConstReference
operator()(
size_t i,
size_t j )
const;
264 inline Pointer
data ();
265 inline ConstPointer
data ()
const;
266 inline Pointer
data (
size_t i );
267 inline ConstPointer
data (
size_t i )
const;
268 inline Iterator
begin (
size_t i );
269 inline ConstIterator
begin (
size_t i )
const;
270 inline ConstIterator
cbegin(
size_t i )
const;
271 inline Iterator
end (
size_t i );
272 inline ConstIterator
end (
size_t i )
const;
273 inline ConstIterator
cend (
size_t i )
const;
280 template<
typename Other,
size_t M,
size_t N >
281 inline DynamicMatrix& operator=(
const Other (&array)[M][N] );
285 template<
typename MT,
bool SO2 >
inline DynamicMatrix& operator= (
const Matrix<MT,SO2>& rhs );
286 template<
typename MT,
bool SO2 >
inline DynamicMatrix& operator+=(
const Matrix<MT,SO2>& rhs );
287 template<
typename MT,
bool SO2 >
inline DynamicMatrix& operator-=(
const Matrix<MT,SO2>& rhs );
288 template<
typename MT,
bool SO2 >
inline DynamicMatrix& operator*=(
const Matrix<MT,SO2>& rhs );
290 template<
typename Other >
291 inline typename EnableIf< IsNumeric<Other>,
DynamicMatrix >::Type&
292 operator*=( Other rhs );
294 template<
typename Other >
295 inline typename EnableIf< IsNumeric<Other>,
DynamicMatrix >::Type&
296 operator/=( Other rhs );
303 inline size_t rows()
const;
307 inline size_t capacity(
size_t i )
const;
309 inline size_t nonZeros(
size_t i )
const;
311 inline void reset(
size_t i );
313 void resize (
size_t m,
size_t n,
bool preserve=
true );
314 inline void extend (
size_t m,
size_t n,
bool preserve=
true );
315 inline void reserve(
size_t elements );
317 template<
typename Other >
inline DynamicMatrix& scale(
const Other& scalar );
325 template<
typename MT >
327 struct VectorizedAssign {
328 enum { value = vectorizable && MT::vectorizable &&
329 IsSame<Type,typename MT::ElementType>::value };
336 template<
typename MT >
338 struct VectorizedAddAssign {
339 enum { value = vectorizable && MT::vectorizable &&
340 IsSame<Type,typename MT::ElementType>::value &&
341 IntrinsicTrait<Type>::addition &&
342 !IsDiagonal<MT>::value };
349 template<
typename MT >
351 struct VectorizedSubAssign {
352 enum { value = vectorizable && MT::vectorizable &&
353 IsSame<Type,typename MT::ElementType>::value &&
354 IntrinsicTrait<Type>::subtraction &&
355 !IsDiagonal<MT>::value };
364 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
365 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
377 template<
typename MT >
378 inline typename DisableIf< VectorizedAssign<MT> >::Type
379 assign(
const DenseMatrix<MT,SO>& rhs );
381 template<
typename MT >
382 inline typename EnableIf< VectorizedAssign<MT> >::Type
383 assign(
const DenseMatrix<MT,SO>& rhs );
385 template<
typename MT >
inline void assign(
const DenseMatrix<MT,!SO>& rhs );
386 template<
typename MT >
inline void assign(
const SparseMatrix<MT,SO>& rhs );
387 template<
typename MT >
inline void assign(
const SparseMatrix<MT,!SO>& rhs );
389 template<
typename MT >
390 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
391 addAssign(
const DenseMatrix<MT,SO>& rhs );
393 template<
typename MT >
394 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
395 addAssign(
const DenseMatrix<MT,SO>& rhs );
397 template<
typename MT >
inline void addAssign(
const DenseMatrix<MT,!SO>& rhs );
398 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,SO>& rhs );
399 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,!SO>& rhs );
401 template<
typename MT >
402 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
403 subAssign(
const DenseMatrix<MT,SO>& rhs );
405 template<
typename MT >
406 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
407 subAssign(
const DenseMatrix<MT,SO>& rhs );
409 template<
typename MT >
inline void subAssign(
const DenseMatrix<MT,!SO>& rhs );
410 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,SO>& rhs );
411 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,!SO>& rhs );
466 template<
typename Type
487 template<
typename Type
492 , nn_ ( adjustColumns( n ) )
497 for(
size_t i=0UL; i<
m_; ++i ) {
498 for(
size_t j=
n_; j<
nn_; ++j )
499 v_[i*nn_+j] = Type();
515 template<
typename Type
520 , nn_ ( adjustColumns( n ) )
524 for(
size_t i=0UL; i<m; ++i ) {
525 for(
size_t j=0UL; j<
n_; ++j )
529 for(
size_t j=n_; j<
nn_; ++j )
530 v_[i*nn_+j] = Type();
560 template<
typename Type
562 template<
typename Other >
566 , nn_ ( adjustColumns( n ) )
570 for(
size_t i=0UL; i<m; ++i ) {
571 for(
size_t j=0UL; j<n; ++j )
572 v_[i*
nn_+j] = array[i*n+j];
575 for(
size_t j=n; j<
nn_; ++j )
576 v_[i*nn_+j] = Type();
604 template<
typename Type
606 template<
typename Other
612 , nn_ ( adjustColumns( N ) )
616 for(
size_t i=0UL; i<M; ++i ) {
617 for(
size_t j=0UL; j<N; ++j )
618 v_[i*
nn_+j] = array[i][j];
621 for(
size_t j=N; j<
nn_; ++j )
622 v_[i*nn_+j] = Type();
637 template<
typename Type
659 template<
typename Type
661 template<
typename MT
666 , nn_ ( adjustColumns(
n_ ) )
670 for(
size_t i=0UL; i<
m_; ++i ) {
672 j<( IsVectorizable<Type>::value ?
nn_ :
n_ ); ++j ) {
673 v_[i*
nn_+j] = Type();
693 template<
typename Type
717 template<
typename Type
736 template<
typename Type
760 template<
typename Type
781 template<
typename Type
798 template<
typename Type
816 template<
typename Type
837 template<
typename Type
859 template<
typename Type
881 template<
typename Type
903 template<
typename Type
925 template<
typename Type
947 template<
typename Type
987 template<
typename Type
989 template<
typename Other
996 for(
size_t i=0UL; i<M; ++i )
997 for(
size_t j=0UL; j<N; ++j )
998 v_[i*nn_+j] = array[i][j];
1011 template<
typename Type
1015 for(
size_t i=0UL; i<
m_; ++i )
1016 for(
size_t j=0UL; j<
n_; ++j )
1033 template<
typename Type
1037 if( &rhs ==
this )
return *
this;
1056 template<
typename Type
1058 template<
typename MT
1062 if( (~rhs).canAlias(
this ) ) {
1088 template<
typename Type
1090 template<
typename MT
1095 throw std::invalid_argument(
"Matrix sizes do not match" );
1097 if( (~rhs).canAlias(
this ) ) {
1120 template<
typename Type
1122 template<
typename MT
1127 throw std::invalid_argument(
"Matrix sizes do not match" );
1129 if( (~rhs).canAlias(
this ) ) {
1152 template<
typename Type
1154 template<
typename MT
1158 if( (~rhs).
rows() !=
n_ )
1159 throw std::invalid_argument(
"Matrix sizes do not match" );
1176 template<
typename Type
1178 template<
typename Other >
1195 template<
typename Type
1197 template<
typename Other >
1222 template<
typename Type
1236 template<
typename Type
1255 template<
typename Type
1269 template<
typename Type
1289 template<
typename Type
1305 template<
typename Type
1309 size_t nonzeros( 0UL );
1311 for(
size_t i=0UL; i<
m_; ++i )
1312 for(
size_t j=0UL; j<
n_; ++j )
1332 template<
typename Type
1338 const size_t jend( (i+1UL)*nn_ );
1339 size_t nonzeros( 0UL );
1341 for(
size_t j=i*nn_; j<jend; ++j )
1355 template<
typename Type
1361 for(
size_t i=0UL; i<
m_; ++i )
1362 for(
size_t j=0UL; j<
n_; ++j )
1363 clear( v_[i*nn_+j] );
1379 template<
typename Type
1386 for(
size_t j=0UL; j<
n_; ++j )
1387 clear( v_[i*nn_+j] );
1399 template<
typename Type
1403 resize( 0UL, 0UL,
false );
1442 template<
typename Type
1448 if( m ==
m_ && n ==
n_ )
return;
1450 const size_t nn( adjustColumns( n ) );
1455 const size_t min_m(
min( m,
m_ ) );
1456 const size_t min_n(
min( n,
n_ ) );
1458 for(
size_t i=0UL; i<min_m; ++i )
1459 for(
size_t j=0UL; j<min_n; ++j )
1460 v[i*nn+j] = v_[i*nn_+j];
1474 for(
size_t i=0UL; i<m; ++i )
1475 for(
size_t j=n; j<nn; ++j )
1476 v_[i*nn+j] = Type();
1500 template<
typename Type
1518 template<
typename Type
1531 for(
size_t i=
capacity_; i<elements; ++i )
1549 template<
typename Type
1566 template<
typename Type
1568 template<
typename Other >
1571 for(
size_t i=0UL; i<
m_; ++i )
1572 for(
size_t j=0UL; j<
n_; ++j )
1573 v_[i*nn_+j] *= scalar;
1587 template<
typename Type
1606 template<
typename Type
1612 else return minColumns;
1635 template<
typename Type
1637 template<
typename Other >
1640 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1655 template<
typename Type
1657 template<
typename Other >
1660 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1674 template<
typename Type
1693 template<
typename Type
1717 template<
typename Type
1731 return load( v_+i*nn_+j );
1751 template<
typename Type
1764 return loadu( v_+i*nn_+j );
1785 template<
typename Type
1799 store( v_+i*nn_+j, value );
1820 template<
typename Type
1833 storeu( v_+i*nn_+j, value );
1854 template<
typename Type
1868 stream( v_+i*nn_+j, value );
1884 template<
typename Type
1886 template<
typename MT >
1893 const size_t jpos(
n_ &
size_t(-2) );
1896 for(
size_t i=0UL; i<
m_; ++i ) {
1897 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1898 v_[i*nn_+j ] = (~rhs)(i,j );
1899 v_[i*nn_+j+1UL] = (~rhs)(i,j+1UL);
1902 v_[i*nn_+jpos] = (~rhs)(i,jpos);
1920 template<
typename Type
1922 template<
typename MT >
1936 for(
size_t i=0UL; i<
m_; ++i )
1942 const size_t jpos(
n_ &
size_t(-
IT::size*4) );
1945 for(
size_t i=0UL; i<
m_; ++i ) {
1947 for(
size_t j=0UL; j<jpos; j+=
IT::size*4UL ) {
1954 store( v_+i*nn_+j, it.load() );
1973 template<
typename Type
1975 template<
typename MT >
1983 const size_t block( 16UL );
1985 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
1986 const size_t iend(
min( m_, ii+block ) );
1987 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
1988 const size_t jend(
min( n_, jj+block ) );
1989 for(
size_t i=ii; i<iend; ++i ) {
1990 for(
size_t j=jj; j<jend; ++j ) {
1991 v_[i*nn_+j] = (~rhs)(i,j);
2011 template<
typename Type
2013 template<
typename MT >
2019 for(
size_t i=0UL; i<
m_; ++i )
2021 v_[i*nn_+element->index()] = element->value();
2037 template<
typename Type
2039 template<
typename MT >
2047 for(
size_t j=0UL; j<
n_; ++j )
2049 v_[element->index()*nn_+j] = element->value();
2065 template<
typename Type
2067 template<
typename MT >
2074 for(
size_t i=0UL; i<
m_; ++i )
2078 v_[i*nn_+i] += (~rhs)(i,i);
2092 for( ; (j+2UL) <= jend; j+=2UL ) {
2093 v_[i*nn_+j ] += (~rhs)(i,j );
2094 v_[i*nn_+j+1UL] += (~rhs)(i,j+1UL);
2097 v_[i*nn_+j] += (~rhs)(i,j);
2116 template<
typename Type
2118 template<
typename MT >
2131 for(
size_t i=0UL; i<
m_; ++i )
2151 store( v_+i*nn_+j,
load( v_+i*nn_+j ) + it.load() );
2169 template<
typename Type
2171 template<
typename MT >
2179 const size_t block( 16UL );
2181 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2182 const size_t iend(
min( m_, ii+block ) );
2183 for(
size_t jj=0UL; jj<
n_; jj+=block )
2188 for(
size_t i=ii; i<iend; ++i )
2195 :(
min( n_, jj+block ) ) );
2198 for(
size_t j=jbegin; j<jend; ++j ) {
2199 v_[i*nn_+j] += (~rhs)(i,j);
2219 template<
typename Type
2221 template<
typename MT >
2227 for(
size_t i=0UL; i<
m_; ++i )
2229 v_[i*nn_+element->index()] += element->value();
2245 template<
typename Type
2247 template<
typename MT >
2255 for(
size_t j=0UL; j<
n_; ++j )
2257 v_[element->index()*nn_+j] += element->value();
2273 template<
typename Type
2275 template<
typename MT >
2282 for(
size_t i=0UL; i<
m_; ++i )
2286 v_[i*nn_+i] -= (~rhs)(i,i);
2300 for( ; (j+2UL) <= jend; j+=2UL ) {
2301 v_[i*nn_+j ] -= (~rhs)(i,j );
2302 v_[i*nn_+j+1UL] -= (~rhs)(i,j+1UL);
2305 v_[i*nn_+j] -= (~rhs)(i,j);
2324 template<
typename Type
2326 template<
typename MT >
2339 for(
size_t i=0UL; i<
m_; ++i )
2359 store( v_+i*nn_+j,
load( v_+i*nn_+j ) - it.load() );
2377 template<
typename Type
2379 template<
typename MT >
2387 const size_t block( 16UL );
2389 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2390 const size_t iend(
min( m_, ii+block ) );
2391 for(
size_t jj=0UL; jj<
n_; jj+=block )
2396 for(
size_t i=ii; i<iend; ++i )
2403 :(
min( n_, jj+block ) ) );
2406 for(
size_t j=jbegin; j<jend; ++j ) {
2407 v_[i*nn_+j] -= (~rhs)(i,j);
2427 template<
typename Type
2429 template<
typename MT >
2435 for(
size_t i=0UL; i<
m_; ++i )
2437 v_[i*nn_+element->index()] -= element->value();
2453 template<
typename Type
2455 template<
typename MT >
2463 for(
size_t j=0UL; j<
n_; ++j )
2465 v_[element->index()*nn_+j] -= element->value();
2490 template<
typename Type >
2519 template<
typename ET >
2531 enum { vectorizable = IsVectorizable<Type>::value };
2537 enum { smpAssignable = !IsSMPAssignable<Type>::value };
2545 explicit inline DynamicMatrix(
size_t m,
size_t n,
const Type& init );
2546 template<
typename Other >
explicit inline DynamicMatrix(
size_t m,
size_t n,
const Other* array );
2548 template<
typename Other,
size_t M,
size_t N >
2549 explicit inline DynamicMatrix(
const Other (&array)[M][N] );
2552 template<
typename MT,
bool SO >
inline DynamicMatrix(
const Matrix<MT,SO>& m );
2566 inline Reference
operator()(
size_t i,
size_t j );
2567 inline ConstReference
operator()(
size_t i,
size_t j )
const;
2568 inline Pointer
data ();
2569 inline ConstPointer
data ()
const;
2570 inline Pointer
data (
size_t j );
2571 inline ConstPointer
data (
size_t j )
const;
2572 inline Iterator
begin (
size_t j );
2573 inline ConstIterator
begin (
size_t j )
const;
2574 inline ConstIterator
cbegin(
size_t j )
const;
2575 inline Iterator
end (
size_t j );
2576 inline ConstIterator
end (
size_t j )
const;
2577 inline ConstIterator
cend (
size_t j )
const;
2584 template<
typename Other,
size_t M,
size_t N >
2585 inline DynamicMatrix& operator=(
const Other (&array)[M][N] );
2589 template<
typename MT,
bool SO >
inline DynamicMatrix& operator= (
const Matrix<MT,SO>& rhs );
2590 template<
typename MT,
bool SO >
inline DynamicMatrix& operator+=(
const Matrix<MT,SO>& rhs );
2591 template<
typename MT,
bool SO >
inline DynamicMatrix& operator-=(
const Matrix<MT,SO>& rhs );
2592 template<
typename MT,
bool SO >
inline DynamicMatrix& operator*=(
const Matrix<MT,SO>& rhs );
2594 template<
typename Other >
2595 inline typename EnableIf< IsNumeric<Other>,
DynamicMatrix >::Type&
2596 operator*=( Other rhs );
2598 template<
typename Other >
2599 inline typename EnableIf< IsNumeric<Other>,
DynamicMatrix >::Type&
2600 operator/=( Other rhs );
2607 inline size_t rows()
const;
2608 inline size_t columns()
const;
2609 inline size_t spacing()
const;
2611 inline size_t capacity(
size_t j )
const;
2613 inline size_t nonZeros(
size_t j )
const;
2614 inline void reset();
2615 inline void reset(
size_t j );
2616 inline void clear();
2617 void resize (
size_t m,
size_t n,
bool preserve=
true );
2618 inline void extend (
size_t m,
size_t n,
bool preserve=
true );
2619 inline void reserve(
size_t elements );
2621 template<
typename Other >
inline DynamicMatrix& scale(
const Other& scalar );
2629 template<
typename MT >
2630 struct VectorizedAssign {
2631 enum { value = vectorizable && MT::vectorizable &&
2632 IsSame<Type,typename MT::ElementType>::value };
2638 template<
typename MT >
2639 struct VectorizedAddAssign {
2640 enum { value = vectorizable && MT::vectorizable &&
2641 IsSame<Type,typename MT::ElementType>::value &&
2642 IntrinsicTrait<Type>::addition &&
2643 !IsDiagonal<MT>::value };
2649 template<
typename MT >
2650 struct VectorizedSubAssign {
2651 enum { value = vectorizable && MT::vectorizable &&
2652 IsSame<Type,typename MT::ElementType>::value &&
2653 IntrinsicTrait<Type>::subtraction &&
2654 !IsDiagonal<MT>::value };
2662 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2663 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2675 template<
typename MT >
2676 inline typename DisableIf< VectorizedAssign<MT> >::Type
2677 assign(
const DenseMatrix<MT,true>& rhs );
2679 template<
typename MT >
2680 inline typename EnableIf< VectorizedAssign<MT> >::Type
2681 assign(
const DenseMatrix<MT,true>& rhs );
2683 template<
typename MT >
inline void assign(
const DenseMatrix<MT,false>& rhs );
2684 template<
typename MT >
inline void assign(
const SparseMatrix<MT,true>& rhs );
2685 template<
typename MT >
inline void assign(
const SparseMatrix<MT,false>& rhs );
2687 template<
typename MT >
2688 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
2689 addAssign(
const DenseMatrix<MT,true>& rhs );
2691 template<
typename MT >
2692 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
2693 addAssign(
const DenseMatrix<MT,true>& rhs );
2695 template<
typename MT >
inline void addAssign(
const DenseMatrix<MT,false>& rhs );
2696 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,true>& rhs );
2697 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,false>& rhs );
2699 template<
typename MT >
2700 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
2701 subAssign (
const DenseMatrix<MT,true>& rhs );
2703 template<
typename MT >
2704 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
2705 subAssign (
const DenseMatrix<MT,true>& rhs );
2707 template<
typename MT >
inline void subAssign(
const DenseMatrix<MT,false>& rhs );
2708 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,true>& rhs );
2709 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,false>& rhs );
2717 inline size_t adjustRows(
size_t minRows )
const;
2764 template<
typename Type >
2786 template<
typename Type >
2789 , mm_ ( adjustRows( m ) )
2794 if( IsVectorizable<Type>::value ) {
2795 for(
size_t j=0UL; j<
n_; ++j )
2796 for(
size_t i=
m_; i<mm_; ++i ) {
2797 v_[i+j*mm_] = Type();
2815 template<
typename Type >
2818 , mm_ ( adjustRows( m ) )
2823 for(
size_t j=0UL; j<
n_; ++j ) {
2824 for(
size_t i=0UL; i<
m_; ++i )
2827 if( IsVectorizable<Type>::value ) {
2828 for(
size_t i=m_; i<mm_; ++i )
2829 v_[i+j*mm_] = Type();
2861 template<
typename Type >
2862 template<
typename Other >
2865 , mm_ ( adjustRows( m ) )
2870 for(
size_t j=0UL; j<n; ++j ) {
2871 for(
size_t i=0UL; i<m; ++i )
2872 v_[i+j*mm_] = array[i+j*m];
2874 if( IsVectorizable<Type>::value ) {
2875 for(
size_t i=m; i<mm_; ++i )
2876 v_[i+j*mm_] = Type();
2906 template<
typename Type >
2907 template<
typename Other
2912 , mm_ ( adjustRows( M ) )
2917 for(
size_t j=0UL; j<N; ++j ) {
2918 for(
size_t i=0UL; i<M; ++i )
2919 v_[i+j*mm_] = array[i][j];
2921 if( IsVectorizable<Type>::value ) {
2922 for(
size_t i=M; i<mm_; ++i )
2923 v_[i+j*mm_] = Type();
2940 template<
typename Type >
2963 template<
typename Type >
2964 template<
typename MT
2967 : m_ ( (~m).
rows() )
2968 , mm_ ( adjustRows( m_ ) )
2973 for(
size_t j=0UL; j<
n_; ++j ) {
2974 for(
size_t i=( IsSparseMatrix<MT>::value ? 0UL : m_ );
2975 i<( IsVectorizable<Type>::value ? mm_ :
m_ ); ++i ) {
2976 v_[i+j*mm_] = Type();
2998 template<
typename Type >
3023 template<
typename Type >
3043 template<
typename Type >
3067 template<
typename Type >
3088 template<
typename Type >
3106 template<
typename Type >
3125 template<
typename Type >
3142 template<
typename Type >
3160 template<
typename Type >
3178 template<
typename Type >
3196 template<
typename Type >
3201 return Iterator( v_ + j*mm_ + m_ );
3214 template<
typename Type >
3232 template<
typename Type >
3273 template<
typename Type >
3274 template<
typename Other
3277 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator=(
const Other (&array)[M][N] )
3281 for(
size_t j=0UL; j<N; ++j )
3282 for(
size_t i=0UL; i<M; ++i )
3283 v_[i+j*mm_] = array[i][j];
3298 template<
typename Type >
3299 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator=( Type rhs )
3301 for(
size_t j=0UL; j<
n_; ++j )
3302 for(
size_t i=0UL; i<
m_; ++i )
3321 template<
typename Type >
3322 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator=(
const DynamicMatrix& rhs )
3324 if( &rhs ==
this )
return *
this;
3326 resize( rhs.m_, rhs.n_,
false );
3345 template<
typename Type >
3346 template<
typename MT
3348 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator=(
const Matrix<MT,SO>& rhs )
3350 if( (~rhs).canAlias(
this ) ) {
3351 DynamicMatrix tmp( ~rhs );
3356 if( IsSparseMatrix<MT>::value )
3378 template<
typename Type >
3379 template<
typename MT
3381 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator+=(
const Matrix<MT,SO>& rhs )
3383 if( (~rhs).
rows() != m_ || (~rhs).
columns() != n_ )
3384 throw std::invalid_argument(
"Matrix sizes do not match" );
3386 if( (~rhs).canAlias(
this ) ) {
3411 template<
typename Type >
3412 template<
typename MT
3414 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator-=(
const Matrix<MT,SO>& rhs )
3416 if( (~rhs).
rows() != m_ || (~rhs).
columns() != n_ )
3417 throw std::invalid_argument(
"Matrix sizes do not match" );
3419 if( (~rhs).canAlias(
this ) ) {
3444 template<
typename Type >
3445 template<
typename MT
3447 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::operator*=(
const Matrix<MT,SO>& rhs )
3449 if( (~rhs).
rows() != n_ )
3450 throw std::invalid_argument(
"Matrix sizes do not match" );
3452 DynamicMatrix tmp( *
this * (~rhs) );
3469 template<
typename Type >
3470 template<
typename Other >
3471 inline typename EnableIf< IsNumeric<Other>, DynamicMatrix<Type,true> >::Type&
3472 DynamicMatrix<Type,true>::operator*=( Other rhs )
3489 template<
typename Type >
3490 template<
typename Other >
3491 inline typename EnableIf< IsNumeric<Other>, DynamicMatrix<Type,true> >::Type&
3492 DynamicMatrix<Type,true>::operator/=( Other rhs )
3517 template<
typename Type >
3532 template<
typename Type >
3550 template<
typename Type >
3565 template<
typename Type >
3581 template<
typename Type >
3598 template<
typename Type >
3601 size_t nonzeros( 0UL );
3603 for(
size_t j=0UL; j<
n_; ++j )
3604 for(
size_t i=0UL; i<
m_; ++i )
3621 template<
typename Type >
3626 const size_t iend( (j+1UL)*mm_ );
3627 size_t nonzeros( 0UL );
3629 for(
size_t i=j*mm_; i<iend; ++i )
3645 template<
typename Type >
3650 for(
size_t j=0UL; j<
n_; ++j )
3651 for(
size_t i=0UL; i<
m_; ++i )
3652 clear( v_[i+j*mm_] );
3668 template<
typename Type >
3674 for(
size_t i=0UL; i<
m_; ++i )
3675 clear( v_[i+j*mm_] );
3689 template<
typename Type >
3692 resize( 0UL, 0UL,
false );
3733 template<
typename Type >
3738 if( m == m_ && n == n_ )
return;
3740 const size_t mm( adjustRows( m ) );
3745 const size_t min_m(
min( m, m_ ) );
3746 const size_t min_n(
min( n, n_ ) );
3748 for(
size_t j=0UL; j<min_n; ++j )
3749 for(
size_t i=0UL; i<min_m; ++i )
3750 v[i+j*mm] = v_[i+j*mm_];
3763 if( IsVectorizable<Type>::value ) {
3764 for(
size_t j=0UL; j<n; ++j )
3765 for(
size_t i=m; i<mm; ++i )
3766 v_[i+j*mm] = Type();
3792 template<
typename Type >
3795 resize( m_+m, n_+n, preserve );
3811 template<
typename Type >
3822 if( IsVectorizable<Type>::value ) {
3823 for(
size_t i=
capacity_; i<elements; ++i )
3843 template<
typename Type >
3846 DynamicMatrix tmp(
trans(*
this) );
3861 template<
typename Type >
3862 template<
typename Other >
3863 inline DynamicMatrix<Type,true>& DynamicMatrix<Type,true>::scale(
const Other& scalar )
3865 for(
size_t j=0UL; j<
n_; ++j )
3866 for(
size_t i=0UL; i<
m_; ++i )
3867 v_[i+j*mm_] *= scalar;
3883 template<
typename Type >
3903 template<
typename Type >
3904 inline size_t DynamicMatrix<Type,true>::adjustRows(
size_t minRows )
const
3906 if( IsVectorizable<Type>::value )
3908 else return minRows;
3933 template<
typename Type >
3934 template<
typename Other >
3937 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
3954 template<
typename Type >
3955 template<
typename Other >
3958 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
3974 template<
typename Type >
3994 template<
typename Type >
4018 template<
typename Type >
4031 return load( v_+i+j*mm_ );
4052 template<
typename Type >
4064 return loadu( v_+i+j*mm_ );
4086 template<
typename Type >
4099 store( v_+i+j*mm_, value );
4121 template<
typename Type >
4133 storeu( v_+i+j*mm_, value );
4156 template<
typename Type >
4169 stream( v_+i+j*mm_, value );
4187 template<
typename Type >
4188 template<
typename MT >
4189 inline typename DisableIf< typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
4195 const size_t ipos( m_ &
size_t(-2) );
4198 for(
size_t j=0UL; j<
n_; ++j ) {
4199 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4200 v_[i +j*mm_] = (~rhs)(i ,j);
4201 v_[i+1UL+j*mm_] = (~rhs)(i+1UL,j);
4204 v_[ipos+j*mm_] = (~rhs)(ipos,j);
4224 template<
typename Type >
4225 template<
typename MT >
4226 inline typename EnableIf< typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
4239 for(
size_t j=0UL; j<
n_; ++j )
4245 const size_t ipos( m_ &
size_t(-
IT::size*4) );
4248 for(
size_t j=0UL; j<
n_; ++j ) {
4250 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
4257 store( v_+i+j*mm_, it.load() );
4278 template<
typename Type >
4279 template<
typename MT >
4287 const size_t block( 16UL );
4289 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4290 const size_t jend(
min( n_, jj+block ) );
4291 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
4292 const size_t iend(
min( m_, ii+block ) );
4293 for(
size_t j=jj; j<jend; ++j ) {
4294 for(
size_t i=ii; i<iend; ++i ) {
4295 v_[i+j*mm_] = (~rhs)(i,j);
4317 template<
typename Type >
4318 template<
typename MT >
4324 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
4326 v_[element->index()+j*mm_] = element->value();
4344 template<
typename Type >
4345 template<
typename MT >
4353 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
4355 v_[i+element->index()*mm_] = element->value();
4373 template<
typename Type >
4374 template<
typename MT >
4375 inline typename DisableIf< typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
4381 for(
size_t j=0UL; j<
n_; ++j )
4383 if( IsDiagonal<MT>::value )
4385 v_[j+j*mm_] += (~rhs)(j,j);
4389 const size_t ibegin( ( IsLower<MT>::value )
4390 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
4392 const size_t iend ( ( IsUpper<MT>::value )
4393 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
4399 for( ; (i+2UL) <= iend; i+=2UL ) {
4400 v_[i +j*mm_] += (~rhs)(i ,j);
4401 v_[i+1UL+j*mm_] += (~rhs)(i+1UL,j);
4404 v_[i+j*mm_] += (~rhs)(i,j);
4425 template<
typename Type >
4426 template<
typename MT >
4427 inline typename EnableIf< typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
4439 for(
size_t j=0UL; j<
n_; ++j )
4441 const size_t ibegin( ( IsLower<MT>::value )
4442 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
4444 const size_t iend ( ( IsUpper<MT>::value )
4445 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
4459 store( v_+i+j*mm_,
load( v_+i+j*mm_ ) + it.load() );
4479 template<
typename Type >
4480 template<
typename MT >
4488 const size_t block( 16UL );
4490 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4491 const size_t jend(
min( n_, jj+block ) );
4492 for(
size_t ii=0UL; ii<
m_; ii+=block )
4494 if( IsLower<MT>::value && ii < jj )
continue;
4495 if( IsUpper<MT>::value && ii > jj )
break;
4497 for(
size_t j=jj; j<jend; ++j )
4499 const size_t ibegin( ( IsLower<MT>::value )
4500 ?(
max( ( IsStrictlyLower<MT>::value ? j+1UL : j ), ii ) )
4502 const size_t iend ( ( IsUpper<MT>::value )
4503 ?(
min( ( IsStrictlyUpper<MT>::value ? j : j+1UL ), m_, ii+block ) )
4504 :(
min( m_, ii+block ) ) );
4507 for(
size_t i=ibegin; i<iend; ++i ) {
4508 v_[i+j*mm_] += (~rhs)(i,j);
4530 template<
typename Type >
4531 template<
typename MT >
4537 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
4539 v_[element->index()+j*mm_] += element->value();
4557 template<
typename Type >
4558 template<
typename MT >
4566 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
4568 v_[i+element->index()*mm_] += element->value();
4586 template<
typename Type >
4587 template<
typename MT >
4588 inline typename DisableIf< typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
4594 for(
size_t j=0UL; j<
n_; ++j )
4596 if( IsDiagonal<MT>::value )
4598 v_[j+j*mm_] -= (~rhs)(j,j);
4602 const size_t ibegin( ( IsLower<MT>::value )
4603 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
4605 const size_t iend ( ( IsUpper<MT>::value )
4606 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
4612 for( ; (i+2UL) <= iend; i+=2UL ) {
4613 v_[i +j*mm_] -= (~rhs)(i ,j);
4614 v_[i+1+j*mm_] -= (~rhs)(i+1,j);
4617 v_[i+j*mm_] -= (~rhs)(i,j);
4639 template<
typename Type >
4640 template<
typename MT >
4641 inline typename EnableIf< typename DynamicMatrix<Type,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
4653 for(
size_t j=0UL; j<
n_; ++j )
4655 const size_t ibegin( ( IsLower<MT>::value )
4656 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
4658 const size_t iend ( ( IsUpper<MT>::value )
4659 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
4673 store( v_+i+j*mm_,
load( v_+i+j*mm_ ) - it.load() );
4693 template<
typename Type >
4694 template<
typename MT >
4702 const size_t block( 16UL );
4704 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4705 const size_t jend(
min( n_, jj+block ) );
4706 for(
size_t ii=0UL; ii<
m_; ii+=block )
4708 if( IsLower<MT>::value && ii < jj )
continue;
4709 if( IsUpper<MT>::value && ii > jj )
break;
4711 for(
size_t j=jj; j<jend; ++j )
4713 const size_t ibegin( ( IsLower<MT>::value )
4714 ?(
max( ( IsStrictlyLower<MT>::value ? j+1UL : j ), ii ) )
4716 const size_t iend ( ( IsUpper<MT>::value )
4717 ?(
min( ( IsStrictlyUpper<MT>::value ? j : j+1UL ), m_, ii+block ) )
4718 :(
min( m_, ii+block ) ) );
4721 for(
size_t i=ibegin; i<iend; ++i ) {
4722 v_[i+j*mm_] -= (~rhs)(i,j);
4744 template<
typename Type >
4745 template<
typename MT >
4751 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
4753 v_[element->index()+j*mm_] -= element->value();
4771 template<
typename Type >
4772 template<
typename MT >
4780 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
4782 v_[i+element->index()*mm_] -= element->value();
4803 template<
typename Type,
bool SO >
4804 inline void reset( DynamicMatrix<Type,SO>& m );
4806 template<
typename Type,
bool SO >
4807 inline void reset( DynamicMatrix<Type,SO>& m,
size_t i );
4809 template<
typename Type,
bool SO >
4810 inline void clear( DynamicMatrix<Type,SO>& m );
4812 template<
typename Type,
bool SO >
4813 inline bool isDefault(
const DynamicMatrix<Type,SO>& m );
4815 template<
typename Type,
bool SO >
4816 inline void swap( DynamicMatrix<Type,SO>& a, DynamicMatrix<Type,SO>& b ) ;
4818 template<
typename Type,
bool SO >
4819 inline void move( DynamicMatrix<Type,SO>& dst, DynamicMatrix<Type,SO>& src ) ;
4831 template<
typename Type
4853 template<
typename Type
4869 template<
typename Type
4896 template<
typename Type
4914 template<
typename Type
4932 template<
typename Type
4951 template<
typename T,
bool SO >
4952 struct HasConstDataAccess< DynamicMatrix<T,SO> > :
public TrueType
4971 template<
typename T,
bool SO >
4972 struct HasMutableDataAccess< DynamicMatrix<T,SO> > :
public TrueType
4991 template<
typename T,
bool SO >
4992 struct IsResizable< DynamicMatrix<T,SO> > :
public TrueType
5011 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5012 struct AddTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
5014 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
5017 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5018 struct AddTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5020 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
5023 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5024 struct AddTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
5026 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
5029 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5030 struct AddTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5032 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
5035 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5036 struct AddTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
5038 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
5041 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5042 struct AddTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5044 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
5047 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5048 struct AddTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
5050 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
5053 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5054 struct AddTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5056 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
5059 template<
typename T1,
bool SO,
typename T2 >
5060 struct AddTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
5062 typedef DynamicMatrix< typename AddTrait<T1,T2>::Type , SO > Type;
5065 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5066 struct AddTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5068 typedef DynamicMatrix< typename AddTrait<T1,T2>::Type ,
false > Type;
5084 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5085 struct SubTrait< DynamicMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
5087 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
5090 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5091 struct SubTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5093 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
5096 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5097 struct SubTrait< StaticMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
5099 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
5102 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5103 struct SubTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5105 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
5108 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5109 struct SubTrait< DynamicMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
5111 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
5114 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5115 struct SubTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5117 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
5120 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5121 struct SubTrait< HybridMatrix<T1,M,N,SO>, DynamicMatrix<T2,SO> >
5123 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
5126 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5127 struct SubTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5129 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
5132 template<
typename T1,
bool SO,
typename T2 >
5133 struct SubTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
5135 typedef DynamicMatrix< typename SubTrait<T1,T2>::Type , SO > Type;
5138 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5139 struct SubTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5141 typedef DynamicMatrix< typename SubTrait<T1,T2>::Type ,
false > Type;
5157 template<
typename T1,
bool SO,
typename T2 >
5158 struct MultTrait< DynamicMatrix<T1,SO>, T2 >
5160 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO > Type;
5164 template<
typename T1,
typename T2,
bool SO >
5165 struct MultTrait< T1, DynamicMatrix<T2,SO> >
5167 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO > Type;
5171 template<
typename T1,
bool SO,
typename T2,
size_t N >
5172 struct MultTrait< DynamicMatrix<T1,SO>, StaticVector<T2,N,false> >
5174 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5177 template<
typename T1,
size_t N,
typename T2,
bool SO >
5178 struct MultTrait< StaticVector<T1,N,true>, DynamicMatrix<T2,SO> >
5180 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5183 template<
typename T1,
bool SO,
typename T2,
size_t N >
5184 struct MultTrait< DynamicMatrix<T1,SO>, HybridVector<T2,N,false> >
5186 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5189 template<
typename T1,
size_t N,
typename T2,
bool SO >
5190 struct MultTrait< HybridVector<T1,N,true>, DynamicMatrix<T2,SO> >
5192 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5195 template<
typename T1,
bool SO,
typename T2 >
5196 struct MultTrait< DynamicMatrix<T1,SO>, DynamicVector<T2,false> >
5198 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5201 template<
typename T1,
typename T2,
bool SO >
5202 struct MultTrait< DynamicVector<T1,true>, DynamicMatrix<T2,SO> >
5204 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5207 template<
typename T1,
bool SO,
typename T2 >
5208 struct MultTrait< DynamicMatrix<T1,SO>, CompressedVector<T2,false> >
5210 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5213 template<
typename T1,
typename T2,
bool SO >
5214 struct MultTrait< CompressedVector<T1,true>, DynamicMatrix<T2,SO> >
5216 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5219 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5220 struct MultTrait< DynamicMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5222 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5225 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5226 struct MultTrait< StaticMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5228 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5231 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5232 struct MultTrait< DynamicMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5234 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5237 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5238 struct MultTrait< HybridMatrix<T1,M,N,SO1>, DynamicMatrix<T2,SO2> >
5240 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5243 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5244 struct MultTrait< DynamicMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5246 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5262 template<
typename T1,
bool SO,
typename T2 >
5263 struct DivTrait< DynamicMatrix<T1,SO>, T2 >
5265 typedef DynamicMatrix< typename DivTrait<T1,T2>::Type , SO > Type;
5282 template<
typename T1,
bool SO,
typename T2 >
5283 struct MathTrait< DynamicMatrix<T1,SO>, DynamicMatrix<T2,SO> >
5285 typedef DynamicMatrix< typename MathTrait<T1,T2>::HighType, SO > HighType;
5286 typedef DynamicMatrix< typename MathTrait<T1,T2>::LowType , SO > LowType;
5302 template<
typename T1,
bool SO >
5303 struct SubmatrixTrait< DynamicMatrix<T1,SO> >
5305 typedef DynamicMatrix<T1,SO> Type;
5321 template<
typename T1,
bool SO >
5322 struct RowTrait< DynamicMatrix<T1,SO> >
5324 typedef DynamicVector<T1,true> Type;
5340 template<
typename T1,
bool SO >
5341 struct ColumnTrait< DynamicMatrix<T1,SO> >
5343 typedef DynamicVector<T1,false> Type;
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:108
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:116
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: DynamicMatrix.h:720
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1649
size_t n_
The current number of columns of the matrix.
Definition: DynamicMatrix.h:427
Constraint on the data type.
Header file for mathematical functions.
void reserve(size_t elements)
Setting the minimum capacity of the matrix.
Definition: DynamicMatrix.h:1520
#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 UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
const bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type stream(T *address, const sse_int16_t &value)
Aligned, non-temporal store of a vector of 2-byte integral values.
Definition: Stream.h:76
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:884
Header file for the row trait.
Type *BLAZE_RESTRICT v_
The dynamically allocated matrix elements.
Definition: DynamicMatrix.h:430
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:258
Header file for the IsSparseMatrix type trait.
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the matrix.
Definition: DynamicMatrix.h:1444
Header file for the IsDiagonal type trait.
BLAZE_ALWAYS_INLINE void stream(size_t i, size_t j, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the matrix.
Definition: DynamicMatrix.h:1857
Header file for the IsSame and IsStrictlySame type traits.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DynamicMatrix.h:1238
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2665
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
#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:116
DynamicMatrix()
The default constructor for DynamicMatrix.
Definition: DynamicMatrix.h:468
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: DynamicMatrix.h:1754
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
Header file for memory allocation and deallocation functionality.
size_t spacing() const
Returns the spacing between the beginning of two rows/columns.
Definition: DynamicMatrix.h:1257
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation ...
Definition: DynamicMatrix.h:187
EnableIf< IsBuiltin< T >, T * >::Type allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:151
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:203
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2667
~DynamicMatrix()
The destructor for DynamicMatrix.
Definition: DynamicMatrix.h:695
This ResultType
Result type for expression template evaluations.
Definition: DynamicMatrix.h:197
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: DynamicMatrix.h:1720
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:1307
size_t adjustColumns(size_t minColumns) const
Adjusting the number columns of the matrix according to its data type Type.
Definition: DynamicMatrix.h:1608
Header file for the DisableIf class template.
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:950
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: DynamicMatrix.h:1676
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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:76
Header file for nested template disabiguation.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4807
Type ElementType
Type of the matrix elements.
Definition: DynamicMatrix.h:200
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#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:116
Header file for the IsSMPAssignable type trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type store(T *address, const sse_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Store.h:80
IntrinsicTrait< Type > IT
Intrinsic trait for the matrix element type.
Definition: DynamicMatrix.h:191
DynamicMatrix< Type, SO > This
Type of this DynamicMatrix instance.
Definition: DynamicMatrix.h:196
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1602
Header file for the DenseMatrix base class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:226
Header file for the DenseIterator class template.
const size_t SMP_DMATASSIGN_THRESHOLD
SMP dense matrix assignment threshold.This threshold specifies when an assignment with a simple dense...
Definition: Thresholds.h:690
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicMatrix.h:202
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:116
Header file for the IsLower type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:92
void extend(size_t m, size_t n, bool preserve=true)
Extending the size of the matrix.
Definition: DynamicMatrix.h:1502
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DynamicMatrix.h:1224
#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:79
void reset()
Reset to the default initial values.
Definition: DynamicMatrix.h:1357
Iterator end(size_t i)
Returns an iterator just past the last element of row/column i.
Definition: DynamicMatrix.h:906
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:195
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:120
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:535
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
System settings for streaming (non-temporal stores)
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:841
DynamicMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DynamicMatrix.h:198
size_t capacity() const
Returns the maximum capacity of the matrix.
Definition: DynamicMatrix.h:1271
Header file for the IsVectorizable type trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
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:428
Type * Pointer
Pointer to a non-constant matrix value.
Definition: DynamicMatrix.h:206
EnableIf< IsDenseMatrix< MT1 > >::Type 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
#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:116
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
Header file for the addition trait.
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
void clear()
Clearing the matrix.
Definition: DynamicMatrix.h:1401
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: DynamicMatrix.h:207
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
size_t m_
The current number of rows of the matrix.
Definition: DynamicMatrix.h:426
Iterator begin(size_t i)
Returns an iterator to the first element of row/column i.
Definition: DynamicMatrix.h:840
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const sse_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:77
BLAZE_ALWAYS_INLINE void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: DynamicMatrix.h:1823
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: DynamicMatrix.h:1658
void move(DynamicMatrix< Type, SO > &dst, DynamicMatrix< Type, SO > &src)
Moving the contents of one dynamic matrix to another.
Definition: DynamicMatrix.h:4934
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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the column trait.
Header file for the isDefault shim.
System settings for the restrict keyword.
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:87
Constraint on the data type.
Constraint on the data type.
void swap(DynamicMatrix &m)
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:1589
Header file for the HasMutableDataAccess type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:200
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
Header file for all intrinsic functionality.
Header file for the mathematical trait.
Type & Reference
Reference to a non-constant matrix value.
Definition: DynamicMatrix.h:204
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
BLAZE_ALWAYS_INLINE void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: DynamicMatrix.h:1788
bool canSMPAssign() const
Returns whether the matrix can be used in SMP assignments.
Definition: DynamicMatrix.h:1695
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2666
DenseIterator< const Type > ConstIterator
Iterator over constant elements.
Definition: DynamicMatrix.h:209
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:937
EnableIf< IsDenseMatrix< MT1 > >::Type 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
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: DynamicMatrix.h:201
size_t capacity_
The maximum capacity of the matrix.
Definition: DynamicMatrix.h:429
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
Rebind mechanism to obtain a DynamicMatrix with different data/element type.
Definition: DynamicMatrix.h:216
DenseIterator< Type > Iterator
Iterator over non-constant elements.
Definition: DynamicMatrix.h:208
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2518
Header file for the IsUpper type trait.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
Pointer data()
Low-level data access to the matrix elements.
Definition: DynamicMatrix.h:762
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
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: DynamicMatrix.h:1638
DynamicMatrix< ET, SO > Other
The type of the other DynamicMatrix.
Definition: DynamicMatrix.h:217
DynamicMatrix & transpose()
Transposing the matrix.
Definition: DynamicMatrix.h:1551
const Type & ConstReference
Reference to a constant matrix value.
Definition: DynamicMatrix.h:205
DynamicMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: DynamicMatrix.h:199
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
Header file for a safe C++ NULL pointer implementation.