35 #ifndef _BLAZE_MATH_VIEWS_COLUMNS_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMNS_H_ 156 return ReturnType( ~matrix, args... );
205 using ReturnType =
const Columns_<
const MT,
index_sequence<I,Is...> >;
206 return ReturnType( ~matrix, args... );
235 return ReturnType( ~matrix, args... );
279 template<
typename MT
283 inline decltype(
auto)
columns(
Matrix<MT,SO>& matrix, T* indices,
size_t n, RCAs... args )
287 using ReturnType = Columns_<MT>;
288 return ReturnType( ~matrix, indices, n, args... );
333 template<
typename MT
337 inline decltype(
auto)
columns( const
Matrix<MT,SO>& matrix, T* indices,
size_t n, RCAs... args )
341 using ReturnType =
const Columns_<const MT>;
342 return ReturnType( ~matrix, indices, n, args... );
362 template<
typename MT
366 inline decltype(
auto)
columns(
Matrix<MT,SO>&& matrix, T* indices,
size_t n, RCAs... args )
370 using ReturnType = Columns_<MT>;
371 return ReturnType( ~matrix, indices, n, args... );
413 template<
typename MT
417 inline decltype(
auto)
columns(
Matrix<MT,SO>& matrix, P p,
size_t n, RCAs... args )
421 using ReturnType = Columns_<MT,P>;
422 return ReturnType( ~matrix, p, n, args... );
466 template<
typename MT
470 inline decltype(
auto)
columns( const
Matrix<MT,SO>& matrix, P p,
size_t n, RCAs... args )
474 using ReturnType =
const Columns_<const MT,P>;
475 return ReturnType( ~matrix, p, n, args... );
495 template<
typename MT
499 inline decltype(
auto)
columns(
Matrix<MT,SO>&& matrix, P p,
size_t n, RCAs... args )
503 using ReturnType = Columns_<MT,P>;
504 return ReturnType( ~matrix, p, n, args... );
546 template<
typename MT
555 return columns<Is...>( std::forward<MT>( matrix ), args... );
596 template<
typename MT
603 return columns( std::forward<MT>( matrix ), indices.begin(), indices.size(), args... );
646 template<
typename MT
650 inline decltype(
auto)
columns( MT&& matrix, const std::array<T,N>& indices, RCAs... args )
654 return columns( std::forward<MT>( matrix ), indices.data(), N, args... );
697 template<
typename MT
700 inline decltype(
auto)
columns( MT&& matrix, const std::vector<T>& indices, RCAs... args )
704 return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
748 template<
typename MT
752 inline decltype(
auto)
columns( MT&& matrix, const SmallArray<T,N>& indices, RCAs... args )
756 return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
778 template<
typename MT
782 inline decltype(
auto)
columns( MT&& matrix, const std::pair<T1,T2>& pair, RRAs... args )
786 return columns( std::forward<MT>( matrix ), pair.first, pair.second, args... );
812 template<
size_t... CCAs
815 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
816 inline decltype(
auto)
columns( const MatMatAddExpr<MT>& matrix, RCAs... args )
820 return columns<CCAs...>( (~matrix).leftOperand(), args... ) +
821 columns<CCAs...>( (~matrix).rightOperand(), args... );
839 template<
size_t... CCAs
842 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
843 inline decltype(
auto)
columns( const MatMatSubExpr<MT>& matrix, RCAs... args )
847 return columns<CCAs...>( (~matrix).leftOperand(), args... ) -
848 columns<CCAs...>( (~matrix).rightOperand(), args... );
866 template<
size_t... CCAs
869 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
870 inline decltype(
auto)
columns( const SchurExpr<MT>& matrix, RCAs... args )
874 return columns<CCAs...>( (~matrix).leftOperand(), args... ) %
875 columns<CCAs...>( (~matrix).rightOperand(), args... );
893 template<
size_t... CCAs
896 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
897 inline decltype(
auto)
columns( const MatMatMultExpr<MT>& matrix, RCAs... args )
901 return (~matrix).leftOperand() *
columns<CCAs...>( (~matrix).rightOperand(), args... );
923 inline decltype(
auto)
columns( const MatMatKronExpr<MT>& matrix, RCAs... args )
927 decltype(
auto) lhs( (~matrix).leftOperand() );
928 decltype(auto) rhs( (~matrix).rightOperand() );
930 const
size_t M( rhs.
rows() );
931 const
size_t N( rhs.
columns() );
933 const auto lhsRows( [M](
size_t i ){
return i / M; } );
934 const auto rhsRows( [M](
size_t i ){
return i % M; } );
936 const auto lhsColumns( [N](
size_t i ) {
937 static constexpr
size_t indices[] = { I, Is... };
938 return indices[i] / N;
941 const auto rhsColumns( [N](
size_t i ) {
942 static constexpr
size_t indices[] = { I, Is... };
943 return indices[i] % N;
946 return columns(
rows( lhs, lhsRows, (~matrix).
rows(), args... ), lhsColumns,
sizeof...(Is)+1UL, args... ) %
947 columns(
rows( rhs, rhsRows, (~matrix).
rows(), args... ), rhsColumns,
sizeof...(Is)+1UL, args... );
967 template<
typename MT
970 inline decltype(
auto)
columns( const MatMatKronExpr<MT>& matrix, T* indices,
size_t n, RCAs... args )
974 decltype(
auto) lhs( (~matrix).leftOperand() );
975 decltype(auto) rhs( (~matrix).rightOperand() );
977 const
size_t M( rhs.
rows() );
978 const
size_t N( rhs.
columns() );
980 const auto lhsRows( [M](
size_t i ){
return i / M; } );
981 const auto rhsRows( [M](
size_t i ){
return i % M; } );
983 SmallArray<size_t,128UL> lhsColumns;
984 lhsColumns.reserve( n );
986 for(
size_t i=0UL; i<n; ++i ) {
987 lhsColumns.pushBack( indices[i] / N );
990 SmallArray<size_t,128UL> rhsColumns;
991 rhsColumns.reserve( n );
993 for(
size_t i=0UL; i<n; ++i ) {
994 rhsColumns.pushBack( indices[i] % N );
997 return columns(
rows( lhs, lhsRows, (~matrix).
rows(), args... ), lhsColumns, n, args... ) %
998 columns(
rows( rhs, rhsRows, (~matrix).
rows(), args... ), rhsColumns, n, args... );
1018 template<
typename MT
1020 ,
typename... RCAs >
1021 inline decltype(
auto)
columns( const MatMatKronExpr<MT>& matrix, P p,
size_t n, RCAs... args )
1025 decltype(
auto) lhs( (~matrix).leftOperand() );
1026 decltype(auto) rhs( (~matrix).rightOperand() );
1028 const
size_t M( rhs.
rows() );
1029 const
size_t N( rhs.
columns() );
1031 const auto lhsRows( [M](
size_t i ){
return i / M; } );
1032 const auto rhsRows( [M](
size_t i ){
return i % M; } );
1034 const auto lhsColumns( [p,N](
size_t i ) {
return p(i) / N; } );
1035 const auto rhsColumns( [p,N](
size_t i ) {
return p(i) % N; } );
1037 return columns(
rows( lhs, lhsRows, (~matrix).
rows(), args... ), lhsColumns, n, args... ) %
1038 columns(
rows( rhs, rhsRows, (~matrix).
rows(), args... ), rhsColumns, n, args... );
1056 template<
size_t... CCAs
1059 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1060 inline decltype(
auto)
columns( const VecTVecMultExpr<MT>& matrix, RCAs... args )
1064 return (~matrix).leftOperand() *
elements<CCAs...>( (~matrix).rightOperand(), args... );
1082 template<
size_t... CCAs
1085 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1086 inline decltype(
auto)
columns( const MatScalarMultExpr<MT>& matrix, RCAs... args )
1090 return columns<CCAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
1108 template<
size_t... CCAs
1111 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1112 inline decltype(
auto)
columns( const MatScalarDivExpr<MT>& matrix, RCAs... args )
1116 return columns<CCAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
1134 template<
size_t... CCAs
1137 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1138 inline decltype(
auto)
columns( const MatMapExpr<MT>& matrix, RCAs... args )
1142 return map( columns<CCAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
1160 template<
size_t... CCAs
1163 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1164 inline decltype(
auto)
columns( const MatMatMapExpr<MT>& matrix, RCAs... args )
1168 return map( columns<CCAs...>( (~matrix).leftOperand(), args... ),
1169 columns<CCAs...>( (~matrix).rightOperand(), args... ),
1170 (~matrix).operation() );
1188 template<
size_t... CCAs
1191 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1192 inline decltype(
auto)
columns( const MatEvalExpr<MT>& matrix, RCAs... args )
1196 return eval( columns<CCAs...>( (~matrix).operand(), args... ) );
1214 template<
size_t... CCAs
1217 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1218 inline decltype(
auto)
columns( const MatSerialExpr<MT>& matrix, RCAs... args )
1222 return serial( columns<CCAs...>( (~matrix).operand(), args... ) );
1240 template<
size_t... CCAs
1243 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1244 inline decltype(
auto)
columns( const DeclExpr<MT>& matrix, RCAs... args )
1248 return columns<CCAs...>( (~matrix).operand(), args... );
1266 template<
size_t... CCAs
1269 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1270 inline decltype(
auto)
columns( const MatTransExpr<MT>& matrix, RCAs... args )
1274 return trans( rows<CCAs...>( (~matrix).operand(), args... ) );
1293 template<
size_t... CCAs
1298 IsColumnMajorMatrix_v<MT> >* =
nullptr >
1299 inline decltype(
auto)
columns( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
1305 return expand<
sizeof...( CCAs ) >( (~matrix).operand() );
1326 template<
typename MT
1330 , EnableIf_t< IsColumnMajorMatrix_v<MT> >* =
nullptr >
1331 inline decltype(
auto)
columns( const VecExpandExpr<MT,CEAs...>& matrix, T indices,
size_t n, RCAs... args )
1337 return expand( (~matrix).operand(), n );
1355 template<
size_t... CCAs
1359 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) &&
1360 !IsColumnMajorMatrix_v<MT> >* =
nullptr >
1361 inline decltype(
auto)
columns( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
1365 return expand<CEAs...>(
elements<CCAs...>( (~matrix).operand(), args... ), (~matrix).expansion() );
1395 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1396 RemoveReference_t<MT>::compileTimeArgs >* =
nullptr >
1397 inline decltype(
auto)
columns( MT&& c, RCAs... args )
1401 return columns( c.operand(), subsequence<I,Is...>( RemoveReference_t<MT>::idces() ), args... );
1424 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1425 !RemoveReference_t<MT>::compileTimeArgs >* =
nullptr >
1426 inline decltype(
auto)
columns( MT&& c, RCAs... args )
1433 static constexpr
size_t indices[] = { I, Is... };
1434 for(
size_t i=0UL; i<
sizeof...(Is)+1UL; ++i ) {
1435 if( c.columns() <= indices[i] ) {
1441 return columns( c.operand(), { c.idx(I), c.idx(Is)... }, args... );
1462 template<
typename MT
1465 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > >* =
nullptr >
1466 inline decltype(
auto)
columns( MT&& c, T* indices,
size_t n, RCAs... args )
1473 for(
size_t i=0UL; i<n; ++i ) {
1474 if( c.columns() <= size_t( indices[i] ) ) {
1480 SmallArray<size_t,128UL> newIndices;
1481 newIndices.reserve( n );
1483 for(
size_t i=0UL; i<n; ++i ) {
1484 newIndices.pushBack( c.idx( indices[i] ) );
1487 return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1508 template<
typename MT
1511 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > && !IsPointer_v<P> >* =
nullptr >
1512 inline decltype(
auto)
columns( MT&& c, P p,
size_t n, RCAs... args )
1519 for(
size_t i=0UL; i<n; ++i ) {
1520 if( c.columns() <= size_t( p(i) ) ) {
1526 SmallArray<size_t,128UL> newIndices;
1527 newIndices.reserve( n );
1529 for(
size_t i=0UL; i<n; ++i ) {
1530 newIndices.pushBack( c.idx( p(i) ) );
1533 return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1559 template<
size_t... CEAs
1561 ,
typename... REAs >
1562 inline decltype(
auto)
elements( const TVecMatMultExpr<VT>& vector, REAs... args )
1566 return (~vector).leftOperand() *
columns<CEAs...>( (~vector).rightOperand(), args... );
1585 template<
size_t... CEAs
1587 ,
typename... REAs >
1588 inline decltype(
auto)
elements( const MatReduceExpr<VT,
columnwise>& vector, REAs... args )
1592 return reduce<columnwise>( columns<CEAs...>( (~vector).operand(), args... ), (~vector).operation() );
1617 template<
size_t... CRAs
1620 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > >* =
nullptr >
1621 inline decltype(
auto)
row( MT&&
columns, RRAs... args )
1654 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1655 RemoveReference_t<MT>::compileTimeArgs >* =
nullptr >
1660 return column< RemoveReference_t<MT>::idx(I) >(
columns.operand(), args... );
1679 template<
size_t... CCAs
1682 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1683 (
sizeof...( CCAs ) == 0UL || !RemoveReference_t<MT>::compileTimeArgs ) >* =
nullptr >
1688 const ColumnData<CCAs...> cd( args... );
1693 if(
columns.columns() <= cd.column() ) {
1720 template<
typename MT
1724 ,
typename... CCAs >
1725 inline void reset( Columns<MT,SO,DF,SF,CCAs...>&
columns )
1741 template<
typename MT
1745 ,
typename... CCAs >
1746 inline void reset( Columns<MT,SO,DF,SF,CCAs...>&&
columns )
1766 template<
typename MT
1770 ,
typename... CCAs >
1771 inline void reset( Columns<MT,SO,DF,SF,CCAs...>&
columns,
size_t i )
1789 template<
typename MT
1793 ,
typename... CCAs >
1794 inline void clear( Columns<MT,SO,DF,SF,CCAs...>&
columns )
1812 template<
typename MT
1816 ,
typename... CCAs >
1817 inline void clear( Columns<MT,SO,DF,SF,CCAs...>&&
columns )
1855 ,
typename... CCAs >
1861 for(
size_t i=0UL; i<
columns.rows(); ++i )
1862 for(
size_t j=0UL; j<
columns.columns(); ++j )
1863 if( !isDefault<RF>(
columns(i,j) ) )
1867 for(
size_t j=0UL; j<
columns.columns(); ++j )
1868 for(
size_t i=0UL; i<
columns.rows(); ++i )
1869 if( !isDefault<RF>(
columns(i,j) ) )
1909 ,
typename... CCAs >
1914 for(
size_t j=0UL; j<
columns.columns(); ++j ) {
1915 for(
auto element=
columns.cbegin(j); element!=
columns.cend(j); ++element )
1916 if( !isDefault<RF>( element->value() ) )
return false;
1943 template<
typename MT
1947 ,
typename... CCAs >
1948 inline bool isIntact(
const Columns<MT,SO,DF,SF,CCAs...>&
columns ) noexcept
1971 template<
typename MT
1977 inline bool isSame(
const Columns<MT,SO1,DF,SF,CCAs...>& a,
const Matrix<MT,SO2>& b ) noexcept
1979 if( !
isSame( a.operand(), ~b ) || ( a.rows() != (~b).
rows() ) || ( a.columns() != (~b).
columns() ) )
1982 for(
size_t j=0UL; j<a.columns(); ++j ) {
2006 template<
typename MT
2012 inline bool isSame(
const Matrix<MT,SO1>& a,
const Columns<MT,SO2,DF,SF,CCAs...>& b ) noexcept
2033 template<
typename MT
2041 inline bool isSame(
const Columns<MT,SO1,DF,SF,CCAs...>& a,
const Submatrix<MT,AF,SO2,DF,CSAs...>& b ) noexcept
2043 if( !
isSame( a.operand(), b.operand() ) || ( a.rows() != (~b).
rows() ) || ( a.columns() != (~b).
columns() ) )
2046 for(
size_t j=0UL; j<a.columns(); ++j ) {
2047 if( a.idx(j) != b.column()+j )
2070 template<
typename MT
2077 ,
typename... CCAs >
2078 inline bool isSame(
const Submatrix<MT,AF,SO1,DF,CSAs...>& a,
const Columns<MT,SO2,DF,SF,CCAs...>& b ) noexcept
2099 template<
typename MT
2104 ,
typename... CCAs2 >
2105 inline bool isSame(
const Columns<MT,SO,DF,SF,CCAs1...>& a,
2106 const Columns<MT,SO,DF,SF,CCAs2...>& b ) noexcept
2108 if( !
isSame( a.operand(), b.operand() ) || a.rows() != b.rows() || a.columns() != b.columns() )
2111 for(
size_t i=0UL; i<a.columns(); ++i ) {
2112 if( a.idx(i) != b.idx(i) )
2165 ,
typename... CCAs >
2166 inline auto invert( Columns<MT,SO,true,SF,CCAs...>& c )
2167 -> DisableIf_t< HasMutableDataAccess_v<MT> >
2169 using RT =
ResultType_t< Columns<MT,SO,
true,SF,CCAs...> >;
2198 template<
typename MT
2204 inline bool trySet(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2209 return trySet( c.operand(), c.idx(i), j, value );
2233 template<
typename MT
2240 trySet(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2247 const size_t jend(
column + n );
2249 for(
size_t j=
column; j<jend; ++j ) {
2250 if( !trySet( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2276 template<
typename MT
2282 inline bool tryAdd(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2287 return tryAdd( c.operand(), c.idx(i), j, value );
2311 template<
typename MT
2318 tryAdd(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2325 const size_t jend(
column + n );
2327 for(
size_t j=
column; j<jend; ++j ) {
2328 if( !tryAdd( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2354 template<
typename MT
2360 inline bool trySub(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2365 return trySub( c.operand(), c.idx(i), j, value );
2389 template<
typename MT
2396 trySub(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2403 const size_t jend(
column + n );
2405 for(
size_t j=
column; j<jend; ++j ) {
2406 if( !trySub( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2432 template<
typename MT
2438 inline bool tryMult(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2443 return tryMult( c.operand(), c.idx(i), j, value );
2467 template<
typename MT
2474 tryMult(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2481 const size_t jend(
column + n );
2483 for(
size_t j=
column; j<jend; ++j ) {
2484 if( !tryMult( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2510 template<
typename MT
2516 inline bool tryDiv(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2521 return tryDiv( c.operand(), c.idx(i), j, value );
2545 template<
typename MT
2552 tryDiv(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2559 const size_t jend(
column + n );
2561 for(
size_t j=
column; j<jend; ++j ) {
2562 if( !tryDiv( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2588 template<
typename MT
2592 ,
typename... CCAs >
2593 inline bool tryShift(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
int count )
2598 return tryShift( c.operand(), c.idx(i), j, count );
2622 template<
typename MT
2626 ,
typename... CCAs >
2628 tryShift(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
int count )
2635 const size_t jend(
column + n );
2637 for(
size_t j=
column; j<jend; ++j ) {
2638 if( !tryShift( c.operand(),
row, c.idx(j), m, 1UL, count ) )
2664 template<
typename MT
2670 inline bool tryBitand(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2675 return tryBitand( c.operand(), c.idx(i), j, value );
2699 template<
typename MT
2706 tryBitand(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2713 const size_t jend(
column + n );
2715 for(
size_t j=
column; j<jend; ++j ) {
2716 if( !tryBitand( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2742 template<
typename MT
2748 inline bool tryBitor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2753 return tryBitor( c.operand(), c.idx(i), j, value );
2777 template<
typename MT
2784 tryBitor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2791 const size_t jend(
column + n );
2793 for(
size_t j=
column; j<jend; ++j ) {
2794 if( !tryBitor( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2820 template<
typename MT
2826 inline bool tryBitxor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2831 return tryBitxor( c.operand(), c.idx(i), j, value );
2855 template<
typename MT
2862 tryBitxor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2869 const size_t jend(
column + n );
2871 for(
size_t j=
column; j<jend; ++j ) {
2872 if( !tryBitxor( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2898 template<
typename MT
2904 inline bool tryAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2905 const Vector<VT,false>& rhs,
size_t row,
size_t column )
2911 return tryAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
2933 template<
typename MT
2939 inline bool tryAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2940 const Vector<VT,true>& rhs,
size_t row,
size_t column )
2946 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
2947 if( !trySet( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
2975 template<
typename MT
2982 inline bool tryAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2983 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
2992 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
2993 if( !trySet( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3019 template<
typename MT1
3026 inline bool tryAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3027 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3034 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
3062 template<
typename MT
3068 inline bool tryAddAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3069 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3075 return tryAddAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
3098 template<
typename MT
3104 inline bool tryAddAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3105 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3111 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3112 if( !tryAdd( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
3140 template<
typename MT
3147 inline bool tryAddAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3148 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3157 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3158 if( !tryAdd( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3184 template<
typename MT1
3191 inline bool tryAddAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3192 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3199 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
3227 template<
typename MT
3233 inline bool trySubAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3234 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3240 return trySubAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
3263 template<
typename MT
3269 inline bool trySubAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3270 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3276 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3277 if( !trySub( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
3305 template<
typename MT
3312 inline bool trySubAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3313 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3322 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3323 if( !trySub( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3350 template<
typename MT1
3357 inline bool trySubAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3358 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3365 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
3393 template<
typename MT
3399 inline bool tryMultAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3400 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3406 return tryMultAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
3429 template<
typename MT
3435 inline bool tryMultAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3436 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3442 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3443 if( !tryMult( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
3471 template<
typename MT
3478 inline bool tryMultAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3479 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3488 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3489 if( !tryMult( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3516 template<
typename MT1
3523 inline bool trySchurAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3524 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3531 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
3559 template<
typename MT
3565 inline bool tryDivAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3566 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3572 return tryDivAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
3595 template<
typename MT
3601 inline bool tryDivAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3602 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3608 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3609 if( !tryDiv( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
3637 template<
typename MT
3644 inline bool tryDivAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3645 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3654 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3655 if( !tryDiv( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3682 template<
typename MT
3688 inline bool tryShiftAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3689 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3695 return tryShiftAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
3718 template<
typename MT
3724 inline bool tryShiftAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3725 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3731 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3732 if( !tryShift( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
3760 template<
typename MT
3767 inline bool tryShiftAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3768 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3777 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3778 if( !tryShift( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3804 template<
typename MT1
3811 inline bool tryShiftAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3812 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3819 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
3847 template<
typename MT
3853 inline bool tryBitandAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3854 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3860 return tryBitandAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
3883 template<
typename MT
3889 inline bool tryBitandAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3890 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3896 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3897 if( !tryBitand( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
3925 template<
typename MT
3932 inline bool tryBitandAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3933 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3942 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3943 if( !tryBitand( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
3970 template<
typename MT1
3977 inline bool tryBitandAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3978 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3985 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
4013 template<
typename MT
4019 inline bool tryBitorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4020 const Vector<VT,false>& rhs,
size_t row,
size_t column )
4026 return tryBitorAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
4049 template<
typename MT
4055 inline bool tryBitorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4056 const Vector<VT,true>& rhs,
size_t row,
size_t column )
4062 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
4063 if( !tryBitor( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
4091 template<
typename MT
4098 inline bool tryBitorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4099 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
4108 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
4109 if( !tryBitor( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
4136 template<
typename MT1
4143 inline bool tryBitorAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4144 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
4151 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
4179 template<
typename MT
4185 inline bool tryBitxorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4186 const Vector<VT,false>& rhs,
size_t row,
size_t column )
4192 return tryBitxorAssign( lhs.operand(), ~rhs,
row, lhs.idx(
column ) );
4215 template<
typename MT
4221 inline bool tryBitxorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4222 const Vector<VT,true>& rhs,
size_t row,
size_t column )
4228 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
4229 if( !tryBitxor( lhs.operand(),
row, lhs.idx(
column+i ), (~rhs)[i] ) )
4257 template<
typename MT
4264 inline bool tryBitxorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4265 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
4274 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
4275 if( !tryBitxor( lhs.operand(),
row+i, lhs.idx(
column+i ), (~rhs)[i] ) )
4302 template<
typename MT1
4309 inline bool tryBitxorAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4310 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
4317 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
4343 template<
typename MT
4347 ,
typename... CCAs >
4348 inline decltype(
auto) derestrict( Columns<MT,SO,DF,SF,CCAs...>& c )
4371 template<
typename MT
4375 ,
typename... CCAs >
4376 inline decltype(
auto) derestrict( Columns<MT,SO,DF,SF,CCAs...>&& c )
4394 template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CCAs >
4395 struct Size< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
4396 :
public Size<MT,0UL>
4399 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t I,
size_t... Is,
typename... CCAs >
4400 struct Size< Columns<MT,SO,DF,SF,index_sequence<I,Is...>,CCAs...>, 1UL >
4417 template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CCAs >
4418 struct MaxSize< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
4419 :
public MaxSize<MT,0UL>
4422 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t I,
size_t... Is,
typename... CCAs >
4423 struct MaxSize< Columns<MT,SO,DF,SF,index_sequence<I,Is...>,CCAs...>, 1UL >
4440 template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CCAs >
4441 struct IsRestricted< Columns<MT,SO,DF,SF,CCAs...> >
4442 :
public IsRestricted<MT>
4458 template<
typename MT,
bool SO,
bool SF,
typename... CCAs >
4459 struct HasConstDataAccess< Columns<MT,SO,true,SF,CCAs...> >
4460 :
public HasConstDataAccess<MT>
4476 template<
typename MT,
bool SO,
bool SF,
typename... CCAs >
4477 struct HasMutableDataAccess< Columns<MT,SO,true,SF,CCAs...> >
4478 :
public HasMutableDataAccess<MT>
4494 template<
typename MT,
bool SO,
bool SF,
typename... CCAs >
4495 struct IsAligned< Columns<MT,SO,true,SF,CCAs...> >
4496 :
public IsAligned<MT>
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
#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
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.
Header file for the implementation of the Columns base template.
Header file for the alignment flag values.
#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:61
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:992
Header file for basic type definitions.
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.The Ptrdiff_t alias template represents an integ...
Definition: IntegralConstant.h:237
Header file for the MatReduceExpr base class.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
Header file for the MatTransExpr base class.
Columns specialization for sparse matrices.
Header file for the dense matrix inversion flags.
Header file for the IsColumnMajorMatrix type trait.
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
Header file for the MatEvalExpr base class.
Header file for the MAYBE_UNUSED function template.
Header file for the MatMatMultExpr base class.
Header file for the extended initializer_list functionality.
Index sequence type of the Blaze library.
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Header file for the MatMatKronExpr base class.
Header file for the matrix storage order types.
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
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Header file for the MatMapExpr base class.
Header file for the DisableIf class template.
Header file for the SmallArray implementation.
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
Columns specialization for dense matrices.
Header file for the MatMatSubExpr base class.
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:786
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:139
Header file for the exception macros of the math module.
Constraint on the data type.
Constraint on the data type.
Header file for the MatSerialExpr base class.
Header file for the VecTVecMultExpr base class.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:137
Header file for the HasConstDataAccess type trait.
Header file for the IsColumns type trait.
Header file for the DeclExpr base class.
Header file for the Matrix base class.
constexpr size_t columnwise
Reduction flag for column-wise reduction operations.
Definition: ReductionFlag.h:90
Header file for the MatScalarMultExpr base class.
Header file for run time assertion macros.
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 SchurExpr base class.
decltype(auto) expand(const DenseVector< VT, TF > &dv, size_t expansion)
Expansion of the given dense vector.
Definition: DVecExpandExpr.h:739
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 IsPointer type trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:114
Header file for the TVecMatMultExpr base class.
Header file for the integer_sequence and index_sequence aliases.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
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 MatMatAddExpr base class.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Header file for the RemoveReference type trait.
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 VecExpandExpr base class.
Header file for the MatMatMapExpr base class.
Initializer list type of the Blaze library.
Header file for all forward declarations for views.
Header file for the IntegralConstant class template.
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
Header file for the implementation of the ColumnData class template.
Header file for the MatScalarDivExpr base class.
Header file for the IsRestricted type trait.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#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
Header file for the reduction flags.
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1121