35 #ifndef _BLAZE_MATH_DENSE_HYBRIDMATRIX_H_
36 #define _BLAZE_MATH_DENSE_HYBRIDMATRIX_H_
183 template<
typename Type
187 class HybridMatrix :
public DenseMatrix< HybridMatrix<Type,M,N,SO>, SO >
220 template<
typename ET >
238 enum { smpAssignable = 0 };
246 explicit inline HybridMatrix(
size_t m,
size_t n,
const Type& init );
247 template<
typename Other >
explicit inline HybridMatrix(
size_t m,
size_t n,
const Other* array );
249 template<
typename Other,
size_t M2,
size_t N2 >
250 explicit inline HybridMatrix(
const Other (&array)[M2][N2] );
253 template<
typename MT,
bool SO2 >
inline HybridMatrix(
const Matrix<MT,SO2>& m );
282 template<
typename Other,
size_t M2,
size_t N2 >
283 inline HybridMatrix& operator=(
const Other (&array)[M2][N2] );
287 template<
typename MT,
bool SO2 >
inline HybridMatrix& operator= (
const Matrix<MT,SO2>& rhs );
288 template<
typename MT,
bool SO2 >
inline HybridMatrix& operator+=(
const Matrix<MT,SO2>& rhs );
289 template<
typename MT,
bool SO2 >
inline HybridMatrix& operator-=(
const Matrix<MT,SO2>& rhs );
290 template<
typename MT,
bool SO2 >
inline HybridMatrix& operator*=(
const Matrix<MT,SO2>& rhs );
292 template<
typename Other >
293 inline typename EnableIf< IsNumeric<Other>,
HybridMatrix >::Type&
294 operator*=( Other rhs );
296 template<
typename Other >
297 inline typename EnableIf< IsNumeric<Other>,
HybridMatrix >::Type&
298 operator/=( Other rhs );
305 inline size_t rows()
const;
309 inline size_t capacity(
size_t i )
const;
311 inline size_t nonZeros(
size_t i )
const;
313 inline void reset(
size_t i );
315 void resize (
size_t m,
size_t n,
bool preserve=
true );
316 inline void extend (
size_t m,
size_t n,
bool preserve=
true );
318 template<
typename Other >
inline HybridMatrix& scale(
const Other& scalar );
326 static inline void*
operator new ( std::size_t
size );
327 static inline void*
operator new[]( std::size_t
size );
328 static inline void*
operator new ( std::size_t
size,
const std::nothrow_t& );
329 static inline void*
operator new[]( std::size_t
size,
const std::nothrow_t& );
331 static inline void operator delete (
void* ptr );
332 static inline void operator delete[](
void* ptr );
333 static inline void operator delete (
void* ptr,
const std::nothrow_t& );
334 static inline void operator delete[](
void* ptr,
const std::nothrow_t& );
341 template<
typename MT >
343 struct VectorizedAssign {
344 enum { value = vectorizable && MT::vectorizable &&
345 IsSame<Type,typename MT::ElementType>::value &&
346 IsRowMajorMatrix<MT>::value };
353 template<
typename MT >
355 struct VectorizedAddAssign {
356 enum { value = vectorizable && MT::vectorizable &&
357 IsSame<Type,typename MT::ElementType>::value &&
358 IntrinsicTrait<Type>::addition &&
359 IsRowMajorMatrix<MT>::value };
366 template<
typename MT >
368 struct VectorizedSubAssign {
369 enum { value = vectorizable && MT::vectorizable &&
370 IsSame<Type,typename MT::ElementType>::value &&
371 IntrinsicTrait<Type>::subtraction &&
372 IsRowMajorMatrix<MT>::value };
381 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
382 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
392 template<
typename MT,
bool SO2 >
393 inline typename DisableIf< VectorizedAssign<MT> >::Type
394 assign(
const DenseMatrix<MT,SO2>& rhs );
396 template<
typename MT,
bool SO2 >
397 inline typename EnableIf< VectorizedAssign<MT> >::Type
398 assign(
const DenseMatrix<MT,SO2>& rhs );
400 template<
typename MT >
inline void assign(
const SparseMatrix<MT,SO>& rhs );
401 template<
typename MT >
inline void assign(
const SparseMatrix<MT,!SO>& rhs );
403 template<
typename MT,
bool SO2 >
404 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
405 addAssign(
const DenseMatrix<MT,SO2>& rhs );
407 template<
typename MT,
bool SO2 >
408 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
409 addAssign(
const DenseMatrix<MT,SO2>& rhs );
411 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,SO>& rhs );
412 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,!SO>& rhs );
414 template<
typename MT,
bool SO2 >
415 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
416 subAssign(
const DenseMatrix<MT,SO2>& rhs );
418 template<
typename MT,
bool SO2 >
419 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
420 subAssign(
const DenseMatrix<MT,SO2>& rhs );
422 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,SO>& rhs );
423 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,!SO>& rhs );
473 template<
typename Type
485 for(
size_t i=0UL; i<M*NN; ++i )
505 template<
typename Type
517 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
520 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
523 for(
size_t i=0UL; i<M*NN; ++i )
544 template<
typename Type
556 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
559 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
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 )
572 for(
size_t i=m; i<M; ++i )
573 for(
size_t j=0UL; j<NN; ++j )
607 template<
typename Type
611 template<
typename Other >
620 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
623 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
625 for(
size_t i=0UL; i<m; ++i ) {
626 for(
size_t j=0UL; j<n; ++j )
627 v_[i*NN+j] = array[i*n+j];
630 for(
size_t j=n; j<NN; ++j )
636 for(
size_t i=m; i<M; ++i )
637 for(
size_t j=0UL; j<NN; ++j )
665 template<
typename Type
669 template<
typename Other
681 for(
size_t i=0UL; i<M2; ++i ) {
682 for(
size_t j=0UL; j<N2; ++j )
683 v_[i*NN+j] = array[i][j];
686 for(
size_t j=N2; j<NN; ++j )
692 for(
size_t i=M2; i<M; ++i )
693 for(
size_t j=0UL; j<NN; ++j )
708 template<
typename Type
719 for(
size_t i=0UL; i<
m_; ++i ) {
720 for(
size_t j=0UL; j<
n_; ++j )
721 v_[i*NN+j] = m.v_[i*NN+j];
724 for(
size_t j=n_; j<NN; ++j )
730 for(
size_t i=m_; i<M; ++i )
731 for(
size_t j=0UL; j<NN; ++j )
744 template<
typename Type
748 template<
typename MT
760 throw std::invalid_argument(
"Invalid setup of hybrid matrix" );
762 for(
size_t i=0UL; i<
m_; ++i ) {
764 j<( IsNumeric<Type>::value ? NN :
n_ );
771 for(
size_t i=m_; i<M; ++i )
772 for(
size_t j=0UL; j<NN; ++j )
796 template<
typename Type
817 template<
typename Type
843 template<
typename Type
867 template<
typename Type
887 template<
typename Type
908 template<
typename Type
932 template<
typename Type
956 template<
typename Type
980 template<
typename Type
1004 template<
typename Type
1028 template<
typename Type
1052 template<
typename Type
1094 template<
typename Type
1098 template<
typename Other
1108 for(
size_t i=0UL; i<M2; ++i )
1109 for(
size_t j=0UL; j<N2; ++j )
1110 v_[i*NN+j] = array[i][j];
1123 template<
typename Type
1132 for(
size_t i=0UL; i<
m_; ++i )
1133 for(
size_t j=0UL; j<
n_; ++j )
1149 template<
typename Type
1160 resize( rhs.rows(), rhs.columns() );
1179 template<
typename Type
1183 template<
typename MT
1190 throw std::invalid_argument(
"Invalid assignment to hybrid matrix" );
1192 if( (~rhs).canAlias(
this ) ) {
1218 template<
typename Type
1222 template<
typename MT
1229 throw std::invalid_argument(
"Matrix sizes do not match" );
1231 if( (~rhs).canAlias(
this ) ) {
1254 template<
typename Type
1258 template<
typename MT
1265 throw std::invalid_argument(
"Matrix sizes do not match" );
1267 if( (~rhs).canAlias(
this ) ) {
1290 template<
typename Type
1294 template<
typename MT
1299 throw std::invalid_argument(
"Matrix sizes do not match" );
1302 return this->operator=( tmp );
1314 template<
typename Type
1318 template<
typename Other >
1324 assign( *
this, (*
this) * rhs );
1339 template<
typename Type
1343 template<
typename Other >
1351 assign( *
this, (*
this) / rhs );
1370 template<
typename Type
1386 template<
typename Type
1405 template<
typename Type
1421 template<
typename Type
1443 template<
typename Type
1463 template<
typename Type
1469 size_t nonzeros( 0UL );
1471 for(
size_t i=0UL; i<
m_; ++i )
1472 for(
size_t j=0UL; j<
n_; ++j )
1492 template<
typename Type
1500 const size_t jend( i*NN+
n_ );
1501 size_t nonzeros( 0UL );
1503 for(
size_t j=i*NN; j<jend; ++j )
1517 template<
typename Type
1525 for(
size_t i=0UL; i<
m_; ++i )
1526 for(
size_t j=0UL; j<
n_; ++j )
1527 clear( v_[i*NN+j] );
1543 template<
typename Type
1552 for(
size_t j=0UL; j<
n_; ++j )
1553 clear( v_[i*NN+j] );
1565 template<
typename Type
1612 template<
typename Type
1621 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
1624 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
1627 for(
size_t i=0UL; i<m; ++i )
1628 for(
size_t j=n; j<
n_; ++j )
1629 v_[i*NN+j] = Type();
1633 for(
size_t i=m; i<
m_; ++i )
1634 for(
size_t j=0UL; j<
n_; ++j )
1635 v_[i*NN+j] = Type();
1659 template<
typename Type
1682 template<
typename Type
1690 if(
m_ > N ||
n_ > M )
1691 throw std::logic_error(
"Impossible transpose operation" );
1693 const size_t maxsize(
max(
m_,
n_ ) );
1694 for(
size_t i=1UL; i<maxsize; ++i )
1695 for(
size_t j=0UL; j<i; ++j )
1696 swap( v_[i*NN+j], v_[j*NN+i] );
1699 for(
size_t i=0UL; i<
m_; ++i ) {
1700 for(
size_t j=m_; j<
n_; ++j ) {
1701 v_[i*NN+j] = Type();
1707 for(
size_t i=
n_; i<
m_; ++i ) {
1708 for(
size_t j=0UL; j<
n_; ++j ) {
1709 v_[i*NN+j] = Type();
1727 template<
typename Type
1731 template<
typename Other >
1734 for(
size_t i=0UL; i<
m_; ++i )
1735 for(
size_t j=0UL; j<
n_; ++j )
1736 v_[i*NN+j] *= scalar;
1750 template<
typename Type
1758 const size_t maxrows(
max(
m_, m.m_ ) );
1759 const size_t maxcols(
max(
n_, m.n_ ) );
1761 for(
size_t i=0UL; i<maxrows; ++i ) {
1762 for(
size_t j=0UL; j<maxcols; ++j ) {
1763 swap( v_[i*NN+j], m(i,j) );
1791 template<
typename Type
1801 return allocate<HybridMatrix>( 1UL );
1816 template<
typename Type
1840 template<
typename Type
1850 return allocate<HybridMatrix>( 1UL );
1865 template<
typename Type
1885 template<
typename Type
1891 deallocate( static_cast<HybridMatrix*>( ptr ) );
1902 template<
typename Type
1908 deallocate( static_cast<HybridMatrix*>( ptr ) );
1919 template<
typename Type
1925 deallocate( static_cast<HybridMatrix*>( ptr ) );
1936 template<
typename Type
1942 deallocate( static_cast<HybridMatrix*>( ptr ) );
1965 template<
typename Type
1969 template<
typename Other >
1972 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1987 template<
typename Type
1991 template<
typename Other >
1994 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2008 template<
typename Type
2034 template<
typename Type
2050 return load( &v_[i*NN+j] );
2070 template<
typename Type
2085 return loadu( &v_[i*NN+j] );
2106 template<
typename Type
2121 store( &v_[i*NN+j], value );
2142 template<
typename Type
2156 storeu( &v_[i*NN+j], value );
2177 template<
typename Type
2192 stream( &v_[i*NN+j], value );
2208 template<
typename Type
2212 template<
typename MT
2219 for(
size_t i=0UL; i<
m_; ++i ) {
2220 for(
size_t j=0UL; j<
n_; ++j ) {
2221 v_[i*NN+j] = (~rhs)(i,j);
2239 template<
typename Type
2243 template<
typename MT
2254 for(
size_t i=0UL; i<
m_; ++i ) {
2274 template<
typename Type
2278 template<
typename MT >
2285 for(
size_t i=0UL; i<
m_; ++i )
2286 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2287 v_[i*NN+element->index()] = element->value();
2303 template<
typename Type
2307 template<
typename MT >
2316 for(
size_t j=0UL; j<
n_; ++j )
2317 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2318 v_[element->index()*NN+j] = element->value();
2334 template<
typename Type
2338 template<
typename MT
2345 for(
size_t i=0UL; i<
m_; ++i ) {
2346 for(
size_t j=0UL; j<
n_; ++j ) {
2347 v_[i*NN+j] += (~rhs)(i,j);
2365 template<
typename Type
2369 template<
typename MT
2381 for(
size_t i=0UL; i<
m_; ++i ) {
2383 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) + (~rhs).
load(i,j) );
2401 template<
typename Type
2405 template<
typename MT >
2412 for(
size_t i=0UL; i<
m_; ++i )
2413 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2414 v_[i*NN+element->index()] += element->value();
2430 template<
typename Type
2434 template<
typename MT >
2443 for(
size_t j=0UL; j<
n_; ++j )
2444 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2445 v_[element->index()*NN+j] += element->value();
2461 template<
typename Type
2465 template<
typename MT
2472 for(
size_t i=0UL; i<
m_; ++i ) {
2473 for(
size_t j=0UL; j<
n_; ++j ) {
2474 v_[i*NN+j] -= (~rhs)(i,j);
2492 template<
typename Type
2496 template<
typename MT
2508 for(
size_t i=0UL; i<
m_; ++i ) {
2510 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) - (~rhs).
load(i,j) );
2528 template<
typename Type
2532 template<
typename MT >
2539 for(
size_t i=0UL; i<
m_; ++i )
2540 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2541 v_[i*NN+element->index()] -= element->value();
2557 template<
typename Type
2561 template<
typename MT >
2570 for(
size_t j=0UL; j<
n_; ++j )
2571 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2572 v_[element->index()*NN+j] -= element->value();
2597 template<
typename Type
2614 typedef HybridMatrix<Type,M,N,true>
This;
2626 typedef DenseIterator<Type>
Iterator;
2633 template<
typename ET >
2635 typedef HybridMatrix<ET,M,N,true>
Other;
2645 enum { vectorizable = IsVectorizable<Type>::value };
2651 enum { smpAssignable = 0 };
2659 explicit inline HybridMatrix(
size_t m,
size_t n,
const Type& init );
2660 template<
typename Other >
explicit inline HybridMatrix(
size_t m,
size_t n,
const Other* array );
2662 template<
typename Other,
size_t M2,
size_t N2 >
2663 explicit inline HybridMatrix(
const Other (&array)[M2][N2] );
2666 template<
typename MT,
bool SO >
inline HybridMatrix(
const Matrix<MT,SO>& m );
2695 template<
typename Other,
size_t M2,
size_t N2 >
2696 inline HybridMatrix& operator=(
const Other (&array)[M2][N2] );
2700 template<
typename MT,
bool SO >
inline HybridMatrix& operator= (
const Matrix<MT,SO>& rhs );
2701 template<
typename MT,
bool SO >
inline HybridMatrix& operator+=(
const Matrix<MT,SO>& rhs );
2702 template<
typename MT,
bool SO >
inline HybridMatrix& operator-=(
const Matrix<MT,SO>& rhs );
2703 template<
typename MT,
bool SO >
inline HybridMatrix& operator*=(
const Matrix<MT,SO>& rhs );
2705 template<
typename Other >
2706 inline typename EnableIf< IsNumeric<Other>,
HybridMatrix >::Type&
2707 operator*=( Other rhs );
2709 template<
typename Other >
2710 inline typename EnableIf< IsNumeric<Other>,
HybridMatrix >::Type&
2711 operator/=( Other rhs );
2718 inline size_t rows()
const;
2719 inline size_t columns()
const;
2720 inline size_t spacing()
const;
2722 inline size_t capacity(
size_t j )
const;
2724 inline size_t nonZeros(
size_t j )
const;
2725 inline void reset();
2726 inline void reset(
size_t i );
2727 inline void clear();
2728 void resize (
size_t m,
size_t n,
bool preserve=
true );
2729 inline void extend (
size_t m,
size_t n,
bool preserve=
true );
2731 template<
typename Other >
inline HybridMatrix& scale(
const Other& scalar );
2739 static inline void*
operator new ( std::size_t
size );
2740 static inline void*
operator new[]( std::size_t
size );
2741 static inline void*
operator new ( std::size_t
size,
const std::nothrow_t& );
2742 static inline void*
operator new[]( std::size_t
size,
const std::nothrow_t& );
2744 static inline void operator delete (
void* ptr );
2745 static inline void operator delete[](
void* ptr );
2746 static inline void operator delete (
void* ptr,
const std::nothrow_t& );
2747 static inline void operator delete[](
void* ptr,
const std::nothrow_t& );
2754 template<
typename MT >
2755 struct VectorizedAssign {
2756 enum { value = vectorizable && MT::vectorizable &&
2757 IsSame<Type,typename MT::ElementType>::value &&
2758 IsColumnMajorMatrix<MT>::value };
2764 template<
typename MT >
2765 struct VectorizedAddAssign {
2766 enum { value = vectorizable && MT::vectorizable &&
2767 IsSame<Type,typename MT::ElementType>::value &&
2768 IntrinsicTrait<Type>::addition &&
2769 IsColumnMajorMatrix<MT>::value };
2775 template<
typename MT >
2776 struct VectorizedSubAssign {
2777 enum { value = vectorizable && MT::vectorizable &&
2778 IsSame<Type,typename MT::ElementType>::value &&
2779 IntrinsicTrait<Type>::subtraction &&
2780 IsColumnMajorMatrix<MT>::value };
2788 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2789 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2799 template<
typename MT,
bool SO >
2800 inline typename DisableIf< VectorizedAssign<MT> >::Type
2801 assign(
const DenseMatrix<MT,SO>& rhs );
2803 template<
typename MT,
bool SO >
2804 inline typename EnableIf< VectorizedAssign<MT> >::Type
2805 assign(
const DenseMatrix<MT,SO>& rhs );
2807 template<
typename MT >
inline void assign(
const SparseMatrix<MT,true>& rhs );
2808 template<
typename MT >
inline void assign(
const SparseMatrix<MT,false>& rhs );
2810 template<
typename MT,
bool SO >
2811 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
2812 addAssign(
const DenseMatrix<MT,SO>& rhs );
2814 template<
typename MT,
bool SO >
2815 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
2816 addAssign(
const DenseMatrix<MT,SO>& rhs );
2818 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,true>& rhs );
2819 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,false>& rhs );
2821 template<
typename MT,
bool SO >
2822 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
2823 subAssign(
const DenseMatrix<MT,SO>& rhs );
2825 template<
typename MT,
bool SO >
2826 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
2827 subAssign(
const DenseMatrix<MT,SO>& rhs );
2829 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,true>& rhs );
2830 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,false>& rhs );
2838 AlignedArray<Type,MM*N>
v_;
2873 template<
typename Type
2883 if( IsNumeric<Type>::value ) {
2884 for(
size_t i=0UL; i<MM*N; ++i )
2906 template<
typename Type
2917 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
2920 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
2922 if( IsNumeric<Type>::value ) {
2923 for(
size_t i=0UL; i<MM*N; ++i )
2946 template<
typename Type
2957 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
2960 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
2962 for(
size_t j=0UL; j<n; ++j ) {
2963 for(
size_t i=0UL; i<m; ++i )
2966 if( IsNumeric<Type>::value ) {
2967 for(
size_t i=m; i<MM; ++i )
2968 v_[i+j*MM] = Type();
2972 if( IsNumeric<Type>::value ) {
2973 for(
size_t j=n; j<N; ++j )
2974 for(
size_t i=0UL; i<MM; ++i )
2975 v_[i+j*MM] = Type();
3010 template<
typename Type
3013 template<
typename Other >
3022 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
3025 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
3027 for(
size_t j=0UL; j<n; ++j ) {
3028 for(
size_t i=0UL; i<m; ++i )
3029 v_[i+j*MM] = array[i+j*m];
3031 if( IsNumeric<Type>::value ) {
3032 for(
size_t i=m; i<MM; ++i )
3033 v_[i+j*MM] = Type();
3037 if( IsNumeric<Type>::value ) {
3038 for(
size_t j=n; j<N; ++j )
3039 for(
size_t i=0UL; i<MM; ++i )
3040 v_[i+j*MM] = Type();
3069 template<
typename Type
3072 template<
typename Other
3084 for(
size_t j=0UL; j<N2; ++j ) {
3085 for(
size_t i=0UL; i<M2; ++i )
3086 v_[i+j*MM] = array[i][j];
3088 if( IsNumeric<Type>::value ) {
3089 for(
size_t i=M2; i<MM; ++i )
3090 v_[i+j*MM] = Type();
3094 if( IsNumeric<Type>::value ) {
3095 for(
size_t j=N2; j<N; ++j )
3096 for(
size_t i=0UL; i<MM; ++i )
3097 v_[i+j*MM] = Type();
3113 template<
typename Type
3123 for(
size_t j=0UL; j<
n_; ++j ) {
3124 for(
size_t i=0UL; i<
m_; ++i )
3125 v_[i+j*MM] = m.v_[i+j*MM];
3127 if( IsNumeric<Type>::value ) {
3128 for(
size_t i=m_; i<MM; ++i )
3129 v_[i+j*MM] = Type();
3133 if( IsNumeric<Type>::value ) {
3134 for(
size_t j=n_; j<N; ++j )
3135 for(
size_t i=0UL; i<MM; ++i )
3136 v_[i+j*MM] = Type();
3150 template<
typename Type
3153 template<
typename MT
3165 throw std::invalid_argument(
"Invalid setup of hybrid matrix" );
3167 for(
size_t j=0UL; j<
n_; ++j ) {
3168 for(
size_t i=( IsSparseMatrix<MT>::value ? 0UL : m_ );
3169 i<( IsNumeric<Type>::value ? MM :
m_ );
3171 v_[i+j*MM] = Type();
3175 if( IsNumeric<Type>::value ) {
3176 for(
size_t j=n_; j<N; ++j )
3177 for(
size_t i=0UL; i<MM; ++i )
3178 v_[i+j*MM] = Type();
3181 assign( *
this, ~m );
3203 template<
typename Type
3225 template<
typename Type
3251 template<
typename Type
3254 inline typename HybridMatrix<Type,M,N,true>::Pointer
3275 template<
typename Type
3278 inline typename HybridMatrix<Type,M,N,true>::ConstPointer
3296 template<
typename Type
3299 inline typename HybridMatrix<Type,M,N,true>::Pointer
3318 template<
typename Type
3321 inline typename HybridMatrix<Type,M,N,true>::ConstPointer
3338 template<
typename Type
3358 template<
typename Type
3378 template<
typename Type
3398 template<
typename Type
3418 template<
typename Type
3438 template<
typename Type
3481 template<
typename Type
3484 template<
typename Other
3487 inline HybridMatrix<Type,M,N,true>&
3488 HybridMatrix<Type,M,N,true>::operator=(
const Other (&array)[M2][N2] )
3495 for(
size_t j=0UL; j<N2; ++j )
3496 for(
size_t i=0UL; i<M2; ++i )
3497 v_[i+j*MM] = array[i][j];
3512 template<
typename Type
3515 inline HybridMatrix<Type,M,N,true>&
3516 HybridMatrix<Type,M,N,true>::operator=(
const Type&
set )
3521 for(
size_t j=0UL; j<
n_; ++j )
3522 for(
size_t i=0UL; i<
m_; ++i )
3540 template<
typename Type
3543 inline HybridMatrix<Type,M,N,true>&
3544 HybridMatrix<Type,M,N,true>::operator=(
const HybridMatrix& rhs )
3551 resize( rhs.rows(), rhs.columns() );
3572 template<
typename Type
3575 template<
typename MT
3577 inline HybridMatrix<Type,M,N,true>& HybridMatrix<Type,M,N,true>::operator=(
const Matrix<MT,SO>& rhs )
3582 throw std::invalid_argument(
"Invalid assignment to hybrid matrix" );
3584 if( (~rhs).canAlias(
this ) ) {
3585 HybridMatrix tmp( ~rhs );
3590 if( IsSparseMatrix<MT>::value )
3612 template<
typename Type
3615 template<
typename MT
3617 inline HybridMatrix<Type,M,N,true>& HybridMatrix<Type,M,N,true>::operator+=(
const Matrix<MT,SO>& rhs )
3621 if( (~rhs).
rows() != m_ || (~rhs).
columns() != n_ )
3622 throw std::invalid_argument(
"Matrix sizes do not match" );
3624 if( (~rhs).canAlias(
this ) ) {
3649 template<
typename Type
3652 template<
typename MT
3654 inline HybridMatrix<Type,M,N,true>& HybridMatrix<Type,M,N,true>::operator-=(
const Matrix<MT,SO>& rhs )
3658 if( (~rhs).
rows() != m_ || (~rhs).
columns() != n_ )
3659 throw std::invalid_argument(
"Matrix sizes do not match" );
3661 if( (~rhs).canAlias(
this ) ) {
3686 template<
typename Type
3689 template<
typename MT
3691 inline HybridMatrix<Type,M,N,true>& HybridMatrix<Type,M,N,true>::operator*=(
const Matrix<MT,SO>& rhs )
3694 throw std::invalid_argument(
"Matrix sizes do not match" );
3696 HybridMatrix tmp( *
this * (~rhs) );
3697 return this->operator=( tmp );
3711 template<
typename Type
3714 template<
typename Other >
3715 inline typename EnableIf< IsNumeric<Other>, HybridMatrix<Type,M,N,true> >::Type&
3716 HybridMatrix<Type,M,N,true>::operator*=( Other rhs )
3720 assign( *
this, (*
this) * rhs );
3737 template<
typename Type
3740 template<
typename Other >
3741 inline typename EnableIf< IsNumeric<Other>, HybridMatrix<Type,M,N,true> >::Type&
3742 HybridMatrix<Type,M,N,true>::operator/=( Other rhs )
3748 assign( *
this, (*
this) / rhs );
3769 template<
typename Type
3786 template<
typename Type
3806 template<
typename Type
3823 template<
typename Type
3841 template<
typename Type
3862 template<
typename Type
3867 size_t nonzeros( 0UL );
3869 for(
size_t j=0UL; j<
n_; ++j )
3870 for(
size_t i=0UL; i<
m_; ++i )
3887 template<
typename Type
3894 const size_t iend( j*MM+m_ );
3895 size_t nonzeros( 0UL );
3897 for(
size_t i=j*MM; i<iend; ++i )
3913 template<
typename Type
3920 for(
size_t j=0UL; j<
n_; ++j )
3921 for(
size_t i=0UL; i<
m_; ++i )
3922 clear( v_[i+j*MM] );
3938 template<
typename Type
3946 for(
size_t i=0UL; i<
m_; ++i )
3947 clear( v_[i+j*MM] );
3961 template<
typename Type
4009 template<
typename Type
4017 throw std::invalid_argument(
"Invalid number of rows for hybrid matrix" );
4020 throw std::invalid_argument(
"Invalid number of columns for hybrid matrix" );
4022 if( IsVectorizable<Type>::value && m < m_ ) {
4023 for(
size_t j=0UL; j<n; ++j )
4024 for(
size_t i=m; i<
m_; ++i )
4025 v_[i+j*MM] = Type();
4028 if( IsVectorizable<Type>::value && n < n_ ) {
4029 for(
size_t j=n; j<
n_; ++j )
4030 for(
size_t i=0UL; i<
m_; ++i )
4031 v_[i+j*MM] = Type();
4057 template<
typename Type
4081 template<
typename Type
4088 if( m_ > N || n_ > M )
4089 throw std::logic_error(
"Impossible transpose operation" );
4091 const size_t maxsize(
max( m_, n_ ) );
4092 for(
size_t j=1UL; j<maxsize; ++j )
4093 for(
size_t i=0UL; i<j; ++i )
4094 swap( v_[i+j*MM], v_[j+i*MM] );
4096 if( IsVectorizable<Type>::value && n_ < m_ ) {
4097 for(
size_t j=0UL; j<
n_; ++j ) {
4098 for(
size_t i=n_; i<
m_; ++i ) {
4099 v_[i+j*MM] = Type();
4104 if( IsVectorizable<Type>::value && n_ > m_ ) {
4105 for(
size_t j=m_; j<
n_; ++j )
4106 for(
size_t i=0UL; i<
m_; ++i )
4107 v_[i+j*MM] = Type();
4125 template<
typename Type
4128 template<
typename Other >
4129 inline HybridMatrix<Type,M,N,true>&
4130 HybridMatrix<Type,M,N,true>::scale(
const Other& scalar )
4132 for(
size_t j=0UL; j<
n_; ++j )
4133 for(
size_t i=0UL; i<
m_; ++i )
4134 v_[i+j*MM] *= scalar;
4150 template<
typename Type
4157 const size_t maxrows(
max( m_, m.m_ ) );
4158 const size_t maxcols(
max( n_, m.n_ ) );
4160 for(
size_t j=0UL; j<maxcols; ++j ) {
4161 for(
size_t i=0UL; i<maxrows; ++i ) {
4162 swap( v_[i+j*MM], m(i,j) );
4192 template<
typename Type
4195 inline void* HybridMatrix<Type,M,N,true>::operator
new( std::size_t
size )
4201 return allocate<HybridMatrix>( 1UL );
4218 template<
typename Type
4221 inline void* HybridMatrix<Type,M,N,true>::operator
new[]( std::size_t
size )
4226 return allocate<HybridMatrix>(
size/
sizeof(HybridMatrix) );
4243 template<
typename Type
4246 inline void* HybridMatrix<Type,M,N,true>::operator
new( std::size_t
size,
const std::nothrow_t& )
4252 return allocate<HybridMatrix>( 1UL );
4269 template<
typename Type
4272 inline void* HybridMatrix<Type,M,N,true>::operator
new[]( std::size_t
size,
const std::nothrow_t& )
4277 return allocate<HybridMatrix>(
size/
sizeof(HybridMatrix) );
4290 template<
typename Type
4293 inline void HybridMatrix<Type,M,N,true>::operator
delete(
void* ptr )
4295 deallocate( static_cast<HybridMatrix*>( ptr ) );
4308 template<
typename Type
4311 inline void HybridMatrix<Type,M,N,true>::operator
delete[](
void* ptr )
4313 deallocate( static_cast<HybridMatrix*>( ptr ) );
4326 template<
typename Type
4329 inline void HybridMatrix<Type,M,N,true>::operator
delete(
void* ptr,
const std::nothrow_t& )
4331 deallocate( static_cast<HybridMatrix*>( ptr ) );
4344 template<
typename Type
4347 inline void HybridMatrix<Type,M,N,true>::operator
delete[](
void* ptr,
const std::nothrow_t& )
4349 deallocate( static_cast<HybridMatrix*>( ptr ) );
4374 template<
typename Type
4377 template<
typename Other >
4380 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4397 template<
typename Type
4400 template<
typename Other >
4403 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4419 template<
typename Type
4445 template<
typename Type
4448 inline typename HybridMatrix<Type,M,N,true>::IntrinsicType
4460 return load( &v_[i+j*MM] );
4481 template<
typename Type
4484 inline typename HybridMatrix<Type,M,N,true>::IntrinsicType
4495 return loadu( &v_[i+j*MM] );
4517 template<
typename Type
4531 store( &v_[i+j*MM], value );
4553 template<
typename Type
4566 storeu( &v_[i+j*MM], value );
4589 template<
typename Type
4603 stream( &v_[i+j*MM], value );
4621 template<
typename Type
4624 template<
typename MT
4626 inline typename DisableIf< typename HybridMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
4631 for(
size_t j=0UL; j<
n_; ++j ) {
4632 for(
size_t i=0UL; i<
m_; ++i ) {
4633 v_[i+j*MM] = (~rhs)(i,j);
4653 template<
typename Type
4656 template<
typename MT
4658 inline typename EnableIf< typename HybridMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
4667 for(
size_t j=0UL; j<
n_; ++j ) {
4689 template<
typename Type
4692 template<
typename MT >
4699 for(
size_t j=0UL; j<
n_; ++j )
4700 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
4701 v_[element->index()+j*MM] = element->value();
4719 template<
typename Type
4722 template<
typename MT >
4731 for(
size_t i=0UL; i<
m_; ++i )
4732 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
4733 v_[i+element->index()*MM] = element->value();
4751 template<
typename Type
4754 template<
typename MT
4756 inline typename DisableIf< typename HybridMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
4761 for(
size_t j=0UL; j<
n_; ++j ) {
4762 for(
size_t i=0UL; i<
m_; ++i ) {
4763 v_[i+j*MM] += (~rhs)(i,j);
4783 template<
typename Type
4786 template<
typename MT
4788 inline typename EnableIf< typename HybridMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
4798 for(
size_t j=0UL; j<
n_; ++j ) {
4800 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) + (~rhs).
load(i,j) );
4820 template<
typename Type
4823 template<
typename MT >
4830 for(
size_t j=0UL; j<
n_; ++j )
4831 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
4832 v_[element->index()+j*MM] += element->value();
4850 template<
typename Type
4853 template<
typename MT >
4862 for(
size_t i=0UL; i<
m_; ++i )
4863 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
4864 v_[i+element->index()*MM] += element->value();
4882 template<
typename Type
4885 template<
typename MT
4887 inline typename DisableIf< typename HybridMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
4892 for(
size_t j=0UL; j<
n_; ++j ) {
4893 for(
size_t i=0UL; i<
m_; ++i ) {
4894 v_[i+j*MM] -= (~rhs)(i,j);
4914 template<
typename Type
4917 template<
typename MT
4919 inline typename EnableIf< typename HybridMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
4929 for(
size_t j=0UL; j<
n_; ++j ) {
4931 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) - (~rhs).
load(i,j) );
4951 template<
typename Type
4954 template<
typename MT >
4961 for(
size_t j=0UL; j<
n_; ++j )
4962 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
4963 v_[element->index()+j*MM] -= element->value();
4981 template<
typename Type
4984 template<
typename MT >
4993 for(
size_t i=0UL; i<
m_; ++i )
4994 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
4995 v_[i+element->index()*MM] -= element->value();
5021 template<
typename Type
5024 class HybridMatrix<Type,M,0UL,SO>;
5037 template<
typename Type
5040 class HybridMatrix<Type,0UL,N,SO>;
5053 template<
typename Type
5055 class HybridMatrix<Type,0UL,0UL,SO>;
5075 template<
typename Type,
size_t M,
size_t N,
bool SO >
5076 inline void reset( HybridMatrix<Type,M,N,SO>& m );
5078 template<
typename Type,
size_t M,
size_t N,
bool SO >
5079 inline void reset( HybridMatrix<Type,M,N,SO>& m,
size_t i );
5081 template<
typename Type,
size_t M,
size_t N,
bool SO >
5082 inline void clear( HybridMatrix<Type,M,N,SO>& m );
5084 template<
typename Type,
size_t M,
size_t N,
bool SO >
5085 inline bool isDefault(
const HybridMatrix<Type,M,N,SO>& m );
5087 template<
typename Type,
size_t M,
size_t N,
bool SO >
5088 inline void swap( HybridMatrix<Type,M,N,SO>& a, HybridMatrix<Type,M,N,SO>& b ) ;
5090 template<
typename Type,
size_t M,
size_t N,
bool SO >
5091 inline void move( HybridMatrix<Type,M,N,SO>& dst, HybridMatrix<Type,M,N,SO>& src ) ;
5103 template<
typename Type
5127 template<
typename Type
5145 template<
typename Type
5174 template<
typename Type
5180 return ( m.rows() == 0UL && m.columns() == 0UL );
5194 template<
typename Type
5214 template<
typename Type
5235 template<
typename T,
size_t M,
size_t N,
bool SO >
5236 struct IsResizable< HybridMatrix<T,M,N,SO> > :
public TrueType
5255 template<
typename T1,
size_t M1,
size_t N1,
bool SO,
typename T2,
size_t M2,
size_t N2 >
5256 struct AddTrait< HybridMatrix<T1,M1,N1,SO>, StaticMatrix<T2,M2,N2,SO> >
5258 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M2, N2, SO > Type;
5261 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5262 struct AddTrait< HybridMatrix<T1,M1,N1,SO1>, StaticMatrix<T2,M2,N2,SO2> >
5264 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M2, N2,
false > Type;
5267 template<
typename T1,
size_t M1,
size_t N1,
bool SO,
typename T2,
size_t M2,
size_t N2 >
5268 struct AddTrait< StaticMatrix<T1,M1,N1,SO>, HybridMatrix<T2,M2,N2,SO> >
5270 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M2, N2, SO > Type;
5273 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5274 struct AddTrait< StaticMatrix<T1,M1,N1,SO1>, HybridMatrix<T2,M2,N2,SO2> >
5276 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M2, N2,
false > Type;
5279 template<
typename T1,
size_t M1,
size_t N1,
bool SO,
typename T2,
size_t M2,
size_t N2 >
5280 struct AddTrait< HybridMatrix<T1,M1,N1,SO>, HybridMatrix<T2,M2,N2,SO> >
5282 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, ( M1 < M2 )?( M1 ):( M2 ), ( N1 < N2 )?( N1 ):( N2 ), SO > Type;
5285 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5286 struct AddTrait< HybridMatrix<T1,M1,N1,SO1>, HybridMatrix<T2,M2,N2,SO2> >
5288 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, ( M1 < M2 )?( M1 ):( M2 ), ( N1 < N2 )?( N1 ):( N2 ), false > Type;
5304 template<
typename T1,
size_t M1,
size_t N1,
bool SO,
typename T2,
size_t M2,
size_t N2 >
5305 struct SubTrait< HybridMatrix<T1,M1,N1,SO>, StaticMatrix<T2,M2,N2,SO> >
5307 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M2, N2, SO > Type;
5310 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5311 struct SubTrait< HybridMatrix<T1,M1,N1,SO1>, StaticMatrix<T2,M2,N2,SO2> >
5313 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M2, N2,
false > Type;
5316 template<
typename T1,
size_t M1,
size_t N1,
bool SO,
typename T2,
size_t M2,
size_t N2 >
5317 struct SubTrait< StaticMatrix<T1,M1,N1,SO>, HybridMatrix<T2,M2,N2,SO> >
5319 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M2, N2, SO > Type;
5322 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5323 struct SubTrait< StaticMatrix<T1,M1,N1,SO1>, HybridMatrix<T2,M2,N2,SO2> >
5325 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M2, N2,
false > Type;
5328 template<
typename T1,
size_t M1,
size_t N1,
bool SO,
typename T2,
size_t M2,
size_t N2 >
5329 struct SubTrait< HybridMatrix<T1,M1,N1,SO>, HybridMatrix<T2,M2,N2,SO> >
5331 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, ( M1 < M2 )?( M1 ):( M2 ), ( N1 < N2 )?( N1 ):( N2 ), SO > Type;
5334 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5335 struct SubTrait< HybridMatrix<T1,M1,N1,SO1>, HybridMatrix<T2,M2,N2,SO2> >
5337 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, ( M1 < M2 )?( M1 ):( M2 ), ( N1 < N2 )?( N1 ):( N2 ), false > Type;
5353 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5354 struct MultTrait< HybridMatrix<T1,M,N,SO>, T2 >
5356 typedef HybridMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
5360 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
5361 struct MultTrait< T1, HybridMatrix<T2,M,N,SO> >
5363 typedef HybridMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
5367 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2,
size_t K >
5368 struct MultTrait< HybridMatrix<T1,M,N,SO>, StaticVector<T2,K,false> >
5370 typedef HybridVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5373 template<
typename T1,
size_t K,
typename T2,
size_t M,
size_t N,
bool SO >
5374 struct MultTrait< StaticVector<T1,K,true>, HybridMatrix<T2,M,N,SO> >
5376 typedef HybridVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5379 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2,
size_t K >
5380 struct MultTrait< HybridMatrix<T1,M,N,SO>, HybridVector<T2,K,false> >
5382 typedef HybridVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5385 template<
typename T1,
size_t K,
typename T2,
size_t M,
size_t N,
bool SO >
5386 struct MultTrait< HybridVector<T1,K,true>, HybridMatrix<T2,M,N,SO> >
5388 typedef HybridVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5391 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5392 struct MultTrait< HybridMatrix<T1,M,N,SO>, DynamicVector<T2,false> >
5394 typedef HybridVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5397 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
5398 struct MultTrait< DynamicVector<T1,true>, HybridMatrix<T2,M,N,SO> >
5400 typedef HybridVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5403 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5404 struct MultTrait< HybridMatrix<T1,M,N,SO>, CompressedVector<T2,false> >
5406 typedef HybridVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5409 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
5410 struct MultTrait< CompressedVector<T1,true>, HybridMatrix<T2,M,N,SO> >
5412 typedef HybridVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5415 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5416 struct MultTrait< HybridMatrix<T1,M1,N1,SO1>, StaticMatrix<T2,M2,N2,SO2> >
5418 typedef HybridMatrix< typename MultTrait<T1,T2>::Type, M1, N2, SO1 > Type;
5421 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5422 struct MultTrait< StaticMatrix<T1,M1,N1,SO1>, HybridMatrix<T2,M2,N2,SO2> >
5424 typedef HybridMatrix< typename MultTrait<T1,T2>::Type, M1, N2, SO1 > Type;
5427 template<
typename T1,
size_t M1,
size_t N1,
bool SO1,
typename T2,
size_t M2,
size_t N2,
bool SO2 >
5428 struct MultTrait< HybridMatrix<T1,M1,N1,SO1>, HybridMatrix<T2,M2,N2,SO2> >
5430 typedef HybridMatrix< typename MultTrait<T1,T2>::Type, M1, N2, SO1 > Type;
5446 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5447 struct DivTrait< HybridMatrix<T1,M,N,SO>, T2 >
5449 typedef HybridMatrix< typename DivTrait<T1,T2>::Type, M, N, SO > Type;
5466 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5467 struct MathTrait< HybridMatrix<T1,M,N,SO>, HybridMatrix<T2,M,N,SO> >
5469 typedef HybridMatrix< typename MathTrait<T1,T2>::HighType, M, N, SO > HighType;
5470 typedef HybridMatrix< typename MathTrait<T1,T2>::LowType , M, N, SO > LowType;
5486 template<
typename T1,
size_t M,
size_t N,
bool SO >
5487 struct SubmatrixTrait< HybridMatrix<T1,M,N,SO> >
5489 typedef HybridMatrix<T1,M,N,SO> Type;
5505 template<
typename T1,
size_t M,
size_t N,
bool SO >
5506 struct RowTrait< HybridMatrix<T1,M,N,SO> >
5508 typedef HybridVector<T1,N,true> Type;
5524 template<
typename T1,
size_t M,
size_t N,
bool SO >
5525 struct ColumnTrait< HybridMatrix<T1,M,N,SO> >
5527 typedef HybridVector<T1,M,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
void stream(size_t i, size_t j, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the matrix.
Definition: HybridMatrix.h:2181
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:994
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i.
Definition: HybridMatrix.h:985
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i.
Definition: HybridMatrix.h:1057
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
Constraint on the data type.
Header file for mathematical functions.
void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: HybridMatrix.h:2110
void swap(SymmetricMatrix< MT, SO, DF, NF > &a, SymmetricMatrix< MT, SO, DF, NF > &b)
Swapping the contents of two matrices.
Definition: SymmetricMatrix.h:195
#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
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: HybridMatrix.h:2075
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: HybridMatrix.h:1409
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:258
Header file for the row trait.
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.
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type stream(T *address, const typename Stream< T, sizeof(T)>::Type &value)
Aligned, non-temporal store of a vector of integral values.
Definition: Stream.h:220
Header file for the IsSame and IsStrictlySame type traits.
This ResultType
Result type for expression template evaluations.
Definition: HybridMatrix.h:202
Header file for the IsColumnMajorMatrix type trait.
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2636
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: HybridMatrix.h:801
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:224
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#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
size_t n_
The current number of columns of the matrix.
Definition: HybridMatrix.h:442
Header file for memory allocation and deallocation functionality.
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: HybridMatrix.h:1992
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Constraint on the data type.
const Type & ReturnType
Return type for expression template evaluations.
Definition: HybridMatrix.h:207
IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: HybridMatrix.h:2039
Header file for the SparseMatrix base class.
Type * Pointer
Pointer to a non-constant matrix value.
Definition: HybridMatrix.h:211
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the matrix.
Definition: HybridMatrix.h:1616
Type & Reference
Reference to a non-constant matrix value.
Definition: HybridMatrix.h:209
Header file for the DisableIf class template.
HybridMatrix< Type, N, M,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: HybridMatrix.h:204
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: HybridMatrix.h:212
Header file for the multiplication trait.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: HybridMatrix.h:1374
Header file for the clear shim.
Header file for nested template disabiguation.
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: HybridMatrix.h:2146
Iterator end(size_t i)
Returns an iterator just past the last element of row/column i.
Definition: HybridMatrix.h:1009
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4754
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: HybridMatrix.h:1467
#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
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: HybridMatrix.h:2012
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: HybridMatrix.h:1970
Header file for the DenseMatrix base class.
Pointer data()
Low-level data access to the matrix elements.
Definition: HybridMatrix.h:848
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.
BLAZE_ALWAYS_INLINE void clear(const NonNumericProxy< MT > &proxy)
Clearing the represented element.
Definition: NonNumericProxy.h:854
HybridMatrix()
The default constructor for HybridMatrix.
Definition: HybridMatrix.h:477
Constraint on the data type.
HybridMatrix< Type, M, N,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: HybridMatrix.h:203
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Loadu< T, sizeof(T)> >::Type::Type loadu(const T *address)
Loads a vector of integral values.
Definition: Loadu.h:221
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
HybridMatrix< ET, M, N, SO > Other
The type of the other HybridMatrix.
Definition: HybridMatrix.h:222
void reset()
Reset to the default initial values.
Definition: HybridMatrix.h:1521
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
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:2480
Header file for the EnableIf class template.
Header file for the IsVectorizable type trait.
DenseIterator< const Type > ConstIterator
Iterator over constant elements.
Definition: HybridMatrix.h:214
Header file for the IsNumeric type trait.
Type ElementType
Type of the matrix elements.
Definition: HybridMatrix.h:205
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Set< T, sizeof(T)> >::Type::Type set(T value)
Sets all values in the vector to the given integral value.
Definition: Set.h:211
Iterator begin(size_t i)
Returns an iterator to the first element of row/column i.
Definition: HybridMatrix.h:937
#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.
HybridMatrix & transpose()
Transposing the matrix.
Definition: HybridMatrix.h:1686
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
Header file for the division trait.
size_t capacity() const
Returns the maximum capacity of the matrix.
Definition: HybridMatrix.h:1425
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
Constraint on the data type.
#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
void move(DynamicMatrix< Type, SO > &dst, DynamicMatrix< Type, SO > &src)
Moving the contents of one dynamic matrix to another.
Definition: DynamicMatrix.h:4769
Header file for the AlignedArray implementation.
Efficient implementation of a dynamically sized matrix with static memory.The HybridMatrix class temp...
Definition: Forward.h:56
#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:2481
Header file for the column trait.
Header file for the isDefault shim.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:87
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
Constraint on the data type.
DenseIterator< Type > Iterator
Iterator over non-constant elements.
Definition: HybridMatrix.h:213
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
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.
Rebind mechanism to obtain a HybridMatrix with different data/element type.
Definition: HybridMatrix.h:221
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2637
Header file for the IsRowMajorMatrix type trait.
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: HybridMatrix.h:206
const Type & ConstReference
Reference to a constant matrix value.
Definition: HybridMatrix.h:210
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2473
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
void swap(HybridMatrix &m)
Swapping the contents of two hybrid matrices.
Definition: HybridMatrix.h:1754
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type storeu(T *address, const typename Storeu< T, sizeof(T)>::Type &value)
Unaligned store of a vector of integral values.
Definition: Storeu.h:218
void clear()
Clearing the hybrid matrix.
Definition: HybridMatrix.h:1569
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
size_t columns() const
Returns the current number of columns of the matrix.
Definition: HybridMatrix.h:1390
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2479
HybridMatrix< Type, M, N, SO > This
Type of this HybridMatrix instance.
Definition: HybridMatrix.h:201
size_t m_
The current number of rows of the matrix.
Definition: HybridMatrix.h:441
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
void extend(size_t m, size_t n, bool preserve=true)
Extending the size of the matrix.
Definition: HybridMatrix.h:1663
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type store(T *address, const typename Store< T, sizeof(T)>::Type &value)
Aligned store of a vector of integral values.
Definition: Store.h:225
IntrinsicTrait< Type > IT
Intrinsic trait for the matrix element type.
Definition: HybridMatrix.h:191
Header file for the IsResizable type trait.
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: HybridMatrix.h:431
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
const This & CompositeType
Data type for composite expression templates.
Definition: HybridMatrix.h:208
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