35 #ifndef _BLAZE_MATH_VIEWS_DENSESUBMATRIX_H_
36 #define _BLAZE_MATH_VIEWS_DENSESUBMATRIX_H_
380 template<
typename MT
382 ,
bool SO = IsColumnMajorMatrix<MT>::value >
433 template<
typename IteratorType >
442 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
445 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
448 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
451 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
587 for(
size_t j=0UL; j<
rest_; ++j )
727 enum { vectorizable = MT::vectorizable };
730 enum { smpAssignable = MT::smpAssignable };
767 template<
typename MT2,
bool SO2 >
inline DenseSubmatrix& operator+=(
const Matrix<MT2,SO2>& rhs );
768 template<
typename MT2,
bool SO2 >
inline DenseSubmatrix& operator-=(
const Matrix<MT2,SO2>& rhs );
769 template<
typename MT2,
bool SO2 >
inline DenseSubmatrix& operator*=(
const Matrix<MT2,SO2>& rhs );
771 template<
typename Other >
772 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
773 operator*=( Other rhs );
775 template<
typename Other >
776 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
777 operator/=( Other rhs );
784 inline size_t rows()
const;
788 inline size_t capacity(
size_t i )
const;
790 inline size_t nonZeros(
size_t i )
const;
792 inline void reset(
size_t i );
793 template<
typename Other >
inline DenseSubmatrix& scale( Other scalar );
800 template<
typename MT2 >
802 struct VectorizedAssign {
803 enum { value = vectorizable && MT2::vectorizable &&
804 IsSame<ElementType,typename MT2::ElementType>::value };
811 template<
typename MT2 >
813 struct VectorizedAddAssign {
814 enum { value = vectorizable && MT2::vectorizable &&
815 IsSame<ElementType,typename MT2::ElementType>::value &&
816 IntrinsicTrait<ElementType>::addition };
823 template<
typename MT2 >
825 struct VectorizedSubAssign {
826 enum { value = vectorizable && MT2::vectorizable &&
827 IsSame<ElementType,typename MT2::ElementType>::value &&
828 IntrinsicTrait<ElementType>::subtraction };
837 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
838 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
849 template<
typename MT2 >
850 inline typename DisableIf< VectorizedAssign<MT2> >::Type
851 assign(
const DenseMatrix<MT2,SO>& rhs );
853 template<
typename MT2 >
854 inline typename EnableIf< VectorizedAssign<MT2> >::Type
855 assign(
const DenseMatrix<MT2,SO>& rhs );
857 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,!SO>& rhs );
858 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,SO>& rhs );
859 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,!SO>& rhs );
861 template<
typename MT2 >
862 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
863 addAssign(
const DenseMatrix<MT2,SO>& rhs );
865 template<
typename MT2 >
866 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
867 addAssign(
const DenseMatrix<MT2,SO>& rhs );
869 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,!SO>& rhs );
870 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,SO>& rhs );
871 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,!SO>& rhs );
873 template<
typename MT2 >
874 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
875 subAssign(
const DenseMatrix<MT2,SO>& rhs );
877 template<
typename MT2 >
878 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
879 subAssign(
const DenseMatrix<MT2,SO>& rhs );
881 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,!SO>& rhs );
882 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,SO>& rhs );
883 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,!SO>& rhs );
917 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
957 template<
typename MT
966 , rest_ ( n %
IT::size )
967 , final_ ( n - rest_ )
968 , isAligned_( ( column %
IT::size == 0UL ) &&
969 ( column + n == matrix.
columns() || n %
IT::size == 0UL ) )
971 if( ( row + m > matrix.rows() ) || ( column + n > matrix.columns() ) )
972 throw std::invalid_argument(
"Invalid submatrix specification" );
992 template<
typename MT
1001 return matrix_(row_+i,column_+j);
1013 template<
typename MT
1022 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
1036 template<
typename MT
1041 return matrix_.data() + row_*
spacing() + column_;
1055 template<
typename MT
1060 return matrix_.data() + row_*
spacing() + column_;
1076 template<
typename MT
1082 const typename MT::Iterator first( matrix_.begin( row_ + i ) + column_ );
1083 return Iterator( first, first + final_, rest_, isAligned_ );
1099 template<
typename MT
1107 return ConstIterator( first, first + final_, rest_, isAligned_ );
1123 template<
typename MT
1131 return ConstIterator( first, first + final_, rest_, isAligned_ );
1147 template<
typename MT
1153 const typename MT::Iterator last( matrix_.begin( row_ + i ) + column_ +
n_ );
1154 return Iterator( last, last, rest_, isAligned_ );
1170 template<
typename MT
1194 template<
typename MT
1221 template<
typename MT
1226 const size_t iend( row_ +
m_ );
1227 const size_t jend( column_ +
n_ );
1229 for(
size_t i=row_; i<iend; ++i )
1230 for(
size_t j=column_; j<jend; ++j )
1249 template<
typename MT
1257 if(
this == &rhs || ( &matrix_ == &rhs.
matrix_ && row_ == rhs.
row_ && column_ == rhs.
column_ ) )
1261 throw std::invalid_argument(
"Submatrix sizes do not match" );
1288 template<
typename MT
1291 template<
typename MT2
1298 throw std::invalid_argument(
"Matrix sizes do not match" );
1303 if( (~rhs).canAlias( &matrix_ ) ) {
1326 template<
typename MT
1329 template<
typename MT2
1336 throw std::invalid_argument(
"Matrix sizes do not match" );
1338 if( (~rhs).canAlias( &matrix_ ) ) {
1361 template<
typename MT
1364 template<
typename MT2
1371 throw std::invalid_argument(
"Matrix sizes do not match" );
1373 if( (~rhs).canAlias( &matrix_ ) ) {
1396 template<
typename MT
1399 template<
typename MT2
1404 throw std::invalid_argument(
"Matrix sizes do not match" );
1411 const MultType tmp( *
this * (~rhs) );
1428 template<
typename MT
1431 template<
typename Other >
1448 template<
typename MT
1451 template<
typename Other >
1476 template<
typename MT
1491 template<
typename MT
1511 template<
typename MT
1516 return matrix_.spacing();
1526 template<
typename MT
1547 template<
typename MT
1563 template<
typename MT
1568 const size_t iend( row_ +
m_ );
1569 const size_t jend( column_ +
n_ );
1570 size_t nonzeros( 0UL );
1572 for(
size_t i=row_; i<iend; ++i )
1573 for(
size_t j=column_; j<jend; ++j )
1593 template<
typename MT
1600 const size_t jend( column_ +
n_ );
1601 size_t nonzeros( 0UL );
1603 for(
size_t j=column_; j<jend; ++j )
1617 template<
typename MT
1624 const size_t iend( row_ +
m_ );
1625 const size_t jend( column_ +
n_ );
1627 for(
size_t i=row_; i<iend; ++i )
1628 for(
size_t j=column_; j<jend; ++j )
1629 reset( matrix_(i,j) );
1645 template<
typename MT
1654 const size_t jend( column_ +
n_ );
1655 for(
size_t j=column_; j<jend; ++j )
1656 reset( matrix_(row_+i,j) );
1667 template<
typename MT
1670 template<
typename Other >
1673 const size_t iend( row_ +
m_ );
1674 const size_t jend( column_ +
n_ );
1676 for(
size_t i=row_; i<iend; ++i )
1677 for(
size_t j=column_; j<jend; ++j )
1678 matrix_(i,j) *= scalar;
1703 template<
typename MT
1706 template<
typename Other >
1709 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1724 template<
typename MT
1727 template<
typename Other >
1730 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1744 template<
typename MT
1764 template<
typename MT
1790 template<
typename MT
1796 return loadu( i, j );
1817 template<
typename MT
1829 if( isAligned_ || j != final_ ) {
1830 return matrix_.loadu( row_+i, column_+j );
1834 for(
size_t k=0UL; k<rest_; ++k )
1835 value[k] = matrix_(row_+i,column_+j+k);
1858 template<
typename MT
1884 template<
typename MT
1895 if( isAligned_ || j != final_ ) {
1896 matrix_.storeu( row_+i, column_+j, value );
1899 for(
size_t k=0UL; k<rest_; ++k )
1900 matrix_(row_+i,column_+j+k) = value[k];
1923 template<
typename MT
1944 template<
typename MT
1947 template<
typename MT2 >
1954 const size_t jend(
n_ &
size_t(-2) );
1957 for(
size_t i=0UL; i<
m_; ++i ) {
1958 for(
size_t j=0UL; j<jend; j+=2UL ) {
1959 matrix_(row_+i,column_+j ) = (~rhs)(i,j );
1960 matrix_(row_+i,column_+j+1UL) = (~rhs)(i,j+1UL);
1963 matrix_(row_+i,column_+jend) = (~rhs)(i,jend);
1981 template<
typename MT
1984 template<
typename MT2 >
1995 !(~rhs).isAliased( &matrix_ ) )
1997 for(
size_t i=0UL; i<
m_; ++i )
1998 for(
size_t j=0UL; j<
n_; j+=IT::size )
1999 matrix_.stream( row_+i, column_+j, (~rhs).load(i,j) );
2003 const size_t jend(
n_ &
size_t(-IT::size*4) );
2006 for(
size_t i=0UL; i<
m_; ++i ) {
2008 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
2009 matrix_.storeu( row_+i, column_+j , it.load() ); it += IT::size;
2010 matrix_.storeu( row_+i, column_+j+IT::size , it.load() ); it += IT::size;
2011 matrix_.storeu( row_+i, column_+j+IT::size*2UL, it.load() ); it += IT::size;
2012 matrix_.storeu( row_+i, column_+j+IT::size*3UL, it.load() ); it += IT::size;
2014 for(
size_t j=jend; j<
n_; j+=IT::size, it+=IT::size ) {
2015 storeu( i, j, it.load() );
2034 template<
typename MT
2037 template<
typename MT2 >
2043 const size_t block( 16UL );
2045 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2046 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
2047 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2048 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
2049 for(
size_t i=ii; i<iend; ++i ) {
2050 for(
size_t j=jj; j<jend; ++j ) {
2051 matrix_(row_+i,column_+j) = (~rhs)(i,j);
2071 template<
typename MT
2074 template<
typename MT2 >
2080 for(
size_t i=0UL; i<
m_; ++i )
2081 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2082 matrix_(row_+i,column_+element->index()) = element->value();
2098 template<
typename MT
2101 template<
typename MT2 >
2107 for(
size_t j=0UL; j<
n_; ++j )
2108 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2109 matrix_(row_+element->index(),column_+j) = element->value();
2125 template<
typename MT
2128 template<
typename MT2 >
2135 const size_t jend(
n_ &
size_t(-2) );
2138 for(
size_t i=0UL; i<
m_; ++i ) {
2139 for(
size_t j=0UL; j<jend; j+=2UL ) {
2140 matrix_(row_+i,column_+j ) += (~rhs)(i,j );
2141 matrix_(row_+i,column_+j+1UL) += (~rhs)(i,j+1UL);
2144 matrix_(row_+i,column_+jend) += (~rhs)(i,jend);
2162 template<
typename MT
2165 template<
typename MT2 >
2174 const size_t jend(
n_ &
size_t(-IT::size*4) );
2177 for(
size_t i=0UL; i<
m_; ++i ) {
2179 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
2180 matrix_.storeu( row_+i, column_+j ,
load(i,j ) + it.load() ); it += IT::size;
2181 matrix_.storeu( row_+i, column_+j+IT::size ,
load(i,j+IT::size ) + it.load() ); it += IT::size;
2182 matrix_.storeu( row_+i, column_+j+IT::size*2UL,
load(i,j+IT::size*2UL) + it.load() ); it += IT::size;
2183 matrix_.storeu( row_+i, column_+j+IT::size*3UL,
load(i,j+IT::size*3UL) + it.load() ); it += IT::size;
2185 for(
size_t j=jend; j<
n_; j+=IT::size, it+=IT::size ) {
2204 template<
typename MT
2207 template<
typename MT2 >
2213 const size_t block( 16UL );
2215 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2216 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
2217 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2218 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
2219 for(
size_t i=ii; i<iend; ++i ) {
2220 for(
size_t j=jj; j<jend; ++j ) {
2221 matrix_(row_+i,column_+j) += (~rhs)(i,j);
2241 template<
typename MT
2244 template<
typename MT2 >
2250 for(
size_t i=0UL; i<
m_; ++i )
2251 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2252 matrix_(row_+i,column_+element->index()) += element->value();
2268 template<
typename MT
2271 template<
typename MT2 >
2277 for(
size_t j=0UL; j<
n_; ++j )
2278 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2279 matrix_(row_+element->index(),column_+j) += element->value();
2295 template<
typename MT
2298 template<
typename MT2 >
2305 const size_t jend(
n_ &
size_t(-2) );
2308 for(
size_t i=0UL; i<
m_; ++i ) {
2309 for(
size_t j=0UL; j<jend; j+=2UL ) {
2310 matrix_(row_+i,column_+j ) -= (~rhs)(i,j );
2311 matrix_(row_+i,column_+j+1UL) -= (~rhs)(i,j+1UL);
2314 matrix_(row_+i,column_+jend) -= (~rhs)(i,jend);
2332 template<
typename MT
2335 template<
typename MT2 >
2344 const size_t jend(
n_ &
size_t(-IT::size*4) );
2347 for(
size_t i=0UL; i<
m_; ++i ) {
2349 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
2350 matrix_.storeu( row_+i, column_+j ,
load(i,j ) - it.load() ); it += IT::size;
2351 matrix_.storeu( row_+i, column_+j+IT::size ,
load(i,j+IT::size ) - it.load() ); it += IT::size;
2352 matrix_.storeu( row_+i, column_+j+IT::size*2UL,
load(i,j+IT::size*2UL) - it.load() ); it += IT::size;
2353 matrix_.storeu( row_+i, column_+j+IT::size*3UL,
load(i,j+IT::size*3UL) - it.load() ); it += IT::size;
2355 for(
size_t j=jend; j<
n_; j+=IT::size, it+=IT::size ) {
2374 template<
typename MT
2377 template<
typename MT2 >
2383 const size_t block( 16UL );
2385 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2386 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
2387 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2388 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
2389 for(
size_t i=ii; i<iend; ++i ) {
2390 for(
size_t j=jj; j<jend; ++j ) {
2391 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
2411 template<
typename MT
2414 template<
typename MT2 >
2420 for(
size_t i=0UL; i<
m_; ++i )
2421 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2422 matrix_(row_+i,column_+element->index()) -= element->value();
2438 template<
typename MT
2441 template<
typename MT2 >
2447 for(
size_t j=0UL; j<
n_; ++j )
2448 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2449 matrix_(row_+element->index(),column_+j) -= element->value();
2474 template<
typename MT >
2500 typedef DenseSubmatrix<MT,unaligned,true>
This;
2501 typedef typename SubmatrixTrait<MT>::Type
ResultType;
2513 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
2519 typedef typename SelectType< useConst, ConstPointer, ElementType* >::Type
Pointer;
2525 template<
typename IteratorType >
2526 class SubmatrixIterator
2531 typedef typename std::iterator_traits<IteratorType>::iterator_category
IteratorCategory;
2534 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
2537 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
2540 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
2543 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
2679 for(
size_t j=0UL; j<
rest_; ++j )
2771 return SubmatrixIterator( it.iterator_ + inc, it.final_, it.rest_, it.isAligned_ );
2783 return SubmatrixIterator( it.iterator_ + inc, it.final_, it.rest_, it.isAligned_ );
2795 return SubmatrixIterator( it.iterator_ - dec, it.final_, it.rest_, it.isAligned_ );
2811 typedef SubmatrixIterator<typename MT::ConstIterator>
ConstIterator;
2814 typedef typename SelectType< useConst, ConstIterator, SubmatrixIterator<typename MT::Iterator> >::Type
Iterator;
2819 enum { vectorizable = MT::vectorizable };
2822 enum { smpAssignable = MT::smpAssignable };
2859 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator+=(
const Matrix<MT2,SO>& rhs );
2860 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator-=(
const Matrix<MT2,SO>& rhs );
2861 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator*=(
const Matrix<MT2,SO>& rhs );
2863 template<
typename Other >
2864 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
2865 operator*=( Other rhs );
2867 template<
typename Other >
2868 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
2869 operator/=( Other rhs );
2876 inline size_t rows()
const;
2877 inline size_t columns()
const;
2878 inline size_t spacing()
const;
2880 inline size_t capacity(
size_t i )
const;
2882 inline size_t nonZeros(
size_t i )
const;
2883 inline void reset();
2884 inline void reset(
size_t i );
2885 template<
typename Other >
inline DenseSubmatrix& scale( Other scalar );
2892 template<
typename MT2 >
2893 struct VectorizedAssign {
2894 enum { value = vectorizable && MT2::vectorizable &&
2895 IsSame<ElementType,typename MT2::ElementType>::value };
2901 template<
typename MT2 >
2902 struct VectorizedAddAssign {
2903 enum { value = vectorizable && MT2::vectorizable &&
2904 IsSame<ElementType,typename MT2::ElementType>::value &&
2905 IntrinsicTrait<ElementType>::addition };
2911 template<
typename MT2 >
2912 struct VectorizedSubAssign {
2913 enum { value = vectorizable && MT2::vectorizable &&
2914 IsSame<ElementType,typename MT2::ElementType>::value &&
2915 IntrinsicTrait<ElementType>::subtraction };
2923 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2924 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2935 template<
typename MT2 >
2936 inline typename DisableIf< VectorizedAssign<MT2> >::Type
2937 assign(
const DenseMatrix<MT2,true>& rhs );
2939 template<
typename MT2 >
2940 inline typename EnableIf< VectorizedAssign<MT2> >::Type
2941 assign(
const DenseMatrix<MT2,true>& rhs );
2943 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,false>& rhs );
2944 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,true>& rhs );
2945 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,false>& rhs );
2947 template<
typename MT2 >
2948 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
2949 addAssign(
const DenseMatrix<MT2,true>& rhs );
2951 template<
typename MT2 >
2952 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
2953 addAssign(
const DenseMatrix<MT2,true>& rhs );
2955 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,false>& rhs );
2956 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,true>& rhs );
2957 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,false>& rhs );
2959 template<
typename MT2 >
2960 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
2961 subAssign(
const DenseMatrix<MT2,true>& rhs );
2963 template<
typename MT2 >
2964 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
2965 subAssign(
const DenseMatrix<MT2,true>& rhs );
2967 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,false>& rhs );
2968 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,true>& rhs );
2969 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,false>& rhs );
3002 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
3003 friend const DenseSubmatrix<MT2,AF1,SO2>
3004 submatrix(
const DenseSubmatrix<MT2,AF2,SO2>& dm,
size_t row,
size_t column,
size_t m,
size_t n );
3041 template<
typename MT >
3043 : matrix_ ( matrix )
3045 , column_ ( column )
3048 , rest_ ( m % IT::size )
3049 , final_ ( m - rest_ )
3050 , isAligned_( ( row % IT::size == 0UL ) &&
3051 ( row + m == matrix.
rows() || m % IT::size == 0UL ) )
3053 if( ( row + m > matrix.rows() ) || ( column + n > matrix.columns() ) )
3054 throw std::invalid_argument(
"Invalid submatrix specification" );
3076 template<
typename MT >
3083 return matrix_(row_+i,column_+j);
3097 template<
typename MT >
3104 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
3120 template<
typename MT >
3123 return matrix_.data() + row_ + column_*
spacing();
3139 template<
typename MT >
3140 inline typename DenseSubmatrix<MT,unaligned,true>::ConstPointer
3143 return matrix_.data() + row_ + column_*
spacing();
3156 template<
typename MT >
3161 const typename MT::Iterator first( matrix_.begin( column_ + j ) + row_ );
3162 return Iterator( first, first + final_, rest_, isAligned_ );
3175 template<
typename MT >
3181 return ConstIterator( first, first + final_, rest_, isAligned_ );
3194 template<
typename MT >
3200 return ConstIterator( first, first + final_, rest_, isAligned_ );
3213 template<
typename MT >
3218 const typename MT::Iterator last( matrix_.begin( column_ + j ) + row_ +
m_ );
3219 return Iterator( last, last, rest_, isAligned_ );
3232 template<
typename MT >
3251 template<
typename MT >
3278 template<
typename MT >
3279 inline DenseSubmatrix<MT,unaligned,true>&
3282 const size_t iend( row_ +
m_ );
3283 const size_t jend( column_ +
n_ );
3285 for(
size_t j=column_; j<jend; ++j )
3286 for(
size_t i=row_; i<iend; ++i )
3307 template<
typename MT >
3308 inline DenseSubmatrix<MT,unaligned,true>&
3314 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
3317 if(
rows() != rhs.rows() ||
columns() != rhs.columns() )
3318 throw std::invalid_argument(
"Submatrix sizes do not match" );
3320 if( rhs.canAlias( &matrix_ ) ) {
3325 if( IsSparseMatrix<MT>::value )
3347 template<
typename MT >
3348 template<
typename MT2
3350 inline DenseSubmatrix<MT,unaligned,true>&
3356 throw std::invalid_argument(
"Matrix sizes do not match" );
3358 if( IsSparseMatrix<MT2>::value )
3361 if( (~rhs).canAlias( &matrix_ ) ) {
3386 template<
typename MT >
3387 template<
typename MT2
3389 inline DenseSubmatrix<MT,unaligned,true>&
3390 DenseSubmatrix<MT,unaligned,true>::operator+=(
const Matrix<MT2,SO>& rhs )
3395 throw std::invalid_argument(
"Matrix sizes do not match" );
3397 if( (~rhs).canAlias( &matrix_ ) ) {
3422 template<
typename MT >
3423 template<
typename MT2
3425 inline DenseSubmatrix<MT,unaligned,true>&
3426 DenseSubmatrix<MT,unaligned,true>::operator-=(
const Matrix<MT2,SO>& rhs )
3431 throw std::invalid_argument(
"Matrix sizes do not match" );
3433 if( (~rhs).canAlias( &matrix_ ) ) {
3458 template<
typename MT >
3459 template<
typename MT2
3461 inline DenseSubmatrix<MT,unaligned,true>&
3462 DenseSubmatrix<MT,unaligned,true>::operator*=(
const Matrix<MT2,SO>& rhs )
3465 throw std::invalid_argument(
"Matrix sizes do not match" );
3467 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
3472 const MultType tmp( *
this * (~rhs) );
3473 if( IsSparseMatrix<MultType>::value )
3491 template<
typename MT >
3492 template<
typename Other >
3493 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,unaligned,true> >::Type&
3494 DenseSubmatrix<MT,unaligned,true>::operator*=( Other rhs )
3511 template<
typename MT >
3512 template<
typename Other >
3513 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,unaligned,true> >::Type&
3514 DenseSubmatrix<MT,unaligned,true>::operator/=( Other rhs )
3539 template<
typename MT >
3554 template<
typename MT >
3572 template<
typename MT >
3575 return matrix_.spacing();
3587 template<
typename MT >
3603 template<
typename MT >
3619 template<
typename MT >
3622 const size_t iend( row_ +
m_ );
3623 const size_t jend( column_ +
n_ );
3624 size_t nonzeros( 0UL );
3626 for(
size_t j=column_; j<jend; ++j )
3627 for(
size_t i=row_; i<iend; ++i )
3644 template<
typename MT >
3649 const size_t iend( row_ +
m_ );
3650 size_t nonzeros( 0UL );
3652 for(
size_t i=row_; i<iend; ++i )
3653 if( !
isDefault( matrix_(i,column_+j) ) )
3668 template<
typename MT >
3673 const size_t iend( row_ +
m_ );
3674 const size_t jend( column_ +
n_ );
3676 for(
size_t j=column_; j<jend; ++j )
3677 for(
size_t i=row_; i<iend; ++i )
3678 reset( matrix_(i,j) );
3691 template<
typename MT >
3698 const size_t iend( row_ +
m_ );
3699 for(
size_t i=row_; i<iend; ++i )
3700 reset( matrix_(i,column_+j) );
3713 template<
typename MT >
3714 template<
typename Other >
3715 inline DenseSubmatrix<MT,unaligned,true>& DenseSubmatrix<MT,unaligned,true>::scale( Other scalar )
3717 const size_t iend( row_ +
m_ );
3718 const size_t jend( column_ +
n_ );
3720 for(
size_t j=column_; j<jend; ++j )
3721 for(
size_t i=row_; i<iend; ++i )
3722 matrix_(i,j) *= scalar;
3749 template<
typename MT >
3750 template<
typename Other >
3753 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
3770 template<
typename MT >
3771 template<
typename Other >
3774 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
3790 template<
typename MT >
3810 template<
typename MT >
3835 template<
typename MT >
3836 inline typename DenseSubmatrix<MT,unaligned,true>::IntrinsicType
3839 return loadu( i, j );
3861 template<
typename MT >
3862 inline typename DenseSubmatrix<MT,unaligned,true>::IntrinsicType
3871 if( isAligned_ || i != final_ ) {
3872 return matrix_.loadu( row_+i, column_+j );
3875 IntrinsicType value;
3876 for(
size_t k=0UL; k<rest_; ++k )
3877 value[k] = matrix_(row_+i+k,column_+j);
3901 template<
typename MT >
3927 template<
typename MT >
3936 if( isAligned_ || i != final_ ) {
3937 matrix_.storeu( row_+i, column_+j, value );
3940 for(
size_t k=0UL; k<rest_; ++k )
3941 matrix_(row_+i+k,column_+j) = value[k];
3965 template<
typename MT >
3986 template<
typename MT >
3987 template<
typename MT2 >
3988 inline typename DisableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
3994 const size_t iend(
m_ &
size_t(-2) );
3997 for(
size_t j=0UL; j<
n_; ++j ) {
3998 for(
size_t i=0UL; i<iend; i+=2UL ) {
3999 matrix_(row_+i ,column_+j) = (~rhs)(i ,j);
4000 matrix_(row_+i+1UL,column_+j) = (~rhs)(i+1UL,j);
4003 matrix_(row_+iend,column_+j) = (~rhs)(iend,j);
4023 template<
typename MT >
4024 template<
typename MT2 >
4025 inline typename EnableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
4035 !(~rhs).isAliased( &matrix_ ) )
4037 for(
size_t j=0UL; j<
n_; ++j )
4038 for(
size_t i=0UL; i<
m_; i+=IT::size )
4039 matrix_.stream( row_+i, column_+j, (~rhs).load(i,j) );
4043 const size_t iend(
m_ &
size_t(-IT::size*4) );
4046 for(
size_t j=0UL; j<
n_; ++j ) {
4048 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4049 matrix_.storeu( row_+i , column_+j, it.load() ); it += IT::size;
4050 matrix_.storeu( row_+i+IT::size , column_+j, it.load() ); it += IT::size;
4051 matrix_.storeu( row_+i+IT::size*2UL, column_+j, it.load() ); it += IT::size;
4052 matrix_.storeu( row_+i+IT::size*3UL, column_+j, it.load() ); it += IT::size;
4054 for(
size_t i=iend; i<
m_; i+=IT::size, it+=IT::size ) {
4055 storeu( i, j, it.load() );
4076 template<
typename MT >
4077 template<
typename MT2 >
4083 const size_t block( 16UL );
4085 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4086 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
4087 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
4088 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
4089 for(
size_t j=jj; j<jend; ++j ) {
4090 for(
size_t i=ii; i<iend; ++i ) {
4091 matrix_(row_+i,column_+j) = (~rhs)(i,j);
4113 template<
typename MT >
4114 template<
typename MT2 >
4120 for(
size_t j=0UL; j<
n_; ++j )
4121 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
4122 matrix_(row_+element->index(),column_+j) = element->value();
4140 template<
typename MT >
4141 template<
typename MT2 >
4147 for(
size_t i=0UL; i<
m_; ++i )
4148 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
4149 matrix_(row_+i,column_+element->index()) = element->value();
4167 template<
typename MT >
4168 template<
typename MT2 >
4169 inline typename DisableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
4175 const size_t iend( m_ &
size_t(-2) );
4178 for(
size_t j=0UL; j<
n_; ++j ) {
4179 for(
size_t i=0UL; i<iend; i+=2UL ) {
4180 matrix_(row_+i ,column_+j) += (~rhs)(i ,j);
4181 matrix_(row_+i+1UL,column_+j) += (~rhs)(i+1UL,j);
4184 matrix_(row_+iend,column_+j) += (~rhs)(iend,j);
4204 template<
typename MT >
4205 template<
typename MT2 >
4206 inline typename EnableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
4214 const size_t iend( m_ &
size_t(-IT::size*4) );
4217 for(
size_t j=0UL; j<
n_; ++j ) {
4219 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4220 matrix_.storeu( row_+i , column_+j,
load(i ,j) + it.load() ); it += IT::size;
4221 matrix_.storeu( row_+i+IT::size , column_+j,
load(i+IT::size ,j) + it.load() ); it += IT::size;
4222 matrix_.storeu( row_+i+IT::size*2UL, column_+j,
load(i+IT::size*2UL,j) + it.load() ); it += IT::size;
4223 matrix_.storeu( row_+i+IT::size*3UL, column_+j,
load(i+IT::size*3UL,j) + it.load() ); it += IT::size;
4225 for(
size_t i=iend; i<
m_; i+=IT::size, it+=IT::size ) {
4246 template<
typename MT >
4247 template<
typename MT2 >
4253 const size_t block( 16UL );
4255 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4256 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
4257 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
4258 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
4259 for(
size_t j=jj; j<jend; ++j ) {
4260 for(
size_t i=ii; i<iend; ++i ) {
4261 matrix_(row_+i,column_+j) += (~rhs)(i,j);
4283 template<
typename MT >
4284 template<
typename MT2 >
4290 for(
size_t j=0UL; j<
n_; ++j )
4291 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
4292 matrix_(row_+element->index(),column_+j) += element->value();
4310 template<
typename MT >
4311 template<
typename MT2 >
4317 for(
size_t i=0UL; i<
m_; ++i )
4318 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
4319 matrix_(row_+i,column_+element->index()) += element->value();
4337 template<
typename MT >
4338 template<
typename MT2 >
4339 inline typename DisableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
4345 const size_t iend( m_ &
size_t(-2) );
4348 for(
size_t j=0UL; j<
n_; ++j ) {
4349 for(
size_t i=0UL; i<iend; i+=2UL ) {
4350 matrix_(row_+i ,column_+j) -= (~rhs)(i ,j);
4351 matrix_(row_+i+1UL,column_+j) -= (~rhs)(i+1UL,j);
4354 matrix_(row_+iend,column_+j) -= (~rhs)(iend,j);
4374 template<
typename MT >
4375 template<
typename MT2 >
4376 inline typename EnableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
4384 const size_t iend( m_ &
size_t(-IT::size*4) );
4387 for(
size_t j=0UL; j<
n_; ++j ) {
4389 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
4390 matrix_.storeu( row_+i , column_+j,
load(i ,j) - it.load() ); it += IT::size;
4391 matrix_.storeu( row_+i+IT::size , column_+j,
load(i+IT::size ,j) - it.load() ); it += IT::size;
4392 matrix_.storeu( row_+i+IT::size*2UL, column_+j,
load(i+IT::size*2UL,j) - it.load() ); it += IT::size;
4393 matrix_.storeu( row_+i+IT::size*3UL, column_+j,
load(i+IT::size*3UL,j) - it.load() ); it += IT::size;
4395 for(
size_t i=iend; i<
m_; i+=IT::size, it+=IT::size ) {
4416 template<
typename MT >
4417 template<
typename MT2 >
4423 const size_t block( 16UL );
4425 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
4426 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
4427 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
4428 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
4429 for(
size_t j=jj; j<jend; ++j ) {
4430 for(
size_t i=ii; i<iend; ++i ) {
4431 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
4453 template<
typename MT >
4454 template<
typename MT2 >
4460 for(
size_t j=0UL; j<
n_; ++j )
4461 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
4462 matrix_(row_+element->index(),column_+j) -= element->value();
4480 template<
typename MT >
4481 template<
typename MT2 >
4487 for(
size_t i=0UL; i<
m_; ++i )
4488 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
4489 matrix_(row_+i,column_+element->index()) -= element->value();
4515 template<
typename MT >
4516 class DenseSubmatrix<MT,
aligned,false> :
public DenseMatrix< DenseSubmatrix<MT,aligned,false>, false >
4522 typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type
Operand;
4525 typedef IntrinsicTrait<typename MT::ElementType>
IT;
4536 enum { useConst = IsConst<MT>::value };
4541 typedef DenseSubmatrix<MT,aligned,false>
This;
4542 typedef typename SubmatrixTrait<MT>::Type
ResultType;
4554 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
4560 typedef typename SelectType< useConst, ConstPointer, ElementType* >::Type
Pointer;
4566 typedef typename SelectType< useConst, ConstIterator, typename MT::Iterator >::Type
Iterator;
4571 enum { vectorizable = MT::vectorizable };
4574 enum { smpAssignable = MT::smpAssignable };
4611 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator+=(
const Matrix<MT2,SO>& rhs );
4612 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator-=(
const Matrix<MT2,SO>& rhs );
4613 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator*=(
const Matrix<MT2,SO>& rhs );
4615 template<
typename Other >
4616 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
4617 operator*=( Other rhs );
4619 template<
typename Other >
4620 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
4621 operator/=( Other rhs );
4628 inline size_t rows()
const;
4629 inline size_t columns()
const;
4630 inline size_t spacing()
const;
4632 inline size_t capacity(
size_t i )
const;
4634 inline size_t nonZeros(
size_t i )
const;
4635 inline void reset();
4636 inline void reset(
size_t i );
4637 template<
typename Other >
inline DenseSubmatrix& scale( Other scalar );
4644 template<
typename MT2 >
4645 struct VectorizedAssign {
4646 enum { value = vectorizable && MT2::vectorizable &&
4647 IsSame<ElementType,typename MT2::ElementType>::value };
4653 template<
typename MT2 >
4654 struct VectorizedAddAssign {
4655 enum { value = vectorizable && MT2::vectorizable &&
4656 IsSame<ElementType,typename MT2::ElementType>::value &&
4657 IntrinsicTrait<ElementType>::addition };
4663 template<
typename MT2 >
4664 struct VectorizedSubAssign {
4665 enum { value = vectorizable && MT2::vectorizable &&
4666 IsSame<ElementType,typename MT2::ElementType>::value &&
4667 IntrinsicTrait<ElementType>::subtraction };
4675 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
4676 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
4687 template<
typename MT2 >
4688 inline typename DisableIf< VectorizedAssign<MT2> >::Type
4689 assign(
const DenseMatrix<MT2,false>& rhs );
4691 template<
typename MT2 >
4692 inline typename EnableIf< VectorizedAssign<MT2> >::Type
4693 assign(
const DenseMatrix<MT2,false>& rhs );
4695 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,true>& rhs );
4696 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,false>& rhs );
4697 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,true>& rhs );
4699 template<
typename MT2 >
4700 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
4701 addAssign(
const DenseMatrix<MT2,false>& rhs );
4703 template<
typename MT2 >
4704 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
4705 addAssign(
const DenseMatrix<MT2,false>& rhs );
4707 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,true>& rhs );
4708 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,false>& rhs );
4709 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,true>& rhs );
4711 template<
typename MT2 >
4712 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
4713 subAssign(
const DenseMatrix<MT2,false>& rhs );
4715 template<
typename MT2 >
4716 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
4717 subAssign(
const DenseMatrix<MT2,false>& rhs );
4719 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,true>& rhs );
4720 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,false>& rhs );
4721 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,true>& rhs );
4738 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
4739 friend const DenseSubmatrix<MT2,AF1,SO2>
4740 submatrix(
const DenseSubmatrix<MT2,AF2,SO2>& dm,
size_t row,
size_t column,
size_t m,
size_t n );
4777 template<
typename MT >
4785 if( ( row + m > matrix.rows() ) || ( column + n > matrix.columns() ) )
4786 throw std::invalid_argument(
"Invalid submatrix specification" );
4788 if( column % IT::size != 0UL || (
column_ + n_ !=
matrix_.columns() && n_ % IT::size != 0UL ) )
4789 throw std::invalid_argument(
"Invalid submatrix alignment" );
4811 template<
typename MT >
4818 return matrix_(row_+i,column_+j);
4832 template<
typename MT >
4839 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
4855 template<
typename MT >
4858 return matrix_.data() + row_*
spacing() + column_;
4874 template<
typename MT >
4875 inline typename DenseSubmatrix<MT,aligned,false>::ConstPointer
4878 return matrix_.data() + row_*
spacing() + column_;
4896 template<
typename MT >
4901 return ( matrix_.begin( row_ + i ) + column_ );
4919 template<
typename MT >
4924 return ( matrix_.cbegin( row_ + i ) + column_ );
4942 template<
typename MT >
4947 return ( matrix_.cbegin( row_ + i ) + column_ );
4965 template<
typename MT >
4970 return ( matrix_.begin( row_ + i ) + column_ +
n_ );
4988 template<
typename MT >
4993 return ( matrix_.cbegin( row_ + i ) + column_ +
n_ );
5011 template<
typename MT >
5016 return ( matrix_.cbegin( row_ + i ) + column_ +
n_ );
5037 template<
typename MT >
5038 inline DenseSubmatrix<MT,aligned,false>&
5041 const size_t iend( row_ + m_ );
5042 const size_t jend( column_ + n_ );
5044 for(
size_t i=row_; i<iend; ++i )
5045 for(
size_t j=column_; j<jend; ++j )
5066 template<
typename MT >
5067 inline DenseSubmatrix<MT,aligned,false>&
5073 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
5076 if(
rows() != rhs.rows() ||
columns() != rhs.columns() )
5077 throw std::invalid_argument(
"Submatrix sizes do not match" );
5079 if( rhs.canAlias( &matrix_ ) ) {
5084 if( IsSparseMatrix<MT>::value )
5106 template<
typename MT >
5107 template<
typename MT2
5109 inline DenseSubmatrix<MT,aligned,false>&
5115 throw std::invalid_argument(
"Matrix sizes do not match" );
5117 if( IsSparseMatrix<MT2>::value )
5120 if( (~rhs).canAlias( &matrix_ ) ) {
5145 template<
typename MT >
5146 template<
typename MT2
5148 inline DenseSubmatrix<MT,aligned,false>&
5149 DenseSubmatrix<MT,aligned,false>::operator+=(
const Matrix<MT2,SO>& rhs )
5154 throw std::invalid_argument(
"Matrix sizes do not match" );
5156 if( (~rhs).canAlias( &matrix_ ) ) {
5181 template<
typename MT >
5182 template<
typename MT2
5184 inline DenseSubmatrix<MT,aligned,false>&
5185 DenseSubmatrix<MT,aligned,false>::operator-=(
const Matrix<MT2,SO>& rhs )
5190 throw std::invalid_argument(
"Matrix sizes do not match" );
5192 if( (~rhs).canAlias( &matrix_ ) ) {
5217 template<
typename MT >
5218 template<
typename MT2
5220 inline DenseSubmatrix<MT,aligned,false>&
5221 DenseSubmatrix<MT,aligned,false>::operator*=(
const Matrix<MT2,SO>& rhs )
5224 throw std::invalid_argument(
"Matrix sizes do not match" );
5226 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
5231 const MultType tmp( *
this * (~rhs) );
5232 if( IsSparseMatrix<MultType>::value )
5250 template<
typename MT >
5251 template<
typename Other >
5252 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,false> >::Type&
5253 DenseSubmatrix<MT,aligned,false>::operator*=( Other rhs )
5270 template<
typename MT >
5271 template<
typename Other >
5272 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,false> >::Type&
5273 DenseSubmatrix<MT,aligned,false>::operator/=( Other rhs )
5298 template<
typename MT >
5313 template<
typename MT >
5333 template<
typename MT >
5336 return matrix_.spacing();
5348 template<
typename MT >
5369 template<
typename MT >
5385 template<
typename MT >
5388 const size_t iend( row_ + m_ );
5389 const size_t jend( column_ + n_ );
5390 size_t nonzeros( 0UL );
5392 for(
size_t i=row_; i<iend; ++i )
5393 for(
size_t j=column_; j<jend; ++j )
5415 template<
typename MT >
5420 const size_t jend( column_ + n_ );
5421 size_t nonzeros( 0UL );
5423 for(
size_t j=column_; j<jend; ++j )
5439 template<
typename MT >
5444 const size_t iend( row_ + m_ );
5445 const size_t jend( column_ + n_ );
5447 for(
size_t i=row_; i<iend; ++i )
5448 for(
size_t j=column_; j<jend; ++j )
5449 reset( matrix_(i,j) );
5467 template<
typename MT >
5474 const size_t jend( column_ + n_ );
5475 for(
size_t j=column_; j<jend; ++j )
5476 reset( matrix_(row_+i,j) );
5489 template<
typename MT >
5490 template<
typename Other >
5491 inline DenseSubmatrix<MT,aligned,false>& DenseSubmatrix<MT,aligned,false>::scale( Other scalar )
5493 const size_t iend( row_ + m_ );
5494 const size_t jend( column_ + n_ );
5496 for(
size_t i=row_; i<iend; ++i )
5497 for(
size_t j=column_; j<jend; ++j )
5498 matrix_(i,j) *= scalar;
5525 template<
typename MT >
5526 template<
typename Other >
5529 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
5546 template<
typename MT >
5547 template<
typename Other >
5550 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
5566 template<
typename MT >
5586 template<
typename MT >
5612 template<
typename MT >
5613 inline typename DenseSubmatrix<MT,aligned,false>::IntrinsicType
5622 return matrix_.load( row_+i, column_+j );
5645 template<
typename MT >
5646 inline typename DenseSubmatrix<MT,aligned,false>::IntrinsicType
5655 return matrix_.loadu( row_+i, column_+j );
5678 template<
typename MT >
5687 return matrix_.store( row_+i, column_+j, value );
5710 template<
typename MT >
5719 matrix_.storeu( row_+i, column_+j, value );
5743 template<
typename MT >
5752 matrix_.stream( row_+i, column_+j, value );
5770 template<
typename MT >
5771 template<
typename MT2 >
5772 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
5778 const size_t jend( n_ &
size_t(-2) );
5781 for(
size_t i=0UL; i<
m_; ++i ) {
5782 for(
size_t j=0UL; j<jend; j+=2UL ) {
5783 matrix_(row_+i,column_+j ) = (~rhs)(i,j );
5784 matrix_(row_+i,column_+j+1UL) = (~rhs)(i,j+1UL);
5787 matrix_(row_+i,column_+jend) = (~rhs)(i,jend);
5807 template<
typename MT >
5808 template<
typename MT2 >
5809 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
5819 !(~rhs).isAliased( &matrix_ ) )
5821 for(
size_t i=0UL; i<
m_; ++i )
5822 for(
size_t j=0UL; j<
n_; j+=IT::size )
5827 const size_t jend( n_ &
size_t(-IT::size*4) );
5830 for(
size_t i=0UL; i<
m_; ++i ) {
5832 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
5833 store( i, j , it.load() ); it += IT::size;
5834 store( i, j+IT::size , it.load() ); it += IT::size;
5835 store( i, j+IT::size*2UL, it.load() ); it += IT::size;
5836 store( i, j+IT::size*3UL, it.load() ); it += IT::size;
5838 for(
size_t j=jend; j<
n_; j+=IT::size, it+=IT::size ) {
5839 store( i, j, it.load() );
5860 template<
typename MT >
5861 template<
typename MT2 >
5867 const size_t block( 16UL );
5869 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
5870 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
5871 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5872 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
5873 for(
size_t i=ii; i<iend; ++i ) {
5874 for(
size_t j=jj; j<jend; ++j ) {
5875 matrix_(row_+i,column_+j) = (~rhs)(i,j);
5897 template<
typename MT >
5898 template<
typename MT2 >
5904 for(
size_t i=0UL; i<
m_; ++i )
5905 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5906 matrix_(row_+i,column_+element->index()) = element->value();
5924 template<
typename MT >
5925 template<
typename MT2 >
5931 for(
size_t j=0UL; j<
n_; ++j )
5932 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5933 matrix_(row_+element->index(),column_+j) = element->value();
5951 template<
typename MT >
5952 template<
typename MT2 >
5953 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
5959 const size_t jend( n_ &
size_t(-2) );
5962 for(
size_t i=0UL; i<
m_; ++i ) {
5963 for(
size_t j=0UL; j<jend; j+=2UL ) {
5964 matrix_(row_+i,column_+j ) += (~rhs)(i,j );
5965 matrix_(row_+i,column_+j+1UL) += (~rhs)(i,j+1UL);
5968 matrix_(row_+i,column_+jend) += (~rhs)(i,jend);
5988 template<
typename MT >
5989 template<
typename MT2 >
5990 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
5998 const size_t jend( n_ &
size_t(-IT::size*4) );
6001 for(
size_t i=0UL; i<
m_; ++i ) {
6003 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
6004 store( i, j ,
load(i,j ) + it.load() ); it += IT::size;
6005 store( i, j+IT::size ,
load(i,j+IT::size ) + it.load() ); it += IT::size;
6006 store( i, j+IT::size*2UL,
load(i,j+IT::size*2UL) + it.load() ); it += IT::size;
6007 store( i, j+IT::size*3UL,
load(i,j+IT::size*3UL) + it.load() ); it += IT::size;
6009 for(
size_t j=jend; j<
n_; j+=IT::size, it+=IT::size ) {
6030 template<
typename MT >
6031 template<
typename MT2 >
6037 const size_t block( 16UL );
6039 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
6040 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
6041 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
6042 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
6043 for(
size_t i=ii; i<iend; ++i ) {
6044 for(
size_t j=jj; j<jend; ++j ) {
6045 matrix_(row_+i,column_+j) += (~rhs)(i,j);
6067 template<
typename MT >
6068 template<
typename MT2 >
6074 for(
size_t i=0UL; i<
m_; ++i )
6075 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
6076 matrix_(row_+i,column_+element->index()) += element->value();
6094 template<
typename MT >
6095 template<
typename MT2 >
6101 for(
size_t j=0UL; j<
n_; ++j )
6102 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
6103 matrix_(row_+element->index(),column_+j) += element->value();
6121 template<
typename MT >
6122 template<
typename MT2 >
6123 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
6129 const size_t jend( n_ &
size_t(-2) );
6132 for(
size_t i=0UL; i<
m_; ++i ) {
6133 for(
size_t j=0UL; j<jend; j+=2UL ) {
6134 matrix_(row_+i,column_+j ) -= (~rhs)(i,j );
6135 matrix_(row_+i,column_+j+1UL) -= (~rhs)(i,j+1UL);
6138 matrix_(row_+i,column_+jend) -= (~rhs)(i,jend);
6158 template<
typename MT >
6159 template<
typename MT2 >
6160 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
6168 const size_t jend( n_ &
size_t(-IT::size*4) );
6171 for(
size_t i=0UL; i<
m_; ++i ) {
6173 for(
size_t j=0UL; j<jend; j+=IT::size*4UL ) {
6174 store( i, j ,
load(i,j ) - it.load() ); it += IT::size;
6175 store( i, j+IT::size ,
load(i,j+IT::size ) - it.load() ); it += IT::size;
6176 store( i, j+IT::size*2UL,
load(i,j+IT::size*2UL) - it.load() ); it += IT::size;
6177 store( i, j+IT::size*3UL,
load(i,j+IT::size*3UL) - it.load() ); it += IT::size;
6179 for(
size_t j=jend; j<
n_; j+=IT::size, it+=IT::size ) {
6200 template<
typename MT >
6201 template<
typename MT2 >
6207 const size_t block( 16UL );
6209 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
6210 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
6211 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
6212 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
6213 for(
size_t i=ii; i<iend; ++i ) {
6214 for(
size_t j=jj; j<jend; ++j ) {
6215 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
6237 template<
typename MT >
6238 template<
typename MT2 >
6244 for(
size_t i=0UL; i<
m_; ++i )
6245 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
6246 matrix_(row_+i,column_+element->index()) -= element->value();
6264 template<
typename MT >
6265 template<
typename MT2 >
6271 for(
size_t j=0UL; j<
n_; ++j )
6272 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
6273 matrix_(row_+element->index(),column_+j) -= element->value();
6299 template<
typename MT >
6300 class DenseSubmatrix<MT,
aligned,true> :
public DenseMatrix< DenseSubmatrix<MT,aligned,true>, true >
6306 typedef typename SelectType< IsExpression<MT>::value, MT, MT& >::Type
Operand;
6309 typedef IntrinsicTrait<typename MT::ElementType>
IT;
6320 enum { useConst = IsConst<MT>::value };
6325 typedef DenseSubmatrix<MT,aligned,true>
This;
6326 typedef typename SubmatrixTrait<MT>::Type
ResultType;
6338 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
6344 typedef typename SelectType< useConst, ConstPointer, ElementType* >::Type
Pointer;
6350 typedef typename SelectType< useConst, ConstIterator, typename MT::Iterator >::Type
Iterator;
6355 enum { vectorizable = MT::vectorizable };
6358 enum { smpAssignable = MT::smpAssignable };
6395 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator+=(
const Matrix<MT2,SO>& rhs );
6396 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator-=(
const Matrix<MT2,SO>& rhs );
6397 template<
typename MT2,
bool SO >
inline DenseSubmatrix& operator*=(
const Matrix<MT2,SO>& rhs );
6399 template<
typename Other >
6400 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
6401 operator*=( Other rhs );
6403 template<
typename Other >
6404 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
6405 operator/=( Other rhs );
6412 inline size_t rows()
const;
6413 inline size_t columns()
const;
6414 inline size_t spacing()
const;
6416 inline size_t capacity(
size_t i )
const;
6418 inline size_t nonZeros(
size_t i )
const;
6419 inline void reset();
6420 inline void reset(
size_t i );
6421 template<
typename Other >
inline DenseSubmatrix& scale( Other scalar );
6428 template<
typename MT2 >
6429 struct VectorizedAssign {
6430 enum { value = vectorizable && MT2::vectorizable &&
6431 IsSame<ElementType,typename MT2::ElementType>::value };
6437 template<
typename MT2 >
6438 struct VectorizedAddAssign {
6439 enum { value = vectorizable && MT2::vectorizable &&
6440 IsSame<ElementType,typename MT2::ElementType>::value &&
6441 IntrinsicTrait<ElementType>::addition };
6447 template<
typename MT2 >
6448 struct VectorizedSubAssign {
6449 enum { value = vectorizable && MT2::vectorizable &&
6450 IsSame<ElementType,typename MT2::ElementType>::value &&
6451 IntrinsicTrait<ElementType>::subtraction };
6459 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
6460 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
6471 template<
typename MT2 >
6472 inline typename DisableIf< VectorizedAssign<MT2> >::Type
6473 assign(
const DenseMatrix<MT2,true>& rhs );
6475 template<
typename MT2 >
6476 inline typename EnableIf< VectorizedAssign<MT2> >::Type
6477 assign(
const DenseMatrix<MT2,true>& rhs );
6479 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,false>& rhs );
6480 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,true>& rhs );
6481 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,false>& rhs );
6483 template<
typename MT2 >
6484 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
6485 addAssign(
const DenseMatrix<MT2,true>& rhs );
6487 template<
typename MT2 >
6488 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
6489 addAssign(
const DenseMatrix<MT2,true>& rhs );
6491 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,false>& rhs );
6492 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,true>& rhs );
6493 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,false>& rhs );
6495 template<
typename MT2 >
6496 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
6497 subAssign(
const DenseMatrix<MT2,true>& rhs );
6499 template<
typename MT2 >
6500 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
6501 subAssign(
const DenseMatrix<MT2,true>& rhs );
6503 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,false>& rhs );
6504 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,true>& rhs );
6505 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,false>& rhs );
6522 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
6523 friend const DenseSubmatrix<MT2,AF1,SO2>
6524 submatrix(
const DenseSubmatrix<MT2,AF2,SO2>& dm,
size_t row,
size_t column,
size_t m,
size_t n );
6561 template<
typename MT >
6569 if( ( row + m > matrix.rows() ) || ( column + n > matrix.columns() ) )
6570 throw std::invalid_argument(
"Invalid submatrix specification" );
6572 if( row % IT::size != 0UL || (
row_ + m_ !=
matrix_.rows() && m_ % IT::size != 0UL ) )
6573 throw std::invalid_argument(
"Invalid submatrix alignment" );
6595 template<
typename MT >
6602 return matrix_(row_+i,column_+j);
6616 template<
typename MT >
6623 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
6639 template<
typename MT >
6642 return matrix_.data() + row_ + column_*
spacing();
6658 template<
typename MT >
6659 inline typename DenseSubmatrix<MT,aligned,true>::ConstPointer
6662 return matrix_.data() + row_ + column_*
spacing();
6675 template<
typename MT >
6680 return ( matrix_.begin( column_ + j ) + row_ );
6693 template<
typename MT >
6698 return ( matrix_.cbegin( column_ + j ) + row_ );
6711 template<
typename MT >
6716 return ( matrix_.cbegin( column_ + j ) + row_ );
6729 template<
typename MT >
6734 return ( matrix_.begin( column_ + j ) + row_ +
m_ );
6747 template<
typename MT >
6752 return ( matrix_.cbegin( column_ + j ) + row_ +
m_ );
6765 template<
typename MT >
6770 return ( matrix_.cbegin( column_ + j ) + row_ +
m_ );
6791 template<
typename MT >
6792 inline DenseSubmatrix<MT,aligned,true>&
6795 const size_t iend( row_ + m_ );
6796 const size_t jend( column_ + n_ );
6798 for(
size_t j=column_; j<jend; ++j )
6799 for(
size_t i=row_; i<iend; ++i )
6820 template<
typename MT >
6821 inline DenseSubmatrix<MT,aligned,true>&
6827 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
6830 if(
rows() != rhs.rows() ||
columns() != rhs.columns() )
6831 throw std::invalid_argument(
"Submatrix sizes do not match" );
6833 if( rhs.canAlias( &matrix_ ) ) {
6838 if( IsSparseMatrix<MT>::value )
6860 template<
typename MT >
6861 template<
typename MT2
6863 inline DenseSubmatrix<MT,aligned,true>&
6869 throw std::invalid_argument(
"Matrix sizes do not match" );
6871 if( IsSparseMatrix<MT2>::value )
6874 if( (~rhs).canAlias( &matrix_ ) ) {
6899 template<
typename MT >
6900 template<
typename MT2
6902 inline DenseSubmatrix<MT,aligned,true>&
6903 DenseSubmatrix<MT,aligned,true>::operator+=(
const Matrix<MT2,SO>& rhs )
6908 throw std::invalid_argument(
"Matrix sizes do not match" );
6910 if( (~rhs).canAlias( &matrix_ ) ) {
6935 template<
typename MT >
6936 template<
typename MT2
6938 inline DenseSubmatrix<MT,aligned,true>&
6939 DenseSubmatrix<MT,aligned,true>::operator-=(
const Matrix<MT2,SO>& rhs )
6944 throw std::invalid_argument(
"Matrix sizes do not match" );
6946 if( (~rhs).canAlias( &matrix_ ) ) {
6971 template<
typename MT >
6972 template<
typename MT2
6974 inline DenseSubmatrix<MT,aligned,true>&
6975 DenseSubmatrix<MT,aligned,true>::operator*=(
const Matrix<MT2,SO>& rhs )
6978 throw std::invalid_argument(
"Matrix sizes do not match" );
6980 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
6985 const MultType tmp( *
this * (~rhs) );
6986 if( IsSparseMatrix<MultType>::value )
7004 template<
typename MT >
7005 template<
typename Other >
7006 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,true> >::Type&
7007 DenseSubmatrix<MT,aligned,true>::operator*=( Other rhs )
7024 template<
typename MT >
7025 template<
typename Other >
7026 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,true> >::Type&
7027 DenseSubmatrix<MT,aligned,true>::operator/=( Other rhs )
7052 template<
typename MT >
7067 template<
typename MT >
7085 template<
typename MT >
7088 return matrix_.spacing();
7100 template<
typename MT >
7116 template<
typename MT >
7132 template<
typename MT >
7135 const size_t iend( row_ + m_ );
7136 const size_t jend( column_ + n_ );
7137 size_t nonzeros( 0UL );
7139 for(
size_t j=column_; j<jend; ++j )
7140 for(
size_t i=row_; i<iend; ++i )
7157 template<
typename MT >
7162 const size_t iend( row_ + m_ );
7163 size_t nonzeros( 0UL );
7165 for(
size_t i=row_; i<iend; ++i )
7166 if( !
isDefault( matrix_(i,column_+j) ) )
7181 template<
typename MT >
7186 const size_t iend( row_ + m_ );
7187 const size_t jend( column_ + n_ );
7189 for(
size_t j=column_; j<jend; ++j )
7190 for(
size_t i=row_; i<iend; ++i )
7191 reset( matrix_(i,j) );
7204 template<
typename MT >
7211 const size_t iend( row_ + m_ );
7212 for(
size_t i=row_; i<iend; ++i )
7213 reset( matrix_(i,column_+j) );
7226 template<
typename MT >
7227 template<
typename Other >
7228 inline DenseSubmatrix<MT,aligned,true>& DenseSubmatrix<MT,aligned,true>::scale( Other scalar )
7230 const size_t iend( row_ + m_ );
7231 const size_t jend( column_ + n_ );
7233 for(
size_t j=column_; j<jend; ++j )
7234 for(
size_t i=row_; i<iend; ++i )
7235 matrix_(i,j) *= scalar;
7262 template<
typename MT >
7263 template<
typename Other >
7266 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
7283 template<
typename MT >
7284 template<
typename Other >
7287 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
7303 template<
typename MT >
7323 template<
typename MT >
7348 template<
typename MT >
7349 inline typename DenseSubmatrix<MT,aligned,true>::IntrinsicType
7358 return matrix_.load( row_+i, column_+j );
7380 template<
typename MT >
7381 inline typename DenseSubmatrix<MT,aligned,true>::IntrinsicType
7390 return matrix_.loadu( row_+i, column_+j );
7412 template<
typename MT >
7421 matrix_.store( row_+i, column_+j, value );
7444 template<
typename MT >
7453 matrix_.storeu( row_+i, column_+j, value );
7476 template<
typename MT >
7485 matrix_.stream( row_+i, column_+j, value );
7503 template<
typename MT >
7504 template<
typename MT2 >
7505 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
7511 const size_t iend( m_ &
size_t(-2) );
7514 for(
size_t j=0UL; j<
n_; ++j ) {
7515 for(
size_t i=0UL; i<iend; i+=2UL ) {
7516 matrix_(row_+i ,column_+j) = (~rhs)(i ,j);
7517 matrix_(row_+i+1UL,column_+j) = (~rhs)(i+1UL,j);
7520 matrix_(row_+iend,column_+j) = (~rhs)(iend,j);
7540 template<
typename MT >
7541 template<
typename MT2 >
7542 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
7552 !(~rhs).isAliased( &matrix_ ) )
7554 for(
size_t j=0UL; j<
n_; ++j )
7555 for(
size_t i=0UL; i<
m_; i+=IT::size )
7560 const size_t iend( m_ &
size_t(-IT::size*4) );
7563 for(
size_t j=0UL; j<
n_; ++j ) {
7565 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
7566 store( i , j, it.load() ); it += IT::size;
7567 store( i+IT::size , j, it.load() ); it += IT::size;
7568 store( i+IT::size*2UL, j, it.load() ); it += IT::size;
7569 store( i+IT::size*3UL, j, it.load() ); it += IT::size;
7571 for(
size_t i=iend; i<
m_; i+=IT::size, it+=IT::size ) {
7572 store( i, j, it.load() );
7593 template<
typename MT >
7594 template<
typename MT2 >
7600 const size_t block( 16UL );
7602 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
7603 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
7604 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
7605 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
7606 for(
size_t j=jj; j<jend; ++j ) {
7607 for(
size_t i=ii; i<iend; ++i ) {
7608 matrix_(row_+i,column_+j) = (~rhs)(i,j);
7630 template<
typename MT >
7631 template<
typename MT2 >
7637 for(
size_t j=0UL; j<
n_; ++j )
7638 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
7639 matrix_(row_+element->index(),column_+j) = element->value();
7657 template<
typename MT >
7658 template<
typename MT2 >
7664 for(
size_t i=0UL; i<
m_; ++i )
7665 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
7666 matrix_(row_+i,column_+element->index()) = element->value();
7684 template<
typename MT >
7685 template<
typename MT2 >
7686 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
7692 const size_t iend( m_ &
size_t(-2) );
7695 for(
size_t j=0UL; j<
n_; ++j ) {
7696 for(
size_t i=0UL; i<iend; i+=2UL ) {
7697 matrix_(row_+i ,column_+j) += (~rhs)(i ,j);
7698 matrix_(row_+i+1UL,column_+j) += (~rhs)(i+1UL,j);
7701 matrix_(row_+iend,column_+j) += (~rhs)(iend,j);
7721 template<
typename MT >
7722 template<
typename MT2 >
7723 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
7731 const size_t iend( m_ &
size_t(-IT::size*4) );
7734 for(
size_t j=0UL; j<
n_; ++j ) {
7736 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
7737 store( i , j,
load(i ,j) + it.load() ); it += IT::size;
7738 store( i+IT::size , j,
load(i+IT::size ,j) + it.load() ); it += IT::size;
7739 store( i+IT::size*2UL, j,
load(i+IT::size*2UL,j) + it.load() ); it += IT::size;
7740 store( i+IT::size*3UL, j,
load(i+IT::size*3UL,j) + it.load() ); it += IT::size;
7742 for(
size_t i=iend; i<
m_; i+=IT::size, it+=IT::size ) {
7763 template<
typename MT >
7764 template<
typename MT2 >
7770 const size_t block( 16UL );
7772 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
7773 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
7774 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
7775 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
7776 for(
size_t j=jj; j<jend; ++j ) {
7777 for(
size_t i=ii; i<iend; ++i ) {
7778 matrix_(row_+i,column_+j) += (~rhs)(i,j);
7800 template<
typename MT >
7801 template<
typename MT2 >
7807 for(
size_t j=0UL; j<
n_; ++j )
7808 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
7809 matrix_(row_+element->index(),column_+j) += element->value();
7827 template<
typename MT >
7828 template<
typename MT2 >
7834 for(
size_t i=0UL; i<
m_; ++i )
7835 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
7836 matrix_(row_+i,column_+element->index()) += element->value();
7854 template<
typename MT >
7855 template<
typename MT2 >
7856 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
7862 const size_t iend( m_ &
size_t(-2) );
7865 for(
size_t j=0UL; j<
n_; ++j ) {
7866 for(
size_t i=0UL; i<iend; i+=2UL ) {
7867 matrix_(row_+i ,column_+j) -= (~rhs)(i ,j);
7868 matrix_(row_+i+1UL,column_+j) -= (~rhs)(i+1UL,j);
7871 matrix_(row_+iend,column_+j) -= (~rhs)(iend,j);
7891 template<
typename MT >
7892 template<
typename MT2 >
7893 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
7901 const size_t iend( m_ &
size_t(-IT::size*4) );
7904 for(
size_t j=0UL; j<
n_; ++j ) {
7906 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
7907 store( i , j,
load(i ,j) - it.load() ); it += IT::size;
7908 store( i+IT::size , j,
load(i+IT::size ,j) - it.load() ); it += IT::size;
7909 store( i+IT::size*2UL, j,
load(i+IT::size*2UL,j) - it.load() ); it += IT::size;
7910 store( i+IT::size*3UL, j,
load(i+IT::size*3UL,j) - it.load() ); it += IT::size;
7912 for(
size_t i=iend; i<
m_; i+=IT::size, it+=IT::size ) {
7933 template<
typename MT >
7934 template<
typename MT2 >
7940 const size_t block( 16UL );
7942 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
7943 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
7944 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
7945 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
7946 for(
size_t j=jj; j<jend; ++j ) {
7947 for(
size_t i=ii; i<iend; ++i ) {
7948 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
7970 template<
typename MT >
7971 template<
typename MT2 >
7977 for(
size_t j=0UL; j<
n_; ++j )
7978 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
7979 matrix_(row_+element->index(),column_+j) -= element->value();
7997 template<
typename MT >
7998 template<
typename MT2 >
8004 for(
size_t i=0UL; i<
m_; ++i )
8005 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
8006 matrix_(row_+i,column_+element->index()) -= element->value();
8027 template<
typename MT,
bool AF,
bool SO >
8028 inline void reset( DenseSubmatrix<MT,AF,SO>& dm );
8030 template<
typename MT,
bool AF,
bool SO >
8031 inline void clear( DenseSubmatrix<MT,AF,SO>& dm );
8033 template<
typename MT,
bool AF,
bool SO >
8034 inline bool isDefault(
const DenseSubmatrix<MT,AF,SO>& dm );
8046 template<
typename MT
8065 template<
typename MT
8093 template<
typename MT
8101 for(
size_t i=0UL; i<(~dm).
rows(); ++i )
8102 for(
size_t j=0UL; j<(~dm).
columns(); ++j )
8107 for(
size_t j=0UL; j<(~dm).
columns(); ++j )
8108 for(
size_t i=0UL; i<(~dm).
rows(); ++i )
8145 inline const DenseSubmatrix<MT,AF1,SO>
8146 submatrix(
const DenseSubmatrix<MT,AF2,SO>& dm,
size_t row,
size_t column,
size_t m,
size_t n )
8150 if( ( row + m > dm.rows() ) || ( column + n > dm.columns() ) )
8151 throw std::invalid_argument(
"Invalid submatrix specification" );
8153 return DenseSubmatrix<MT,AF1,SO>( dm.matrix_, dm.row_ +
row, dm.column_ +
column, m, n );
8169 template<
typename MT,
bool AF,
bool SO >
8170 struct SubmatrixTrait< DenseSubmatrix<MT,AF,SO> >
8188 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
8189 struct SubmatrixExprTrait< DenseSubmatrix<MT,AF1,SO>, AF2 >
8191 typedef DenseSubmatrix<MT,AF2,SO> Type;
8199 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
8200 struct SubmatrixExprTrait< const DenseSubmatrix<MT,AF1,SO>, AF2 >
8202 typedef DenseSubmatrix<MT,AF2,SO> Type;
8210 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
8211 struct SubmatrixExprTrait< volatile DenseSubmatrix<MT,AF1,SO>, AF2 >
8213 typedef DenseSubmatrix<MT,AF2,SO> Type;
8221 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
8222 struct SubmatrixExprTrait< const volatile DenseSubmatrix<MT,AF1,SO>, AF2 >
8224 typedef DenseSubmatrix<MT,AF2,SO> Type;
8240 template<
typename MT,
bool AF,
bool SO >
8241 struct RowTrait< DenseSubmatrix<MT,AF,SO> >
8259 template<
typename MT,
bool AF,
bool SO >
8260 struct ColumnTrait< DenseSubmatrix<MT,AF,SO> >
Constraint on the data type.
SelectType< useConst, ConstIterator, SubmatrixIterator< typename MT::Iterator > >::Type Iterator
Iterator over non-constant elements.
Definition: DenseSubmatrix.h:722
void stream(size_t i, size_t j, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:1926
Constraint on the data type.
IteratorCategory iterator_category
The iterator category.
Definition: DenseSubmatrix.h:454
ReferenceType reference
Reference return type.
Definition: DenseSubmatrix.h:457
const size_t column_
The first column of the submatrix.
Definition: DenseSubmatrix.h:893
const size_t rest_
The number of remaining elements in an unaligned intrinsic operation.
Definition: DenseSubmatrix.h:896
bool canAlias(const Other *alias) const
Returns whether the submatrix can alias with the given address alias.
Definition: DenseSubmatrix.h:1707
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#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
EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:222
Header file for the subvector/submatrix alignment flag values.
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a constant row value.
Definition: DenseSubmatrix.h:427
const size_t OPENMP_DMATASSIGN_THRESHOLD
OpenMP dense matrix assignment threshold.This threshold specifies when an assignment with a plain den...
Definition: Thresholds.h:536
Header file for the subtraction trait.
std::iterator_traits< IteratorType >::difference_type DifferenceType
Difference between two iterators.
Definition: DenseSubmatrix.h:451
DifferenceType difference_type
Difference between two iterators.
Definition: DenseSubmatrix.h:458
Header file for the row trait.
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:151
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:117
Header file for the IsSparseMatrix type trait.
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:197
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
Reference operator()(size_t i, size_t j)
2D-access to the dense submatrix elements.
Definition: DenseSubmatrix.h:996
bool operator<=(const SubmatrixIterator &rhs) const
Less-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:644
EnableIf< IsIntegral< T >, Loadu< T, sizeof(T)> >::Type::Type loadu(const T *address)
Loads a vector of integral values.
Definition: Loadu.h:219
Header file for the IsSame and IsStrictlySame type traits.
DenseSubmatrix(Operand matrix, size_t row, size_t column, size_t m, size_t n)
The constructor for DenseSubmatrix.
Definition: DenseSubmatrix.h:960
bool isAligned() const
Returns whether the submatrix is properly aligned in memory.
Definition: DenseSubmatrix.h:1747
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: DenseSubmatrix.h:1150
bool isAliased(const Other *alias) const
Returns whether the submatrix is aliased with the given address alias.
Definition: DenseSubmatrix.h:1728
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
Header file for the IsColumnMajorMatrix type trait.
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DenseSubmatrix.h:1198
Header file for the sparse matrix SMP implementation.
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2528
void storeu(float *address, const sse_float_t &value)
Unaligned store of a vector of 'float' values.
Definition: Storeu.h:234
ReferenceType operator*() const
Direct access to the element at the current iterator position.
Definition: DenseSubmatrix.h:548
const size_t n_
The number of columns of the submatrix.
Definition: DenseSubmatrix.h:895
const size_t row_
The first row of the submatrix.
Definition: DenseSubmatrix.h:892
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:103
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:118
CompressedMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:247
SubmatrixIterator(IteratorType iterator, IteratorType final, size_t rest, bool isAligned)
Constructor for the SubmatrixIterator class.
Definition: DenseSubmatrix.h:469
const ElementType * ConstPointer
Pointer to a constant row value.
Definition: DenseSubmatrix.h:424
void reset()
Reset to the default initial values.
Definition: DenseSubmatrix.h:1620
MT::ElementType ElementType
Type of the submatrix elements.
Definition: DenseSubmatrix.h:412
size_t columns() const
Returns the number of columns of the dense submatrix.
Definition: DenseSubmatrix.h:1494
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:118
Pointer data()
Low-level data access to the submatrix elements.
Definition: DenseSubmatrix.h:1039
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DenseSubmatrix.h:1127
size_t rows() const
Returns the number of rows of the dense submatrix.
Definition: DenseSubmatrix.h:1479
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
Base class for all submatrices.The Submatrix class serves as a tag for all submatrices (i...
Definition: Submatrix.h:64
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:104
friend const SubmatrixIterator operator+(size_t inc, const SubmatrixIterator &it)
Addition between an integral value and a SubmatrixIterator.
Definition: DenseSubmatrix.h:690
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseSubmatrix.h:389
DenseSubmatrix & operator=(const ElementType &rhs)
Homogenous assignment to all submatrix elements.
Definition: DenseSubmatrix.h:1224
const bool aligned
Alignment flag for aligned subvectors and submatrices.
Definition: AlignmentFlag.h:83
SubmatrixTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseSubmatrix.h:409
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: DenseSubmatrix.h:1079
Constraint on the data type.
Header file for the matrix storage order types.
Constraint on the data type.
void smpAddAssign(DenseMatrix< 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:121
void stream(float *address, const sse_float_t &value)
Aligned, non-temporal store of a vector of 'float' values.
Definition: Stream.h:233
ValueType value_type
Type of the underlying elements.
Definition: DenseSubmatrix.h:455
bool operator<(const SubmatrixIterator &rhs) const
Less-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:622
std::iterator_traits< IteratorType >::reference ReferenceType
Reference return type.
Definition: DenseSubmatrix.h:448
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:1821
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant submatrix value.
Definition: DenseSubmatrix.h:421
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for nested template disabiguation.
Header file for the If class template.
IntrinsicType load() const
Aligned load of an intrinsic element of the dense submatrix.
Definition: DenseSubmatrix.h:563
Header file for the IsFloatingPoint type trait.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
SubmatrixIterator< typename MT::ConstIterator > ConstIterator
Iterator over constant elements.
Definition: DenseSubmatrix.h:719
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
SubmatrixIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DenseSubmatrix.h:483
Header file for the Or class template.
bool operator==(const SubmatrixIterator &rhs) const
Equality comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:600
Header file for the dense matrix SMP implementation.
Constraint on the data type.
Header file for the DenseMatrix base class.
const DenseSubmatrix & CompositeType
Data type for composite expression templates.
Definition: DenseSubmatrix.h:415
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:179
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the matrix element type.
Definition: DenseSubmatrix.h:392
IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:1794
Constraint on the data type.
#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
bool operator!=(const SubmatrixIterator &rhs) const
Inequality comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:611
Constraints on the storage order of matrix types.
const SubmatrixIterator operator++(int)
Post-increment operator.
Definition: DenseSubmatrix.h:517
SubmatrixIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DenseSubmatrix.h:495
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseSubmatrix.h:411
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2382
const size_t final_
The final index for unaligned intrinsic operations.
Definition: DenseSubmatrix.h:897
Constraint on the data type.
Header file for the SelectType class template.
std::iterator_traits< IteratorType >::value_type ValueType
Type of the underlying elements.
Definition: DenseSubmatrix.h:442
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
Operand matrix_
The dense matrix containing the submatrix.
Definition: DenseSubmatrix.h:891
const bool unaligned
Alignment flag for unaligned subvectors and submatrices.
Definition: AlignmentFlag.h:63
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:91
IteratorType iterator_
Iterator to the current submatrix element.
Definition: DenseSubmatrix.h:709
Header file for the IsNumeric type trait.
DenseSubmatrix< MT, AF, SO > This
Type of this DenseSubmatrix instance.
Definition: DenseSubmatrix.h:408
const bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
bool isAligned_
Memory alignment flag.
Definition: DenseSubmatrix.h:712
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:103
Header file for the SubmatrixExprTrait class template.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2383
Header file for the IsConst type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
IntrinsicType loadu() const
Unaligned load of an intrinsic element of the dense submatrix.
Definition: DenseSubmatrix.h:578
Header file for run time assertion macros.
DifferenceType operator-(const SubmatrixIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DenseSubmatrix.h:666
Base template for the MultTrait class.
Definition: MultTrait.h:141
Header file for the addition trait.
Header file for the division trait.
SubmatrixIterator & operator++()
Pre-increment operator.
Definition: DenseSubmatrix.h:506
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseSubmatrix.h:414
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:209
Header file for the submatrix trait.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Iterator over the elements of the sparse submatrix.
Definition: DenseSubmatrix.h:434
Header file for the reset shim.
const bool isAligned_
Memory alignment flag.
Definition: DenseSubmatrix.h:902
Header file for the cache size of the target architecture.
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:239
std::iterator_traits< IteratorType >::iterator_category IteratorCategory
The iterator category.
Definition: DenseSubmatrix.h:439
bool operator>(const SubmatrixIterator &rhs) const
Greater-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:633
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
Header file for the column trait.
Header file for the isDefault shim.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DenseSubmatrix.h:410
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:85
PointerType pointer
Pointer return type.
Definition: DenseSubmatrix.h:456
size_t capacity() const
Returns the maximum capacity of the dense submatrix.
Definition: DenseSubmatrix.h:1529
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
const SubmatrixIterator operator--(int)
Post-decrement operator.
Definition: DenseSubmatrix.h:538
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
IteratorType final_
The final iterator for intrinsic operations.
Definition: DenseSubmatrix.h:710
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:1887
Header file for all intrinsic functionality.
size_t nonZeros() const
Returns the number of non-zero elements in the dense submatrix.
Definition: DenseSubmatrix.h:1566
IT::Type IntrinsicType
Intrinsic type of the submatrix elements.
Definition: DenseSubmatrix.h:413
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2529
MT::ConstReference ConstReference
Reference to a constant submatrix value.
Definition: DenseSubmatrix.h:418
SubmatrixExprTrait< MT, unaligned >::Type submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:134
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:248
size_t rest_
The number of remaining elements beyond the final iterator.
Definition: DenseSubmatrix.h:711
std::iterator_traits< IteratorType >::pointer PointerType
Pointer return type.
Definition: DenseSubmatrix.h:445
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2379
View on a specific submatrix of a dense matrix.The DenseSubmatrix template represents a view on a spe...
Definition: DenseSubmatrix.h:383
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
bool canSMPAssign() const
Returns whether the submatrix can be used in SMP assignments.
Definition: DenseSubmatrix.h:1767
Header file for basic type definitions.
size_t spacing() const
Returns the spacing between the beginning of two rows/columns.
Definition: DenseSubmatrix.h:1514
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2385
Header file for the Submatrix base class.
const size_t m_
The number of rows of the submatrix.
Definition: DenseSubmatrix.h:894
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a N-dimensional matrix type...
Definition: Matrix.h:79
void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:1861
friend const SubmatrixIterator operator-(const SubmatrixIterator &it, size_t dec)
Subtraction between a SubmatrixIterator and an integral value.
Definition: DenseSubmatrix.h:702
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
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:138
SubmatrixIterator & operator--()
Pre-decrement operator.
Definition: DenseSubmatrix.h:527
#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 operator>=(const SubmatrixIterator &rhs) const
Greater-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:655
void store(float *address, const sse_float_t &value)
Aligned store of a vector of 'float' values.
Definition: Store.h:242
Header file for the IsExpression type trait class.
friend const SubmatrixIterator operator+(const SubmatrixIterator &it, size_t inc)
Addition between a SubmatrixIterator and an integral value.
Definition: DenseSubmatrix.h:678
Constraint on the data type.
Header file for the FunctionTrace class.