35 #ifndef _BLAZE_MATH_VIEWS_DENSESUBMATRIX_H_
36 #define _BLAZE_MATH_VIEWS_DENSESUBMATRIX_H_
477 template<
typename MT
479 ,
bool SO = IsColumnMajorMatrix<MT>::value >
520 template<
typename IteratorType >
529 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
532 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
535 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
538 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
574 template<
typename IteratorType2 >
667 inline IntrinsicType
load()
const {
685 inline IntrinsicType
loada()
const {
700 inline IntrinsicType
loadu()
const {
823 inline IteratorType
base()
const {
856 enum { vectorizable = MT::vectorizable };
859 enum { smpAssignable = MT::smpAssignable };
865 explicit inline DenseSubmatrix( Operand matrix,
size_t rindex,
size_t cindex,
size_t m,
size_t n );
877 inline Reference
operator()(
size_t i,
size_t j );
878 inline ConstReference
operator()(
size_t i,
size_t j )
const;
879 inline Reference
at(
size_t i,
size_t j );
880 inline ConstReference
at(
size_t i,
size_t j )
const;
881 inline Pointer
data ();
882 inline ConstPointer
data ()
const;
883 inline Pointer
data (
size_t i );
884 inline ConstPointer
data (
size_t i )
const;
885 inline Iterator
begin (
size_t i );
886 inline ConstIterator
begin (
size_t i )
const;
887 inline ConstIterator
cbegin(
size_t i )
const;
888 inline Iterator
end (
size_t i );
889 inline ConstIterator
end (
size_t i )
const;
890 inline ConstIterator
cend (
size_t i )
const;
900 template<
typename MT2,
bool SO2 >
903 template<
typename MT2,
bool SO2 >
904 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
905 operator+=(
const Matrix<MT2,SO2>& rhs );
907 template<
typename MT2,
bool SO2 >
908 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
909 operator+=(
const Matrix<MT2,SO2>& rhs );
911 template<
typename MT2,
bool SO2 >
912 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
913 operator-=(
const Matrix<MT2,SO2>& rhs );
915 template<
typename MT2,
bool SO2 >
916 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
917 operator-=(
const Matrix<MT2,SO2>& rhs );
919 template<
typename MT2,
bool SO2 >
922 template<
typename Other >
923 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
924 operator*=( Other rhs );
926 template<
typename Other >
927 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
928 operator/=( Other rhs );
935 inline size_t row()
const;
936 inline size_t rows()
const;
937 inline size_t column()
const;
941 inline size_t capacity(
size_t i )
const;
943 inline size_t nonZeros(
size_t i )
const;
945 inline void reset(
size_t i );
948 template<
typename Other >
inline DenseSubmatrix& scale(
const Other& scalar );
955 template<
typename MT2 >
957 struct VectorizedAssign {
959 vectorizable && MT2::vectorizable &&
960 IsSame<ElementType,typename MT2::ElementType>::value };
967 template<
typename MT2 >
969 struct VectorizedAddAssign {
971 vectorizable && MT2::vectorizable &&
972 IsSame<ElementType,typename MT2::ElementType>::value &&
973 IntrinsicTrait<ElementType>::addition };
980 template<
typename MT2 >
982 struct VectorizedSubAssign {
984 vectorizable && MT2::vectorizable &&
985 IsSame<ElementType,typename MT2::ElementType>::value &&
986 IntrinsicTrait<ElementType>::subtraction };
995 template<
typename Other >
996 inline bool canAlias(
const Other* alias )
const;
998 template<
typename MT2,
bool AF2,
bool SO2 >
999 inline bool canAlias(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
1001 template<
typename Other >
1002 inline bool isAliased(
const Other* alias )
const;
1004 template<
typename MT2,
bool AF2,
bool SO2 >
1005 inline bool isAliased(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
1010 inline IntrinsicType
load (
size_t i,
size_t j )
const;
1011 inline IntrinsicType
loada(
size_t i,
size_t j )
const;
1012 inline IntrinsicType
loadu(
size_t i,
size_t j )
const;
1014 inline void store (
size_t i,
size_t j,
const IntrinsicType& value );
1015 inline void storea(
size_t i,
size_t j,
const IntrinsicType& value );
1016 inline void storeu(
size_t i,
size_t j,
const IntrinsicType& value );
1017 inline void stream(
size_t i,
size_t j,
const IntrinsicType& value );
1019 template<
typename MT2 >
1020 inline typename DisableIf< VectorizedAssign<MT2> >::Type
1021 assign(
const DenseMatrix<MT2,SO>& rhs );
1023 template<
typename MT2 >
1024 inline typename EnableIf< VectorizedAssign<MT2> >::Type
1025 assign(
const DenseMatrix<MT2,SO>& rhs );
1027 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,!SO>& rhs );
1028 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,SO>& rhs );
1029 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,!SO>& rhs );
1031 template<
typename MT2 >
1032 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
1033 addAssign(
const DenseMatrix<MT2,SO>& rhs );
1035 template<
typename MT2 >
1036 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
1037 addAssign(
const DenseMatrix<MT2,SO>& rhs );
1039 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,!SO>& rhs );
1040 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,SO>& rhs );
1041 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,!SO>& rhs );
1043 template<
typename MT2 >
1044 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
1045 subAssign(
const DenseMatrix<MT2,SO>& rhs );
1047 template<
typename MT2 >
1048 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
1049 subAssign(
const DenseMatrix<MT2,SO>& rhs );
1051 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,!SO>& rhs );
1052 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,SO>& rhs );
1053 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,!SO>& rhs );
1085 template<
typename MT2,
bool AF2,
bool SO2 >
friend class DenseSubmatrix;
1087 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
1091 template<
typename MT2,
bool AF2,
bool SO2 >
1094 template<
typename MT2,
bool AF2,
bool SO2 >
1097 template<
typename MT2,
bool AF2,
bool SO2 >
1100 template<
typename MT2,
bool AF2,
bool SO2 >
1103 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
1107 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
1111 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
1115 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
1119 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
1123 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
1127 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
1131 template<
typename MT2,
bool AF2,
bool SO2 >
1173 template<
typename MT
1177 : matrix_ ( matrix )
1179 , column_ ( cindex )
1182 , isAligned_( vectorizable && matrix.data() != NULL &&
checkAlignment( data() ) &&
1210 template<
typename MT
1219 return matrix_(row_+i,column_+j);
1234 template<
typename MT
1243 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
1259 template<
typename MT
1271 return (*
this)(i,j);
1287 template<
typename MT
1299 return (*
this)(i,j);
1313 template<
typename MT
1318 return matrix_.data() + row_*
spacing() + column_;
1332 template<
typename MT
1337 return matrix_.data() + row_*
spacing() + column_;
1350 template<
typename MT
1355 return matrix_.data() + (row_+i)*
spacing() + column_;
1368 template<
typename MT
1373 return matrix_.data() + (row_+i)*
spacing() + column_;
1389 template<
typename MT
1395 return Iterator( matrix_.begin( row_ + i ) + column_, isAligned_ );
1411 template<
typename MT
1418 return ConstIterator( matrix_.cbegin( row_ + i ) + column_, isAligned_ );
1434 template<
typename MT
1441 return ConstIterator( matrix_.cbegin( row_ + i ) + column_, isAligned_ );
1457 template<
typename MT
1463 return Iterator( matrix_.begin( row_ + i ) + column_ +
n_, isAligned_ );
1479 template<
typename MT
1486 return ConstIterator( matrix_.cbegin( row_ + i ) + column_ +
n_, isAligned_ );
1502 template<
typename MT
1509 return ConstIterator( matrix_.cbegin( row_ + i ) + column_ +
n_, isAligned_ );
1532 template<
typename MT
1537 const size_t iend( row_ +
m_ );
1539 for(
size_t i=row_; i<iend; ++i )
1543 ?(
max( i+1UL, column_ ) )
1544 :(
max( i, column_ ) ) )
1548 ?(
min( i, column_+
n_ ) )
1549 :(
min( i+1UL, column_+
n_ ) ) )
1552 for(
size_t j=jbegin; j<jend; ++j )
1575 template<
typename MT
1583 if(
this == &rhs || ( &matrix_ == &rhs.
matrix_ && row_ == rhs.
row_ && column_ == rhs.
column_ ) )
1590 if( !tryAssign( matrix_, rhs, row_, column_ ) ) {
1625 template<
typename MT
1628 template<
typename MT2
1639 Right right( ~rhs );
1641 if( !tryAssign( matrix_, right, row_, column_ ) ) {
1678 template<
typename MT
1681 template<
typename MT2
1700 if( !tryAddAssign( matrix_, ~rhs, row_, column_ ) ) {
1707 (~rhs).canAlias( &matrix_ ) ) {
1708 const AddType tmp( *
this + (~rhs) );
1735 template<
typename MT
1738 template<
typename MT2
1757 const AddType tmp( *
this + (~rhs) );
1759 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
1787 template<
typename MT
1790 template<
typename MT2
1792 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
1809 if( !trySubAssign( matrix_, ~rhs, row_, column_ ) ) {
1816 (~rhs).canAlias( &matrix_ ) ) {
1817 const SubType tmp( *
this - (~rhs ) );
1844 template<
typename MT
1847 template<
typename MT2
1849 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
1866 const SubType tmp( *
this - (~rhs) );
1868 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
1896 template<
typename MT
1899 template<
typename MT2
1916 const MultType tmp( *
this * (~rhs) );
1918 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
1943 template<
typename MT
1946 template<
typename Other >
1972 template<
typename MT
1975 template<
typename Other >
2004 template<
typename MT
2019 template<
typename MT
2034 template<
typename MT
2049 template<
typename MT
2069 template<
typename MT
2074 return matrix_.spacing();
2084 template<
typename MT
2105 template<
typename MT
2124 template<
typename MT
2129 const size_t iend( row_ +
m_ );
2130 const size_t jend( column_ +
n_ );
2131 size_t nonzeros( 0UL );
2133 for(
size_t i=row_; i<iend; ++i )
2134 for(
size_t j=column_; j<jend; ++j )
2154 template<
typename MT
2161 const size_t jend( column_ +
n_ );
2162 size_t nonzeros( 0UL );
2164 for(
size_t j=column_; j<jend; ++j )
2178 template<
typename MT
2185 for(
size_t i=row_; i<row_+
m_; ++i )
2189 ?(
max( i+1UL, column_ ) )
2190 :(
max( i, column_ ) ) )
2194 ?(
min( i, column_+
n_ ) )
2195 :(
min( i+1UL, column_+
n_ ) ) )
2198 for(
size_t j=jbegin; j<jend; ++j )
2199 clear( matrix_(i,j) );
2216 template<
typename MT
2227 ?(
max( i+1UL, column_ ) )
2228 :(
max( i, column_ ) ) )
2232 ?(
min( i, column_+
n_ ) )
2233 :(
min( i+1UL, column_+
n_ ) ) )
2236 for(
size_t j=jbegin; j<jend; ++j )
2237 clear( matrix_(row_+i,j) );
2259 template<
typename MT
2268 if( !tryAssign( matrix_,
trans( *
this ), row_, column_ ) ) {
2298 template<
typename MT
2307 if( !tryAssign( matrix_,
ctrans( *
this ), row_, column_ ) ) {
2330 template<
typename MT
2333 template<
typename Other >
2338 const size_t iend( row_ +
m_ );
2340 for(
size_t i=row_; i<iend; ++i )
2344 ?(
max( i+1UL, column_ ) )
2345 :(
max( i, column_ ) ) )
2349 ?(
min( i, column_+
n_ ) )
2350 :(
min( i+1UL, column_+
n_ ) ) )
2353 for(
size_t j=jbegin; j<jend; ++j )
2354 matrix_(i,j) *= scalar;
2371 template<
typename MT
2378 if( ( row_ +
m_ <= column_ ) || ( column_ +
n_ <= row_ ) )
2403 template<
typename MT
2406 template<
typename Other >
2409 return matrix_.isAliased( alias );
2424 template<
typename MT
2427 template<
typename MT2
2432 return ( matrix_.isAliased( &alias->
matrix_ ) &&
2433 ( row_ +
m_ > alias->
row_ ) && ( row_ < alias->row_ + alias->
m_ ) &&
2434 ( column_ +
n_ > alias->
column_ ) && ( column_ < alias->column_ + alias->
n_ ) );
2449 template<
typename MT
2452 template<
typename Other >
2455 return matrix_.isAliased( alias );
2470 template<
typename MT
2473 template<
typename MT2
2478 return ( matrix_.isAliased( &alias->
matrix_ ) &&
2479 ( row_ +
m_ > alias->
row_ ) && ( row_ < alias->row_ + alias->
m_ ) &&
2480 ( column_ +
n_ > alias->
column_ ) && ( column_ < alias->column_ + alias->
n_ ) );
2494 template<
typename MT
2514 template<
typename MT
2519 return (
rows() > SMP_DMATASSIGN_THRESHOLD );
2539 template<
typename MT
2546 return loada( i, j );
2548 return loadu( i, j );
2569 template<
typename MT
2582 return matrix_.loada( row_+i, column_+j );
2603 template<
typename MT
2616 return matrix_.loadu( row_+i, column_+j );
2637 template<
typename MT
2666 template<
typename MT
2678 matrix_.storea( row_+i, column_+j, value );
2699 template<
typename MT
2711 matrix_.storeu( row_+i, column_+j, value );
2733 template<
typename MT
2746 matrix_.stream( row_+i, column_+j, value );
2748 matrix_.storeu( row_+i, column_+j, value );
2764 template<
typename MT
2767 template<
typename MT2 >
2774 const size_t jpos(
n_ &
size_t(-2) );
2777 for(
size_t i=0UL; i<
m_; ++i ) {
2778 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2779 matrix_(row_+i,column_+j ) = (~rhs)(i,j );
2780 matrix_(row_+i,column_+j+1UL) = (~rhs)(i,j+1UL);
2783 matrix_(row_+i,column_+jpos) = (~rhs)(i,jpos);
2801 template<
typename MT
2804 template<
typename MT2 >
2818 !(~rhs).isAliased( &matrix_ ) )
2820 for(
size_t i=0UL; i<
m_; ++i )
2825 matrix_.stream( row_+i, column_+j, (~rhs).load(i,j) );
2827 for( ; j<
n_; ++j ) {
2828 matrix_(row_+i,column_+j) = (~rhs)(i,j);
2834 for(
size_t i=0UL; i<
m_; ++i )
2840 store( i, j , it.load() ); it +=
IT::size;
2846 store( i, j, it.load() );
2848 for( ; j<
n_; ++j, ++it ) {
2849 matrix_(row_+i,column_+j) = *it;
2868 template<
typename MT
2871 template<
typename MT2 >
2879 const size_t block( BLOCK_SIZE );
2881 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
2882 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
2883 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
2884 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
2885 for(
size_t i=ii; i<iend; ++i ) {
2886 for(
size_t j=jj; j<jend; ++j ) {
2887 matrix_(row_+i,column_+j) = (~rhs)(i,j);
2907 template<
typename MT
2910 template<
typename MT2 >
2916 for(
size_t i=0UL; i<
m_; ++i )
2918 matrix_(row_+i,column_+element->index()) = element->value();
2934 template<
typename MT
2937 template<
typename MT2 >
2945 for(
size_t j=0UL; j<
n_; ++j )
2947 matrix_(row_+element->index(),column_+j) = element->value();
2963 template<
typename MT
2966 template<
typename MT2 >
2973 const size_t jpos(
n_ &
size_t(-2) );
2976 for(
size_t i=0UL; i<
m_; ++i ) {
2977 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2978 matrix_(row_+i,column_+j ) += (~rhs)(i,j );
2979 matrix_(row_+i,column_+j+1UL) += (~rhs)(i,j+1UL);
2982 matrix_(row_+i,column_+jpos) += (~rhs)(i,jpos);
3000 template<
typename MT
3003 template<
typename MT2 >
3012 for(
size_t i=0UL; i<
m_; ++i )
3022 const size_t jpos( jend &
size_t(-
IT::size) );
3029 store( i, j , load(i,j ) + it.load() ); it +=
IT::size;
3035 store( i, j, load(i,j) + it.load() );
3037 for( ; j<jend; ++j, ++it ) {
3038 matrix_(row_+i,column_+j) += *it;
3056 template<
typename MT
3059 template<
typename MT2 >
3067 const size_t block( BLOCK_SIZE );
3069 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
3070 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
3071 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
3072 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
3073 for(
size_t i=ii; i<iend; ++i ) {
3074 for(
size_t j=jj; j<jend; ++j ) {
3075 matrix_(row_+i,column_+j) += (~rhs)(i,j);
3095 template<
typename MT
3098 template<
typename MT2 >
3104 for(
size_t i=0UL; i<
m_; ++i )
3106 matrix_(row_+i,column_+element->index()) += element->value();
3122 template<
typename MT
3125 template<
typename MT2 >
3133 for(
size_t j=0UL; j<
n_; ++j )
3135 matrix_(row_+element->index(),column_+j) += element->value();
3151 template<
typename MT
3154 template<
typename MT2 >
3161 const size_t jpos(
n_ &
size_t(-2) );
3164 for(
size_t i=0UL; i<
m_; ++i ) {
3165 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3166 matrix_(row_+i,column_+j ) -= (~rhs)(i,j );
3167 matrix_(row_+i,column_+j+1UL) -= (~rhs)(i,j+1UL);
3170 matrix_(row_+i,column_+jpos) -= (~rhs)(i,jpos);
3188 template<
typename MT
3191 template<
typename MT2 >
3200 for(
size_t i=0UL; i<
m_; ++i )
3210 const size_t jpos( jend &
size_t(-
IT::size) );
3217 store( i, j , load(i,j ) - it.load() ); it +=
IT::size;
3223 store( i, j, load(i,j) - it.load() );
3225 for( ; j<jend; ++j, ++it ) {
3226 matrix_(row_+i,column_+j) -= *it;
3244 template<
typename MT
3247 template<
typename MT2 >
3255 const size_t block( BLOCK_SIZE );
3257 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
3258 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
3259 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
3260 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
3261 for(
size_t i=ii; i<iend; ++i ) {
3262 for(
size_t j=jj; j<jend; ++j ) {
3263 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
3283 template<
typename MT
3286 template<
typename MT2 >
3292 for(
size_t i=0UL; i<
m_; ++i )
3294 matrix_(row_+i,column_+element->index()) -= element->value();
3310 template<
typename MT
3313 template<
typename MT2 >
3321 for(
size_t j=0UL; j<
n_; ++j )
3323 matrix_(row_+element->index(),column_+j) -= element->value();
3348 template<
typename MT >
3389 template<
typename IteratorType >
3390 class SubmatrixIterator
3395 typedef typename std::iterator_traits<IteratorType>::iterator_category
IteratorCategory;
3398 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
3401 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
3404 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
3407 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
3445 template<
typename IteratorType2 >
3523 inline ReferenceType
operator*()
const {
3538 inline IntrinsicType
load()
const {
3556 inline IntrinsicType
loada()
const {
3571 inline IntrinsicType
loadu()
const {
3694 inline IteratorType
base()
const {
3719 typedef SubmatrixIterator<typename MT::ConstIterator>
ConstIterator;
3722 typedef typename If< IsConst<MT>,
ConstIterator, SubmatrixIterator<typename MT::Iterator> >::Type
Iterator;
3727 enum { vectorizable = MT::vectorizable };
3730 enum { smpAssignable = MT::smpAssignable };
3736 explicit inline DenseSubmatrix( Operand matrix,
size_t rindex,
size_t cindex,
size_t m,
size_t n );
3748 inline Reference
operator()(
size_t i,
size_t j );
3749 inline ConstReference
operator()(
size_t i,
size_t j )
const;
3750 inline Reference
at(
size_t i,
size_t j );
3751 inline ConstReference
at(
size_t i,
size_t j )
const;
3752 inline Pointer
data ();
3753 inline ConstPointer
data ()
const;
3754 inline Pointer
data (
size_t j );
3755 inline ConstPointer
data (
size_t j )
const;
3756 inline Iterator
begin (
size_t j );
3757 inline ConstIterator
begin (
size_t j )
const;
3758 inline ConstIterator
cbegin(
size_t j )
const;
3759 inline Iterator
end (
size_t j );
3760 inline ConstIterator
end (
size_t j )
const;
3761 inline ConstIterator
cend (
size_t j )
const;
3771 template<
typename MT2,
bool SO >
3774 template<
typename MT2,
bool SO >
3775 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
3776 operator+=(
const Matrix<MT2,SO>& rhs );
3778 template<
typename MT2,
bool SO >
3779 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
3780 operator+=(
const Matrix<MT2,SO>& rhs );
3782 template<
typename MT2,
bool SO >
3783 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
3784 operator-=(
const Matrix<MT2,SO>& rhs );
3786 template<
typename MT2,
bool SO >
3787 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
3788 operator-=(
const Matrix<MT2,SO>& rhs );
3790 template<
typename MT2,
bool SO >
3793 template<
typename Other >
3794 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
3795 operator*=( Other rhs );
3797 template<
typename Other >
3798 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
3799 operator/=( Other rhs );
3806 inline size_t row()
const;
3807 inline size_t rows()
const;
3808 inline size_t column()
const;
3809 inline size_t columns()
const;
3810 inline size_t spacing()
const;
3812 inline size_t capacity(
size_t i )
const;
3814 inline size_t nonZeros(
size_t i )
const;
3815 inline void reset();
3816 inline void reset(
size_t i );
3819 template<
typename Other >
inline DenseSubmatrix& scale(
const Other& scalar );
3826 template<
typename MT2 >
3827 struct VectorizedAssign {
3829 vectorizable && MT2::vectorizable &&
3830 IsSame<ElementType,typename MT2::ElementType>::value };
3836 template<
typename MT2 >
3837 struct VectorizedAddAssign {
3839 vectorizable && MT2::vectorizable &&
3840 IsSame<ElementType,typename MT2::ElementType>::value &&
3841 IntrinsicTrait<ElementType>::addition };
3847 template<
typename MT2 >
3848 struct VectorizedSubAssign {
3850 vectorizable && MT2::vectorizable &&
3851 IsSame<ElementType,typename MT2::ElementType>::value &&
3852 IntrinsicTrait<ElementType>::subtraction };
3860 template<
typename Other >
3861 inline bool canAlias(
const Other* alias )
const;
3863 template<
typename MT2,
bool AF2,
bool SO2 >
3864 inline bool canAlias(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
3866 template<
typename Other >
3867 inline bool isAliased(
const Other* alias )
const;
3869 template<
typename MT2,
bool AF2,
bool SO2 >
3870 inline bool isAliased(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
3875 inline IntrinsicType
load (
size_t i,
size_t j )
const;
3876 inline IntrinsicType
loada(
size_t i,
size_t j )
const;
3877 inline IntrinsicType
loadu(
size_t i,
size_t j )
const;
3879 inline void store (
size_t i,
size_t j,
const IntrinsicType& value );
3880 inline void storea(
size_t i,
size_t j,
const IntrinsicType& value );
3881 inline void storeu(
size_t i,
size_t j,
const IntrinsicType& value );
3882 inline void stream(
size_t i,
size_t j,
const IntrinsicType& value );
3884 template<
typename MT2 >
3885 inline typename DisableIf< VectorizedAssign<MT2> >::Type
3886 assign(
const DenseMatrix<MT2,true>& rhs );
3888 template<
typename MT2 >
3889 inline typename EnableIf< VectorizedAssign<MT2> >::Type
3890 assign(
const DenseMatrix<MT2,true>& rhs );
3892 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,false>& rhs );
3893 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,true>& rhs );
3894 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,false>& rhs );
3896 template<
typename MT2 >
3897 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
3898 addAssign(
const DenseMatrix<MT2,true>& rhs );
3900 template<
typename MT2 >
3901 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
3902 addAssign(
const DenseMatrix<MT2,true>& rhs );
3904 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,false>& rhs );
3905 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,true>& rhs );
3906 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,false>& rhs );
3908 template<
typename MT2 >
3909 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
3910 subAssign(
const DenseMatrix<MT2,true>& rhs );
3912 template<
typename MT2 >
3913 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
3914 subAssign(
const DenseMatrix<MT2,true>& rhs );
3916 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,false>& rhs );
3917 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,true>& rhs );
3918 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,false>& rhs );
3949 template<
typename MT2,
bool AF2,
bool SO2 >
friend class DenseSubmatrix;
3951 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
3952 friend const DenseSubmatrix<MT2,AF1,SO2>
3953 submatrix(
const DenseSubmatrix<MT2,AF2,SO2>& dm,
size_t row,
size_t column,
size_t m,
size_t n );
3955 template<
typename MT2,
bool AF2,
bool SO2 >
3956 friend bool isIntact(
const DenseSubmatrix<MT2,AF2,SO2>& dm );
3958 template<
typename MT2,
bool AF2,
bool SO2 >
3959 friend bool isSame(
const DenseSubmatrix<MT2,AF2,SO2>& a,
const DenseMatrix<MT2,SO2>& b );
3961 template<
typename MT2,
bool AF2,
bool SO2 >
3962 friend bool isSame(
const DenseMatrix<MT2,SO2>& a,
const DenseSubmatrix<MT2,AF2,SO2>& b );
3964 template<
typename MT2,
bool AF2,
bool SO2 >
3965 friend bool isSame(
const DenseSubmatrix<MT2,AF2,SO2>& a,
const DenseSubmatrix<MT2,AF2,SO2>& b );
3967 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
3968 friend bool tryAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
3971 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
3972 friend bool tryAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
3975 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
3976 friend bool tryAddAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
3979 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
3980 friend bool tryAddAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
3983 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
3984 friend bool trySubAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
3987 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
3988 friend bool trySubAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
3991 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
3992 friend bool tryMultAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
3995 template<
typename MT2,
bool AF2,
bool SO2 >
3996 friend typename DerestrictTrait< DenseSubmatrix<MT2,AF2,SO2> >::Type
3997 derestrict( DenseSubmatrix<MT2,AF2,SO2>& dm );
4036 template<
typename MT >
4038 : matrix_ ( matrix )
4040 , column_ ( cindex )
4043 , isAligned_( vectorizable && matrix.data() != NULL &&
checkAlignment( data() ) &&
4044 ( n < 2UL || ( matrix.
spacing() & size_t(-IT::
size) ) == 0UL ) )
4073 template<
typename MT >
4080 return matrix_(row_+i,column_+j);
4097 template<
typename MT >
4104 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
4122 template<
typename MT >
4132 return (*
this)(i,j);
4150 template<
typename MT >
4160 return (*
this)(i,j);
4176 template<
typename MT >
4177 inline typename DenseSubmatrix<MT,unaligned,true>::Pointer
4180 return matrix_.data() + row_ + column_*
spacing();
4196 template<
typename MT >
4197 inline typename DenseSubmatrix<MT,unaligned,true>::ConstPointer
4200 return matrix_.data() + row_ + column_*
spacing();
4215 template<
typename MT >
4216 inline typename DenseSubmatrix<MT,unaligned,true>::Pointer
4219 return matrix_.data() + row_ + (column_+j)*
spacing();
4234 template<
typename MT >
4235 inline typename DenseSubmatrix<MT,unaligned,true>::ConstPointer
4238 return matrix_.data() + row_ + (column_+j)*
spacing();
4251 template<
typename MT >
4256 return Iterator( matrix_.begin( column_ + j ) + row_, isAligned_ );
4269 template<
typename MT >
4274 return ConstIterator( matrix_.cbegin( column_ + j ) + row_, isAligned_ );
4287 template<
typename MT >
4292 return ConstIterator( matrix_.cbegin( column_ + j ) + row_, isAligned_ );
4305 template<
typename MT >
4310 return Iterator( matrix_.begin( column_ + j ) + row_ +
m_, isAligned_ );
4323 template<
typename MT >
4328 return ConstIterator( matrix_.cbegin( column_ + j ) + row_ +
m_, isAligned_ );
4341 template<
typename MT >
4346 return ConstIterator( matrix_.cbegin( column_ + j ) + row_ +
m_, isAligned_ );
4371 template<
typename MT >
4372 inline DenseSubmatrix<MT,unaligned,true>&
4375 const size_t jend( column_ +
n_ );
4377 for(
size_t j=column_; j<jend; ++j )
4379 const size_t ibegin( ( IsLower<MT>::value )
4380 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4381 ?(
max( j+1UL, row_ ) )
4382 :(
max( j, row_ ) ) )
4384 const size_t iend ( ( IsUpper<MT>::value )
4385 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4386 ?(
min( j, row_+
m_ ) )
4387 :(
min( j+1UL, row_+
m_ ) ) )
4390 for(
size_t i=ibegin; i<iend; ++i )
4415 template<
typename MT >
4416 inline DenseSubmatrix<MT,unaligned,true>&
4422 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
4425 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
4429 if( !tryAssign( matrix_, rhs, row_, column_ ) ) {
4433 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4435 if( rhs.canAlias( &matrix_ ) ) {
4436 const ResultType tmp( rhs );
4466 template<
typename MT >
4467 template<
typename MT2
4469 inline DenseSubmatrix<MT,unaligned,true>&
4478 typedef typename If< IsRestricted<MT>,
typename MT2::CompositeType,
const MT2& >::Type Right;
4479 Right right( ~rhs );
4481 if( !tryAssign( matrix_, right, row_, column_ ) ) {
4485 if( IsSparseMatrix<MT2>::value )
4488 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4490 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4520 template<
typename MT >
4521 template<
typename MT2
4523 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
4524 , DenseSubmatrix<MT,unaligned,true>& >::Type
4525 DenseSubmatrix<MT,unaligned,true>::operator+=(
const Matrix<MT2,SO>& rhs )
4531 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
4540 if( !tryAddAssign( matrix_, ~rhs, row_, column_ ) ) {
4544 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4546 if( ( ( IsSymmetric<MT>::value || IsHermitian<MT>::value ) && hasOverlap() ) ||
4547 (~rhs).canAlias( &matrix_ ) ) {
4548 const AddType tmp( *
this + (~rhs) );
4577 template<
typename MT >
4578 template<
typename MT2
4580 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
4581 , DenseSubmatrix<MT,unaligned,true>& >::Type
4582 DenseSubmatrix<MT,unaligned,true>::operator+=(
const Matrix<MT2,SO>& rhs )
4588 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
4597 const AddType tmp( *
this + (~rhs) );
4599 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
4603 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4629 template<
typename MT >
4630 template<
typename MT2
4632 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
4633 , DenseSubmatrix<MT,unaligned,true>& >::Type
4634 DenseSubmatrix<MT,unaligned,true>::operator-=(
const Matrix<MT2,SO>& rhs )
4640 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
4649 if( !trySubAssign( matrix_, ~rhs, row_, column_ ) ) {
4653 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4655 if( ( ( IsSymmetric<MT>::value || IsHermitian<MT>::value ) && hasOverlap() ) ||
4656 (~rhs).canAlias( &matrix_ ) ) {
4657 const SubType tmp( *
this - (~rhs ) );
4686 template<
typename MT >
4687 template<
typename MT2
4689 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
4690 , DenseSubmatrix<MT,unaligned,true>& >::Type
4691 DenseSubmatrix<MT,unaligned,true>::operator-=(
const Matrix<MT2,SO>& rhs )
4697 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
4706 const SubType tmp( *
this - (~rhs) );
4708 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
4712 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4738 template<
typename MT >
4739 template<
typename MT2
4741 inline DenseSubmatrix<MT,unaligned,true>&
4742 DenseSubmatrix<MT,unaligned,true>::operator*=(
const Matrix<MT2,SO>& rhs )
4748 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
4757 const MultType tmp( *
this * (~rhs) );
4759 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
4763 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4786 template<
typename MT >
4787 template<
typename Other >
4788 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,unaligned,true> >::Type&
4789 DenseSubmatrix<MT,unaligned,true>::operator*=( Other rhs )
4793 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4815 template<
typename MT >
4816 template<
typename Other >
4817 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,unaligned,true> >::Type&
4818 DenseSubmatrix<MT,unaligned,true>::operator/=( Other rhs )
4824 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4847 template<
typename MT >
4862 template<
typename MT >
4877 template<
typename MT >
4892 template<
typename MT >
4910 template<
typename MT >
4913 return matrix_.spacing();
4925 template<
typename MT >
4941 template<
typename MT >
4960 template<
typename MT >
4963 const size_t iend( row_ +
m_ );
4964 const size_t jend( column_ +
n_ );
4965 size_t nonzeros( 0UL );
4967 for(
size_t j=column_; j<jend; ++j )
4968 for(
size_t i=row_; i<iend; ++i )
4985 template<
typename MT >
4990 const size_t iend( row_ +
m_ );
4991 size_t nonzeros( 0UL );
4993 for(
size_t i=row_; i<iend; ++i )
4994 if( !
isDefault( matrix_(i,column_+j) ) )
5009 template<
typename MT >
5014 for(
size_t j=column_; j<column_+
n_; ++j )
5016 const size_t ibegin( ( IsLower<MT>::value )
5017 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
5018 ?(
max( j+1UL, row_ ) )
5019 :(
max( j, row_ ) ) )
5021 const size_t iend ( ( IsUpper<MT>::value )
5022 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
5023 ?(
min( j, row_+
m_ ) )
5024 :(
min( j+1UL, row_+
m_ ) ) )
5027 for(
size_t i=ibegin; i<iend; ++i )
5028 clear( matrix_(i,j) );
5042 template<
typename MT >
5049 const size_t ibegin( ( IsLower<MT>::value )
5050 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
5051 ?(
max( j+1UL, row_ ) )
5052 :(
max( j, row_ ) ) )
5054 const size_t iend ( ( IsUpper<MT>::value )
5055 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
5056 ?(
min( j, row_+
m_ ) )
5057 :(
min( j+1UL, row_+
m_ ) ) )
5060 for(
size_t i=ibegin; i<iend; ++i )
5061 clear( matrix_(i,column_+j) );
5085 template<
typename MT >
5092 if( !tryAssign( matrix_,
trans( *
this ), row_, column_ ) ) {
5096 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
5097 const ResultType tmp(
trans( *
this ) );
5124 template<
typename MT >
5131 if( !tryAssign( matrix_,
ctrans( *
this ), row_, column_ ) ) {
5135 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
5136 const ResultType tmp(
ctrans( *
this ) );
5156 template<
typename MT >
5157 template<
typename Other >
5158 inline DenseSubmatrix<MT,unaligned,true>& DenseSubmatrix<MT,unaligned,true>::scale(
const Other& scalar )
5162 const size_t jend( column_ + n_ );
5164 for(
size_t j=column_; j<jend; ++j )
5166 const size_t ibegin( ( IsLower<MT>::value )
5167 ?( ( IsStrictlyLower<MT>::value )
5168 ?(
max( j+1UL, row_ ) )
5169 :(
max( j, row_ ) ) )
5171 const size_t iend ( ( IsUpper<MT>::value )
5172 ?( ( IsStrictlyUpper<MT>::value )
5173 ?(
min( j, row_+
m_ ) )
5174 :(
min( j+1UL, row_+
m_ ) ) )
5177 for(
size_t i=ibegin; i<iend; ++i )
5178 matrix_(i,j) *= scalar;
5197 template<
typename MT >
5200 BLAZE_INTERNAL_ASSERT( IsSymmetric<MT>::value || IsHermitian<MT>::value,
"Invalid matrix detected" );
5202 if( ( row_ +
m_ <= column_ ) || ( column_ + n_ <= row_ ) )
5229 template<
typename MT >
5230 template<
typename Other >
5233 return matrix_.isAliased( alias );
5250 template<
typename MT >
5251 template<
typename MT2
5256 return ( matrix_.isAliased( &alias->matrix_ ) &&
5257 ( row_ +
m_ > alias->row_ ) && ( row_ < alias->row_ + alias->m_ ) &&
5258 ( column_ + n_ > alias->column_ ) && ( column_ < alias->column_ + alias->n_ ) );
5275 template<
typename MT >
5276 template<
typename Other >
5279 return matrix_.isAliased( alias );
5296 template<
typename MT >
5297 template<
typename MT2
5302 return ( matrix_.isAliased( &alias->matrix_ ) &&
5303 ( row_ +
m_ > alias->row_ ) && ( row_ < alias->row_ + alias->m_ ) &&
5304 ( column_ + n_ > alias->column_ ) && ( column_ < alias->column_ + alias->n_ ) );
5320 template<
typename MT >
5340 template<
typename MT >
5343 return (
columns() > SMP_DMATASSIGN_THRESHOLD );
5364 template<
typename MT >
5365 inline typename DenseSubmatrix<MT,unaligned,true>::IntrinsicType
5369 return loada( i, j );
5371 return loadu( i, j );
5393 template<
typename MT >
5394 inline typename DenseSubmatrix<MT,unaligned,true>::IntrinsicType
5404 return matrix_.loada( row_+i, column_+j );
5426 template<
typename MT >
5427 inline typename DenseSubmatrix<MT,unaligned,true>::IntrinsicType
5437 return matrix_.loadu( row_+i, column_+j );
5459 template<
typename MT >
5487 template<
typename MT >
5497 matrix_.storea( row_+i, column_+j, value );
5520 template<
typename MT >
5530 matrix_.storeu( row_+i, column_+j, value );
5553 template<
typename MT >
5564 matrix_.stream( row_+i, column_+j, value );
5566 matrix_.storeu( row_+i, column_+j, value );
5584 template<
typename MT >
5585 template<
typename MT2 >
5586 inline typename DisableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
5587 DenseSubmatrix<MT,unaligned,true>::assign(
const DenseMatrix<MT2,true>& rhs )
5592 const size_t ipos(
m_ &
size_t(-2) );
5595 for(
size_t j=0UL; j<
n_; ++j ) {
5596 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5597 matrix_(row_+i ,column_+j) = (~rhs)(i ,j);
5598 matrix_(row_+i+1UL,column_+j) = (~rhs)(i+1UL,j);
5601 matrix_(row_+ipos,column_+j) = (~rhs)(ipos,j);
5621 template<
typename MT >
5622 template<
typename MT2 >
5623 inline typename EnableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
5624 DenseSubmatrix<MT,unaligned,true>::assign(
const DenseMatrix<MT2,true>& rhs )
5635 m_*n_ > (
cacheSize / (
sizeof(ElementType) * 3UL ) ) &&
5636 !(~rhs).isAliased( &matrix_ ) )
5638 for(
size_t j=0UL; j<
n_; ++j )
5643 matrix_.stream( row_+i, column_+j, (~rhs).load(i,j) );
5645 for( ; i<
m_; ++i ) {
5646 matrix_(row_+i,column_+j) = (~rhs)(i,j);
5652 for(
size_t j=0UL; j<
n_; ++j )
5658 store( i , j, it.load() ); it +=
IT::size;
5664 store( i, j, it.load() );
5666 for( ; i<
m_; ++i, ++it ) {
5667 matrix_(row_+i,column_+j) = (~rhs)(i,j);
5688 template<
typename MT >
5689 template<
typename MT2 >
5690 inline void DenseSubmatrix<MT,unaligned,true>::assign(
const DenseMatrix<MT2,false>& rhs )
5697 const size_t block( BLOCK_SIZE );
5699 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5700 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
5701 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
5702 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
5703 for(
size_t j=jj; j<jend; ++j ) {
5704 for(
size_t i=ii; i<iend; ++i ) {
5705 matrix_(row_+i,column_+j) = (~rhs)(i,j);
5727 template<
typename MT >
5728 template<
typename MT2 >
5729 inline void DenseSubmatrix<MT,unaligned,true>::assign(
const SparseMatrix<MT2,true>& rhs )
5734 for(
size_t j=0UL; j<
n_; ++j )
5736 matrix_(row_+element->index(),column_+j) = element->value();
5754 template<
typename MT >
5755 template<
typename MT2 >
5756 inline void DenseSubmatrix<MT,unaligned,true>::assign(
const SparseMatrix<MT2,false>& rhs )
5763 for(
size_t i=0UL; i<
m_; ++i )
5765 matrix_(row_+i,column_+element->index()) = element->value();
5783 template<
typename MT >
5784 template<
typename MT2 >
5785 inline typename DisableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
5786 DenseSubmatrix<MT,unaligned,true>::addAssign(
const DenseMatrix<MT2,true>& rhs )
5791 const size_t ipos( m_ &
size_t(-2) );
5794 for(
size_t j=0UL; j<
n_; ++j ) {
5795 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5796 matrix_(row_+i ,column_+j) += (~rhs)(i ,j);
5797 matrix_(row_+i+1UL,column_+j) += (~rhs)(i+1UL,j);
5800 matrix_(row_+ipos,column_+j) += (~rhs)(ipos,j);
5820 template<
typename MT >
5821 template<
typename MT2 >
5822 inline typename EnableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
5823 DenseSubmatrix<MT,unaligned,true>::addAssign(
const DenseMatrix<MT2,true>& rhs )
5830 for(
size_t j=0UL; j<
n_; ++j )
5832 const size_t ibegin( ( IsLower<MT>::value )
5833 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
5835 const size_t iend ( ( IsUpper<MT>::value )
5836 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5840 const size_t ipos( iend &
size_t(-
IT::size) );
5847 store( i , j, load(i ,j) + it.load() ); it +=
IT::size;
5853 store( i, j, load(i,j) + it.load() );
5855 for( ; i<iend; ++i, ++it ) {
5856 matrix_(row_+i,column_+j) += *it;
5876 template<
typename MT >
5877 template<
typename MT2 >
5878 inline void DenseSubmatrix<MT,unaligned,true>::addAssign(
const DenseMatrix<MT2,false>& rhs )
5885 const size_t block( BLOCK_SIZE );
5887 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
5888 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
5889 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
5890 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
5891 for(
size_t j=jj; j<jend; ++j ) {
5892 for(
size_t i=ii; i<iend; ++i ) {
5893 matrix_(row_+i,column_+j) += (~rhs)(i,j);
5915 template<
typename MT >
5916 template<
typename MT2 >
5917 inline void DenseSubmatrix<MT,unaligned,true>::addAssign(
const SparseMatrix<MT2,true>& rhs )
5922 for(
size_t j=0UL; j<
n_; ++j )
5924 matrix_(row_+element->index(),column_+j) += element->value();
5942 template<
typename MT >
5943 template<
typename MT2 >
5944 inline void DenseSubmatrix<MT,unaligned,true>::addAssign(
const SparseMatrix<MT2,false>& rhs )
5951 for(
size_t i=0UL; i<
m_; ++i )
5953 matrix_(row_+i,column_+element->index()) += element->value();
5971 template<
typename MT >
5972 template<
typename MT2 >
5973 inline typename DisableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
5974 DenseSubmatrix<MT,unaligned,true>::subAssign(
const DenseMatrix<MT2,true>& rhs )
5979 const size_t ipos( m_ &
size_t(-2) );
5982 for(
size_t j=0UL; j<
n_; ++j ) {
5983 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5984 matrix_(row_+i ,column_+j) -= (~rhs)(i ,j);
5985 matrix_(row_+i+1UL,column_+j) -= (~rhs)(i+1UL,j);
5988 matrix_(row_+ipos,column_+j) -= (~rhs)(ipos,j);
6008 template<
typename MT >
6009 template<
typename MT2 >
6010 inline typename EnableIf< typename DenseSubmatrix<MT,unaligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
6011 DenseSubmatrix<MT,unaligned,true>::subAssign(
const DenseMatrix<MT2,true>& rhs )
6018 for(
size_t j=0UL; j<
n_; ++j )
6020 const size_t ibegin( ( IsLower<MT>::value )
6021 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
6023 const size_t iend ( ( IsUpper<MT>::value )
6024 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
6028 const size_t ipos( iend &
size_t(-
IT::size) );
6035 store( i , j, load(i ,j) - it.load() ); it +=
IT::size;
6041 store( i, j, load(i,j) - it.load() );
6043 for( ; i<iend; ++i, ++it ) {
6044 matrix_(row_+i,column_+j) -= *it;
6064 template<
typename MT >
6065 template<
typename MT2 >
6066 inline void DenseSubmatrix<MT,unaligned,true>::subAssign(
const DenseMatrix<MT2,false>& rhs )
6073 const size_t block( BLOCK_SIZE );
6075 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
6076 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
6077 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
6078 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
6079 for(
size_t j=jj; j<jend; ++j ) {
6080 for(
size_t i=ii; i<iend; ++i ) {
6081 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
6103 template<
typename MT >
6104 template<
typename MT2 >
6105 inline void DenseSubmatrix<MT,unaligned,true>::subAssign(
const SparseMatrix<MT2,true>& rhs )
6110 for(
size_t j=0UL; j<
n_; ++j )
6112 matrix_(row_+element->index(),column_+j) -= element->value();
6130 template<
typename MT >
6131 template<
typename MT2 >
6132 inline void DenseSubmatrix<MT,unaligned,true>::subAssign(
const SparseMatrix<MT2,false>& rhs )
6139 for(
size_t i=0UL; i<
m_; ++i )
6141 matrix_(row_+i,column_+element->index()) -= element->value();
6167 template<
typename MT >
6168 class DenseSubmatrix<MT,
aligned,false> :
public DenseMatrix< DenseSubmatrix<MT,aligned,false>, false >
6174 typedef typename If< IsExpression<MT>, MT, MT& >::Type
Operand;
6177 typedef IntrinsicTrait<typename MT::ElementType>
IT;
6182 typedef DenseSubmatrix<MT,aligned,false>
This;
6183 typedef typename SubmatrixTrait<MT>::Type
ResultType;
6201 typedef typename If< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >
6213 enum { vectorizable = MT::vectorizable };
6216 enum { smpAssignable = MT::smpAssignable };
6222 explicit inline DenseSubmatrix( Operand matrix,
size_t rindex,
size_t cindex,
size_t m,
size_t n );
6234 inline Reference
operator()(
size_t i,
size_t j );
6235 inline ConstReference
operator()(
size_t i,
size_t j )
const;
6236 inline Reference
at(
size_t i,
size_t j );
6237 inline ConstReference
at(
size_t i,
size_t j )
const;
6238 inline Pointer
data ();
6239 inline ConstPointer
data ()
const;
6240 inline Pointer
data (
size_t i );
6241 inline ConstPointer
data (
size_t i )
const;
6242 inline Iterator
begin (
size_t i );
6243 inline ConstIterator
begin (
size_t i )
const;
6244 inline ConstIterator
cbegin(
size_t i )
const;
6245 inline Iterator
end (
size_t i );
6246 inline ConstIterator
end (
size_t i )
const;
6247 inline ConstIterator
cend (
size_t i )
const;
6257 template<
typename MT2,
bool SO >
6260 template<
typename MT2,
bool SO >
6261 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
6262 operator+=(
const Matrix<MT2,SO>& rhs );
6264 template<
typename MT2,
bool SO >
6265 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
6266 operator+=(
const Matrix<MT2,SO>& rhs );
6268 template<
typename MT2,
bool SO >
6269 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
6270 operator-=(
const Matrix<MT2,SO>& rhs );
6272 template<
typename MT2,
bool SO >
6273 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
6274 operator-=(
const Matrix<MT2,SO>& rhs );
6276 template<
typename MT2,
bool SO >
6279 template<
typename Other >
6280 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
6281 operator*=( Other rhs );
6283 template<
typename Other >
6284 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
6285 operator/=( Other rhs );
6292 inline size_t row()
const;
6293 inline size_t rows()
const;
6294 inline size_t column()
const;
6295 inline size_t columns()
const;
6296 inline size_t spacing()
const;
6298 inline size_t capacity(
size_t i )
const;
6300 inline size_t nonZeros(
size_t i )
const;
6301 inline void reset();
6302 inline void reset(
size_t i );
6305 template<
typename Other >
inline DenseSubmatrix& scale(
const Other& scalar );
6312 template<
typename MT2 >
6313 struct VectorizedAssign {
6315 vectorizable && MT2::vectorizable &&
6316 IsSame<ElementType,typename MT2::ElementType>::value };
6322 template<
typename MT2 >
6323 struct VectorizedAddAssign {
6325 vectorizable && MT2::vectorizable &&
6326 IsSame<ElementType,typename MT2::ElementType>::value &&
6327 IntrinsicTrait<ElementType>::addition };
6333 template<
typename MT2 >
6334 struct VectorizedSubAssign {
6336 vectorizable && MT2::vectorizable &&
6337 IsSame<ElementType,typename MT2::ElementType>::value &&
6338 IntrinsicTrait<ElementType>::subtraction };
6346 template<
typename Other >
6347 inline bool canAlias(
const Other* alias )
const;
6349 template<
typename MT2,
bool AF2,
bool SO2 >
6350 inline bool canAlias(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
6352 template<
typename Other >
6353 inline bool isAliased(
const Other* alias )
const;
6355 template<
typename MT2,
bool AF2,
bool SO2 >
6356 inline bool isAliased(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
6370 template<
typename MT2 >
6371 inline typename DisableIf< VectorizedAssign<MT2> >::Type
6372 assign(
const DenseMatrix<MT2,false>& rhs );
6374 template<
typename MT2 >
6375 inline typename EnableIf< VectorizedAssign<MT2> >::Type
6376 assign(
const DenseMatrix<MT2,false>& rhs );
6378 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,true>& rhs );
6379 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,false>& rhs );
6380 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,true>& rhs );
6382 template<
typename MT2 >
6383 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
6384 addAssign(
const DenseMatrix<MT2,false>& rhs );
6386 template<
typename MT2 >
6387 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
6388 addAssign(
const DenseMatrix<MT2,false>& rhs );
6390 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,true>& rhs );
6391 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,false>& rhs );
6392 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,true>& rhs );
6394 template<
typename MT2 >
6395 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
6396 subAssign(
const DenseMatrix<MT2,false>& rhs );
6398 template<
typename MT2 >
6399 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
6400 subAssign(
const DenseMatrix<MT2,false>& rhs );
6402 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,true>& rhs );
6403 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,false>& rhs );
6404 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,true>& rhs );
6428 template<
typename MT2,
bool AF2,
bool SO2 >
friend class DenseSubmatrix;
6430 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
6431 friend const DenseSubmatrix<MT2,AF1,SO2>
6432 submatrix(
const DenseSubmatrix<MT2,AF2,SO2>& dm,
size_t row,
size_t column,
size_t m,
size_t n );
6434 template<
typename MT2,
bool AF2,
bool SO2 >
6435 friend bool isIntact(
const DenseSubmatrix<MT2,AF2,SO2>& dm );
6437 template<
typename MT2,
bool AF2,
bool SO2 >
6438 friend bool isSame(
const DenseSubmatrix<MT2,AF2,SO2>& a,
const DenseMatrix<MT2,SO2>& b );
6440 template<
typename MT2,
bool AF2,
bool SO2 >
6441 friend bool isSame(
const DenseMatrix<MT2,SO2>& a,
const DenseSubmatrix<MT2,AF2,SO2>& b );
6443 template<
typename MT2,
bool AF2,
bool SO2 >
6444 friend bool isSame(
const DenseSubmatrix<MT2,AF2,SO2>& a,
const DenseSubmatrix<MT2,AF2,SO2>& b );
6446 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
6447 friend bool tryAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
6450 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
6451 friend bool tryAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
6454 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
6455 friend bool tryAddAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
6458 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
6459 friend bool tryAddAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
6462 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
6463 friend bool trySubAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
6466 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
6467 friend bool trySubAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
6470 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
6471 friend bool tryMultAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
6474 template<
typename MT2,
bool AF2,
bool SO2 >
6475 friend typename DerestrictTrait< DenseSubmatrix<MT2,AF2,SO2> >::Type
6476 derestrict( DenseSubmatrix<MT2,AF2,SO2>& dm );
6515 template<
typename MT >
6555 template<
typename MT >
6562 return matrix_(row_+i,column_+j);
6579 template<
typename MT >
6586 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
6604 template<
typename MT >
6614 return (*
this)(i,j);
6632 template<
typename MT >
6642 return (*
this)(i,j);
6658 template<
typename MT >
6659 inline typename DenseSubmatrix<MT,aligned,false>::Pointer
6662 return matrix_.data() + row_*
spacing() + column_;
6678 template<
typename MT >
6679 inline typename DenseSubmatrix<MT,aligned,false>::ConstPointer
6682 return matrix_.data() + row_*
spacing() + column_;
6697 template<
typename MT >
6698 inline typename DenseSubmatrix<MT,aligned,false>::Pointer
6701 return matrix_.data() + (row_+i)*
spacing() + column_;
6716 template<
typename MT >
6717 inline typename DenseSubmatrix<MT,aligned,false>::ConstPointer
6720 return matrix_.data() + (row_+i)*
spacing() + column_;
6738 template<
typename MT >
6743 return ( matrix_.begin( row_ + i ) + column_ );
6761 template<
typename MT >
6766 return ( matrix_.cbegin( row_ + i ) + column_ );
6784 template<
typename MT >
6789 return ( matrix_.cbegin( row_ + i ) + column_ );
6807 template<
typename MT >
6812 return ( matrix_.begin( row_ + i ) + column_ +
n_ );
6830 template<
typename MT >
6835 return ( matrix_.cbegin( row_ + i ) + column_ +
n_ );
6853 template<
typename MT >
6858 return ( matrix_.cbegin( row_ + i ) + column_ +
n_ );
6883 template<
typename MT >
6884 inline DenseSubmatrix<MT,aligned,false>&
6887 const size_t iend( row_ + m_ );
6889 for(
size_t i=row_; i<iend; ++i )
6891 const size_t jbegin( ( IsUpper<MT>::value )
6892 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
6893 ?(
max( i+1UL, column_ ) )
6894 :(
max( i, column_ ) ) )
6896 const size_t jend ( ( IsLower<MT>::value )
6897 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
6898 ?(
min( i, column_+n_ ) )
6899 :(
min( i+1UL, column_+n_ ) ) )
6902 for(
size_t j=jbegin; j<jend; ++j )
6927 template<
typename MT >
6928 inline DenseSubmatrix<MT,aligned,false>&
6934 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
6937 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
6941 if( !tryAssign( matrix_, rhs, row_, column_ ) ) {
6945 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
6947 if( rhs.canAlias( &matrix_ ) ) {
6948 const ResultType tmp( rhs );
6978 template<
typename MT >
6979 template<
typename MT2
6981 inline DenseSubmatrix<MT,aligned,false>&
6990 typedef typename If< IsRestricted<MT>,
typename MT2::CompositeType,
const MT2& >::Type Right;
6991 Right right( ~rhs );
6993 if( !tryAssign( matrix_, right, row_, column_ ) ) {
6997 if( IsSparseMatrix<MT2>::value )
7000 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7002 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
7032 template<
typename MT >
7033 template<
typename MT2
7035 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
7036 , DenseSubmatrix<MT,aligned,false>& >::Type
7037 DenseSubmatrix<MT,aligned,false>::operator+=(
const Matrix<MT2,SO>& rhs )
7043 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
7052 if( !tryAddAssign( matrix_, ~rhs, row_, column_ ) ) {
7056 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7058 if( ( ( IsSymmetric<MT>::value || IsHermitian<MT>::value ) && hasOverlap() ) ||
7059 (~rhs).canAlias( &matrix_ ) ) {
7060 const AddType tmp( *
this + (~rhs) );
7089 template<
typename MT >
7090 template<
typename MT2
7092 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
7093 , DenseSubmatrix<MT,aligned,false>& >::Type
7094 DenseSubmatrix<MT,aligned,false>::operator+=(
const Matrix<MT2,SO>& rhs )
7100 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
7109 const AddType tmp( *
this + (~rhs) );
7111 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
7115 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7141 template<
typename MT >
7142 template<
typename MT2
7144 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
7145 , DenseSubmatrix<MT,aligned,false>& >::Type
7146 DenseSubmatrix<MT,aligned,false>::operator-=(
const Matrix<MT2,SO>& rhs )
7152 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
7161 if( !trySubAssign( matrix_, ~rhs, row_, column_ ) ) {
7165 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7167 if( ( ( IsSymmetric<MT>::value || IsHermitian<MT>::value ) && hasOverlap() ) ||
7168 (~rhs).canAlias( &matrix_ ) ) {
7169 const SubType tmp( *
this - (~rhs ) );
7198 template<
typename MT >
7199 template<
typename MT2
7201 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
7202 , DenseSubmatrix<MT,aligned,false>& >::Type
7203 DenseSubmatrix<MT,aligned,false>::operator-=(
const Matrix<MT2,SO>& rhs )
7209 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
7218 const SubType tmp( *
this - (~rhs) );
7220 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
7224 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7250 template<
typename MT >
7251 template<
typename MT2
7253 inline DenseSubmatrix<MT,aligned,false>&
7254 DenseSubmatrix<MT,aligned,false>::operator*=(
const Matrix<MT2,SO>& rhs )
7260 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
7269 const MultType tmp( *
this * (~rhs) );
7271 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
7275 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7298 template<
typename MT >
7299 template<
typename Other >
7300 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,false> >::Type&
7301 DenseSubmatrix<MT,aligned,false>::operator*=( Other rhs )
7305 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7327 template<
typename MT >
7328 template<
typename Other >
7329 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,false> >::Type&
7330 DenseSubmatrix<MT,aligned,false>::operator/=( Other rhs )
7336 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7359 template<
typename MT >
7374 template<
typename MT >
7389 template<
typename MT >
7404 template<
typename MT >
7424 template<
typename MT >
7427 return matrix_.spacing();
7439 template<
typename MT >
7460 template<
typename MT >
7479 template<
typename MT >
7482 const size_t iend( row_ + m_ );
7483 const size_t jend( column_ + n_ );
7484 size_t nonzeros( 0UL );
7486 for(
size_t i=row_; i<iend; ++i )
7487 for(
size_t j=column_; j<jend; ++j )
7509 template<
typename MT >
7514 const size_t jend( column_ + n_ );
7515 size_t nonzeros( 0UL );
7517 for(
size_t j=column_; j<jend; ++j )
7533 template<
typename MT >
7538 for(
size_t i=row_; i<row_+
m_; ++i )
7540 const size_t jbegin( ( IsUpper<MT>::value )
7541 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
7542 ?(
max( i+1UL, column_ ) )
7543 :(
max( i, column_ ) ) )
7545 const size_t jend ( ( IsLower<MT>::value )
7546 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
7547 ?(
min( i, column_+n_ ) )
7548 :(
min( i+1UL, column_+n_ ) ) )
7551 for(
size_t j=jbegin; j<jend; ++j )
7552 clear( matrix_(i,j) );
7571 template<
typename MT >
7578 const size_t jbegin( ( IsUpper<MT>::value )
7579 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
7580 ?(
max( i+1UL, column_ ) )
7581 :(
max( i, column_ ) ) )
7583 const size_t jend ( ( IsLower<MT>::value )
7584 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
7585 ?(
min( i, column_+n_ ) )
7586 :(
min( i+1UL, column_+n_ ) ) )
7589 for(
size_t j=jbegin; j<jend; ++j )
7590 clear( matrix_(row_+i,j) );
7614 template<
typename MT >
7621 if( !tryAssign( matrix_,
trans( *
this ), row_, column_ ) ) {
7625 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7626 const ResultType tmp(
trans( *
this ) );
7653 template<
typename MT >
7660 if( !tryAssign( matrix_,
ctrans( *
this ), row_, column_ ) ) {
7664 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
7665 const ResultType tmp(
ctrans( *
this ) );
7685 template<
typename MT >
7686 template<
typename Other >
7687 inline DenseSubmatrix<MT,aligned,false>& DenseSubmatrix<MT,aligned,false>::scale(
const Other& scalar )
7691 const size_t iend( row_ + m_ );
7693 for(
size_t i=row_; i<iend; ++i )
7695 const size_t jbegin( ( IsUpper<MT>::value )
7696 ?( ( IsStrictlyUpper<MT>::value )
7697 ?(
max( i+1UL, column_ ) )
7698 :(
max( i, column_ ) ) )
7700 const size_t jend ( ( IsLower<MT>::value )
7701 ?( ( IsStrictlyLower<MT>::value )
7702 ?(
min( i, column_+n_ ) )
7703 :(
min( i+1UL, column_+n_ ) ) )
7706 for(
size_t j=jbegin; j<jend; ++j )
7707 matrix_(i,j) *= scalar;
7726 template<
typename MT >
7729 BLAZE_INTERNAL_ASSERT( IsSymmetric<MT>::value || IsHermitian<MT>::value,
"Invalid matrix detected" );
7731 if( ( row_ + m_ <= column_ ) || ( column_ + n_ <= row_ ) )
7758 template<
typename MT >
7759 template<
typename Other >
7762 return matrix_.isAliased( alias );
7779 template<
typename MT >
7780 template<
typename MT2
7785 return ( matrix_.isAliased( &alias->matrix_ ) &&
7786 ( row_ + m_ > alias->row_ ) && ( row_ < alias->row_ + alias->m_ ) &&
7787 ( column_ + n_ > alias->column_ ) && ( column_ < alias->column_ + alias->n_ ) );
7804 template<
typename MT >
7805 template<
typename Other >
7808 return matrix_.isAliased( alias );
7825 template<
typename MT >
7826 template<
typename MT2
7831 return ( matrix_.isAliased( &alias->matrix_ ) &&
7832 ( row_ + m_ > alias->row_ ) && ( row_ < alias->row_ + alias->m_ ) &&
7833 ( column_ + n_ > alias->column_ ) && ( column_ < alias->column_ + alias->n_ ) );
7849 template<
typename MT >
7869 template<
typename MT >
7872 return (
rows() > SMP_DMATASSIGN_THRESHOLD );
7894 template<
typename MT >
7898 return loada( i, j );
7921 template<
typename MT >
7932 return matrix_.loada( row_+i, column_+j );
7955 template<
typename MT >
7966 return matrix_.loadu( row_+i, column_+j );
7989 template<
typename MT >
7993 return storea( i, j, value );
8016 template<
typename MT >
8027 return matrix_.storea( row_+i, column_+j, value );
8050 template<
typename MT >
8061 matrix_.storeu( row_+i, column_+j, value );
8085 template<
typename MT >
8096 matrix_.stream( row_+i, column_+j, value );
8114 template<
typename MT >
8115 template<
typename MT2 >
8116 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
8117 DenseSubmatrix<MT,aligned,false>::assign(
const DenseMatrix<MT2,false>& rhs )
8122 const size_t jpos( n_ &
size_t(-2) );
8125 for(
size_t i=0UL; i<
m_; ++i ) {
8126 for(
size_t j=0UL; j<jpos; j+=2UL ) {
8127 matrix_(row_+i,column_+j ) = (~rhs)(i,j );
8128 matrix_(row_+i,column_+j+1UL) = (~rhs)(i,j+1UL);
8131 matrix_(row_+i,column_+jpos) = (~rhs)(i,jpos);
8151 template<
typename MT >
8152 template<
typename MT2 >
8153 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
8154 DenseSubmatrix<MT,aligned,false>::assign(
const DenseMatrix<MT2,false>& rhs )
8161 const size_t jpos( n_ &
size_t(-
IT::size) );
8165 m_*n_ > (
cacheSize / (
sizeof(ElementType) * 3UL ) ) &&
8166 !(~rhs).isAliased( &matrix_ ) )
8168 for(
size_t i=0UL; i<
m_; ++i )
8173 stream( i, j, (~rhs).load(i,j) );
8175 for( ; j<
n_; ++j ) {
8176 matrix_(row_+i,column_+j) = (~rhs)(i,j);
8182 for(
size_t i=0UL; i<
m_; ++i )
8188 store( i, j , it.load() ); it +=
IT::size;
8194 store( i, j, it.load() );
8196 for( ; j<
n_; ++j, ++it ) {
8197 matrix_(row_+i,column_+j) = *it;
8218 template<
typename MT >
8219 template<
typename MT2 >
8220 inline void DenseSubmatrix<MT,aligned,false>::assign(
const DenseMatrix<MT2,true>& rhs )
8227 const size_t block( BLOCK_SIZE );
8229 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
8230 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
8231 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
8232 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
8233 for(
size_t i=ii; i<iend; ++i ) {
8234 for(
size_t j=jj; j<jend; ++j ) {
8235 matrix_(row_+i,column_+j) = (~rhs)(i,j);
8257 template<
typename MT >
8258 template<
typename MT2 >
8259 inline void DenseSubmatrix<MT,aligned,false>::assign(
const SparseMatrix<MT2,false>& rhs )
8264 for(
size_t i=0UL; i<
m_; ++i )
8266 matrix_(row_+i,column_+element->index()) = element->value();
8284 template<
typename MT >
8285 template<
typename MT2 >
8286 inline void DenseSubmatrix<MT,aligned,false>::assign(
const SparseMatrix<MT2,true>& rhs )
8293 for(
size_t j=0UL; j<
n_; ++j )
8295 matrix_(row_+element->index(),column_+j) = element->value();
8313 template<
typename MT >
8314 template<
typename MT2 >
8315 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
8316 DenseSubmatrix<MT,aligned,false>::addAssign(
const DenseMatrix<MT2,false>& rhs )
8321 const size_t jpos( n_ &
size_t(-2) );
8324 for(
size_t i=0UL; i<
m_; ++i ) {
8325 for(
size_t j=0UL; j<jpos; j+=2UL ) {
8326 matrix_(row_+i,column_+j ) += (~rhs)(i,j );
8327 matrix_(row_+i,column_+j+1UL) += (~rhs)(i,j+1UL);
8330 matrix_(row_+i,column_+jpos) += (~rhs)(i,jpos);
8350 template<
typename MT >
8351 template<
typename MT2 >
8352 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
8353 DenseSubmatrix<MT,aligned,false>::addAssign(
const DenseMatrix<MT2,false>& rhs )
8360 for(
size_t i=0UL; i<
m_; ++i )
8362 const size_t jbegin( ( IsUpper<MT2>::value )
8363 ?( ( IsStrictlyUpper<MT2>::value ? i+1UL : i ) &
size_t(-
IT::size) )
8365 const size_t jend ( ( IsLower<MT2>::value )
8366 ?( IsStrictlyLower<MT2>::value ? i : i+1UL )
8370 const size_t jpos( jend &
size_t(-
IT::size) );
8377 store( i, j , load(i,j ) + it.load() ); it +=
IT::size;
8383 store( i, j, load(i,j) + it.load() );
8385 for( ; j<jend; ++j, ++it ) {
8386 matrix_(row_+i,column_+j) += *it;
8406 template<
typename MT >
8407 template<
typename MT2 >
8408 inline void DenseSubmatrix<MT,aligned,false>::addAssign(
const DenseMatrix<MT2,true>& rhs )
8415 const size_t block( BLOCK_SIZE );
8417 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
8418 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
8419 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
8420 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
8421 for(
size_t i=ii; i<iend; ++i ) {
8422 for(
size_t j=jj; j<jend; ++j ) {
8423 matrix_(row_+i,column_+j) += (~rhs)(i,j);
8445 template<
typename MT >
8446 template<
typename MT2 >
8447 inline void DenseSubmatrix<MT,aligned,false>::addAssign(
const SparseMatrix<MT2,false>& rhs )
8452 for(
size_t i=0UL; i<
m_; ++i )
8454 matrix_(row_+i,column_+element->index()) += element->value();
8472 template<
typename MT >
8473 template<
typename MT2 >
8474 inline void DenseSubmatrix<MT,aligned,false>::addAssign(
const SparseMatrix<MT2,true>& rhs )
8481 for(
size_t j=0UL; j<
n_; ++j )
8483 matrix_(row_+element->index(),column_+j) += element->value();
8501 template<
typename MT >
8502 template<
typename MT2 >
8503 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
8504 DenseSubmatrix<MT,aligned,false>::subAssign(
const DenseMatrix<MT2,false>& rhs )
8509 const size_t jpos( n_ &
size_t(-2) );
8512 for(
size_t i=0UL; i<
m_; ++i ) {
8513 for(
size_t j=0UL; j<jpos; j+=2UL ) {
8514 matrix_(row_+i,column_+j ) -= (~rhs)(i,j );
8515 matrix_(row_+i,column_+j+1UL) -= (~rhs)(i,j+1UL);
8518 matrix_(row_+i,column_+jpos) -= (~rhs)(i,jpos);
8538 template<
typename MT >
8539 template<
typename MT2 >
8540 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,false>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
8541 DenseSubmatrix<MT,aligned,false>::subAssign(
const DenseMatrix<MT2,false>& rhs )
8548 for(
size_t i=0UL; i<
m_; ++i )
8550 const size_t jbegin( ( IsUpper<MT2>::value )
8551 ?( ( IsStrictlyUpper<MT2>::value ? i+1UL : i ) &
size_t(-
IT::size) )
8553 const size_t jend ( ( IsLower<MT2>::value )
8554 ?( IsStrictlyLower<MT2>::value ? i : i+1UL )
8558 const size_t jpos( jend &
size_t(-
IT::size) );
8565 store( i, j , load(i,j ) - it.load() ); it +=
IT::size;
8571 store( i, j, load(i,j) - it.load() );
8573 for( ; j<jend; ++j, ++it ) {
8574 matrix_(row_+i,column_+j) -= *it;
8594 template<
typename MT >
8595 template<
typename MT2 >
8596 inline void DenseSubmatrix<MT,aligned,false>::subAssign(
const DenseMatrix<MT2,true>& rhs )
8603 const size_t block( BLOCK_SIZE );
8605 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
8606 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
8607 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
8608 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
8609 for(
size_t i=ii; i<iend; ++i ) {
8610 for(
size_t j=jj; j<jend; ++j ) {
8611 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
8633 template<
typename MT >
8634 template<
typename MT2 >
8635 inline void DenseSubmatrix<MT,aligned,false>::subAssign(
const SparseMatrix<MT2,false>& rhs )
8640 for(
size_t i=0UL; i<
m_; ++i )
8642 matrix_(row_+i,column_+element->index()) -= element->value();
8660 template<
typename MT >
8661 template<
typename MT2 >
8662 inline void DenseSubmatrix<MT,aligned,false>::subAssign(
const SparseMatrix<MT2,true>& rhs )
8669 for(
size_t j=0UL; j<
n_; ++j )
8671 matrix_(row_+element->index(),column_+j) -= element->value();
8697 template<
typename MT >
8698 class DenseSubmatrix<MT,
aligned,true> :
public DenseMatrix< DenseSubmatrix<MT,aligned,true>, true >
8704 typedef typename If< IsExpression<MT>, MT, MT& >::Type
Operand;
8707 typedef IntrinsicTrait<typename MT::ElementType>
IT;
8712 typedef DenseSubmatrix<MT,aligned,true>
This;
8713 typedef typename SubmatrixTrait<MT>::Type
ResultType;
8731 typedef typename If< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >
8743 enum { vectorizable = MT::vectorizable };
8746 enum { smpAssignable = MT::smpAssignable };
8752 explicit inline DenseSubmatrix( Operand matrix,
size_t rindex,
size_t cindex,
size_t m,
size_t n );
8764 inline Reference
operator()(
size_t i,
size_t j );
8765 inline ConstReference
operator()(
size_t i,
size_t j )
const;
8766 inline Reference
at(
size_t i,
size_t j );
8767 inline ConstReference
at(
size_t i,
size_t j )
const;
8768 inline Pointer
data ();
8769 inline ConstPointer
data ()
const;
8770 inline Pointer
data (
size_t j );
8771 inline ConstPointer
data (
size_t j )
const;
8772 inline Iterator
begin (
size_t j );
8773 inline ConstIterator
begin (
size_t j )
const;
8774 inline ConstIterator
cbegin(
size_t j )
const;
8775 inline Iterator
end (
size_t j );
8776 inline ConstIterator
end (
size_t j )
const;
8777 inline ConstIterator
cend (
size_t j )
const;
8787 template<
typename MT2,
bool SO >
8790 template<
typename MT2,
bool SO >
8791 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
8792 operator+=(
const Matrix<MT2,SO>& rhs );
8794 template<
typename MT2,
bool SO >
8795 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
8796 operator+=(
const Matrix<MT2,SO>& rhs );
8798 template<
typename MT2,
bool SO >
8799 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
8800 operator-=(
const Matrix<MT2,SO>& rhs );
8802 template<
typename MT2,
bool SO >
8803 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >,
DenseSubmatrix& >::Type
8804 operator-=(
const Matrix<MT2,SO>& rhs );
8806 template<
typename MT2,
bool SO >
8809 template<
typename Other >
8810 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
8811 operator*=( Other rhs );
8813 template<
typename Other >
8814 inline typename EnableIf< IsNumeric<Other>,
DenseSubmatrix >::Type&
8815 operator/=( Other rhs );
8822 inline size_t row()
const;
8823 inline size_t rows()
const;
8824 inline size_t column()
const;
8825 inline size_t columns()
const;
8826 inline size_t spacing()
const;
8828 inline size_t capacity(
size_t i )
const;
8830 inline size_t nonZeros(
size_t i )
const;
8831 inline void reset();
8832 inline void reset(
size_t i );
8835 template<
typename Other >
inline DenseSubmatrix& scale(
const Other& scalar );
8842 template<
typename MT2 >
8843 struct VectorizedAssign {
8845 vectorizable && MT2::vectorizable &&
8846 IsSame<ElementType,typename MT2::ElementType>::value };
8852 template<
typename MT2 >
8853 struct VectorizedAddAssign {
8855 vectorizable && MT2::vectorizable &&
8856 IsSame<ElementType,typename MT2::ElementType>::value &&
8857 IntrinsicTrait<ElementType>::addition };
8863 template<
typename MT2 >
8864 struct VectorizedSubAssign {
8866 vectorizable && MT2::vectorizable &&
8867 IsSame<ElementType,typename MT2::ElementType>::value &&
8868 IntrinsicTrait<ElementType>::subtraction };
8876 template<
typename Other >
8877 inline bool canAlias(
const Other* alias )
const;
8879 template<
typename MT2,
bool AF2,
bool SO2 >
8880 inline bool canAlias(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
8882 template<
typename Other >
8883 inline bool isAliased(
const Other* alias )
const;
8885 template<
typename MT2,
bool AF2,
bool SO2 >
8886 inline bool isAliased(
const DenseSubmatrix<MT2,AF2,SO2>* alias )
const;
8900 template<
typename MT2 >
8901 inline typename DisableIf< VectorizedAssign<MT2> >::Type
8902 assign(
const DenseMatrix<MT2,true>& rhs );
8904 template<
typename MT2 >
8905 inline typename EnableIf< VectorizedAssign<MT2> >::Type
8906 assign(
const DenseMatrix<MT2,true>& rhs );
8908 template<
typename MT2 >
inline void assign(
const DenseMatrix<MT2,false>& rhs );
8909 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,true>& rhs );
8910 template<
typename MT2 >
inline void assign(
const SparseMatrix<MT2,false>& rhs );
8912 template<
typename MT2 >
8913 inline typename DisableIf< VectorizedAddAssign<MT2> >::Type
8914 addAssign(
const DenseMatrix<MT2,true>& rhs );
8916 template<
typename MT2 >
8917 inline typename EnableIf< VectorizedAddAssign<MT2> >::Type
8918 addAssign(
const DenseMatrix<MT2,true>& rhs );
8920 template<
typename MT2 >
inline void addAssign(
const DenseMatrix<MT2,false>& rhs );
8921 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,true>& rhs );
8922 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,false>& rhs );
8924 template<
typename MT2 >
8925 inline typename DisableIf< VectorizedSubAssign<MT2> >::Type
8926 subAssign(
const DenseMatrix<MT2,true>& rhs );
8928 template<
typename MT2 >
8929 inline typename EnableIf< VectorizedSubAssign<MT2> >::Type
8930 subAssign(
const DenseMatrix<MT2,true>& rhs );
8932 template<
typename MT2 >
inline void subAssign(
const DenseMatrix<MT2,false>& rhs );
8933 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,true>& rhs );
8934 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,false>& rhs );
8958 template<
typename MT2,
bool AF2,
bool SO2 >
friend class DenseSubmatrix;
8960 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
8961 friend const DenseSubmatrix<MT2,AF1,SO2>
8962 submatrix(
const DenseSubmatrix<MT2,AF2,SO2>& dm,
size_t row,
size_t column,
size_t m,
size_t n );
8964 template<
typename MT2,
bool AF2,
bool SO2 >
8965 friend bool isIntact(
const DenseSubmatrix<MT2,AF2,SO2>& dm );
8967 template<
typename MT2,
bool AF2,
bool SO2 >
8968 friend bool isSame(
const DenseSubmatrix<MT2,AF2,SO2>& a,
const DenseMatrix<MT2,SO2>& b );
8970 template<
typename MT2,
bool AF2,
bool SO2 >
8971 friend bool isSame(
const DenseMatrix<MT2,SO2>& a,
const DenseSubmatrix<MT2,AF2,SO2>& b );
8973 template<
typename MT2,
bool AF2,
bool SO2 >
8974 friend bool isSame(
const DenseSubmatrix<MT2,AF2,SO2>& a,
const DenseSubmatrix<MT2,AF2,SO2>& b );
8976 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
8977 friend bool tryAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
8980 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
8981 friend bool tryAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
8984 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
8985 friend bool tryAddAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
8988 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
8989 friend bool tryAddAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
8992 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
8993 friend bool trySubAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
8996 template<
typename MT2,
bool AF2,
bool SO2,
typename MT3,
bool SO3 >
8997 friend bool trySubAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Matrix<MT3,SO3>& rhs,
9000 template<
typename MT2,
bool AF2,
bool SO2,
typename VT,
bool TF >
9001 friend bool tryMultAssign(
const DenseSubmatrix<MT2,AF2,SO2>& lhs,
const Vector<VT,TF>& rhs,
9004 template<
typename MT2,
bool AF2,
bool SO2 >
9005 friend typename DerestrictTrait< DenseSubmatrix<MT2,AF2,SO2> >::Type
9006 derestrict( DenseSubmatrix<MT2,AF2,SO2>& dm );
9045 template<
typename MT >
9085 template<
typename MT >
9092 return matrix_(row_+i,column_+j);
9109 template<
typename MT >
9116 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
9134 template<
typename MT >
9144 return (*
this)(i,j);
9162 template<
typename MT >
9172 return (*
this)(i,j);
9188 template<
typename MT >
9189 inline typename DenseSubmatrix<MT,aligned,true>::Pointer
9192 return matrix_.data() + row_ + column_*
spacing();
9208 template<
typename MT >
9209 inline typename DenseSubmatrix<MT,aligned,true>::ConstPointer
9212 return matrix_.data() + row_ + column_*
spacing();
9227 template<
typename MT >
9228 inline typename DenseSubmatrix<MT,aligned,true>::Pointer
9231 return matrix_.data() + row_ + (column_+j)*
spacing();
9246 template<
typename MT >
9247 inline typename DenseSubmatrix<MT,aligned,true>::ConstPointer
9250 return matrix_.data() + row_ + (column_+j)*
spacing();
9263 template<
typename MT >
9268 return ( matrix_.begin( column_ + j ) + row_ );
9281 template<
typename MT >
9286 return ( matrix_.cbegin( column_ + j ) + row_ );
9299 template<
typename MT >
9304 return ( matrix_.cbegin( column_ + j ) + row_ );
9317 template<
typename MT >
9322 return ( matrix_.begin( column_ + j ) + row_ +
m_ );
9335 template<
typename MT >
9340 return ( matrix_.cbegin( column_ + j ) + row_ +
m_ );
9353 template<
typename MT >
9358 return ( matrix_.cbegin( column_ + j ) + row_ +
m_ );
9383 template<
typename MT >
9384 inline DenseSubmatrix<MT,aligned,true>&
9387 const size_t jend( column_ + n_ );
9389 for(
size_t j=column_; j<jend; ++j )
9391 const size_t ibegin( ( IsLower<MT>::value )
9392 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
9393 ?(
max( j+1UL, row_ ) )
9394 :(
max( j, row_ ) ) )
9396 const size_t iend ( ( IsUpper<MT>::value )
9397 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
9398 ?(
min( j, row_+m_ ) )
9399 :(
min( j+1UL, row_+m_ ) ) )
9402 for(
size_t i=ibegin; i<iend; ++i )
9427 template<
typename MT >
9428 inline DenseSubmatrix<MT,aligned,true>&
9434 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
9437 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
9441 if( !tryAssign( matrix_, rhs, row_, column_ ) ) {
9445 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9447 if( rhs.canAlias( &matrix_ ) ) {
9448 const ResultType tmp( rhs );
9477 template<
typename MT >
9478 template<
typename MT2
9480 inline DenseSubmatrix<MT,aligned,true>&
9489 typedef typename If< IsRestricted<MT>,
typename MT2::CompositeType,
const MT2& >::Type Right;
9490 Right right( ~rhs );
9492 if( !tryAssign( matrix_, right, row_, column_ ) ) {
9496 if( IsSparseMatrix<MT2>::value )
9499 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9501 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
9531 template<
typename MT >
9532 template<
typename MT2
9534 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
9535 , DenseSubmatrix<MT,aligned,true>& >::Type
9536 DenseSubmatrix<MT,aligned,true>::operator+=(
const Matrix<MT2,SO>& rhs )
9542 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
9551 if( !tryAddAssign( matrix_, ~rhs, row_, column_ ) ) {
9555 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9557 if( ( ( IsSymmetric<MT>::value || IsHermitian<MT>::value ) && hasOverlap() ) ||
9558 (~rhs).canAlias( &matrix_ ) ) {
9559 const AddType tmp( *
this + (~rhs) );
9588 template<
typename MT >
9589 template<
typename MT2
9591 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
9592 , DenseSubmatrix<MT,aligned,true>& >::Type
9593 DenseSubmatrix<MT,aligned,true>::operator+=(
const Matrix<MT2,SO>& rhs )
9599 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
9608 const AddType tmp( *
this + (~rhs) );
9610 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
9614 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9640 template<
typename MT >
9641 template<
typename MT2
9643 inline typename DisableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
9644 , DenseSubmatrix<MT,aligned,true>& >::Type
9645 DenseSubmatrix<MT,aligned,true>::operator-=(
const Matrix<MT2,SO>& rhs )
9651 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
9660 if( !trySubAssign( matrix_, ~rhs, row_, column_ ) ) {
9664 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9666 if( ( ( IsSymmetric<MT>::value || IsHermitian<MT>::value ) && hasOverlap() ) ||
9667 (~rhs).canAlias( &matrix_ ) ) {
9668 const SubType tmp( *
this - (~rhs ) );
9697 template<
typename MT >
9698 template<
typename MT2
9700 inline typename EnableIf< And< IsRestricted<MT>, RequiresEvaluation<MT2> >
9701 , DenseSubmatrix<MT,aligned,true>& >::Type
9702 DenseSubmatrix<MT,aligned,true>::operator-=(
const Matrix<MT2,SO>& rhs )
9708 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
9717 const SubType tmp( *
this - (~rhs) );
9719 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
9723 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9749 template<
typename MT >
9750 template<
typename MT2
9752 inline DenseSubmatrix<MT,aligned,true>&
9753 DenseSubmatrix<MT,aligned,true>::operator*=(
const Matrix<MT2,SO>& rhs )
9759 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
9768 const MultType tmp( *
this * (~rhs) );
9770 if( !tryAssign( matrix_, tmp, row_, column_ ) ) {
9774 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9797 template<
typename MT >
9798 template<
typename Other >
9799 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,true> >::Type&
9800 DenseSubmatrix<MT,aligned,true>::operator*=( Other rhs )
9804 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9826 template<
typename MT >
9827 template<
typename Other >
9828 inline typename EnableIf< IsNumeric<Other>, DenseSubmatrix<MT,aligned,true> >::Type&
9829 DenseSubmatrix<MT,aligned,true>::operator/=( Other rhs )
9835 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
9858 template<
typename MT >
9873 template<
typename MT >
9888 template<
typename MT >
9903 template<
typename MT >
9921 template<
typename MT >
9924 return matrix_.spacing();
9936 template<
typename MT >
9952 template<
typename MT >
9971 template<
typename MT >
9974 const size_t iend( row_ + m_ );
9975 const size_t jend( column_ + n_ );
9976 size_t nonzeros( 0UL );
9978 for(
size_t j=column_; j<jend; ++j )
9979 for(
size_t i=row_; i<iend; ++i )
9996 template<
typename MT >
10001 const size_t iend( row_ + m_ );
10002 size_t nonzeros( 0UL );
10004 for(
size_t i=row_; i<iend; ++i )
10005 if( !
isDefault( matrix_(i,column_+j) ) )
10020 template<
typename MT >
10025 for(
size_t j=column_; j<column_+
n_; ++j )
10027 const size_t ibegin( ( IsLower<MT>::value )
10028 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
10029 ?(
max( j+1UL, row_ ) )
10030 :(
max( j, row_ ) ) )
10032 const size_t iend ( ( IsUpper<MT>::value )
10033 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
10034 ?(
min( j, row_+m_ ) )
10035 :(
min( j+1UL, row_+m_ ) ) )
10038 for(
size_t i=ibegin; i<iend; ++i )
10039 clear( matrix_(i,j) );
10053 template<
typename MT >
10060 const size_t ibegin( ( IsLower<MT>::value )
10061 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
10062 ?(
max( j+1UL, row_ ) )
10063 :(
max( j, row_ ) ) )
10065 const size_t iend ( ( IsUpper<MT>::value )
10066 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
10067 ?(
min( j, row_+m_ ) )
10068 :(
min( j+1UL, row_+m_ ) ) )
10071 for(
size_t i=ibegin; i<iend; ++i )
10072 clear( matrix_(i,column_+j) );
10096 template<
typename MT >
10103 if( !tryAssign( matrix_,
trans( *
this ), row_, column_ ) ) {
10107 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
10108 const ResultType tmp(
trans( *
this ) );
10135 template<
typename MT >
10142 if( !tryAssign( matrix_,
ctrans( *
this ), row_, column_ ) ) {
10146 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
10147 const ResultType tmp(
ctrans( *
this ) );
10167 template<
typename MT >
10168 template<
typename Other >
10169 inline DenseSubmatrix<MT,aligned,true>& DenseSubmatrix<MT,aligned,true>::scale(
const Other& scalar )
10173 const size_t jend( column_ + n_ );
10175 for(
size_t j=column_; j<jend; ++j )
10177 const size_t ibegin( ( IsLower<MT>::value )
10178 ?( ( IsStrictlyLower<MT>::value )
10179 ?(
max( j+1UL, row_ ) )
10180 :(
max( j, row_ ) ) )
10182 const size_t iend ( ( IsUpper<MT>::value )
10183 ?( ( IsStrictlyUpper<MT>::value )
10184 ?(
min( j, row_+m_ ) )
10185 :(
min( j+1UL, row_+m_ ) ) )
10188 for(
size_t i=ibegin; i<iend; ++i )
10189 matrix_(i,j) *= scalar;
10208 template<
typename MT >
10211 BLAZE_INTERNAL_ASSERT( IsSymmetric<MT>::value || IsHermitian<MT>::value,
"Invalid matrix detected" );
10213 if( ( row_ + m_ <= column_ ) || ( column_ + n_ <= row_ ) )
10240 template<
typename MT >
10241 template<
typename Other >
10244 return matrix_.isAliased( alias );
10261 template<
typename MT >
10262 template<
typename MT2
10267 return ( matrix_.isAliased( &alias->matrix_ ) &&
10268 ( row_ + m_ > alias->row_ ) && ( row_ < alias->row_ + alias->m_ ) &&
10269 ( column_ + n_ > alias->column_ ) && ( column_ < alias->column_ + alias->n_ ) );
10286 template<
typename MT >
10287 template<
typename Other >
10290 return matrix_.isAliased( alias );
10307 template<
typename MT >
10308 template<
typename MT2
10313 return ( matrix_.isAliased( &alias->matrix_ ) &&
10314 ( row_ + m_ > alias->row_ ) && ( row_ < alias->row_ + alias->m_ ) &&
10315 ( column_ + n_ > alias->column_ ) && ( column_ < alias->column_ + alias->n_ ) );
10331 template<
typename MT >
10351 template<
typename MT >
10354 return (
columns() > SMP_DMATASSIGN_THRESHOLD );
10375 template<
typename MT >
10379 return loada( i, j );
10401 template<
typename MT >
10412 return matrix_.loada( row_+i, column_+j );
10434 template<
typename MT >
10445 return matrix_.loadu( row_+i, column_+j );
10467 template<
typename MT >
10493 template<
typename MT >
10504 matrix_.storea( row_+i, column_+j, value );
10527 template<
typename MT >
10538 matrix_.storeu( row_+i, column_+j, value );
10561 template<
typename MT >
10572 matrix_.stream( row_+i, column_+j, value );
10590 template<
typename MT >
10591 template<
typename MT2 >
10592 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
10593 DenseSubmatrix<MT,aligned,true>::assign(
const DenseMatrix<MT2,true>& rhs )
10598 const size_t ipos( m_ &
size_t(-2) );
10601 for(
size_t j=0UL; j<
n_; ++j ) {
10602 for(
size_t i=0UL; i<ipos; i+=2UL ) {
10603 matrix_(row_+i ,column_+j) = (~rhs)(i ,j);
10604 matrix_(row_+i+1UL,column_+j) = (~rhs)(i+1UL,j);
10607 matrix_(row_+ipos,column_+j) = (~rhs)(ipos,j);
10627 template<
typename MT >
10628 template<
typename MT2 >
10629 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAssign<MT2> >::Type
10630 DenseSubmatrix<MT,aligned,true>::assign(
const DenseMatrix<MT2,true>& rhs )
10637 const size_t ipos( m_ &
size_t(-
IT::size) );
10641 m_*n_ > (
cacheSize / (
sizeof(ElementType) * 3UL ) ) &&
10642 !(~rhs).isAliased( &matrix_ ) )
10644 for(
size_t j=0UL; j<
n_; ++j )
10649 stream( i, j, (~rhs).load(i,j) );
10651 for( ; i<
m_; ++i ) {
10652 matrix_(row_+i,column_+j) = (~rhs)(i,j);
10658 for(
size_t j=0UL; j<
n_; ++j )
10664 store( i , j, it.load() ); it +=
IT::size;
10670 store( i, j, it.load() );
10672 for( ; i<
m_; ++i, ++it ) {
10673 matrix_(row_+i,column_+j) = (~rhs)(i,j);
10694 template<
typename MT >
10695 template<
typename MT2 >
10696 inline void DenseSubmatrix<MT,aligned,true>::assign(
const DenseMatrix<MT2,false>& rhs )
10703 const size_t block( BLOCK_SIZE );
10705 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
10706 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
10707 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
10708 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
10709 for(
size_t j=jj; j<jend; ++j ) {
10710 for(
size_t i=ii; i<iend; ++i ) {
10711 matrix_(row_+i,column_+j) = (~rhs)(i,j);
10733 template<
typename MT >
10734 template<
typename MT2 >
10735 inline void DenseSubmatrix<MT,aligned,true>::assign(
const SparseMatrix<MT2,true>& rhs )
10740 for(
size_t j=0UL; j<
n_; ++j )
10742 matrix_(row_+element->index(),column_+j) = element->value();
10760 template<
typename MT >
10761 template<
typename MT2 >
10762 inline void DenseSubmatrix<MT,aligned,true>::assign(
const SparseMatrix<MT2,false>& rhs )
10769 for(
size_t i=0UL; i<
m_; ++i )
10771 matrix_(row_+i,column_+element->index()) = element->value();
10789 template<
typename MT >
10790 template<
typename MT2 >
10791 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
10792 DenseSubmatrix<MT,aligned,true>::addAssign(
const DenseMatrix<MT2,true>& rhs )
10797 const size_t ipos( m_ &
size_t(-2) );
10800 for(
size_t j=0UL; j<
n_; ++j ) {
10801 for(
size_t i=0UL; i<ipos; i+=2UL ) {
10802 matrix_(row_+i ,column_+j) += (~rhs)(i ,j);
10803 matrix_(row_+i+1UL,column_+j) += (~rhs)(i+1UL,j);
10806 matrix_(row_+ipos,column_+j) += (~rhs)(ipos,j);
10826 template<
typename MT >
10827 template<
typename MT2 >
10828 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT2> >::Type
10829 DenseSubmatrix<MT,aligned,true>::addAssign(
const DenseMatrix<MT2,true>& rhs )
10836 for(
size_t j=0UL; j<
n_; ++j )
10838 const size_t ibegin( ( IsLower<MT>::value )
10839 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
10841 const size_t iend ( ( IsUpper<MT>::value )
10842 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
10846 const size_t ipos( iend &
size_t(-
IT::size) );
10849 size_t i( ibegin );
10853 store( i , j, load(i ,j) + it.load() ); it +=
IT::size;
10859 store( i, j, load(i,j) + it.load() );
10861 for( ; i<iend; ++i, ++it ) {
10862 matrix_(row_+i,column_+j) += *it;
10882 template<
typename MT >
10883 template<
typename MT2 >
10884 inline void DenseSubmatrix<MT,aligned,true>::addAssign(
const DenseMatrix<MT2,false>& rhs )
10891 const size_t block( BLOCK_SIZE );
10893 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
10894 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
10895 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
10896 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
10897 for(
size_t j=jj; j<jend; ++j ) {
10898 for(
size_t i=ii; i<iend; ++i ) {
10899 matrix_(row_+i,column_+j) += (~rhs)(i,j);
10921 template<
typename MT >
10922 template<
typename MT2 >
10923 inline void DenseSubmatrix<MT,aligned,true>::addAssign(
const SparseMatrix<MT2,true>& rhs )
10928 for(
size_t j=0UL; j<
n_; ++j )
10930 matrix_(row_+element->index(),column_+j) += element->value();
10948 template<
typename MT >
10949 template<
typename MT2 >
10950 inline void DenseSubmatrix<MT,aligned,true>::addAssign(
const SparseMatrix<MT2,false>& rhs )
10957 for(
size_t i=0UL; i<
m_; ++i )
10959 matrix_(row_+i,column_+element->index()) += element->value();
10977 template<
typename MT >
10978 template<
typename MT2 >
10979 inline typename DisableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
10980 DenseSubmatrix<MT,aligned,true>::subAssign(
const DenseMatrix<MT2,true>& rhs )
10985 const size_t ipos( m_ &
size_t(-2) );
10988 for(
size_t j=0UL; j<
n_; ++j ) {
10989 for(
size_t i=0UL; i<ipos; i+=2UL ) {
10990 matrix_(row_+i ,column_+j) -= (~rhs)(i ,j);
10991 matrix_(row_+i+1UL,column_+j) -= (~rhs)(i+1UL,j);
10994 matrix_(row_+ipos,column_+j) -= (~rhs)(ipos,j);
11014 template<
typename MT >
11015 template<
typename MT2 >
11016 inline typename EnableIf< typename DenseSubmatrix<MT,aligned,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT2> >::Type
11017 DenseSubmatrix<MT,aligned,true>::subAssign(
const DenseMatrix<MT2,true>& rhs )
11024 for(
size_t j=0UL; j<
n_; ++j )
11026 const size_t ibegin( ( IsLower<MT>::value )
11027 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
11029 const size_t iend ( ( IsUpper<MT>::value )
11030 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
11034 const size_t ipos( iend &
size_t(-
IT::size) );
11037 size_t i( ibegin );
11041 store( i , j, load(i ,j) - it.load() ); it +=
IT::size;
11047 store( i, j, load(i,j) - it.load() );
11049 for( ; i<iend; ++i, ++it ) {
11050 matrix_(row_+i,column_+j) -= *it;
11070 template<
typename MT >
11071 template<
typename MT2 >
11072 inline void DenseSubmatrix<MT,aligned,true>::subAssign(
const DenseMatrix<MT2,false>& rhs )
11079 const size_t block( BLOCK_SIZE );
11081 for(
size_t jj=0UL; jj<
n_; jj+=block ) {
11082 const size_t jend( ( n_<(jj+block) )?( n_ ):( jj+block ) );
11083 for(
size_t ii=0UL; ii<
m_; ii+=block ) {
11084 const size_t iend( ( m_<(ii+block) )?( m_ ):( ii+block ) );
11085 for(
size_t j=jj; j<jend; ++j ) {
11086 for(
size_t i=ii; i<iend; ++i ) {
11087 matrix_(row_+i,column_+j) -= (~rhs)(i,j);
11109 template<
typename MT >
11110 template<
typename MT2 >
11111 inline void DenseSubmatrix<MT,aligned,true>::subAssign(
const SparseMatrix<MT2,true>& rhs )
11116 for(
size_t j=0UL; j<
n_; ++j )
11118 matrix_(row_+element->index(),column_+j) -= element->value();
11136 template<
typename MT >
11137 template<
typename MT2 >
11138 inline void DenseSubmatrix<MT,aligned,true>::subAssign(
const SparseMatrix<MT2,false>& rhs )
11145 for(
size_t i=0UL; i<
m_; ++i )
11147 matrix_(row_+i,column_+element->index()) -= element->value();
11168 template<
typename MT,
bool AF,
bool SO >
11169 inline void reset( DenseSubmatrix<MT,AF,SO>& dm );
11171 template<
typename MT,
bool AF,
bool SO >
11172 inline void reset( DenseSubmatrix<MT,AF,SO>& dm,
size_t i );
11174 template<
typename MT,
bool AF,
bool SO >
11175 inline void clear( DenseSubmatrix<MT,AF,SO>& dm );
11177 template<
typename MT,
bool AF,
bool SO >
11178 inline bool isDefault(
const DenseSubmatrix<MT,AF,SO>& dm );
11180 template<
typename MT,
bool AF,
bool SO >
11181 inline bool isIntact(
const DenseSubmatrix<MT,AF,SO>& dm );
11183 template<
typename MT,
bool AF,
bool SO >
11184 inline bool isSymmetric(
const DenseSubmatrix<MT,AF,SO>& dm );
11186 template<
typename MT,
bool AF,
bool SO >
11187 inline bool isHermitian(
const DenseSubmatrix<MT,AF,SO>& dm );
11189 template<
typename MT,
bool AF,
bool SO >
11190 inline bool isLower(
const DenseSubmatrix<MT,AF,SO>& dm );
11192 template<
typename MT,
bool AF,
bool SO >
11193 inline bool isUniLower(
const DenseSubmatrix<MT,AF,SO>& dm );
11195 template<
typename MT,
bool AF,
bool SO >
11198 template<
typename MT,
bool AF,
bool SO >
11199 inline bool isUpper(
const DenseSubmatrix<MT,AF,SO>& dm );
11201 template<
typename MT,
bool AF,
bool SO >
11202 inline bool isUniUpper(
const DenseSubmatrix<MT,AF,SO>& dm );
11204 template<
typename MT,
bool AF,
bool SO >
11207 template<
typename MT,
bool AF,
bool SO >
11208 inline bool isSame(
const DenseSubmatrix<MT,AF,SO>& a,
const DenseMatrix<MT,SO>& b );
11210 template<
typename MT,
bool AF,
bool SO >
11211 inline bool isSame(
const DenseMatrix<MT,SO>& a,
const DenseSubmatrix<MT,AF,SO>& b );
11213 template<
typename MT,
bool AF,
bool SO >
11214 inline bool isSame(
const DenseSubmatrix<MT,AF,SO>& a,
const DenseSubmatrix<MT,AF,SO>& b );
11226 template<
typename MT
11249 template<
typename MT
11268 template<
typename MT
11296 template<
typename MT
11304 for(
size_t i=0UL; i<(~dm).
rows(); ++i )
11305 for(
size_t j=0UL; j<(~dm).
columns(); ++j )
11310 for(
size_t j=0UL; j<(~dm).
columns(); ++j )
11311 for(
size_t i=0UL; i<(~dm).
rows(); ++i )
11339 template<
typename MT
11344 return ( dm.row_ + dm.m_ <= dm.matrix_.rows() &&
11345 dm.column_ + dm.n_ <= dm.matrix_.columns() &&
11373 template<
typename MT
11382 else return isSymmetric( static_cast<const BaseType&>( dm ) );
11409 template<
typename MT
11418 else return isHermitian( static_cast<const BaseType&>( dm ) );
11455 template<
typename MT
11464 else return isLower( static_cast<const BaseType&>( dm ) );
11500 template<
typename MT
11509 else return isUniLower( static_cast<const BaseType&>( dm ) );
11545 template<
typename MT
11591 template<
typename MT
11600 else return isUpper( static_cast<const BaseType&>( dm ) );
11636 template<
typename MT
11645 else return isUniUpper( static_cast<const BaseType&>( dm ) );
11681 template<
typename MT
11707 template<
typename MT
11712 return (
isSame( a.matrix_, ~b ) && ( a.rows() == (~b).
rows() ) && ( a.columns() == (~b).
columns() ) );
11729 template<
typename MT
11734 return (
isSame( ~a, b.matrix_ ) && ( (~a).rows() == b.rows() ) && ( (~a).columns() == b.columns() ) );
11751 template<
typename MT
11756 return (
isSame( a.matrix_, b.matrix_ ) &&
11757 ( a.row_ == b.row_ ) && ( a.column_ == b.column_ ) &&
11758 ( a.m_ == b.m_ ) && ( a.n_ == b.n_ ) );
11800 inline typename DisableIf< HasMutableDataAccess<MT> >::Type
11801 invert( DenseSubmatrix<MT,AF,SO>& dm )
11832 template<
typename MT
11837 inline bool tryAssign(
const DenseSubmatrix<MT,AF,SO>& lhs,
const Vector<VT,TF>& rhs,
11845 return tryAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
11867 template<
typename MT1
11872 inline bool tryAssign(
const DenseSubmatrix<MT1,AF,SO1>& lhs,
const Matrix<MT2,SO2>& rhs,
11873 size_t row,
size_t column )
11880 return tryAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
11902 template<
typename MT
11907 inline bool tryAddAssign(
const DenseSubmatrix<MT,AF,SO>& lhs,
const Vector<VT,TF>& rhs,
11908 size_t row,
size_t column )
11915 return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
11937 template<
typename MT1
11942 inline bool tryAddAssign(
const DenseSubmatrix<MT1,AF,SO1>& lhs,
const Matrix<MT2,SO2>& rhs,
11943 size_t row,
size_t column )
11950 return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
11972 template<
typename MT
11977 inline bool trySubAssign(
const DenseSubmatrix<MT,AF,SO>& lhs,
const Vector<VT,TF>& rhs,
11978 size_t row,
size_t column )
11985 return trySubAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
12007 template<
typename MT1
12012 inline bool trySubAssign(
const DenseSubmatrix<MT1,AF,SO1>& lhs,
const Matrix<MT2,SO2>& rhs,
12013 size_t row,
size_t column )
12020 return trySubAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
12043 template<
typename MT
12048 inline bool tryMultAssign(
const DenseSubmatrix<MT,AF,SO>& lhs,
const Vector<VT,TF>& rhs,
12049 size_t row,
size_t column )
12056 return tryMultAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
12077 template<
typename MT
12080 inline typename DerestrictTrait< DenseSubmatrix<MT,AF,SO> >::Type
12081 derestrict( DenseSubmatrix<MT,AF,SO>& dm )
12083 typedef typename DerestrictTrait< DenseSubmatrix<MT,AF,SO> >::Type
ReturnType;
12084 return ReturnType( derestrict( dm.matrix_ ), dm.row_, dm.column_, dm.m_, dm.n_ );
12117 inline const DenseSubmatrix<MT,AF1,SO>
12118 submatrix(
const DenseSubmatrix<MT,AF2,SO>& dm,
size_t row,
size_t column,
size_t m,
size_t n )
12122 if( ( row + m > dm.rows() ) || ( column + n > dm.columns() ) ) {
12126 return DenseSubmatrix<MT,AF1,SO>( dm.matrix_, dm.row_ +
row, dm.column_ +
column, m, n );
12142 template<
typename MT,
bool AF,
bool SO >
12143 struct IsRestricted< DenseSubmatrix<MT,AF,SO> > :
public IsTrue< IsRestricted<MT>::value >
12159 template<
typename MT,
bool AF,
bool SO >
12160 struct DerestrictTrait< DenseSubmatrix<MT,AF,SO> >
12162 typedef DenseSubmatrix< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type, AF > Type;
12178 template<
typename MT,
bool AF,
bool SO >
12179 struct HasConstDataAccess< DenseSubmatrix<MT,AF,SO> >
12180 :
public IsTrue< HasConstDataAccess<MT>::value >
12196 template<
typename MT,
bool AF,
bool SO >
12197 struct HasMutableDataAccess< DenseSubmatrix<MT,AF,SO> >
12198 :
public IsTrue< HasMutableDataAccess<MT>::value >
12214 template<
typename MT,
bool SO >
12215 struct IsAligned< DenseSubmatrix<MT,
aligned,SO> > :
public IsTrue<true>
12231 template<
typename MT,
bool AF,
bool SO,
typename T >
12232 struct AddTrait< DenseSubmatrix<MT,AF,SO>, T >
12234 typedef typename AddTrait< typename SubmatrixTrait<MT>::Type, T >::Type Type;
12237 template<
typename T,
typename MT,
bool AF,
bool TF >
12238 struct AddTrait< T, DenseSubmatrix<MT,AF,TF> >
12240 typedef typename AddTrait< T, typename SubmatrixTrait<MT>::Type >::Type Type;
12256 template<
typename MT,
bool AF,
bool SO,
typename T >
12257 struct SubTrait< DenseSubmatrix<MT,AF,SO>, T >
12259 typedef typename SubTrait< typename SubmatrixTrait<MT>::Type, T >::Type Type;
12262 template<
typename T,
typename MT,
bool AF,
bool TF >
12263 struct SubTrait< T, DenseSubmatrix<MT,AF,TF> >
12265 typedef typename SubTrait< T, typename SubmatrixTrait<MT>::Type >::Type Type;
12281 template<
typename MT,
bool AF,
bool SO,
typename T >
12282 struct MultTrait< DenseSubmatrix<MT,AF,SO>, T >
12284 typedef typename MultTrait< typename SubmatrixTrait<MT>::Type, T >::Type Type;
12287 template<
typename T,
typename MT,
bool AF,
bool TF >
12288 struct MultTrait< T, DenseSubmatrix<MT,AF,TF> >
12290 typedef typename MultTrait< T, typename SubmatrixTrait<MT>::Type >::Type Type;
12306 template<
typename MT,
bool AF,
bool SO,
typename T >
12307 struct DivTrait< DenseSubmatrix<MT,AF,SO>, T >
12309 typedef typename DivTrait< typename SubmatrixTrait<MT>::Type, T >::Type Type;
12312 template<
typename T,
typename MT,
bool AF,
bool TF >
12313 struct DivTrait< T, DenseSubmatrix<MT,AF,TF> >
12315 typedef typename DivTrait< T, typename SubmatrixTrait<MT>::Type >::Type Type;
12331 template<
typename MT,
bool AF,
bool SO >
12332 struct SubmatrixTrait< DenseSubmatrix<MT,AF,SO> >
12350 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
12351 struct SubmatrixExprTrait< DenseSubmatrix<MT,AF1,SO>, AF2 >
12353 typedef DenseSubmatrix<MT,AF2,SO> Type;
12361 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
12362 struct SubmatrixExprTrait< const DenseSubmatrix<MT,AF1,SO>, AF2 >
12364 typedef DenseSubmatrix<MT,AF2,SO> Type;
12372 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
12373 struct SubmatrixExprTrait< volatile DenseSubmatrix<MT,AF1,SO>, AF2 >
12375 typedef DenseSubmatrix<MT,AF2,SO> Type;
12383 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
12384 struct SubmatrixExprTrait< const volatile DenseSubmatrix<MT,AF1,SO>, AF2 >
12386 typedef DenseSubmatrix<MT,AF2,SO> Type;
12402 template<
typename MT,
bool AF,
bool SO >
12403 struct RowTrait< DenseSubmatrix<MT,AF,SO> >
12421 template<
typename MT,
bool AF,
bool SO >
12422 struct ColumnTrait< DenseSubmatrix<MT,AF,SO> >
Constraint on the data type.
void storea(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:2669
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
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:2736
Constraint on the data type.
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
DenseSubmatrix & transpose()
In-place transpose of the submatrix.
Definition: DenseSubmatrix.h:2262
IteratorCategory iterator_category
The iterator category.
Definition: DenseSubmatrix.h:541
ReferenceType reference
Reference return type.
Definition: DenseSubmatrix.h:544
const size_t column_
The first column of the submatrix.
Definition: DenseSubmatrix.h:1070
Header file for kernel specific block sizes.
Header file for mathematical functions.
bool canAlias(const Other *alias) const
Returns whether the submatrix can alias with the given address alias.
Definition: DenseSubmatrix.h:2407
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
Header file for the subtraction trait.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:79
Header file for basic type definitions.
If< IsConst< MT >, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant submatrix value.
Definition: DenseSubmatrix.h:507
std::iterator_traits< IteratorType >::difference_type DifferenceType
Difference between two iterators.
Definition: DenseSubmatrix.h:538
DifferenceType difference_type
Difference between two iterators.
Definition: DenseSubmatrix.h:545
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
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:250
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1201
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:118
Header file for the IsSparseMatrix type trait.
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1434
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
Header file for the IsDiagonal type trait.
#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:1214
bool operator<=(const SubmatrixIterator &rhs) const
Less-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:755
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:647
const bool aligned
Alignment flag for aligned vectors and matrices.Via this flag it is possible to specify subvectors...
Definition: AlignmentFlag.h:85
Header file for the IsSame and IsStrictlySame type traits.
Header file for the dense matrix inversion flags.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:697
bool hasOverlap() const
Checking whether there exists an overlap in the context of a symmetric matrix.
Definition: DenseSubmatrix.h:2374
bool isAligned() const
Returns whether the submatrix is properly aligned in memory.
Definition: DenseSubmatrix.h:2497
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: DenseSubmatrix.h:1460
bool isAliased(const Other *alias) const
Returns whether the submatrix is aliased with the given address alias.
Definition: DenseSubmatrix.h:2453
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
Header file for the IsColumnMajorMatrix type trait.
DenseSubmatrix & ctranspose()
In-place conjugate transpose of the submatrix.
Definition: DenseSubmatrix.h:2301
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DenseSubmatrix.h:1506
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2749
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
ReferenceType operator*() const
Direct access to the element at the current iterator position.
Definition: DenseSubmatrix.h:652
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
const size_t n_
The number of columns of the submatrix.
Definition: DenseSubmatrix.h:1072
const size_t row_
The first row of the submatrix.
Definition: DenseSubmatrix.h:1069
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:107
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the And class template.
#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
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:118
CompressedMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:257
const ElementType * ConstPointer
Pointer to a constant submatrix value.
Definition: DenseSubmatrix.h:510
SubmatrixIterator(const SubmatrixIterator< IteratorType2 > &it)
Conversion constructor from different SubmatrixIterator instances.
Definition: DenseSubmatrix.h:575
void reset()
Reset to the default initial values.
Definition: DenseSubmatrix.h:2181
MT::ElementType ElementType
Type of the submatrix elements.
Definition: DenseSubmatrix.h:498
size_t columns() const
Returns the number of columns of the dense submatrix.
Definition: DenseSubmatrix.h:2052
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
Constraints on the storage order of matrix types.
#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
Header file for the RequiresEvaluation type trait.
System settings for performance optimizations.
bool isAligned() const
Access to the iterator's memory alignment flag.
Definition: DenseSubmatrix.h:833
Pointer data()
Low-level data access to the submatrix elements.
Definition: DenseSubmatrix.h:1316
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DenseSubmatrix.h:1438
size_t rows() const
Returns the number of rows of the dense submatrix.
Definition: DenseSubmatrix.h:2022
Header file for the IsUniLower type trait.
SubmatrixIterator()
Default constructor of the SubmatrixIterator class.
Definition: DenseSubmatrix.h:551
Base class for all submatrices.The Submatrix class serves as a tag for all submatrices (i...
Definition: Submatrix.h:64
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1044
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:117
friend const SubmatrixIterator operator+(size_t inc, const SubmatrixIterator &it)
Addition between an integral value and a SubmatrixIterator.
Definition: DenseSubmatrix.h:801
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
DenseSubmatrix & operator=(const ElementType &rhs)
Homogenous assignment to all submatrix elements.
Definition: DenseSubmatrix.h:1535
SubmatrixTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseSubmatrix.h:495
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: DenseSubmatrix.h:1392
Constraint on the data type.
Header file for the matrix storage order types.
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:767
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
SubmatrixIterator(IteratorType iterator, bool isMemoryAligned)
Constructor of the SubmatrixIterator class.
Definition: DenseSubmatrix.h:563
ValueType value_type
Type of the underlying elements.
Definition: DenseSubmatrix.h:542
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:85
bool operator<(const SubmatrixIterator &rhs) const
Less-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:733
std::iterator_traits< IteratorType >::reference ReferenceType
Reference return type.
Definition: DenseSubmatrix.h:535
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:2607
Header file for the DisableIf class template.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:74
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
IntrinsicType load() const
Load of an intrinsic element of the dense submatrix.
Definition: DenseSubmatrix.h:667
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: ColumnMajorMatrix.h:79
SubmatrixIterator< typename MT::ConstIterator > ConstIterator
Iterator over constant elements.
Definition: DenseSubmatrix.h:848
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const simd_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:75
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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
SubmatrixIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DenseSubmatrix.h:587
Header file for the Or class template.
bool operator==(const SubmatrixIterator &rhs) const
Equality comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:711
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
Header file for the DenseMatrix base class.
Header file for the Not class template.
const DenseSubmatrix & CompositeType
Data type for composite expression templates.
Definition: DenseSubmatrix.h:501
const CTransExprTrait< MT >::Type ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatConjExpr.h:974
size_t row() const
Returns the index of the first row of the submatrix in the underlying dense matrix.
Definition: DenseSubmatrix.h:2007
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the matrix element type.
Definition: DenseSubmatrix.h:489
Header file for the IsLower type trait.
IntrinsicType load(size_t i, size_t j) const
Load of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:2543
Header file for the IsAligned type trait.
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:722
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1277
const SubmatrixIterator operator++(int)
Post-increment operator.
Definition: DenseSubmatrix.h:621
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
If< IsConst< MT >, ConstIterator, SubmatrixIterator< typename MT::Iterator > >::Type Iterator
Iterator over non-constant elements.
Definition: DenseSubmatrix.h:851
SubmatrixIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DenseSubmatrix.h:599
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:187
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseSubmatrix.h:497
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1121
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
const bool unaligned
Alignment flag for unaligned vectors and matrices.Via this flag it is possible to specify subvectors...
Definition: AlignmentFlag.h:64
Constraint on the data type.
std::iterator_traits< IteratorType >::value_type ValueType
Type of the underlying elements.
Definition: DenseSubmatrix.h:529
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
If< Or< IsConst< MT >, Not< HasMutableDataAccess< MT > > >, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant submatrix value.
Definition: DenseSubmatrix.h:514
Header file for the IsPadded type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:76
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:85
Operand matrix_
The dense matrix containing the submatrix.
Definition: DenseSubmatrix.h:1068
Header file for the DerestrictTrait class template.
Constraint on the data type.
IteratorType iterator_
Iterator to the current submatrix element.
Definition: DenseSubmatrix.h:840
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
DenseSubmatrix< MT, AF, SO > This
Type of this DenseSubmatrix instance.
Definition: DenseSubmatrix.h:494
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:841
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:107
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type loada(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loada.h:77
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
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: RowMajorMatrix.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the IsConst type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
IntrinsicType loadu() const
Unaligned load of an intrinsic element of the dense submatrix.
Definition: DenseSubmatrix.h:700
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:138
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
DifferenceType operator-(const SubmatrixIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DenseSubmatrix.h:777
Base template for the MultTrait class.
Definition: MultTrait.h:138
IntrinsicType loada() const
Aligned load of an intrinsic element of the dense submatrix.
Definition: DenseSubmatrix.h:685
Header file for the addition trait.
Header file for the division trait.
SubmatrixIterator & operator++()
Pre-increment operator.
Definition: DenseSubmatrix.h:610
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseSubmatrix.h:500
DenseSubmatrix(Operand matrix, size_t rindex, size_t cindex, size_t m, size_t n)
The constructor for DenseSubmatrix.
Definition: DenseSubmatrix.h:1176
Header file for the submatrix trait.
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: DenseSubmatrix.h:486
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:521
const bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
const bool isAligned_
Memory alignment flag.
Definition: DenseSubmatrix.h:1073
Header file for the cache size of the target architecture.
std::iterator_traits< IteratorType >::iterator_category IteratorCategory
The iterator category.
Definition: DenseSubmatrix.h:526
Compile time type negation.The Not class template negates the given compile time condition. In case the given condition would evaluate to true, the nested member enumeration is set to false and vice versa:
Definition: Not.h:70
bool operator>(const SubmatrixIterator &rhs) const
Greater-than comparison between two SubmatrixIterator objects.
Definition: DenseSubmatrix.h:744
#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:2591
Header file for the column trait.
Header file for the isDefault shim.
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DenseSubmatrix.h:496
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
Constraint on the data type.
PointerType pointer
Pointer return type.
Definition: DenseSubmatrix.h:543
Constraint on the data type.
size_t capacity() const
Returns the maximum capacity of the dense submatrix.
Definition: DenseSubmatrix.h:2087
Constraints on the storage order of matrix types.
IntrinsicType loada(size_t i, size_t j) const
Aligned load of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:2573
Header file for the HasMutableDataAccess type trait.
#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
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Header file for the IsReference type trait.
const SubmatrixIterator operator--(int)
Post-decrement operator.
Definition: DenseSubmatrix.h:642
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:2702
Header file for all intrinsic functionality.
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
size_t nonZeros() const
Returns the number of non-zero elements in the dense submatrix.
Definition: DenseSubmatrix.h:2127
IteratorType base() const
Access to the current position of the submatrix iterator.
Definition: DenseSubmatrix.h:823
IT::Type IntrinsicType
Intrinsic type of the submatrix elements.
Definition: DenseSubmatrix.h:499
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2750
MT::ConstReference ConstReference
Reference to a constant submatrix value.
Definition: DenseSubmatrix.h:504
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:146
size_t column() const
Returns the index of the first column of the submatrix in the underlying dense matrix.
Definition: DenseSubmatrix.h:2037
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:944
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:258
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:767
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Header file for the alignment check function.
std::iterator_traits< IteratorType >::pointer PointerType
Pointer return type.
Definition: DenseSubmatrix.h:532
#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:2583
Header file for the IsTrue value trait.
View on a specific submatrix of a dense matrix.The DenseSubmatrix template represents a view on a spe...
Definition: DenseSubmatrix.h:480
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type stream(T *address, const simd_int16_t &value)
Aligned, non-temporal store of a vector of 2-byte integral values.
Definition: Stream.h:74
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
Reference at(size_t i, size_t j)
Checked access to the submatrix elements.
Definition: DenseSubmatrix.h:1263
bool canSMPAssign() const
Returns whether the submatrix can be used in SMP assignments.
Definition: DenseSubmatrix.h:2517
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:94
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
size_t spacing() const
Returns the spacing between the beginning of two rows/columns.
Definition: DenseSubmatrix.h:2072
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
bool isUniUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper unitriangular matrix.
Definition: DenseMatrix.h:1354
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Base template for the SubTrait class.
Definition: SubTrait.h:138
Header file for the Submatrix base class.
const size_t m_
The number of rows of the submatrix.
Definition: DenseSubmatrix.h:1071
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)
Macro for the emission of a std::logic_error exceptionThis macro encapsulates the default way of Blaz...
Definition: Exception.h:283
Header file for the IsUpper type trait.
Header file for exception macros.
void store(size_t i, size_t j, const IntrinsicType &value)
Store of an intrinsic element of the submatrix.
Definition: DenseSubmatrix.h:2640
friend const SubmatrixIterator operator-(const SubmatrixIterator &it, size_t dec)
Subtraction between a SubmatrixIterator and an integral value.
Definition: DenseSubmatrix.h:813
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 IsHermitian type trait.
Header file for the IsRestricted type trait.
System settings for the inline keywords.
Size type of the Blaze library.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
SubmatrixIterator & operator--()
Pre-decrement operator.
Definition: DenseSubmatrix.h:631
#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:766
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storea(T *address, const simd_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Storea.h:78
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:789
Constraint on the data type.
Header file for the FunctionTrace class.
Header file for a safe C++ NULL pointer implementation.