35 #ifndef _BLAZE_MATH_VIEWS_ROWS_H_ 36 #define _BLAZE_MATH_VIEWS_ROWS_H_ 148 inline decltype(
auto)
rows(
Matrix<MT,SO>& matrix, RRAs... args )
198 inline decltype(
auto)
rows( const
Matrix<MT,SO>& matrix, RRAs... args )
227 inline decltype(
auto)
rows(
Matrix<MT,SO>&& matrix, RRAs... args )
276 template<
typename MT
280 inline decltype(
auto)
rows(
Matrix<MT,SO>& matrix, const T* indices,
size_t n, RRAs... args )
285 return ReturnType( ~matrix, indices, n, args... );
330 template<
typename MT
334 inline decltype(
auto)
rows( const
Matrix<MT,SO>& matrix, const T* indices,
size_t n, RRAs... args )
339 return ReturnType( ~matrix, indices, n, args... );
359 template<
typename MT
363 inline decltype(
auto)
rows(
Matrix<MT,SO>&& matrix, const T* indices,
size_t n, RRAs... args )
368 return ReturnType( ~matrix, indices, n, args... );
410 template<
typename MT
414 , EnableIf_t< !IsPointer_v<P> >* =
nullptr >
415 inline decltype(
auto)
rows(
Matrix<MT,SO>& matrix, P p,
size_t n, RRAs... args )
463 template<
typename MT
467 , EnableIf_t< !IsPointer_v<P> >* =
nullptr >
468 inline decltype(
auto)
rows( const
Matrix<MT,SO>& matrix, P p,
size_t n, RRAs... args )
493 template<
typename MT
497 , EnableIf_t< !IsPointer_v<P> >* =
nullptr >
498 inline decltype(
auto)
rows(
Matrix<MT,SO>&& matrix, P p,
size_t n, RRAs... args )
545 template<
typename MT
554 return rows<Is...>( std::forward<MT>( matrix ), args... );
595 template<
typename MT
602 return rows( std::forward<MT>( matrix ), indices.begin(), indices.size(), args... );
645 template<
typename MT
649 inline decltype(
auto)
rows( MT&& matrix, const
std::array<T,N>& indices, RRAs... args )
653 return rows( std::forward<MT>( matrix ), indices.data(), N, args... );
696 template<
typename MT
699 inline decltype(
auto)
rows( MT&& matrix, const
std::vector<T>& indices, RRAs... args )
703 return rows( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
746 template<
typename MT
750 inline decltype(
auto)
rows( MT&& matrix, const
SmallArray<T,N>& indices, RRAs... args )
754 return rows( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
775 template<
typename MT
779 inline decltype(
auto)
rows( MT&& matrix, const
std::pair<T1,T2>& pair, RRAs... args )
783 return rows( std::forward<MT>( matrix ), pair.first, pair.second, args... );
809 template<
typename... CRAs
812 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
813 inline decltype(
auto)
rows( const MatMatAddExpr<MT>& matrix, RRAs... args )
817 return rows<CRAs...>( (~matrix).leftOperand(), args... ) +
818 rows<CRAs...>( (~matrix).rightOperand(), args... );
836 template<
typename... CRAs
839 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
840 inline decltype(
auto)
rows( const MatMatSubExpr<MT>& matrix, RRAs... args )
844 return rows<CRAs...>( (~matrix).leftOperand(), args... ) -
845 rows<CRAs...>( (~matrix).rightOperand(), args... );
863 template<
typename... CRAs
866 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
867 inline decltype(
auto)
rows( const SchurExpr<MT>& matrix, RRAs... args )
871 return rows<CRAs...>( (~matrix).leftOperand(), args... ) %
872 rows<CRAs...>( (~matrix).rightOperand(), args... );
890 template<
typename... CRAs
893 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
894 inline decltype(
auto)
rows( const MatMatMultExpr<MT>& matrix, RRAs... args )
898 return rows<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
916 template<
typename... CRAs
919 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
920 inline decltype(
auto)
rows( const VecTVecMultExpr<MT>& matrix, RRAs... args )
924 return elements<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
942 template<
typename... CRAs
945 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
946 inline decltype(
auto)
rows( const MatScalarMultExpr<MT>& matrix, RRAs... args )
950 return rows<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
968 template<
typename... CRAs
971 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
972 inline decltype(
auto)
rows( const MatScalarDivExpr<MT>& matrix, RRAs... args )
976 return rows<CRAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
994 template<
typename... CRAs
997 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
998 inline decltype(
auto)
rows( const MatMapExpr<MT>& matrix, RRAs... args )
1002 return map( rows<CRAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
1020 template<
typename... CRAs
1023 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
1024 inline decltype(
auto)
rows( const MatMatMapExpr<MT>& matrix, RRAs... args )
1028 return map( rows<CRAs...>( (~matrix).leftOperand(), args... ),
1029 rows<CRAs...>( (~matrix).rightOperand(), args... ),
1030 (~matrix).operation() );
1048 template<
typename... CRAs
1051 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
1052 inline decltype(
auto)
rows( const MatEvalExpr<MT>& matrix, RRAs... args )
1056 return eval( rows<CRAs...>( (~matrix).operand(), args... ) );
1074 template<
typename... CRAs
1077 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
1078 inline decltype(
auto)
rows( const MatSerialExpr<MT>& matrix, RRAs... args )
1082 return serial( rows<CRAs...>( (~matrix).operand(), args... ) );
1100 template<
typename... CRAs
1103 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
1104 inline decltype(
auto)
rows( const DeclExpr<MT>& matrix, RRAs... args )
1108 return rows<CRAs...>( (~matrix).operand(), args... );
1126 template<
typename... CRAs
1129 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) >* =
nullptr >
1130 inline decltype(
auto)
rows( const MatTransExpr<MT>& matrix, RRAs... args )
1134 return trans( columns<CRAs...>( (~matrix).operand(), args... ) );
1152 template<
typename... CRAs
1157 IsRowMajorMatrix_v<MT> >* =
nullptr >
1158 inline decltype(
auto)
rows( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
1164 return expand<
sizeof...( CRAs ) >( (~matrix).operand() );
1182 template<
typename... CRAs
1186 ,
EnableIf_t< (
sizeof...( CRAs ) == 0UL ) &&
1187 IsRowMajorMatrix_v<MT> >* =
nullptr >
1188 inline decltype(
auto)
rows( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
1192 const RowsData<CRAs...> rd( args... );
1194 return expand( (~matrix).operand(), rd.rows() );
1212 template<
typename... CRAs
1216 ,
EnableIf_t< (
sizeof...( CRAs ) +
sizeof...( RRAs ) > 0UL ) &&
1217 !IsRowMajorMatrix_v<MT> >* =
nullptr >
1218 inline decltype(
auto)
rows( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
1222 return expand<CEAs...>(
elements<CRAs...>( (~matrix).operand(), args... ), (~matrix).expansion() );
1248 ,
typename... RRAs >
1249 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,index_sequence<I2,Is2...>,CRAs...>& r, RRAs... args )
1253 static constexpr
size_t indices[] = { I2, Is2... };
1254 return rows< indices[I1], indices[Is1]... >( r.operand(), args... );
1281 ,
typename... RRAs >
1282 inline decltype(
auto)
rows( const Rows<MT,SO,DF,SF,index_sequence<I2,Is2...>,CRAs...>& r, RRAs... args )
1286 static constexpr
size_t indices[] = { I2, Is2... };
1287 return rows< indices[I1], indices[Is1]... >( r.operand(), args... );
1314 ,
typename... RRAs >
1315 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,index_sequence<I2,Is2...>,CRAs...>&& r, RRAs... args )
1319 static constexpr
size_t indices[] = { I2, Is2... };
1320 return rows< indices[I1], indices[Is1]... >( r.operand(), args... );
1345 ,
typename... RRAs >
1346 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,CRAs...>& r, RRAs... args )
1353 static constexpr
size_t indices[] = { I, Is... };
1354 for(
size_t i=0UL; i<
sizeof...(Is)+1UL; ++i ) {
1355 if( r.rows() <= indices[i] ) {
1361 return rows( r.operand(), { r.idx(I), r.idx(Is)... }, args... );
1387 ,
typename... RRAs >
1388 inline decltype(
auto)
rows( const Rows<MT,SO,DF,SF,CRAs...>& r, RRAs... args )
1395 static constexpr
size_t indices[] = { I, Is... };
1396 for(
size_t i=0UL; i<
sizeof...(Is)+1UL; ++i ) {
1397 if( r.rows() <= indices[i] ) {
1403 return rows( r.operand(), { r.idx(I), r.idx(Is)... }, args... );
1429 ,
typename... RRAs >
1430 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,CRAs...>&& r, RRAs... args )
1437 static constexpr
size_t indices[] = { I, Is... };
1438 for(
size_t i=0UL; i<
sizeof...(Is)+1UL; ++i ) {
1439 if( r.rows() <= indices[i] ) {
1445 return rows( r.operand(), { r.idx(I), r.idx(Is)... }, args... );
1465 template<
typename MT
1471 ,
typename... RRAs >
1472 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,CRAs...>& r, const T* indices,
size_t n, RRAs... args )
1479 for(
size_t i=0UL; i<n; ++i ) {
1480 if( r.rows() <= size_t( indices[i] ) ) {
1486 SmallArray<size_t,128UL> newIndices;
1487 newIndices.reserve( n );
1489 for(
size_t i=0UL; i<n; ++i ) {
1490 newIndices.pushBack( r.idx( indices[i] ) );
1493 return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1514 template<
typename MT
1520 ,
typename... RRAs >
1521 inline decltype(
auto)
rows( const Rows<MT,SO,DF,SF,CRAs...>& r, const T* indices,
size_t n, RRAs... args )
1528 for(
size_t i=0UL; i<n; ++i ) {
1529 if( r.rows() <= size_t( indices[i] ) ) {
1535 SmallArray<size_t,128UL> newIndices;
1536 newIndices.reserve( n );
1538 for(
size_t i=0UL; i<n; ++i ) {
1539 newIndices.pushBack( r.idx( indices[i] ) );
1542 return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1563 template<
typename MT
1569 ,
typename... RRAs >
1570 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,CRAs...>&& r, const T* indices,
size_t n, RRAs... args )
1577 for(
size_t i=0UL; i<n; ++i ) {
1578 if( r.rows() <= size_t( indices[i] ) ) {
1584 SmallArray<size_t,128UL> newIndices;
1585 newIndices.reserve( n );
1587 for(
size_t i=0UL; i<n; ++i ) {
1588 newIndices.pushBack( r.idx( indices[i] ) );
1591 return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1611 template<
typename MT
1617 ,
typename... RRAs >
1618 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,CRAs...>& r, P p,
size_t n, RRAs... args )
1625 for(
size_t i=0UL; i<n; ++i ) {
1626 if( r.rows() <= size_t( p(i) ) ) {
1632 SmallArray<size_t,128UL> newIndices;
1633 newIndices.reserve( n );
1635 for(
size_t i=0UL; i<n; ++i ) {
1636 newIndices.pushBack( r.idx( p(i) ) );
1639 return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1660 template<
typename MT
1666 ,
typename... RRAs >
1667 inline decltype(
auto)
rows( const Rows<MT,SO,DF,SF,CRAs...>& r, P p,
size_t n, RRAs... args )
1674 for(
size_t i=0UL; i<n; ++i ) {
1675 if( r.rows() <= size_t( p(i) ) ) {
1681 SmallArray<size_t,128UL> newIndices;
1682 newIndices.reserve( n );
1684 for(
size_t i=0UL; i<n; ++i ) {
1685 newIndices.pushBack( r.idx( p(i) ) );
1688 return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1709 template<
typename MT
1715 ,
typename... RRAs >
1716 inline decltype(
auto)
rows( Rows<MT,SO,DF,SF,CRAs...>&& r, P p,
size_t n, RRAs... args )
1723 for(
size_t i=0UL; i<n; ++i ) {
1724 if( r.rows() <= size_t( p(i) ) ) {
1730 SmallArray<size_t,128UL> newIndices;
1731 newIndices.reserve( n );
1733 for(
size_t i=0UL; i<n; ++i ) {
1734 newIndices.pushBack( r.idx( p(i) ) );
1737 return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1763 template<
size_t... CEAs
1765 ,
typename... REAs >
1766 inline decltype(
auto)
elements( const MatVecMultExpr<VT>& vector, REAs... args )
1770 return rows<CEAs...>( (~vector).leftOperand(), args... ) * (~vector).rightOperand();
1789 template<
size_t... CEAs
1791 ,
typename... REAs >
1792 inline decltype(
auto)
elements( const MatReduceExpr<VT,
rowwise>& vector, REAs... args )
1796 return reduce<rowwise>(
rows<CEAs...>( (~vector).operand(), args... ), (~vector).operation() );
1829 ,
typename... RRAs >
1830 inline decltype(
auto)
row( Rows<MT,SO,DF,SF,index_sequence<I2,Is...>,CRAs...>&
rows, RRAs... args )
1834 static constexpr
size_t indices[] = { I2, Is... };
1835 return row<indices[I1]>(
rows.operand(), args... );
1861 ,
typename... RRAs >
1862 inline decltype(
auto)
row( const Rows<MT,SO,DF,SF,index_sequence<I2,Is...>,CRAs...>&
rows, RRAs... args )
1866 static constexpr
size_t indices[] = { I2, Is... };
1867 return row<indices[I1]>(
rows.operand(), args... );
1893 ,
typename... RRAs >
1894 inline decltype(
auto)
row( Rows<MT,SO,DF,SF,index_sequence<I2,Is...>,CRAs...>&&
rows, RRAs... args )
1898 static constexpr
size_t indices[] = { I2, Is... };
1899 return row<indices[I1]>(
rows.operand(), args... );
1917 template<
size_t... CRAs1
1923 ,
typename... RRAs >
1924 inline decltype(
auto)
row( Rows<MT,SO,DF,SF,CRAs2...>&
rows, RRAs... args )
1928 const RowData<CRAs1...> rd( args... );
1933 if(
rows.rows() <= rd.row() ) {
1938 return row(
rows.operand(),
rows.idx( rd.row() ), args... );
1957 template<
size_t... CRAs1
1963 ,
typename... RRAs >
1964 inline decltype(
auto)
row( const Rows<MT,SO,DF,SF,CRAs2...>&
rows, RRAs... args )
1968 const RowData<CRAs1...> rd( args... );
1973 if(
rows.rows() <= rd.row() ) {
1978 return row(
rows.operand(),
rows.idx( rd.row() ), args... );
1997 template<
size_t... CRAs1
2003 ,
typename... RRAs >
2004 inline decltype(
auto)
row( Rows<MT,SO,DF,SF,CRAs2...>&&
rows, RRAs... args )
2008 const RowData<CRAs1...> rd( args... );
2013 if(
rows.rows() <= rd.row() ) {
2018 return row(
rows.operand(),
rows.idx( rd.row() ), args... );
2043 template<
size_t... CCAs
2051 ,
typename... RCAs >
2052 inline decltype(
auto)
column( Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>&
rows, RCAs... args )
2074 template<
size_t... CCAs
2082 ,
typename... RCAs >
2083 inline decltype(
auto)
column( const Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>&
rows, RCAs... args )
2105 template<
size_t... CCAs
2113 ,
typename... RCAs >
2114 inline decltype(
auto)
column( Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>&&
rows, RCAs... args )
2135 template<
size_t... CCAs
2141 ,
typename... RCAs >
2142 inline decltype(
auto)
column( Rows<MT,SO,DF,SF,CRAs...>&
rows, RCAs... args )
2146 return elements( column<CCAs...>(
rows.operand(), args... ),
rows.idces() );
2164 template<
size_t... CCAs
2170 ,
typename... RCAs >
2171 inline decltype(
auto)
column( const Rows<MT,SO,DF,SF,CRAs...>&
rows, RCAs... args )
2175 return elements( column<CCAs...>(
rows.operand(), args... ),
rows.idces() );
2193 template<
size_t... CCAs
2199 ,
typename... RCAs >
2200 inline decltype(
auto)
column( Rows<MT,SO,DF,SF,CRAs...>&&
rows, RCAs... args )
2204 return elements( column<CCAs...>(
rows.operand(), args... ),
rows.idces() );
2226 template<
typename MT
2230 ,
typename... CRAs >
2231 inline void reset( Rows<MT,SO,DF,SF,CRAs...>&
rows )
2247 template<
typename MT
2251 ,
typename... CRAs >
2252 inline void reset( Rows<MT,SO,DF,SF,CRAs...>&&
rows )
2272 template<
typename MT
2276 ,
typename... CRAs >
2277 inline void reset( Rows<MT,SO,DF,SF,CRAs...>&
rows,
size_t i )
2295 template<
typename MT
2299 ,
typename... CRAs >
2300 inline void clear( Rows<MT,SO,DF,SF,CRAs...>&
rows )
2318 template<
typename MT
2322 ,
typename... CRAs >
2323 inline void clear( Rows<MT,SO,DF,SF,CRAs...>&&
rows )
2361 ,
typename... CRAs >
2362 inline bool isDefault(
const Rows<MT,SO,true,SF,CRAs...>&
rows )
2367 for(
size_t i=0UL; i<
rows.rows(); ++i )
2368 for(
size_t j=0UL; j<
rows.columns(); ++j )
2369 if( !isDefault<RF>(
rows(i,j) ) )
2373 for(
size_t j=0UL; j<
rows.columns(); ++j )
2374 for(
size_t i=0UL; i<
rows.rows(); ++i )
2375 if( !isDefault<RF>(
rows(i,j) ) )
2415 ,
typename... CRAs >
2416 inline bool isDefault(
const Rows<MT,SO,false,SF,CRAs...>&
rows )
2420 for(
size_t i=0UL; i<
rows.rows(); ++i ) {
2421 for(
auto element=
rows.cbegin(i); element!=
rows.cend(i); ++element )
2422 if( !isDefault<RF>( element->value() ) )
return false;
2450 template<
typename MT
2454 ,
typename... CRAs >
2455 inline bool isIntact(
const Rows<MT,SO,DF,SF,CRAs...>&
rows ) noexcept
2457 return (
rows.rows() <=
rows.operand().rows() &&
2458 rows.columns() ==
rows.operand().columns() &&
2478 template<
typename MT
2484 inline bool isSame(
const Rows<MT,SO1,DF,SF,CRAs...>& a,
const Matrix<MT,SO2>& b ) noexcept
2486 if( !
isSame( a.operand(), ~b ) || ( a.rows() != (~b).
rows() ) || ( a.columns() != (~b).
columns() ) )
2489 for(
size_t i=0UL; i<a.rows(); ++i ) {
2513 template<
typename MT
2519 inline bool isSame(
const Matrix<MT,SO1>& a,
const Rows<MT,SO2,DF,SF,CRAs...>& b ) noexcept
2540 template<
typename MT
2548 inline bool isSame(
const Rows<MT,SO1,DF,SF,CRAs...>& a,
const Submatrix<MT,AF,SO2,DF,CSAs...>& b ) noexcept
2550 if( !
isSame( a.operand(), b.operand() ) || ( a.rows() != (~b).
rows() ) || ( a.columns() != (~b).
columns() ) )
2553 for(
size_t i=0UL; i<a.rows(); ++i ) {
2554 if( a.idx(i) != b.row()+i )
2577 template<
typename MT
2584 ,
typename... CRAs >
2585 inline bool isSame(
const Submatrix<MT,AF,SO1,DF,CSAs...>& a,
const Rows<MT,SO2,DF,SF,CRAs...>& b ) noexcept
2606 template<
typename MT
2611 ,
typename... CRAs2 >
2612 inline bool isSame(
const Rows<MT,SO,DF,SF,CRAs1...>& a,
2613 const Rows<MT,SO,DF,SF,CRAs2...>& b ) noexcept
2615 if( !
isSame( a.operand(), b.operand() ) || a.rows() != b.rows() || a.columns() != b.columns() )
2618 for(
size_t i=0UL; i<a.rows(); ++i ) {
2619 if( a.idx(i) != b.idx(i) )
2672 ,
typename... CRAs >
2673 inline auto invert( Rows<MT,SO,true,SF,CRAs...>& r )
2674 -> DisableIf_t< HasMutableDataAccess_v<MT> >
2676 using RT =
ResultType_t< Rows<MT,SO,
true,SF,CRAs...> >;
2705 template<
typename MT
2711 inline bool trySet(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t i,
size_t j,
const ET& value )
2716 return trySet( r.operand(), r.idx(i), j, value );
2738 template<
typename MT
2744 inline bool tryAdd(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t i,
size_t j,
const ET& value )
2749 return tryAdd( r.operand(), r.idx(i), j, value );
2771 template<
typename MT
2777 inline bool trySub(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t i,
size_t j,
const ET& value )
2782 return trySub( r.operand(), r.idx(i), j, value );
2804 template<
typename MT
2810 inline bool tryMult(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t i,
size_t j,
const ET& value )
2815 return tryMult( r.operand(), r.idx(i), j, value );
2839 template<
typename MT
2846 tryMult(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2853 const size_t iend(
row + m );
2855 for(
size_t i=
row; i<iend; ++i ) {
2856 if( !tryMult( r.operand(), r.idx(i),
column, m, n, value ) )
2882 template<
typename MT
2888 inline bool tryDiv(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t i,
size_t j,
const ET& value )
2893 return tryDiv( r.operand(), r.idx(i), j, value );
2917 template<
typename MT
2924 tryDiv(
const Rows<MT,SO,DF,SF,CRAs...>& r,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2931 const size_t iend(
row + m );
2933 for(
size_t i=
row; i<iend; ++i ) {
2934 if( !tryDiv( r.operand(), r.idx(i),
column, m, n, value ) )
2960 template<
typename MT
2966 inline bool tryAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
2967 const Vector<VT,false>& rhs,
size_t row,
size_t column )
2973 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
2974 if( !trySet( lhs.operand(), lhs.idx(
row+i ),
column, (~rhs)[i] ) )
3000 template<
typename MT
3006 inline bool tryAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3007 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3013 return tryAssign( lhs.operand(), ~rhs, lhs.idx(
row ),
column );
3036 template<
typename MT
3043 inline bool tryAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3044 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3053 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3054 if( !trySet( lhs.operand(), lhs.idx(
row+i ),
column+i, (~rhs)[i] ) )
3080 template<
typename MT1
3087 inline bool tryAssign(
const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3088 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3095 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
3124 template<
typename MT
3130 inline bool tryAddAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3131 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3137 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3138 if( !tryAdd( lhs.operand(), lhs.idx(
row+i ),
column, (~rhs)[i] ) )
3164 template<
typename MT
3170 inline bool tryAddAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3171 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3177 return tryAddAssign( lhs.operand(), ~rhs, lhs.idx(
row ),
column );
3201 template<
typename MT
3208 inline bool tryAddAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3209 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3218 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3219 if( !tryAdd( lhs.operand(), lhs.idx(
row+i ),
column+i, (~rhs)[i] ) )
3245 template<
typename MT1
3252 inline bool tryAddAssign(
const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3253 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3260 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
3288 template<
typename MT
3294 inline bool trySubAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3295 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3301 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3302 if( !trySub( lhs.operand(), lhs.idx(
row+i ),
column, (~rhs)[i] ) )
3329 template<
typename MT
3335 inline bool trySubAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3336 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3342 return trySubAssign( lhs.operand(), ~rhs, lhs.idx(
row ),
column );
3366 template<
typename MT
3373 inline bool trySubAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3374 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3383 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3384 if( !trySub( lhs.operand(), lhs.idx(
row+i ),
column+i, (~rhs)[i] ) )
3410 template<
typename MT1
3417 inline bool trySubAssign(
const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3418 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3425 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
3454 template<
typename MT
3460 inline bool tryMultAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3461 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3467 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3468 if( !tryMult( lhs.operand(), lhs.idx(
row+i ),
column, (~rhs)[i] ) )
3495 template<
typename MT
3501 inline bool tryMultAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3502 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3508 return tryMultAssign( lhs.operand(), ~rhs, lhs.idx(
row ),
column );
3532 template<
typename MT
3539 inline bool tryMultAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3540 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3549 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3550 if( !tryMult( lhs.operand(), lhs.idx(
row+i ),
column+i, (~rhs)[i] ) )
3577 template<
typename MT1
3584 inline bool trySchurAssign(
const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3585 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3592 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
3621 template<
typename MT
3627 inline bool tryDivAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3628 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3634 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3635 if( !tryDiv( lhs.operand(), lhs.idx(
row+i ),
column, (~rhs)[i] ) )
3661 template<
typename MT
3667 inline bool tryDivAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3668 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3674 return tryDivAssign( lhs.operand(), ~rhs, lhs.idx(
row ),
column );
3698 template<
typename MT
3705 inline bool tryDivAssign(
const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3706 const Vector<VT,TF>& rhs, ptrdiff_t
band,
size_t row,
size_t column )
3715 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3716 if( !tryDiv( lhs.operand(), lhs.idx(
row+i ),
column+i, (~rhs)[i] ) )
3741 template<
typename MT
3745 ,
typename... CRAs >
3746 inline decltype(
auto) derestrict( Rows<MT,SO,DF,SF,CRAs...>& r )
3748 return rows( derestrict( r.operand() ), r.idces(),
unchecked );
3769 template<
typename MT
3773 ,
typename... CRAs >
3774 inline decltype(
auto) derestrict( Rows<MT,SO,DF,SF,CRAs...>&& r )
3776 return rows( derestrict( r.operand() ), r.idces(),
unchecked );
3792 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t I,
size_t... Is,
typename... CRAs >
3793 struct Size< Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>, 0UL >
3794 :
public PtrdiffT<1UL+sizeof...(Is)>
3797 template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CRAs >
3798 struct Size< Rows<MT,SO,DF,SF,CRAs...>, 1UL >
3799 :
public Size<MT,1UL>
3815 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t I,
size_t... Is,
typename... CRAs >
3816 struct MaxSize< Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>, 0UL >
3817 :
public PtrdiffT<1UL+sizeof...(Is)>
3820 template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CRAs >
3821 struct MaxSize< Rows<MT,SO,DF,SF,CRAs...>, 1UL >
3822 :
public MaxSize<MT,1UL>
3838 template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CRAs >
3839 struct IsRestricted< Rows<MT,SO,DF,SF,CRAs...> >
3840 :
public IsRestricted<MT>
3856 template<
typename MT,
bool SO,
bool SF,
typename... CRAs >
3857 struct HasConstDataAccess< Rows<MT,SO,true,SF,CRAs...> >
3858 :
public HasConstDataAccess<MT>
3874 template<
typename MT,
bool SO,
bool SF,
typename... CRAs >
3875 struct HasMutableDataAccess< Rows<MT,SO,true,SF,CRAs...> >
3876 :
public HasMutableDataAccess<MT>
3892 template<
typename MT,
bool SO,
bool SF,
typename... CRAs >
3893 struct IsAligned< Rows<MT,SO,true,SF,CRAs...> >
3894 :
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
Rows specialization for sparse matrices.
#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 RowData class template.
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
#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.
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.
Header file for the dense matrix inversion flags.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
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 MatMatMultExpr base class.
Header file for the extended initializer_list functionality.
Index sequence type of the Blaze library.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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 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:775
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
Implementation of a dynamic array with small array optimization.The SmallArray class template is a hy...
Definition: SmallArray.h:81
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:139
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:135
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:611
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
Header file for the HasConstDataAccess type trait.
IntegralConstant< ptrdiff_t, N > PtrdiffT
Compile time integral constant wrapper for ptrdiff_t.The PtrdiffT class template represents an integr...
Definition: PtrdiffT.h:72
Header file for the DeclExpr base class.
Header file for the Matrix base class.
Header file for the PtrdiffT class template.
Header file for all forward declarations for views.
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:109
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
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
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.
constexpr size_t rowwise
Reduction flag for row-wise reduction operations.
Definition: ReductionFlag.h:70
Header file for the IsRowMajorMatrix type trait.
Header file for the MatMatMapExpr base class.
Initializer list type of the Blaze library.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
Rows specialization for dense matrices.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the MatScalarDivExpr base class.
Header file for the MatVecMultExpr base class.
Header file for the implementation of the Rows base template.
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
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:1110