35 #ifndef _BLAZE_MATH_VIEWS_COLUMNS_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMNS_DENSE_H_ 119 template<
typename MT
122 class Columns<MT,true,true,SF,CCAs...>
123 :
public View< DenseMatrix< Columns<MT,true,true,SF,CCAs...>, true > >
124 ,
private ColumnsData<CCAs...>
128 using DataType = ColumnsData<CCAs...>;
129 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
133 static constexpr
size_t N =
sizeof...( CCAs );
138 template<
typename MT1,
typename MT2 >
139 static constexpr
bool EnforceEvaluation_v =
140 ( IsRestricted_v<MT1> && RequiresEvaluation_v<MT2> );
146 using This = Columns<MT,
true,
true,SF,CCAs...>;
148 using BaseType = DenseMatrix<This,true>;
149 using ViewedType = MT;
150 using ResultType = ColumnsTrait_t<MT,N>;
151 using OppositeType = OppositeType_t<ResultType>;
152 using TransposeType = TransposeType_t<ResultType>;
153 using ElementType = ElementType_t<MT>;
154 using SIMDType = SIMDTrait_t<ElementType>;
155 using ReturnType = ReturnType_t<MT>;
156 using CompositeType =
const Columns&;
159 using ConstReference = ConstReference_t<MT>;
162 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
165 using ConstPointer = ConstPointer_t<MT>;
168 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
171 using ConstIterator = ConstIterator_t<MT>;
174 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
179 static constexpr
bool simdEnabled = MT::simdEnabled;
182 static constexpr
bool smpAssignable = MT::smpAssignable;
185 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
191 template<
typename... RCAs >
192 explicit inline Columns( MT& matrix, RCAs... args );
194 Columns(
const Columns& ) =
default;
195 Columns( Columns&& ) =
default;
202 ~Columns() =
default;
209 inline Reference operator()(
size_t i,
size_t j );
210 inline ConstReference operator()(
size_t i,
size_t j )
const;
211 inline Reference at(
size_t i,
size_t j );
212 inline ConstReference at(
size_t i,
size_t j )
const;
213 inline Pointer
data () noexcept;
214 inline ConstPointer
data () const noexcept;
215 inline Pointer
data (
size_t j ) noexcept;
216 inline ConstPointer
data (
size_t j ) const noexcept;
217 inline Iterator
begin (
size_t j );
218 inline ConstIterator
begin (
size_t j ) const;
219 inline ConstIterator
cbegin(
size_t j ) const;
220 inline Iterator
end (
size_t j );
221 inline ConstIterator
end (
size_t j ) const;
222 inline ConstIterator
cend (
size_t j ) const;
229 inline Columns& operator=( const ElementType& rhs );
230 inline Columns& operator=( initializer_list< initializer_list<ElementType> > list );
231 inline Columns& operator=( const Columns& rhs );
233 template< typename MT2,
bool SO2 >
234 inline Columns& operator=( const Matrix<MT2,SO2>& rhs );
236 template< typename MT2,
bool SO2 >
237 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
238 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
240 template< typename MT2,
bool SO2 >
241 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
242 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
244 template< typename MT2,
bool SO2 >
245 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
246 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
248 template< typename MT2,
bool SO2 >
249 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
250 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
252 template< typename MT2,
bool SO2 >
253 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
254 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
256 template< typename MT2,
bool SO2 >
257 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
258 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
266 using DataType::idces;
269 inline MT& operand() noexcept;
270 inline const MT& operand() const noexcept;
272 inline
size_t rows() const noexcept;
273 inline
size_t spacing() const noexcept;
274 inline
size_t capacity() const noexcept;
275 inline
size_t capacity(
size_t j ) const noexcept;
277 inline
size_t nonZeros(
size_t j ) const;
279 inline
void reset(
size_t j );
289 template< typename Other > inline Columns& scale( const Other& scalar );
296 template< typename MT2 >
297 static constexpr
bool VectorizedAssign_v =
298 ( useOptimizedKernels &&
299 simdEnabled && MT2::simdEnabled &&
305 template< typename MT2 >
306 static constexpr
bool VectorizedAddAssign_v =
307 ( useOptimizedKernels &&
308 simdEnabled && MT2::simdEnabled &&
316 template< typename MT2 >
317 static constexpr
bool VectorizedSubAssign_v =
318 ( useOptimizedKernels &&
319 simdEnabled && MT2::simdEnabled &&
327 template< typename MT2 >
328 static constexpr
bool VectorizedSchurAssign_v =
329 ( useOptimizedKernels &&
330 simdEnabled && MT2::simdEnabled &&
337 static constexpr
size_t SIMDSIZE = SIMDTrait<ElementType>::
size;
344 template< typename Other >
345 inline
bool canAlias( const Other* alias ) const noexcept;
347 template< typename MT2,
bool SO2,
bool SF2, typename... CCAs2 >
348 inline
bool canAlias( const Columns<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
350 template< typename Other >
351 inline
bool isAliased( const Other* alias ) const noexcept;
353 template< typename MT2,
bool SO2,
bool SF2, typename... CCAs2 >
354 inline
bool isAliased( const Columns<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
356 inline
bool isAligned () const noexcept;
357 inline
bool canSMPAssign() const noexcept;
368 template< typename MT2 >
369 inline auto assign( const DenseMatrix<MT2,true>& rhs ) ->
DisableIf_t< VectorizedAssign_v<MT2> >;
371 template< typename MT2 >
372 inline auto assign( const DenseMatrix<MT2,true>& rhs ) ->
EnableIf_t< VectorizedAssign_v<MT2> >;
374 template< typename MT2 > inline
void assign( const DenseMatrix<MT2,false>& rhs );
376 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,true>& rhs );
377 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,false>& rhs );
379 template< typename MT2 >
380 inline auto addAssign( const DenseMatrix<MT2,true>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<MT2> >;
382 template< typename MT2 >
383 inline auto addAssign( const DenseMatrix<MT2,true>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<MT2> >;
385 template< typename MT2 > inline
void addAssign( const DenseMatrix<MT2,false>& rhs );
386 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,true>& rhs );
387 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,false>& rhs );
389 template< typename MT2 >
390 inline auto subAssign( const DenseMatrix<MT2,true>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<MT2> >;
392 template< typename MT2 >
393 inline auto subAssign( const DenseMatrix<MT2,true>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<MT2> >;
395 template< typename MT2 > inline
void subAssign( const DenseMatrix<MT2,false>& rhs );
396 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,true>& rhs );
397 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,false>& rhs );
399 template< typename MT2 >
400 inline auto schurAssign( const DenseMatrix<MT2,true>& rhs ) ->
DisableIf_t< VectorizedSchurAssign_v<MT2> >;
402 template< typename MT2 >
403 inline auto schurAssign( const DenseMatrix<MT2,true>& rhs ) ->
EnableIf_t< VectorizedSchurAssign_v<MT2> >;
405 template< typename MT2 > inline
void schurAssign( const DenseMatrix<MT2,false>& rhs );
406 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,true>& rhs );
407 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,false>& rhs );
420 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename... CCAs2 > friend class Columns;
459 template< typename MT
462 template< typename... RCAs >
463 inline Columns<MT,true,true,SF,CCAs...>::Columns( MT& matrix, RCAs... args )
464 : DataType( args... )
468 for(
size_t j=0UL; j<
columns(); ++j ) {
469 if( matrix_.columns() <= idx(j) ) {
498 template<
typename MT
501 inline typename Columns<MT,
true,
true,SF,CCAs...>::Reference
502 Columns<MT,true,true,SF,CCAs...>::operator()(
size_t i,
size_t j )
507 return matrix_(i,idx(j));
524 template<
typename MT
527 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstReference
528 Columns<MT,true,true,SF,CCAs...>::operator()(
size_t i,
size_t j )
const 533 return const_cast<const MT&>( matrix_ )(i,idx(j));
551 template<
typename MT
554 inline typename Columns<MT,
true,
true,SF,CCAs...>::Reference
555 Columns<MT,true,true,SF,CCAs...>::at(
size_t i,
size_t j )
581 template<
typename MT
584 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstReference
585 Columns<MT,true,true,SF,CCAs...>::at(
size_t i,
size_t j )
const 609 template<
typename MT
612 inline typename Columns<MT,
true,
true,SF,CCAs...>::Pointer
615 return matrix_.data( idx(0UL) );
631 template<
typename MT
634 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstPointer
637 return matrix_.data( idx(0UL) );
652 template<
typename MT
655 inline typename Columns<MT,
true,
true,SF,CCAs...>::Pointer
658 return matrix_.data( idx(j) );
673 template<
typename MT
676 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstPointer
679 return matrix_.data( idx(j) );
694 template<
typename MT
697 inline typename Columns<MT,
true,
true,SF,CCAs...>::Iterator
701 return matrix_.begin( idx(j) );
716 template<
typename MT
719 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstIterator
723 return matrix_.cbegin( idx(j) );
738 template<
typename MT
741 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstIterator
745 return matrix_.cbegin( idx(j) );
760 template<
typename MT
763 inline typename Columns<MT,
true,
true,SF,CCAs...>::Iterator
767 return matrix_.end( idx(j) );
782 template<
typename MT
785 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstIterator
789 return matrix_.cend( idx(j) );
804 template<
typename MT
807 inline typename Columns<MT,
true,
true,SF,CCAs...>::ConstIterator
811 return matrix_.cend( idx(j) );
836 template<
typename MT
839 inline Columns<MT,
true,
true,SF,CCAs...>&
840 Columns<MT,true,true,SF,CCAs...>::operator=(
const ElementType& rhs )
842 for(
size_t j=0UL; j<
columns(); ++j ) {
868 template<
typename MT
871 inline Columns<MT,
true,
true,SF,CCAs...>&
872 Columns<MT,true,true,SF,CCAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
877 if( list.size() !=
rows() ) {
881 if( IsRestricted_v<MT> ) {
882 const InitializerMatrix<ElementType> tmp( list,
columns() );
883 for(
size_t j=0UL; j<
columns(); ++j ) {
884 if( !tryAssign( matrix_,
column( tmp, j ), 0UL, idx(j) ) ) {
890 decltype(
auto) left( derestrict( *this ) );
893 for( const auto& rowList : list ) {
895 for(
const auto& element : rowList ) {
896 matrix_(i,idx(j)) = element;
900 matrix_(i,idx(j)) = ElementType();
926 template<
typename MT
929 inline Columns<MT,
true,
true,SF,CCAs...>&
930 Columns<MT,true,true,SF,CCAs...>::operator=(
const Columns& rhs )
938 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
941 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
945 if( IsRestricted_v<MT> ) {
946 for(
size_t j=0UL; j<
columns(); ++j ) {
953 decltype(
auto) left( derestrict( *this ) );
955 if( rhs.canAlias( &matrix_ ) ) {
956 const ResultType tmp( rhs );
986 template<
typename MT
989 template<
typename MT2
991 inline Columns<MT,
true,
true,SF,CCAs...>&
992 Columns<MT,true,true,SF,CCAs...>::operator=(
const Matrix<MT2,SO2>& rhs )
1003 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<MT2>,
const MT2& >;
1004 Right right( ~rhs );
1006 if( IsRestricted_v<MT> ) {
1007 for(
size_t j=0UL; j<
columns(); ++j ) {
1014 decltype(
auto) left( derestrict( *this ) );
1020 if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1021 const ResultType_t<MT2> tmp( right );
1050 template<
typename MT
1052 ,
typename... CCAs >
1053 template<
typename MT2
1056 -> DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
1065 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
1074 if( IsRestricted_v<MT> ) {
1075 for(
size_t j=0UL; j<
columns(); ++j ) {
1082 decltype(
auto) left( derestrict( *this ) );
1084 if( (~rhs).canAlias( &matrix_ ) ) {
1085 const AddType tmp( *
this + (~rhs) );
1114 template<
typename MT
1116 ,
typename... CCAs >
1117 template<
typename MT2
1120 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
1129 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
1138 const AddType tmp( *
this + (~rhs) );
1140 if( IsRestricted_v<MT> ) {
1141 for(
size_t j=0UL; j<
columns(); ++j ) {
1148 decltype(
auto) left( derestrict( *this ) );
1174 template< typename MT
1176 , typename... CCAs >
1177 template< typename MT2
1179 inline auto Columns<MT,true,true,SF,CCAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
1180 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
1189 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
1198 if( IsRestricted_v<MT> ) {
1199 for(
size_t j=0UL; j<
columns(); ++j ) {
1206 decltype(
auto) left( derestrict( *this ) );
1208 if( (~rhs).canAlias( &matrix_ ) ) {
1209 const SubType tmp( *
this - (~rhs ) );
1238 template<
typename MT
1240 ,
typename... CCAs >
1241 template<
typename MT2
1244 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
1253 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
1262 const SubType tmp( *
this - (~rhs) );
1264 if( IsRestricted_v<MT> ) {
1265 for(
size_t j=0UL; j<
columns(); ++j ) {
1272 decltype(
auto) left( derestrict( *this ) );
1298 template< typename MT
1300 , typename... CCAs >
1301 template< typename MT2
1303 inline auto Columns<MT,true,true,SF,CCAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
1304 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
1313 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
1321 if( IsRestricted_v<MT> ) {
1322 for(
size_t j=0UL; j<
columns(); ++j ) {
1329 decltype(
auto) left( derestrict( *this ) );
1331 if( (~rhs).canAlias( &matrix_ ) ) {
1332 const SchurType tmp( *
this % (~rhs) );
1333 if( IsSparseMatrix_v<SchurType> )
1363 template<
typename MT
1365 ,
typename... CCAs >
1366 template<
typename MT2
1368 inline auto Columns<MT,true,true,SF,CCAs...>::operator%=(
const Matrix<MT2,SO2>& rhs )
1369 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
1378 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
1386 const SchurType tmp( *
this % (~rhs) );
1388 if( IsRestricted_v<MT> ) {
1389 for(
size_t j=0UL; j<
columns(); ++j ) {
1396 decltype(
auto) left( derestrict( *this ) );
1426 template<
typename MT
1428 ,
typename... CCAs >
1429 inline MT& Columns<MT,true,true,SF,CCAs...>::operand() noexcept
1443 template<
typename MT
1445 ,
typename... CCAs >
1446 inline const MT& Columns<MT,true,true,SF,CCAs...>::operand() const noexcept
1460 template<
typename MT
1462 ,
typename... CCAs >
1465 return matrix_.rows();
1480 template<
typename MT
1482 ,
typename... CCAs >
1485 return matrix_.spacing();
1497 template<
typename MT
1499 ,
typename... CCAs >
1517 template<
typename MT
1519 ,
typename... CCAs >
1538 template<
typename MT
1540 ,
typename... CCAs >
1543 size_t nonzeros( 0UL );
1545 for(
size_t j=0UL; j<
columns(); ++j ) {
1546 nonzeros += matrix_.nonZeros( idx(j) );
1564 template<
typename MT
1566 ,
typename... CCAs >
1571 return matrix_.nonZeros( idx(j) );
1583 template<
typename MT
1585 ,
typename... CCAs >
1588 for(
size_t j=0UL; j<
columns(); ++j ) {
1589 matrix_.reset( idx(j) );
1605 template<
typename MT
1607 ,
typename... CCAs >
1610 matrix_.reset( idx(j) );
1637 template<
typename MT
1639 ,
typename... CCAs >
1640 inline Columns<MT,
true,
true,SF,CCAs...>&
1650 const ResultType tmp(
trans( *
this ) );
1652 if( IsRestricted_v<MT> ) {
1653 for(
size_t j=0UL; j<
columns(); ++j ) {
1654 if( !tryAssign( matrix_,
column( tmp, j ), 0UL, idx(j) ) ) {
1660 decltype(
auto) left( derestrict( *this ) );
1683 template< typename MT
1685 , typename... CCAs >
1686 inline Columns<MT,true,true,SF,CCAs...>&
1687 Columns<MT,true,true,SF,CCAs...>::
ctranspose()
1696 const ResultType tmp(
ctrans( *
this ) );
1698 if( IsRestricted_v<MT> ) {
1699 for(
size_t j=0UL; j<
columns(); ++j ) {
1700 if( !tryAssign( matrix_,
column( tmp, j ), 0UL, idx(j) ) ) {
1706 decltype(
auto) left( derestrict( *this ) );
1729 template< typename MT
1731 , typename... CCAs >
1732 template< typename Other >
1733 inline Columns<MT,true,true,SF,CCAs...>&
1734 Columns<MT,true,true,SF,CCAs...>::scale( const Other& scalar )
1740 for(
size_t j=0UL; j<
columns(); ++j )
1742 const size_t index ( idx(j) );
1743 const size_t ibegin( IsLower<MT>::value ? ( IsStrictlyLower_v<MT> ? index+1UL : index ) : 0UL );
1744 const size_t iend ( IsUpper<MT>::value ? ( IsStrictlyUpper_v<MT> ? index : index+1UL ) :
rows() );
1746 for(
size_t i=ibegin; i<iend; ++i ) {
1747 matrix_(i,index) *= scalar;
1776 template<
typename MT
1778 ,
typename... CCAs >
1779 template<
typename Other >
1780 inline bool Columns<MT,true,true,SF,CCAs...>::canAlias(
const Other* alias )
const noexcept
1782 return matrix_.isAliased( alias );
1800 template<
typename MT
1802 ,
typename... CCAs >
1803 template<
typename MT2
1806 ,
typename... CCAs2 >
1808 Columns<MT,true,true,SF,CCAs...>::canAlias(
const Columns<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
1810 return matrix_.isAliased( &alias->matrix_ );
1827 template<
typename MT
1829 ,
typename... CCAs >
1830 template<
typename Other >
1831 inline bool Columns<MT,true,true,SF,CCAs...>::isAliased(
const Other* alias )
const noexcept
1833 return matrix_.isAliased( alias );
1851 template<
typename MT
1853 ,
typename... CCAs >
1854 template<
typename MT2
1857 ,
typename... CCAs2 >
1859 Columns<MT,true,true,SF,CCAs...>::isAliased(
const Columns<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
1861 return matrix_.isAliased( &alias->matrix_ );
1877 template<
typename MT
1879 ,
typename... CCAs >
1880 inline bool Columns<MT,true,true,SF,CCAs...>::isAligned() const noexcept
1882 return matrix_.isAligned();
1899 template<
typename MT
1901 ,
typename... CCAs >
1902 inline bool Columns<MT,true,true,SF,CCAs...>::canSMPAssign() const noexcept
1904 return (
rows() *
columns() > SMP_DMATASSIGN_THRESHOLD );
1925 template<
typename MT
1927 ,
typename... CCAs >
1929 Columns<MT,true,true,SF,CCAs...>::load(
size_t i,
size_t j )
const noexcept
1931 return matrix_.load( i, idx(j) );
1952 template<
typename MT
1954 ,
typename... CCAs >
1958 return matrix_.loada( i, idx(j) );
1979 template<
typename MT
1981 ,
typename... CCAs >
1985 return matrix_.loadu( i, idx(j) );
2007 template<
typename MT
2009 ,
typename... CCAs >
2011 Columns<MT,true,true,SF,CCAs...>::store(
size_t i,
size_t j,
const SIMDType& value ) noexcept
2013 matrix_.store( i, idx(j), value );
2035 template<
typename MT
2037 ,
typename... CCAs >
2041 matrix_.storea( i, idx(j), value );
2063 template<
typename MT
2065 ,
typename... CCAs >
2069 matrix_.storeu( i, idx(j), value );
2091 template<
typename MT
2093 ,
typename... CCAs >
2097 matrix_.stream( i, idx(j), value );
2115 template<
typename MT
2117 ,
typename... CCAs >
2118 template<
typename MT2 >
2119 inline auto Columns<MT,true,true,SF,CCAs...>::assign(
const DenseMatrix<MT2,true>& rhs )
2120 -> DisableIf_t< VectorizedAssign_v<MT2> >
2128 const size_t ipos(
rows() &
size_t(-2) );
2131 for(
size_t j=0UL; j<
columns(); ++j ) {
2132 const size_t index( idx(j) );
2133 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2134 matrix_(i ,index) = (~rhs)(i ,j);
2135 matrix_(i+1UL,index) = (~rhs)(i+1UL,j);
2137 if( ipos <
rows() ) {
2138 matrix_(ipos,index) = (~rhs)(ipos,j);
2158 template<
typename MT
2160 ,
typename... CCAs >
2161 template<
typename MT2 >
2162 inline auto Columns<MT,true,true,SF,CCAs...>::assign(
const DenseMatrix<MT2,true>& rhs )
2163 -> EnableIf_t< VectorizedAssign_v<MT2> >
2173 const size_t ipos(
rows() &
size_t(-SIMDSIZE) );
2177 rows()*
columns() > ( cacheSize / (
sizeof(ElementType) * 3UL ) ) &&
2178 !(~rhs).isAliased( &matrix_ ) )
2180 for(
size_t j=0UL; j<
columns(); ++j )
2183 Iterator left(
begin(j) );
2184 ConstIterator_t<MT2> right( (~rhs).
begin(j) );
2186 for( ; i<ipos; i+=SIMDSIZE ) {
2187 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2189 for( ; i<
rows(); ++i ) {
2196 for(
size_t j=0UL; j<
columns(); ++j )
2199 Iterator left(
begin(j) );
2200 ConstIterator_t<MT2> right( (~rhs).
begin(j) );
2202 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2203 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2204 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2205 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2206 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2208 for( ; i<ipos; i+=SIMDSIZE ) {
2209 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2211 for( ; i<
rows(); ++i ) {
2212 *left = *right; ++left; ++right;
2233 template<
typename MT
2235 ,
typename... CCAs >
2236 template<
typename MT2 >
2237 inline void Columns<MT,true,true,SF,CCAs...>::assign(
const DenseMatrix<MT2,false>& rhs )
2247 constexpr
size_t block( BLOCK_SIZE );
2251 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
2252 for(
size_t j=0UL; j<
columns(); ++j ) {
2253 const size_t index( idx(j) );
2254 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2255 matrix_(i ,index) = (~rhs)(i ,j);
2256 matrix_(i+1UL,index) = (~rhs)(i+1UL,j);
2258 if( ipos < (~rhs).rows() ) {
2259 matrix_(ipos,index) = (~rhs)(ipos,j);
2265 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2266 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2267 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2268 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2269 for(
size_t j=jj; j<jend; ++j ) {
2270 const size_t index( idx(j) );
2271 for(
size_t i=ii; i<iend; ++i ) {
2272 matrix_(i,index) = (~rhs)(i,j);
2295 template<
typename MT
2297 ,
typename... CCAs >
2298 template<
typename MT2 >
2299 inline void Columns<MT,true,true,SF,CCAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2307 for(
size_t j=0UL; j<
columns(); ++j ) {
2308 const size_t index( idx(j) );
2309 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2310 matrix_(element->index(),index) = element->value();
2329 template<
typename MT
2331 ,
typename... CCAs >
2332 template<
typename MT2 >
2333 inline void Columns<MT,true,true,SF,CCAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2343 for(
size_t i=0UL; i<
rows(); ++i ) {
2344 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2345 matrix_(i,idx(element->index())) = element->value();
2364 template<
typename MT
2366 ,
typename... CCAs >
2367 template<
typename MT2 >
2368 inline auto Columns<MT,true,true,SF,CCAs...>::addAssign(
const DenseMatrix<MT2,true>& rhs )
2369 -> DisableIf_t< VectorizedAddAssign_v<MT2> >
2377 const size_t ipos(
rows() &
size_t(-2) );
2380 for(
size_t j=0UL; j<
columns(); ++j )
2382 const size_t index( idx(j) );
2383 if( IsDiagonal_v<MT2> ) {
2384 matrix_(j,index) += (~rhs)(j,j);
2387 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2388 matrix_(i ,index) += (~rhs)(i ,j);
2389 matrix_(i+1UL,index) += (~rhs)(i+1UL,j);
2391 if( ipos <
rows() ) {
2392 matrix_(ipos,index) += (~rhs)(ipos,j);
2413 template<
typename MT
2415 ,
typename... CCAs >
2416 template<
typename MT2 >
2417 inline auto Columns<MT,true,true,SF,CCAs...>::addAssign(
const DenseMatrix<MT2,true>& rhs )
2418 -> EnableIf_t< VectorizedAddAssign_v<MT2> >
2428 for(
size_t j=0UL; j<
columns(); ++j )
2430 const size_t ibegin( ( IsLower_v<MT2> )
2431 ?( ( IsStrictlyLower_v<MT2> ? j+1UL : j ) &
size_t(-SIMDSIZE) )
2433 const size_t iend ( ( IsUpper_v<MT2> )
2434 ?( IsStrictlyUpper_v<MT2> ? j : j+1UL )
2438 const size_t ipos( iend &
size_t(-SIMDSIZE) );
2442 Iterator left(
begin(j) + ibegin );
2443 ConstIterator_t<MT2> right( (~rhs).
begin(j) + ibegin );
2445 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2446 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2447 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2448 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2449 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2451 for( ; i<ipos; i+=SIMDSIZE ) {
2452 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2454 for( ; i<iend; ++i ) {
2455 *left += *right; ++left; ++right;
2475 template<
typename MT
2477 ,
typename... CCAs >
2478 template<
typename MT2 >
2479 inline void Columns<MT,true,true,SF,CCAs...>::addAssign(
const DenseMatrix<MT2,false>& rhs )
2489 constexpr
size_t block( BLOCK_SIZE );
2493 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
2494 for(
size_t j=0UL; j<
columns(); ++j ) {
2495 const size_t index( idx(j) );
2496 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2497 matrix_(i ,index) += (~rhs)(i ,j);
2498 matrix_(i+1UL,index) += (~rhs)(i+1UL,j);
2500 if( ipos < (~rhs).rows() )
2501 matrix_(ipos,index) += (~rhs)(ipos,j);
2506 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2507 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2508 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2509 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2510 for(
size_t j=jj; j<jend; ++j ) {
2511 const size_t index( idx(j) );
2512 for(
size_t i=ii; i<iend; ++i ) {
2513 matrix_(i,index) += (~rhs)(i,j);
2536 template<
typename MT
2538 ,
typename... CCAs >
2539 template<
typename MT2 >
2540 inline void Columns<MT,true,true,SF,CCAs...>::addAssign(
const SparseMatrix<MT2,true>& rhs )
2548 for(
size_t j=0UL; j<
columns(); ++j ) {
2549 const size_t index( idx(j) );
2550 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2551 matrix_(element->index(),index) += element->value();
2570 template<
typename MT
2572 ,
typename... CCAs >
2573 template<
typename MT2 >
2574 inline void Columns<MT,true,true,SF,CCAs...>::addAssign(
const SparseMatrix<MT2,false>& rhs )
2584 for(
size_t i=0UL; i<
rows(); ++i ) {
2585 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2586 matrix_(i,idx(element->index())) += element->value();
2605 template<
typename MT
2607 ,
typename... CCAs >
2608 template<
typename MT2 >
2609 inline auto Columns<MT,true,true,SF,CCAs...>::subAssign(
const DenseMatrix<MT2,true>& rhs )
2610 -> DisableIf_t< VectorizedSubAssign_v<MT2> >
2618 const size_t ipos(
rows() &
size_t(-2) );
2621 for(
size_t j=0UL; j<
columns(); ++j )
2623 const size_t index( idx(j) );
2625 if( IsDiagonal_v<MT2> ) {
2626 matrix_(j,index) -= (~rhs)(j,j);
2629 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2630 matrix_(i ,index) -= (~rhs)(i ,j);
2631 matrix_(i+1UL,index) -= (~rhs)(i+1UL,j);
2633 if( ipos <
rows() ) {
2634 matrix_(ipos,index) -= (~rhs)(ipos,j);
2655 template<
typename MT
2657 ,
typename... CCAs >
2658 template<
typename MT2 >
2659 inline auto Columns<MT,true,true,SF,CCAs...>::subAssign(
const DenseMatrix<MT2,true>& rhs )
2660 -> EnableIf_t< VectorizedSubAssign_v<MT2> >
2670 for(
size_t j=0UL; j<
columns(); ++j )
2672 const size_t ibegin( ( IsLower_v<MT2> )
2673 ?( ( IsStrictlyLower_v<MT2> ? j+1UL : j ) &
size_t(-SIMDSIZE) )
2675 const size_t iend ( ( IsUpper_v<MT2> )
2676 ?( IsStrictlyUpper_v<MT2> ? j : j+1UL )
2680 const size_t ipos( iend &
size_t(-SIMDSIZE) );
2684 Iterator left(
begin(j) + ibegin );
2685 ConstIterator_t<MT2> right( (~rhs).
begin(j) + ibegin );
2687 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2688 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2689 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2690 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2691 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2693 for( ; i<ipos; i+=SIMDSIZE ) {
2694 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2696 for( ; i<iend; ++i ) {
2697 *left -= *right; ++left; ++right;
2717 template<
typename MT
2719 ,
typename... CCAs >
2720 template<
typename MT2 >
2721 inline void Columns<MT,true,true,SF,CCAs...>::subAssign(
const DenseMatrix<MT2,false>& rhs )
2731 constexpr
size_t block( BLOCK_SIZE );
2735 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
2736 for(
size_t j=0UL; j<
columns(); ++j ) {
2737 const size_t index( idx(j) );
2738 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2739 matrix_(i ,index) -= (~rhs)(i ,j);
2740 matrix_(i+1UL,index) -= (~rhs)(i+1UL,j);
2742 if( ipos < (~rhs).rows() )
2743 matrix_(ipos,index) -= (~rhs)(ipos,j);
2748 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2749 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2750 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2751 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2752 for(
size_t j=jj; j<jend; ++j ) {
2753 const size_t index( idx(j) );
2754 for(
size_t i=ii; i<iend; ++i ) {
2755 matrix_(i,index) -= (~rhs)(i,j);
2778 template<
typename MT
2780 ,
typename... CCAs >
2781 template<
typename MT2 >
2782 inline void Columns<MT,true,true,SF,CCAs...>::subAssign(
const SparseMatrix<MT2,true>& rhs )
2790 for(
size_t j=0UL; j<
columns(); ++j ) {
2791 const size_t index( idx(j) );
2792 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2793 matrix_(element->index(),index) -= element->value();
2812 template<
typename MT
2814 ,
typename... CCAs >
2815 template<
typename MT2 >
2816 inline void Columns<MT,true,true,SF,CCAs...>::subAssign(
const SparseMatrix<MT2,false>& rhs )
2826 for(
size_t i=0UL; i<
rows(); ++i ) {
2827 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2828 matrix_(i,idx(element->index())) -= element->value();
2847 template<
typename MT
2849 ,
typename... CCAs >
2850 template<
typename MT2 >
2851 inline auto Columns<MT,true,true,SF,CCAs...>::schurAssign(
const DenseMatrix<MT2,true>& rhs )
2852 -> DisableIf_t< VectorizedSchurAssign_v<MT2> >
2860 const size_t ipos(
rows() &
size_t(-2) );
2863 for(
size_t j=0UL; j<
columns(); ++j ) {
2864 const size_t index( idx(j) );
2865 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2866 matrix_(i ,index) *= (~rhs)(i ,j);
2867 matrix_(i+1UL,index) *= (~rhs)(i+1UL,j);
2869 if( ipos <
rows() ) {
2870 matrix_(ipos,index) *= (~rhs)(ipos,j);
2891 template<
typename MT
2893 ,
typename... CCAs >
2894 template<
typename MT2 >
2895 inline auto Columns<MT,true,true,SF,CCAs...>::schurAssign(
const DenseMatrix<MT2,true>& rhs )
2896 -> EnableIf_t< VectorizedSchurAssign_v<MT2> >
2906 for(
size_t j=0UL; j<
columns(); ++j )
2908 const size_t ipos(
rows() &
size_t(-SIMDSIZE) );
2912 Iterator left(
begin(j) );
2913 ConstIterator_t<MT2> right( (~rhs).
begin(j) );
2915 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2916 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2917 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2918 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2919 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2921 for( ; i<ipos; i+=SIMDSIZE ) {
2922 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2924 for( ; i<
rows(); ++i ) {
2925 *left *= *right; ++left; ++right;
2945 template<
typename MT
2947 ,
typename... CCAs >
2948 template<
typename MT2 >
2949 inline void Columns<MT,true,true,SF,CCAs...>::schurAssign(
const DenseMatrix<MT2,false>& rhs )
2959 constexpr
size_t block( BLOCK_SIZE );
2963 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
2964 for(
size_t j=0UL; j<
columns(); ++j ) {
2965 const size_t index( idx(j) );
2966 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2967 matrix_(i ,index) *= (~rhs)(i ,j);
2968 matrix_(i+1UL,index) *= (~rhs)(i+1UL,j);
2970 if( ipos < (~rhs).rows() )
2971 matrix_(ipos,index) *= (~rhs)(ipos,j);
2976 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2977 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2978 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2979 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2980 for(
size_t j=jj; j<jend; ++j ) {
2981 const size_t index( idx(j) );
2982 for(
size_t i=ii; i<iend; ++i ) {
2983 matrix_(i,index) *= (~rhs)(i,j);
3006 template<
typename MT
3008 ,
typename... CCAs >
3009 template<
typename MT2 >
3010 inline void Columns<MT,true,true,SF,CCAs...>::schurAssign(
const SparseMatrix<MT2,true>& rhs )
3020 for(
size_t j=0UL; j<
columns(); ++j )
3022 const size_t index( idx(j) );
3025 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
3026 for( ; i<element->index(); ++i )
3027 reset( matrix_(i,index) );
3028 matrix_(i,index) *= element->value();
3032 for( ; i<
rows(); ++i ) {
3033 reset( matrix_(i,index) );
3053 template<
typename MT
3055 ,
typename... CCAs >
3056 template<
typename MT2 >
3057 inline void Columns<MT,true,true,SF,CCAs...>::schurAssign(
const SparseMatrix<MT2,false>& rhs )
3069 for(
size_t i=0UL; i<
rows(); ++i )
3073 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
3074 for( ; j<element->index(); ++j )
3075 reset( matrix_(i,idx(j)) );
3076 matrix_(i,idx(j)) *= element->value();
3081 reset( matrix_(i,idx(j)) );
3109 template<
typename MT
3110 ,
typename... CCAs >
3111 class Columns<MT,false,true,false,CCAs...>
3112 :
public View< DenseMatrix< Columns<MT,false,true,false,CCAs...>, true > >
3113 ,
private ColumnsData<CCAs...>
3117 using DataType = ColumnsData<CCAs...>;
3118 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
3122 static constexpr
size_t N =
sizeof...( CCAs );
3127 template<
typename MT1,
typename MT2 >
3128 static constexpr
bool EnforceEvaluation_v =
3129 ( IsRestricted_v<MT1> && RequiresEvaluation_v<MT2> );
3135 using This = Columns<MT,
false,
true,
false,CCAs...>;
3137 using BaseType = DenseMatrix<This,true>;
3138 using ViewedType = MT;
3139 using ResultType = ColumnsTrait_t<MT,N>;
3140 using OppositeType = OppositeType_t<ResultType>;
3141 using TransposeType = TransposeType_t<ResultType>;
3142 using ElementType = ElementType_t<MT>;
3143 using ReturnType = ReturnType_t<MT>;
3144 using CompositeType =
const Columns&;
3147 using ConstReference = ConstReference_t<MT>;
3150 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
3153 using ConstPointer = ConstPointer_t<MT>;
3156 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
3162 template<
typename MatrixType
3163 ,
typename IteratorType >
3164 class ColumnsIterator
3169 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
3172 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
3175 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
3178 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
3181 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
3184 using iterator_category = IteratorCategory;
3185 using value_type = ValueType;
3186 using pointer = PointerType;
3187 using reference = ReferenceType;
3188 using difference_type = DifferenceType;
3194 inline ColumnsIterator() noexcept
3195 : matrix_(
nullptr )
3209 inline ColumnsIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
3210 : matrix_( &matrix )
3215 if( row_ != matrix_->rows() )
3216 pos_ = matrix_->begin( row_ ) + column_;
3225 template<
typename MatrixType2,
typename IteratorType2 >
3226 inline ColumnsIterator(
const ColumnsIterator<MatrixType2,IteratorType2>& it ) noexcept
3227 : matrix_( it.matrix_ )
3229 , column_( it.column_ )
3240 inline ColumnsIterator&
operator+=(
size_t inc ) noexcept {
3243 if( row_ != matrix_->rows() )
3244 pos_ = matrix_->begin( row_ ) + column_;
3256 inline ColumnsIterator&
operator-=(
size_t dec ) noexcept {
3259 if( row_ != matrix_->rows() )
3260 pos_ = matrix_->begin( row_ ) + column_;
3271 inline ColumnsIterator& operator++() noexcept {
3274 if( row_ != matrix_->rows() )
3275 pos_ = matrix_->begin( row_ ) + column_;
3286 inline const ColumnsIterator operator++(
int ) noexcept {
3287 const ColumnsIterator tmp( *
this );
3298 inline ColumnsIterator& operator--() noexcept {
3301 if( row_ != matrix_->rows() )
3302 pos_ = matrix_->begin( row_ ) + column_;
3313 inline const ColumnsIterator operator--(
int ) noexcept {
3314 const ColumnsIterator tmp( *
this );
3326 inline ReferenceType operator[](
size_t index )
const {
3328 const IteratorType pos( matrix_->begin( row_+index ) + column_ );
3338 inline ReferenceType
operator*()
const {
3348 inline PointerType operator->()
const {
3359 template<
typename MatrixType2,
typename IteratorType2 >
3360 inline bool operator==(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3361 return row_ == rhs.row_;
3371 template<
typename MatrixType2,
typename IteratorType2 >
3372 inline bool operator!=(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3373 return !( *
this == rhs );
3383 template<
typename MatrixType2,
typename IteratorType2 >
3384 inline bool operator<(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3385 return row_ < rhs.row_;
3395 template<
typename MatrixType2,
typename IteratorType2 >
3396 inline bool operator>(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3397 return row_ > rhs.row_;
3407 template<
typename MatrixType2,
typename IteratorType2 >
3408 inline bool operator<=(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3409 return row_ <= rhs.row_;
3419 template<
typename MatrixType2,
typename IteratorType2 >
3420 inline bool operator>=(
const ColumnsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3421 return row_ >= rhs.row_;
3431 inline DifferenceType
operator-(
const ColumnsIterator& rhs )
const noexcept {
3432 return row_ - rhs.row_;
3443 friend inline const ColumnsIterator
operator+(
const ColumnsIterator& it,
size_t inc ) noexcept {
3444 return ColumnsIterator( *it.matrix_, it.row_+inc, it.column_ );
3455 friend inline const ColumnsIterator
operator+(
size_t inc,
const ColumnsIterator& it ) noexcept {
3456 return ColumnsIterator( *it.matrix_, it.row_+inc, it.column_ );
3467 friend inline const ColumnsIterator
operator-(
const ColumnsIterator& it,
size_t dec ) noexcept {
3468 return ColumnsIterator( *it.matrix_, it.row_-dec, it.column_ );
3474 MatrixType* matrix_;
3481 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnsIterator;
3488 using ConstIterator = ColumnsIterator< const MT, ConstIterator_t<MT> >;
3491 using Iterator = If_t< IsConst_v<MT>, ConstIterator, ColumnsIterator< MT, Iterator_t<MT> > >;
3496 static constexpr
bool simdEnabled =
false;
3499 static constexpr
bool smpAssignable = MT::smpAssignable;
3502 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
3508 template<
typename... RCAs >
3509 explicit inline Columns( MT& matrix, RCAs... args );
3511 Columns(
const Columns& ) =
default;
3512 Columns( Columns&& ) =
default;
3519 ~Columns() =
default;
3526 inline Reference operator()(
size_t i,
size_t j );
3527 inline ConstReference operator()(
size_t i,
size_t j )
const;
3528 inline Reference at(
size_t i,
size_t j );
3529 inline ConstReference at(
size_t i,
size_t j )
const;
3530 inline Pointer
data () noexcept;
3531 inline ConstPointer
data () const noexcept;
3532 inline Pointer
data (
size_t j ) noexcept;
3533 inline ConstPointer
data (
size_t j ) const noexcept;
3534 inline Iterator
begin (
size_t j );
3535 inline ConstIterator
begin (
size_t j ) const;
3536 inline ConstIterator
cbegin(
size_t j ) const;
3537 inline Iterator
end (
size_t j );
3538 inline ConstIterator
end (
size_t j ) const;
3539 inline ConstIterator
cend (
size_t j ) const;
3546 inline Columns& operator=( const ElementType& rhs );
3547 inline Columns& operator=( initializer_list< initializer_list<ElementType> > list );
3548 inline Columns& operator=( const Columns& rhs );
3550 template< typename MT2,
bool SO2 >
3551 inline Columns& operator=( const Matrix<MT2,SO2>& rhs );
3553 template< typename MT2,
bool SO2 >
3554 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
3555 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
3557 template< typename MT2,
bool SO2 >
3558 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
3559 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
3561 template< typename MT2,
bool SO2 >
3562 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
3563 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
3565 template< typename MT2,
bool SO2 >
3566 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
3567 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
3569 template< typename MT2,
bool SO2 >
3570 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
3571 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
3573 template< typename MT2,
bool SO2 >
3574 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
3575 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >;
3582 using DataType::idx;
3583 using DataType::idces;
3586 inline MT& operand() noexcept;
3587 inline const MT& operand() const noexcept;
3589 inline
size_t rows() const noexcept;
3590 inline
size_t spacing() const noexcept;
3591 inline
size_t capacity() const noexcept;
3592 inline
size_t capacity(
size_t j ) const noexcept;
3594 inline
size_t nonZeros(
size_t j ) const;
3595 inline
void reset();
3596 inline
void reset(
size_t j );
3606 template< typename Other > inline Columns& scale( const Other& scalar );
3613 template< typename Other >
3614 inline
bool canAlias( const Other* alias ) const noexcept;
3616 template< typename MT2,
bool SO2,
bool SF2, typename... CCAs2 >
3617 inline
bool canAlias( const Columns<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
3619 template< typename Other >
3620 inline
bool isAliased( const Other* alias ) const noexcept;
3622 template< typename MT2,
bool SO2,
bool SF2, typename... CCAs2 >
3623 inline
bool isAliased( const Columns<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
3625 inline
bool isAligned () const noexcept;
3626 inline
bool canSMPAssign() const noexcept;
3628 template< typename MT2 > inline
void assign( const DenseMatrix<MT2,true>& rhs );
3629 template< typename MT2 > inline
void assign( const DenseMatrix<MT2,false>& rhs );
3630 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,true>& rhs );
3631 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,false>& rhs );
3633 template< typename MT2 > inline
void addAssign( const DenseMatrix<MT2,true>& rhs );
3634 template< typename MT2 > inline
void addAssign( const DenseMatrix<MT2,false>& rhs );
3635 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,true>& rhs );
3636 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,false>& rhs );
3638 template< typename MT2 > inline
void subAssign( const DenseMatrix<MT2,true>& rhs );
3639 template< typename MT2 > inline
void subAssign( const DenseMatrix<MT2,false>& rhs );
3640 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,true>& rhs );
3641 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,false>& rhs );
3643 template< typename MT2 > inline
void schurAssign( const DenseMatrix<MT2,true>& rhs );
3644 template< typename MT2 > inline
void schurAssign( const DenseMatrix<MT2,false>& rhs );
3645 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,true>& rhs );
3646 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,false>& rhs );
3659 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename... CCAs2 > friend class Columns;
3699 template< typename MT
3700 , typename... CCAs >
3701 template< typename... RCAs >
3702 inline Columns<MT,false,true,false,CCAs...>::Columns( MT& matrix, RCAs... args )
3703 : DataType( args... )
3704 , matrix_ ( matrix )
3707 for(
size_t j=0UL; j<
columns(); ++j ) {
3708 if( matrix_.columns() <= idx(j) ) {
3737 template<
typename MT
3738 ,
typename... CCAs >
3739 inline typename Columns<MT,
false,
true,
false,CCAs...>::Reference
3740 Columns<MT,false,true,false,CCAs...>::operator()(
size_t i,
size_t j )
3745 return matrix_(i,idx(j));
3762 template<
typename MT
3763 ,
typename... CCAs >
3764 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstReference
3765 Columns<MT,false,true,false,CCAs...>::operator()(
size_t i,
size_t j )
const 3770 return const_cast<const MT&>( matrix_ )(i,idx(j));
3788 template<
typename MT
3789 ,
typename... CCAs >
3790 inline typename Columns<MT,
false,
true,
false,CCAs...>::Reference
3791 Columns<MT,false,true,false,CCAs...>::at(
size_t i,
size_t j )
3799 return (*
this)(i,j);
3817 template<
typename MT
3818 ,
typename... CCAs >
3819 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstReference
3820 Columns<MT,false,true,false,CCAs...>::at(
size_t i,
size_t j )
const 3828 return (*
this)(i,j);
3844 template<
typename MT
3845 ,
typename... CCAs >
3846 inline typename Columns<MT,
false,
true,
false,CCAs...>::Pointer
3849 return matrix_.data() + idx(0UL);
3865 template<
typename MT
3866 ,
typename... CCAs >
3867 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstPointer
3870 return matrix_.data() + idx(0UL);
3885 template<
typename MT
3886 ,
typename... CCAs >
3887 inline typename Columns<MT,
false,
true,
false,CCAs...>::Pointer
3890 return matrix_.data() + idx(j);
3905 template<
typename MT
3906 ,
typename... CCAs >
3907 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstPointer
3910 return matrix_.data() + idx(j);
3925 template<
typename MT
3926 ,
typename... CCAs >
3927 inline typename Columns<MT,
false,
true,
false,CCAs...>::Iterator
3931 return Iterator( matrix_, 0UL, idx(j) );
3946 template<
typename MT
3947 ,
typename... CCAs >
3948 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstIterator
3952 return ConstIterator( matrix_, 0UL, idx(j) );
3967 template<
typename MT
3968 ,
typename... CCAs >
3969 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstIterator
3973 return ConstIterator( matrix_, 0UL, idx(j) );
3988 template<
typename MT
3989 ,
typename... CCAs >
3990 inline typename Columns<MT,
false,
true,
false,CCAs...>::Iterator
3994 return Iterator( matrix_,
rows(), idx(j) );
4009 template<
typename MT
4010 ,
typename... CCAs >
4011 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstIterator
4015 return ConstIterator( matrix_,
rows(), idx(j) );
4030 template<
typename MT
4031 ,
typename... CCAs >
4032 inline typename Columns<MT,
false,
true,
false,CCAs...>::ConstIterator
4036 return ConstIterator( matrix_,
rows(), idx(j) );
4061 template<
typename MT
4062 ,
typename... CCAs >
4063 inline Columns<MT,
false,
true,
false,CCAs...>&
4064 Columns<MT,false,true,false,CCAs...>::operator=(
const ElementType& rhs )
4066 for(
size_t j=0UL; j<
columns(); ++j ) {
4092 template<
typename MT
4093 ,
typename... CCAs >
4094 inline Columns<MT,
false,
true,
false,CCAs...>&
4095 Columns<MT,false,true,false,CCAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
4100 if( list.size() !=
rows() ) {
4104 if( IsRestricted_v<MT> ) {
4105 const InitializerMatrix<ElementType> tmp( list,
columns() );
4106 for(
size_t j=0UL; j<
columns(); ++j ) {
4107 if( !tryAssign( matrix_,
column( tmp, j ), 0UL, idx(j) ) ) {
4113 decltype(
auto) left( derestrict( *this ) );
4116 for( const auto& rowList : list ) {
4118 for(
const auto& element : rowList ) {
4119 matrix_(i,idx(j)) = element;
4123 matrix_(i,idx(j)) = ElementType();
4149 template<
typename MT
4150 ,
typename... CCAs >
4151 inline Columns<MT,
false,
true,
false,CCAs...>&
4152 Columns<MT,false,true,false,CCAs...>::operator=(
const Columns& rhs )
4160 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
4163 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
4167 if( IsRestricted_v<MT> ) {
4168 for(
size_t j=0UL; j<
columns(); ++j ) {
4175 decltype(
auto) left( derestrict( *this ) );
4177 if( rhs.canAlias( &matrix_ ) ) {
4178 const ResultType tmp( rhs );
4208 template<
typename MT
4209 ,
typename... CCAs >
4210 template<
typename MT2
4212 inline Columns<MT,
false,
true,
false,CCAs...>&
4213 Columns<MT,false,true,false,CCAs...>::operator=(
const Matrix<MT2,SO2>& rhs )
4224 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<MT2>,
const MT2& >;
4225 Right right( ~rhs );
4227 if( IsRestricted_v<MT> ) {
4228 for(
size_t j=0UL; j<
columns(); ++j ) {
4235 decltype(
auto) left( derestrict( *this ) );
4241 if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4242 const ResultType_t<MT2> tmp( right );
4271 template<
typename MT
4272 ,
typename... CCAs >
4273 template<
typename MT2
4276 -> DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
4285 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4294 if( IsRestricted_v<MT> ) {
4295 for(
size_t j=0UL; j<
columns(); ++j ) {
4302 decltype(
auto) left( derestrict( *this ) );
4304 if( (~rhs).canAlias( &matrix_ ) ) {
4305 const AddType tmp( *
this + (~rhs) );
4334 template<
typename MT
4335 ,
typename... CCAs >
4336 template<
typename MT2
4339 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
4348 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4357 const AddType tmp( *
this + (~rhs) );
4359 if( IsRestricted_v<MT> ) {
4360 for(
size_t j=0UL; j<
columns(); ++j ) {
4367 decltype(
auto) left( derestrict( *this ) );
4393 template< typename MT
4394 , typename... CCAs >
4395 template< typename MT2
4397 inline auto Columns<MT,false,true,false,CCAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
4398 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
4407 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4416 if( IsRestricted_v<MT> ) {
4417 for(
size_t j=0UL; j<
columns(); ++j ) {
4424 decltype(
auto) left( derestrict( *this ) );
4426 if( (~rhs).canAlias( &matrix_ ) ) {
4427 const SubType tmp( *
this - (~rhs ) );
4456 template<
typename MT
4457 ,
typename... CCAs >
4458 template<
typename MT2
4461 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
4470 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4479 const SubType tmp( *
this - (~rhs) );
4481 if( IsRestricted_v<MT> ) {
4482 for(
size_t j=0UL; j<
columns(); ++j ) {
4489 decltype(
auto) left( derestrict( *this ) );
4515 template< typename MT
4516 , typename... CCAs >
4517 template< typename MT2
4519 inline auto Columns<MT,false,true,false,CCAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
4520 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
4529 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4537 if( IsRestricted_v<MT> ) {
4538 for(
size_t j=0UL; j<
columns(); ++j ) {
4545 decltype(
auto) left( derestrict( *this ) );
4547 if( (~rhs).canAlias( &matrix_ ) ) {
4548 const SchurType tmp( *
this % (~rhs) );
4549 if( IsSparseMatrix_v<SchurType> )
4579 template<
typename MT
4580 ,
typename... CCAs >
4581 template<
typename MT2
4583 inline auto Columns<MT,false,true,false,CCAs...>::operator%=(
const Matrix<MT2,SO2>& rhs )
4584 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Columns& >
4593 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4601 const SchurType tmp( *
this % (~rhs) );
4603 if( IsRestricted_v<MT> ) {
4604 for(
size_t j=0UL; j<
columns(); ++j ) {
4611 decltype(
auto) left( derestrict( *this ) );
4641 template<
typename MT
4642 ,
typename... CCAs >
4643 inline MT& Columns<MT,false,true,false,CCAs...>::operand() noexcept
4657 template<
typename MT
4658 ,
typename... CCAs >
4659 inline const MT& Columns<MT,false,true,false,CCAs...>::operand() const noexcept
4673 template<
typename MT
4674 ,
typename... CCAs >
4677 return matrix_.rows();
4692 template<
typename MT
4693 ,
typename... CCAs >
4696 return matrix_.rows();
4708 template<
typename MT
4709 ,
typename... CCAs >
4727 template<
typename MT
4728 ,
typename... CCAs >
4747 template<
typename MT
4748 ,
typename... CCAs >
4751 size_t nonzeros( 0UL );
4753 for(
size_t j=0UL; j<
columns(); ++j ) {
4772 template<
typename MT
4773 ,
typename... CCAs >
4778 size_t nonzeros( 0UL );
4780 const size_t index( idx(j) );
4781 for(
size_t i=0UL; i<
rows(); ++i ) {
4798 template<
typename MT
4799 ,
typename... CCAs >
4802 for(
size_t j=0UL; j<
columns(); ++j ) {
4819 template<
typename MT
4820 ,
typename... CCAs >
4825 const size_t index( idx(j) );
4826 for(
size_t i=0UL; i<
rows(); ++i ) {
4827 reset( matrix_( i, index ) );
4855 template<
typename MT
4856 ,
typename... CCAs >
4857 inline Columns<MT,
false,
true,
false,CCAs...>&
4867 const ResultType tmp(
trans( *
this ) );
4869 if( IsRestricted_v<MT> ) {
4870 for(
size_t j=0UL; j<
columns(); ++j ) {
4871 if( !tryAssign( matrix_,
column( tmp, j ), 0UL, idx(j) ) ) {
4877 decltype(
auto) left( derestrict( *this ) );
4900 template< typename MT
4901 , typename... CCAs >
4902 inline Columns<MT,false,true,false,CCAs...>&
4903 Columns<MT,false,true,false,CCAs...>::
ctranspose()
4912 const ResultType tmp(
ctrans( *
this ) );
4914 if( IsRestricted_v<MT> ) {
4915 for(
size_t j=0UL; j<
columns(); ++j ) {
4916 if( !tryAssign( matrix_,
column( tmp, j ), 0UL, idx(j) ) ) {
4922 decltype(
auto) left( derestrict( *this ) );
4945 template< typename MT
4946 , typename... CCAs >
4947 template< typename Other >
4948 inline Columns<MT,false,true,false,CCAs...>&
4949 Columns<MT,false,true,false,CCAs...>::scale( const Other& scalar )
4955 for(
size_t j=0UL; j<
columns(); ++j )
4957 const size_t index ( idx(j) );
4958 const size_t ibegin( IsLower<MT>::value ? ( IsStrictlyLower_v<MT> ? index+1UL : index ) : 0UL );
4959 const size_t iend ( IsUpper<MT>::value ? ( IsStrictlyUpper_v<MT> ? index : index+1UL ) :
rows() );
4961 for(
size_t i=ibegin; i<iend; ++i ) {
4962 matrix_(i,index) *= scalar;
4991 template<
typename MT
4992 ,
typename... CCAs >
4993 template<
typename Other >
4994 inline bool Columns<MT,false,true,false,CCAs...>::canAlias(
const Other* alias )
const noexcept
4996 return matrix_.isAliased( alias );
5014 template<
typename MT
5015 ,
typename... CCAs >
5016 template<
typename MT2
5019 ,
typename... CCAs2 >
5021 Columns<MT,false,true,false,CCAs...>::canAlias(
const Columns<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
5023 return matrix_.isAliased( &alias->matrix_ );
5040 template<
typename MT
5041 ,
typename... CCAs >
5042 template<
typename Other >
5043 inline bool Columns<MT,false,true,false,CCAs...>::isAliased(
const Other* alias )
const noexcept
5045 return matrix_.isAliased( alias );
5063 template<
typename MT
5064 ,
typename... CCAs >
5065 template<
typename MT2
5068 ,
typename... CCAs2 >
5070 Columns<MT,false,true,false,CCAs...>::isAliased(
const Columns<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
5072 return matrix_.isAliased( &alias->matrix_ );
5088 template<
typename MT
5089 ,
typename... CCAs >
5090 inline bool Columns<MT,false,true,false,CCAs...>::isAligned() const noexcept
5109 template<
typename MT
5110 ,
typename... CCAs >
5111 inline bool Columns<MT,false,true,false,CCAs...>::canSMPAssign() const noexcept
5113 return (
rows() *
columns() > SMP_DMATASSIGN_THRESHOLD );
5131 template<
typename MT
5132 ,
typename... CCAs >
5133 template<
typename MT2 >
5134 inline void Columns<MT,false,true,false,CCAs...>::assign(
const DenseMatrix<MT2,true>& rhs )
5142 const size_t ipos(
rows() &
size_t(-2) );
5145 for(
size_t j=0UL; j<
columns(); ++j ) {
5146 const size_t index( idx(j) );
5147 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5148 matrix_(i ,index) = (~rhs)(i ,j);
5149 matrix_(i+1UL,index) = (~rhs)(i+1UL,j);
5151 if( ipos <
rows() ) {
5152 matrix_(ipos,index) = (~rhs)(ipos,j);
5172 template<
typename MT
5173 ,
typename... CCAs >
5174 template<
typename MT2 >
5175 inline void Columns<MT,false,true,false,CCAs...>::assign(
const DenseMatrix<MT2,false>& rhs )
5185 constexpr
size_t block( BLOCK_SIZE );
5189 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
5190 for(
size_t j=0UL; j<
columns(); ++j ) {
5191 const size_t index( idx(j) );
5192 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5193 matrix_(i ,index) = (~rhs)(i ,j);
5194 matrix_(i+1UL,index) = (~rhs)(i+1UL,j);
5196 if( ipos < (~rhs).rows() ) {
5197 matrix_(ipos,index) = (~rhs)(ipos,j);
5203 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5204 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5205 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5206 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5207 for(
size_t j=jj; j<jend; ++j ) {
5208 const size_t index( idx(j) );
5209 for(
size_t i=ii; i<iend; ++i ) {
5210 matrix_(i,index) = (~rhs)(i,j);
5233 template<
typename MT
5234 ,
typename... CCAs >
5235 template<
typename MT2 >
5236 inline void Columns<MT,false,true,false,CCAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
5244 for(
size_t j=0UL; j<
columns(); ++j ) {
5245 const size_t index( idx(j) );
5246 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
5247 matrix_(element->index(),index) = element->value();
5266 template<
typename MT
5267 ,
typename... CCAs >
5268 template<
typename MT2 >
5269 inline void Columns<MT,false,true,false,CCAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
5279 for(
size_t i=0UL; i<
rows(); ++i ) {
5280 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5281 matrix_(i,idx(element->index())) = element->value();
5300 template<
typename MT
5301 ,
typename... CCAs >
5302 template<
typename MT2 >
5303 inline void Columns<MT,false,true,false,CCAs...>::addAssign(
const DenseMatrix<MT2,true>& rhs )
5311 const size_t ipos(
rows() &
size_t(-2) );
5314 for(
size_t j=0UL; j<
columns(); ++j )
5316 const size_t index( idx(j) );
5317 if( IsDiagonal_v<MT2> ) {
5318 matrix_(j,index) += (~rhs)(j,j);
5321 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5322 matrix_(i ,index) += (~rhs)(i ,j);
5323 matrix_(i+1UL,index) += (~rhs)(i+1UL,j);
5325 if( ipos <
rows() ) {
5326 matrix_(ipos,index) += (~rhs)(ipos,j);
5347 template<
typename MT
5348 ,
typename... CCAs >
5349 template<
typename MT2 >
5350 inline void Columns<MT,false,true,false,CCAs...>::addAssign(
const DenseMatrix<MT2,false>& rhs )
5360 constexpr
size_t block( BLOCK_SIZE );
5364 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
5365 for(
size_t j=0UL; j<
columns(); ++j ) {
5366 const size_t index( idx(j) );
5367 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5368 matrix_(i ,index) += (~rhs)(i ,j);
5369 matrix_(i+1UL,index) += (~rhs)(i+1UL,j);
5371 if( ipos < (~rhs).rows() )
5372 matrix_(ipos,index) += (~rhs)(ipos,j);
5377 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5378 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5379 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5380 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5381 for(
size_t j=jj; j<jend; ++j ) {
5382 const size_t index( idx(j) );
5383 for(
size_t i=ii; i<iend; ++i ) {
5384 matrix_(i,index) += (~rhs)(i,j);
5407 template<
typename MT
5408 ,
typename... CCAs >
5409 template<
typename MT2 >
5410 inline void Columns<MT,false,true,false,CCAs...>::addAssign(
const SparseMatrix<MT2,true>& rhs )
5418 for(
size_t j=0UL; j<
columns(); ++j ) {
5419 const size_t index( idx(j) );
5420 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
5421 matrix_(element->index(),index) += element->value();
5440 template<
typename MT
5441 ,
typename... CCAs >
5442 template<
typename MT2 >
5443 inline void Columns<MT,false,true,false,CCAs...>::addAssign(
const SparseMatrix<MT2,false>& rhs )
5453 for(
size_t i=0UL; i<
rows(); ++i ) {
5454 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5455 matrix_(i,idx(element->index())) += element->value();
5474 template<
typename MT
5475 ,
typename... CCAs >
5476 template<
typename MT2 >
5477 inline void Columns<MT,false,true,false,CCAs...>::subAssign(
const DenseMatrix<MT2,true>& rhs )
5485 const size_t ipos(
rows() &
size_t(-2) );
5488 for(
size_t j=0UL; j<
columns(); ++j )
5490 const size_t index( idx(j) );
5492 if( IsDiagonal_v<MT2> ) {
5493 matrix_(j,index) -= (~rhs)(j,j);
5496 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5497 matrix_(i ,index) -= (~rhs)(i ,j);
5498 matrix_(i+1UL,index) -= (~rhs)(i+1UL,j);
5500 if( ipos <
rows() ) {
5501 matrix_(ipos,index) -= (~rhs)(ipos,j);
5522 template<
typename MT
5523 ,
typename... CCAs >
5524 template<
typename MT2 >
5525 inline void Columns<MT,false,true,false,CCAs...>::subAssign(
const DenseMatrix<MT2,false>& rhs )
5535 constexpr
size_t block( BLOCK_SIZE );
5539 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
5540 for(
size_t j=0UL; j<
columns(); ++j ) {
5541 const size_t index( idx(j) );
5542 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5543 matrix_(i ,index) -= (~rhs)(i ,j);
5544 matrix_(i+1UL,index) -= (~rhs)(i+1UL,j);
5546 if( ipos < (~rhs).rows() )
5547 matrix_(ipos,index) -= (~rhs)(ipos,j);
5552 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5553 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5554 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5555 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5556 for(
size_t j=jj; j<jend; ++j ) {
5557 const size_t index( idx(j) );
5558 for(
size_t i=ii; i<iend; ++i ) {
5559 matrix_(i,index) -= (~rhs)(i,j);
5582 template<
typename MT
5583 ,
typename... CCAs >
5584 template<
typename MT2 >
5585 inline void Columns<MT,false,true,false,CCAs...>::subAssign(
const SparseMatrix<MT2,true>& rhs )
5593 for(
size_t j=0UL; j<
columns(); ++j ) {
5594 const size_t index( idx(j) );
5595 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
5596 matrix_(element->index(),index) -= element->value();
5615 template<
typename MT
5616 ,
typename... CCAs >
5617 template<
typename MT2 >
5618 inline void Columns<MT,false,true,false,CCAs...>::subAssign(
const SparseMatrix<MT2,false>& rhs )
5628 for(
size_t i=0UL; i<
rows(); ++i ) {
5629 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
5630 matrix_(i,idx(element->index())) -= element->value();
5649 template<
typename MT
5650 ,
typename... CCAs >
5651 template<
typename MT2 >
5652 inline void Columns<MT,false,true,false,CCAs...>::schurAssign(
const DenseMatrix<MT2,true>& rhs )
5660 const size_t ipos(
rows() &
size_t(-2) );
5663 for(
size_t j=0UL; j<
columns(); ++j ) {
5664 const size_t index( idx(j) );
5665 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5666 matrix_(i ,index) *= (~rhs)(i ,j);
5667 matrix_(i+1UL,index) *= (~rhs)(i+1UL,j);
5669 if( ipos <
rows() ) {
5670 matrix_(ipos,index) *= (~rhs)(ipos,j);
5690 template<
typename MT
5691 ,
typename... CCAs >
5692 template<
typename MT2 >
5693 inline void Columns<MT,false,true,false,CCAs...>::schurAssign(
const DenseMatrix<MT2,false>& rhs )
5703 constexpr
size_t block( BLOCK_SIZE );
5707 const size_t ipos( (~rhs).
rows() &
size_t(-2) );
5708 for(
size_t j=0UL; j<
columns(); ++j ) {
5709 const size_t index( idx(j) );
5710 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5711 matrix_(i ,index) *= (~rhs)(i ,j);
5712 matrix_(i+1UL,index) *= (~rhs)(i+1UL,j);
5714 if( ipos < (~rhs).rows() )
5715 matrix_(ipos,index) *= (~rhs)(ipos,j);
5720 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5721 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5722 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5723 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5724 for(
size_t j=jj; j<jend; ++j ) {
5725 const size_t index( idx(j) );
5726 for(
size_t i=ii; i<iend; ++i ) {
5727 matrix_(i,index) *= (~rhs)(i,j);
5750 template<
typename MT
5751 ,
typename... CCAs >
5752 template<
typename MT2 >
5753 inline void Columns<MT,false,true,false,CCAs...>::schurAssign(
const SparseMatrix<MT2,true>& rhs )
5763 for(
size_t j=0UL; j<
columns(); ++j )
5765 const size_t index( idx(j) );
5768 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
5769 for( ; i<element->index(); ++i )
5770 reset( matrix_(i,index) );
5771 matrix_(i,index) *= element->value();
5775 for( ; i<
rows(); ++i ) {
5776 reset( matrix_(i,index) );
5796 template<
typename MT
5797 ,
typename... CCAs >
5798 template<
typename MT2 >
5799 inline void Columns<MT,false,true,false,CCAs...>::schurAssign(
const SparseMatrix<MT2,false>& rhs )
5811 for(
size_t i=0UL; i<
rows(); ++i )
5815 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
5816 for( ; j<element->index(); ++j )
5817 reset( matrix_(i,idx(j)) );
5818 matrix_(i,idx(j)) *= element->value();
5823 reset( matrix_(i,idx(j)) );
5851 template<
typename MT
5852 ,
typename... CCAs >
5853 class Columns<MT,false,true,true,CCAs...>
5854 :
public View< DenseMatrix< Columns<MT,false,true,true,CCAs...>, true > >
5855 ,
private ColumnsData<CCAs...>
5859 using DataType = ColumnsData<CCAs...>;
5860 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
5864 static constexpr
size_t N =
sizeof...( CCAs );
5870 using This = Columns<MT,
false,
true,
true,CCAs...>;
5872 using BaseType = DenseMatrix<This,true>;
5873 using ViewedType = MT;
5874 using ResultType = ColumnsTrait_t<MT,N>;
5875 using OppositeType = OppositeType_t<ResultType>;
5876 using TransposeType = TransposeType_t<ResultType>;
5877 using ElementType = ElementType_t<MT>;
5878 using SIMDType = SIMDTrait_t<ElementType>;
5879 using ReturnType = ReturnType_t<MT>;
5880 using CompositeType =
const Columns&;
5883 using ConstReference = ConstReference_t<MT>;
5886 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
5889 using ConstPointer = ConstPointer_t<MT>;
5892 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
5895 using ConstIterator = ConstIterator_t<MT>;
5898 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
5903 static constexpr
bool simdEnabled = MT::simdEnabled;
5906 static constexpr
bool smpAssignable = MT::smpAssignable;
5909 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
5915 template<
typename... RCAs >
5916 explicit inline Columns( MT& matrix, RCAs... args );
5918 Columns(
const Columns& ) =
default;
5919 Columns( Columns&& ) =
default;
5926 ~Columns() =
default;
5933 inline Reference operator()(
size_t i,
size_t j );
5934 inline ConstReference operator()(
size_t i,
size_t j )
const;
5935 inline Reference at(
size_t i,
size_t j );
5936 inline ConstReference at(
size_t i,
size_t j )
const;
5937 inline Pointer
data () noexcept;
5938 inline ConstPointer
data () const noexcept;
5939 inline Pointer
data (
size_t j ) noexcept;
5940 inline ConstPointer
data (
size_t j ) const noexcept;
5941 inline Iterator
begin (
size_t j );
5942 inline ConstIterator
begin (
size_t j ) const;
5943 inline ConstIterator
cbegin(
size_t j ) const;
5944 inline Iterator
end (
size_t j );
5945 inline ConstIterator
end (
size_t j ) const;
5946 inline ConstIterator
cend (
size_t j ) const;
5953 inline Columns& operator=( const ElementType& rhs );
5955 Columns& operator=( const Columns& ) = delete;
5962 using DataType::idx;
5963 using DataType::idces;
5966 inline MT& operand() noexcept;
5967 inline const MT& operand() const noexcept;
5969 inline
size_t rows() const noexcept;
5970 inline
size_t spacing() const noexcept;
5971 inline
size_t capacity() const noexcept;
5972 inline
size_t capacity(
size_t j ) const noexcept;
5974 inline
size_t nonZeros(
size_t j ) const;
5975 inline
void reset();
5976 inline
void reset(
size_t j );
5983 template< typename Other >
5984 inline
bool canAlias( const Other* alias ) const noexcept;
5986 template< typename MT2,
bool SO2,
bool SF2, typename... CCAs2 >
5987 inline
bool canAlias( const Columns<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
5989 template< typename Other >
5990 inline
bool isAliased( const Other* alias ) const noexcept;
5992 template< typename MT2,
bool SO2,
bool SF2, typename... CCAs2 >
5993 inline
bool isAliased( const Columns<MT2,SO2,true,SF2,CCAs2...>* alias ) const noexcept;
5995 inline
bool isAligned () const noexcept;
5996 inline
bool canSMPAssign() const noexcept;
6013 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename... CCAs2 > friend class Columns;
6053 template< typename MT
6054 , typename... CCAs >
6055 template< typename... RCAs >
6056 inline Columns<MT,false,true,true,CCAs...>::Columns( MT& matrix, RCAs... args )
6057 : DataType( args... )
6058 , matrix_ ( matrix )
6061 for(
size_t j=0UL; j<
columns(); ++j ) {
6062 if( matrix_.columns() <= idx(j) ) {
6091 template<
typename MT
6092 ,
typename... CCAs >
6093 inline typename Columns<MT,
false,
true,
true,CCAs...>::Reference
6094 Columns<MT,false,true,true,CCAs...>::operator()(
size_t i,
size_t j )
6099 return matrix_(idx(j),i);
6116 template<
typename MT
6117 ,
typename... CCAs >
6118 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstReference
6119 Columns<MT,false,true,true,CCAs...>::operator()(
size_t i,
size_t j )
const 6124 return const_cast<const MT&>( matrix_ )(idx(j),i);
6142 template<
typename MT
6143 ,
typename... CCAs >
6144 inline typename Columns<MT,
false,
true,
true,CCAs...>::Reference
6145 Columns<MT,false,true,true,CCAs...>::at(
size_t i,
size_t j )
6153 return (*
this)(i,j);
6171 template<
typename MT
6172 ,
typename... CCAs >
6173 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstReference
6174 Columns<MT,false,true,true,CCAs...>::at(
size_t i,
size_t j )
const 6182 return (*
this)(i,j);
6198 template<
typename MT
6199 ,
typename... CCAs >
6200 inline typename Columns<MT,
false,
true,
true,CCAs...>::Pointer
6203 return matrix_.data( idx(0UL) );
6219 template<
typename MT
6220 ,
typename... CCAs >
6221 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstPointer
6224 return matrix_.data( idx(0UL) );
6239 template<
typename MT
6240 ,
typename... CCAs >
6241 inline typename Columns<MT,
false,
true,
true,CCAs...>::Pointer
6244 return matrix_.data( idx(j) );
6259 template<
typename MT
6260 ,
typename... CCAs >
6261 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstPointer
6264 return matrix_.data( idx(j) );
6279 template<
typename MT
6280 ,
typename... CCAs >
6281 inline typename Columns<MT,
false,
true,
true,CCAs...>::Iterator
6285 return matrix_.begin( idx(j) );
6300 template<
typename MT
6301 ,
typename... CCAs >
6302 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstIterator
6306 return matrix_.cbegin( idx(j) );
6321 template<
typename MT
6322 ,
typename... CCAs >
6323 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstIterator
6327 return matrix_.cbegin( idx(j) );
6342 template<
typename MT
6343 ,
typename... CCAs >
6344 inline typename Columns<MT,
false,
true,
true,CCAs...>::Iterator
6348 return matrix_.end( idx(j) );
6363 template<
typename MT
6364 ,
typename... CCAs >
6365 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstIterator
6369 return matrix_.cend( idx(j) );
6384 template<
typename MT
6385 ,
typename... CCAs >
6386 inline typename Columns<MT,
false,
true,
true,CCAs...>::ConstIterator
6390 return matrix_.cend( idx(j) );
6415 template<
typename MT
6416 ,
typename... CCAs >
6417 inline Columns<MT,
false,
true,
true,CCAs...>&
6418 Columns<MT,false,true,true,CCAs...>::operator=(
const ElementType& rhs )
6420 for(
size_t j=0UL; j<
columns(); ++j ) {
6444 template<
typename MT
6445 ,
typename... CCAs >
6446 inline MT& Columns<MT,false,true,true,CCAs...>::operand() noexcept
6460 template<
typename MT
6461 ,
typename... CCAs >
6462 inline const MT& Columns<MT,false,true,true,CCAs...>::operand() const noexcept
6476 template<
typename MT
6477 ,
typename... CCAs >
6480 return matrix_.rows();
6495 template<
typename MT
6496 ,
typename... CCAs >
6499 return matrix_.spacing();
6511 template<
typename MT
6512 ,
typename... CCAs >
6530 template<
typename MT
6531 ,
typename... CCAs >
6550 template<
typename MT
6551 ,
typename... CCAs >
6554 size_t nonzeros( 0UL );
6556 for(
size_t j=0UL; j<
columns(); ++j ) {
6557 nonzeros += matrix_.nonZeros( idx(j) );
6575 template<
typename MT
6576 ,
typename... CCAs >
6581 return matrix_.nonZeros( idx(j) );
6593 template<
typename MT
6594 ,
typename... CCAs >
6597 for(
size_t j=0UL; j<
columns(); ++j ) {
6598 matrix_.reset( idx(j) );
6614 template<
typename MT
6615 ,
typename... CCAs >
6618 matrix_.reset( idx(j) );
6641 template<
typename MT
6642 ,
typename... CCAs >
6643 template<
typename Other >
6644 inline bool Columns<MT,false,true,true,CCAs...>::canAlias(
const Other* alias )
const noexcept
6646 return matrix_.isAliased( alias );
6664 template<
typename MT
6665 ,
typename... CCAs >
6666 template<
typename MT2
6669 ,
typename... CCAs2 >
6671 Columns<MT,false,true,true,CCAs...>::canAlias(
const Columns<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
6673 return matrix_.isAliased( &alias->matrix_ );
6690 template<
typename MT
6691 ,
typename... CCAs >
6692 template<
typename Other >
6693 inline bool Columns<MT,false,true,true,CCAs...>::isAliased(
const Other* alias )
const noexcept
6695 return matrix_.isAliased( alias );
6713 template<
typename MT
6714 ,
typename... CCAs >
6715 template<
typename MT2
6718 ,
typename... CCAs2 >
6720 Columns<MT,false,true,true,CCAs...>::isAliased(
const Columns<MT2,SO2,true,SF2,CCAs2...>* alias )
const noexcept
6722 return matrix_.isAliased( &alias->matrix_ );
6738 template<
typename MT
6739 ,
typename... CCAs >
6740 inline bool Columns<MT,false,true,true,CCAs...>::isAligned() const noexcept
6742 return matrix_.isAligned();
6759 template<
typename MT
6760 ,
typename... CCAs >
6761 inline bool Columns<MT,false,true,true,CCAs...>::canSMPAssign() const noexcept
6763 return (
rows() *
columns() > SMP_DMATASSIGN_THRESHOLD );
6784 template<
typename MT
6785 ,
typename... CCAs >
6787 Columns<MT,false,true,true,CCAs...>::load(
size_t i,
size_t j )
const noexcept
6789 return matrix_.load( idx(j), i );
6810 template<
typename MT
6811 ,
typename... CCAs >
6815 return matrix_.loada( idx(j), i );
6836 template<
typename MT
6837 ,
typename... CCAs >
6841 return matrix_.loadu( idx(j), i );
Constraint on the data type.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
Header file for the implementation of the Columns base template.
Header file for kernel specific block sizes.
Header file for the Schur product trait.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:170
Header file for the View base class.
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
Header file for the IsSparseMatrix type trait.
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:81
#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:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
#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....
Definition: Submatrix.h:81
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
#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:81
Header file for the MAYBE_UNUSED function template.
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type,...
Definition: Symmetric.h:60
Header file for the reset shim.
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:187
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:81
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the RequiresEvaluation type trait.
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Constraint on the data type.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:253
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1361
Header file for the If class template.
#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:61
decltype(auto) operator *(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9091
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:187
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
Header file for the DenseMatrix base class.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:446
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
Header file for all SIMD functionality.
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
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:61
Header file for the exception macros of the math module.
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:438
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COLUMNS_TYPE(T)
Constraint on the data type.In case the given data type T is a column selection type (i....
Definition: Columns.h:81
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
Header file for the IsSIMDCombinable type trait.
#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,...
Definition: Symmetric.h:79
#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:61
Header file for the HasSIMDMult type trait.
Header file for the IsConst type trait.
Header file for run time assertion macros.
Header file for the addition trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance,...
Definition: Check.h:96
Header file for the columns trait.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Header file for the cache size of the target architecture.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type,...
Definition: Reference.h:79
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Constraint on the data type.
Constraint on the data type.
Header file for the HasSIMDSub type trait.
Constraints on the storage order of matrix types.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
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:81
Header file for the IsReference type trait.
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Header file for the implementation of the ColumnsData class template.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:188
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type,...
Definition: Hermitian.h:79
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)
Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Bla...
Definition: Exception.h:187
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.The IsDiagonal_v variable template provides...
Definition: IsDiagonal.h:148
Header file for the IsRestricted type trait.
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
constexpr bool IsSparseMatrix_v
Auxiliary variable template for the IsSparseMatrix type trait.The IsSparseMatrix_v variable template ...
Definition: IsSparseMatrix.h:138
Header file for the IsExpression type trait class.
Constraint on the data type.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825