35#ifndef _BLAZE_MATH_VIEWS_COLUMNS_H_
36#define _BLAZE_MATH_VIEWS_COLUMNS_H_
158 using ReturnType = Columns_< MT, index_sequence<I,Is...> >;
159 return ReturnType( *matrix, args... );
208 using ReturnType =
const Columns_<
const MT, index_sequence<I,Is...> >;
209 return ReturnType( *matrix, args... );
237 using ReturnType = Columns_< MT, index_sequence<I,Is...> >;
238 return ReturnType( *matrix, args... );
290 using ReturnType = Columns_<MT>;
291 return ReturnType( *matrix, indices, n, args... );
344 using ReturnType =
const Columns_<const MT>;
345 return ReturnType( *matrix, indices, n, args... );
373 using ReturnType = Columns_<MT>;
374 return ReturnType( *matrix, indices, n, args... );
424 using ReturnType = Columns_<MT,P>;
425 return ReturnType( *matrix, p, n, args... );
477 using ReturnType =
const Columns_<const MT,P>;
478 return ReturnType( *matrix, p, n, args... );
506 using ReturnType = Columns_<MT,P>;
507 return ReturnType( *matrix, p, n, args... );
552inline decltype(
auto)
columns( MT&& matrix, index_sequence<Is...> indices, RCAs... args )
558 return columns<Is...>( std::forward<MT>( matrix ), args... );
602inline decltype(
auto)
columns( MT&& matrix, initializer_list<T> indices, RCAs... args )
606 return columns( std::forward<MT>( matrix ), indices.begin(), indices.size(), args... );
653inline decltype(
auto)
columns( MT&& matrix,
const std::array<T,N>& indices, RCAs... args )
657 return columns( std::forward<MT>( matrix ), indices.data(), N, args... );
703inline decltype(
auto)
columns( MT&& matrix,
const std::vector<T>& indices, RCAs... args )
707 return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
755inline decltype(
auto)
columns( MT&& matrix,
const SmallArray<T,N>& indices, RCAs... args )
759 return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
785inline decltype(
auto)
columns( MT&& matrix,
const std::pair<T1,T2>& pair, RRAs... args )
789 return columns( std::forward<MT>( matrix ), pair.first, pair.second, args... );
816template<
size_t... CCAs
819 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
820inline decltype(
auto)
columns( const MatMatAddExpr<MT>& matrix, RCAs... args )
824 return columns<CCAs...>( (*matrix).leftOperand(), args... ) +
825 columns<CCAs...>( (*matrix).rightOperand(), args... );
844template<
size_t... CCAs
847 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
848inline decltype(
auto)
columns( const MatMatSubExpr<MT>& matrix, RCAs... args )
852 return columns<CCAs...>( (*matrix).leftOperand(), args... ) -
853 columns<CCAs...>( (*matrix).rightOperand(), args... );
872template<
size_t... CCAs
875 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
876inline decltype(
auto)
columns( const SchurExpr<MT>& matrix, RCAs... args )
880 return columns<CCAs...>( (*matrix).leftOperand(), args... ) %
881 columns<CCAs...>( (*matrix).rightOperand(), args... );
900template<
size_t... CCAs
903 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
904inline decltype(
auto)
columns( const MatMatMultExpr<MT>& matrix, RCAs... args )
908 return (*matrix).leftOperand() *
columns<CCAs...>( (*matrix).rightOperand(), args... );
931inline decltype(
auto)
columns(
const MatMatKronExpr<MT>& matrix, RCAs... args )
935 decltype(
auto) lhs( (*matrix).leftOperand() );
936 decltype(
auto) rhs( (*matrix).rightOperand() );
938 const size_t M( rhs.rows() );
939 const size_t N( rhs.columns() );
941 const auto lhsRows( [M](
size_t i ){
return i / M; } );
942 const auto rhsRows( [M](
size_t i ){
return i % M; } );
944 const auto lhsColumns( [N](
size_t i ) {
945 constexpr size_t indices[] = { I, Is... };
946 return indices[i] / N;
949 const auto rhsColumns( [N](
size_t i ) {
950 constexpr size_t indices[] = { I, Is... };
951 return indices[i] % N;
954 return columns(
rows( lhs, lhsRows, (*matrix).rows(), args... ), lhsColumns,
sizeof...(Is)+1UL, args... ) %
955 columns(
rows( rhs, rhsRows, (*matrix).rows(), args... ), rhsColumns,
sizeof...(Is)+1UL, args... );
979inline decltype(
auto)
columns(
const MatMatKronExpr<MT>& matrix, T* indices,
size_t n, RCAs... args )
983 decltype(
auto) lhs( (*matrix).leftOperand() );
984 decltype(
auto) rhs( (*matrix).rightOperand() );
986 const size_t M( rhs.rows() );
987 const size_t N( rhs.columns() );
989 const auto lhsRows( [M](
size_t i ){
return i / M; } );
990 const auto rhsRows( [M](
size_t i ){
return i % M; } );
992 SmallArray<size_t,128UL> lhsColumns;
993 lhsColumns.reserve( n );
995 for(
size_t i=0UL; i<n; ++i ) {
996 lhsColumns.pushBack( indices[i] / N );
999 SmallArray<size_t,128UL> rhsColumns;
1000 rhsColumns.reserve( n );
1002 for(
size_t i=0UL; i<n; ++i ) {
1003 rhsColumns.pushBack( indices[i] % N );
1006 return columns(
rows( lhs, lhsRows, (*matrix).rows(), args... ), lhsColumns, n, args... ) %
1007 columns(
rows( rhs, rhsRows, (*matrix).rows(), args... ), rhsColumns, n, args... );
1028template<
typename MT
1030 ,
typename... RCAs >
1031inline decltype(
auto)
columns(
const MatMatKronExpr<MT>& matrix, P p,
size_t n, RCAs... args )
1035 decltype(
auto) lhs( (*matrix).leftOperand() );
1036 decltype(
auto) rhs( (*matrix).rightOperand() );
1038 const size_t M( rhs.rows() );
1039 const size_t N( rhs.columns() );
1041 const auto lhsRows( [M](
size_t i ){
return i / M; } );
1042 const auto rhsRows( [M](
size_t i ){
return i % M; } );
1044 const auto lhsColumns( [p,N](
size_t i ) {
return p(i) / N; } );
1045 const auto rhsColumns( [p,N](
size_t i ) {
return p(i) % N; } );
1047 return columns(
rows( lhs, lhsRows, (*matrix).rows(), args... ), lhsColumns, n, args... ) %
1048 columns(
rows( rhs, rhsRows, (*matrix).rows(), args... ), rhsColumns, n, args... );
1067template<
size_t... CCAs
1070 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1071inline decltype(
auto)
columns( const VecTVecMultExpr<MT>& matrix, RCAs... args )
1076 return (*matrix).leftOperand() *
elements<CCAs...>( (*matrix).rightOperand(), args... );
1099template<
size_t... CCAs
1102 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1103inline decltype(
auto)
columns( const MatScalarMultExpr<MT>& matrix, RCAs... args )
1107 return columns<CCAs...>( (*matrix).leftOperand(), args... ) * (*matrix).rightOperand();
1126template<
size_t... CCAs
1129 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1130inline decltype(
auto)
columns( const MatScalarDivExpr<MT>& matrix, RCAs... args )
1134 return columns<CCAs...>( (*matrix).leftOperand(), args... ) / (*matrix).rightOperand();
1153template<
size_t... CCAs
1156 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1157inline decltype(
auto)
columns( const MatMapExpr<MT>& matrix, RCAs... args )
1161 return map( columns<CCAs...>( (*matrix).operand(), args... ), (*matrix).operation() );
1180template<
size_t... CCAs
1183 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1184inline decltype(
auto)
columns( const MatMatMapExpr<MT>& matrix, RCAs... args )
1188 return map( columns<CCAs...>( (*matrix).leftOperand(), args... ),
1189 columns<CCAs...>( (*matrix).rightOperand(), args... ),
1190 (*matrix).operation() );
1209template<
size_t... CCAs
1212 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1213inline decltype(
auto)
columns( const VecTVecMapExpr<MT>& matrix, RCAs... args )
1218 return map( (*matrix).leftOperand(),
1219 elements<CCAs...>( (*matrix).rightOperand(), args... ), (*matrix).operation() );
1242template<
size_t... CCAs
1245 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1246inline decltype(
auto)
columns( const MatEvalExpr<MT>& matrix, RCAs... args )
1250 return eval( columns<CCAs...>( (*matrix).operand(), args... ) );
1269template<
size_t... CCAs
1272 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1273inline decltype(
auto)
columns( const MatSerialExpr<MT>& matrix, RCAs... args )
1277 return serial( columns<CCAs...>( (*matrix).operand(), args... ) );
1296template<
size_t... CCAs
1299 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1300inline decltype(
auto)
columns( const MatNoAliasExpr<MT>& matrix, RCAs... args )
1304 return noalias( columns<CCAs...>( (*matrix).operand(), args... ) );
1323template<
size_t... CCAs
1326 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1327inline decltype(
auto)
columns( const MatNoSIMDExpr<MT>& matrix, RCAs... args )
1331 return nosimd( columns<CCAs...>( (*matrix).operand(), args... ) );
1350template<
size_t... CCAs
1353 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1354inline decltype(
auto)
columns( const DeclExpr<MT>& matrix, RCAs... args )
1358 return columns<CCAs...>( (*matrix).operand(), args... );
1377template<
size_t... CCAs
1380 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) >* =
nullptr >
1381inline decltype(
auto)
columns( const MatTransExpr<MT>& matrix, RCAs... args )
1385 return trans( rows<CCAs...>( (*matrix).operand(), args... ) );
1405template<
size_t... CCAs
1410 IsColumnMajorMatrix_v<MT> >* =
nullptr >
1411inline decltype(
auto)
columns(
const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
1416 constexpr size_t indices[] = { CCAs... };
1417 for(
size_t i=0UL; i<
sizeof...(CCAs); ++i ) {
1418 if( (*matrix).columns() <= indices[i] ) {
1424 return expand<
sizeof...( CCAs ) >( (*matrix).operand() );
1446template<
typename MT
1450 , EnableIf_t< IsColumnMajorMatrix_v<MT> >* =
nullptr >
1451inline decltype(
auto)
columns(
const VecExpandExpr<MT,CEAs...>& matrix, T* indices,
size_t n, RCAs... args )
1456 for(
size_t i=0UL; i<n; ++i ) {
1457 if( (*matrix).columns() <=
size_t( indices[i] ) ) {
1463 return expand( (*matrix).operand(), n );
1485template<
typename MT
1489 , EnableIf_t< IsColumnMajorMatrix_v<MT> >* =
nullptr >
1490inline decltype(
auto)
columns(
const VecExpandExpr<MT,CEAs...>& matrix, P p,
size_t n, RCAs... args )
1495 for(
size_t i=0UL; i<n; ++i ) {
1496 if( (*matrix).columns() <=
size_t( p(i) ) ) {
1502 return expand( (*matrix).operand(), n );
1521template<
size_t... CCAs
1525 ,
EnableIf_t< (
sizeof...( CCAs ) +
sizeof...( RCAs ) > 0UL ) &&
1526 !IsColumnMajorMatrix_v<MT> >* =
nullptr >
1527inline decltype(
auto)
columns( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
1532 return expand<CEAs...>(
elements<CCAs...>( (*matrix).operand(), args... ), (*matrix).expansion() );
1559 ,
typename... RCAs >
1560inline decltype(
auto)
columns(
const MatRepeatExpr<MT,CRAs...>& matrix, RCAs... args )
1565 constexpr size_t indices[] = { I, Is... };
1566 for(
size_t i=0UL; i<
sizeof...(Is)+1UL; ++i ) {
1567 if( (*matrix).columns() <= indices[i] ) {
1573 auto lambda = [
columns=(*matrix).operand().columns()](
size_t i ) {
1574 constexpr size_t indices[] = { I, Is... };
1579 , (*matrix).template repetitions<0UL>(), 1UL );
1600template<
typename MT
1603 ,
typename... RCAs >
1604inline decltype(
auto)
columns(
const MatRepeatExpr<MT,CRAs...>& matrix, T* indices,
size_t n, RCAs... args )
1609 for(
size_t i=0UL; i<n; ++i ) {
1610 if( (*matrix).columns() <=
size_t( indices[i] ) ) {
1616 SmallArray<size_t,128UL> newIndices( indices, indices+n );
1618 for(
size_t& index : newIndices ) {
1619 index = index % (*matrix).operand().columns();
1623 , (*matrix).template repetitions<0UL>(), 1UL );
1644template<
typename MT
1647 ,
typename... RCAs >
1648inline decltype(
auto)
columns(
const MatRepeatExpr<MT,CRAs...>& matrix, P p,
size_t n, RCAs... args )
1653 for(
size_t i=0UL; i<n; ++i ) {
1654 if( (*matrix).columns() <=
size_t( p(i) ) ) {
1660 auto lambda = [
columns=(*matrix).operand().columns(),p](
size_t i ) {
1665 , (*matrix).template repetitions<0UL>(), 1UL );
1695 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1696 RemoveReference_t<MT>::compileTimeArgs >* =
nullptr >
1697inline decltype(
auto)
columns( MT&& c, RCAs... args )
1701 return columns( c.operand(), subsequence<I,Is...>( RemoveReference_t<MT>::idces() ), args... );
1724 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1725 !RemoveReference_t<MT>::compileTimeArgs >* =
nullptr >
1726inline decltype(
auto)
columns( MT&& c, RCAs... args )
1731 constexpr size_t indices[] = { I, Is... };
1732 for(
size_t i=0UL; i<
sizeof...(Is)+1UL; ++i ) {
1733 if( c.columns() <= indices[i] ) {
1760template<
typename MT
1763 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > >* =
nullptr >
1764inline decltype(
auto)
columns( MT&& c, T* indices,
size_t n, RCAs... args )
1769 for(
size_t i=0UL; i<n; ++i ) {
1770 if( c.columns() <=
size_t( indices[i] ) ) {
1776 SmallArray<size_t,128UL> newIndices;
1777 newIndices.reserve( n );
1779 for(
size_t i=0UL; i<n; ++i ) {
1780 newIndices.pushBack( c.idx( indices[i] ) );
1783 return columns( c.operand(), newIndices.data(), newIndices.size(),
unchecked );
1804template<
typename MT
1807 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > && !IsPointer_v<P> >* =
nullptr >
1808inline decltype(
auto)
columns( MT&& c, P p,
size_t n, RCAs... args )
1813 for(
size_t i=0UL; i<n; ++i ) {
1814 if( c.columns() <=
size_t( p(i) ) ) {
1820 SmallArray<size_t,128UL> newIndices;
1821 newIndices.reserve( n );
1823 for(
size_t i=0UL; i<n; ++i ) {
1824 newIndices.pushBack( c.idx( p(i) ) );
1827 return columns( c.operand(), newIndices.data(), newIndices.size(),
unchecked );
1854template<
size_t... CEAs
1856 ,
typename... REAs >
1857inline decltype(
auto)
elements(
const TVecMatMultExpr<VT>& vector, REAs... args )
1862 return (*vector).leftOperand() *
columns<CEAs...>( (*vector).rightOperand(), args... );
1886template<
size_t... CEAs
1888 ,
typename... REAs >
1889inline decltype(
auto)
elements(
const MatReduceExpr<VT,columnwise>& vector, REAs... args )
1894 return reduce<columnwise>( columns<CEAs...>( (*vector).operand(), args... ), (*vector).operation() );
1924template<
size_t... CRAs
1927 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > >* =
nullptr >
1928inline decltype(
auto)
row( MT&&
columns, RRAs... args )
1961 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1962 RemoveReference_t<MT>::compileTimeArgs >* =
nullptr >
1967 return column< RemoveReference_t<MT>::idx(I) >(
columns.operand(), args... );
1986template<
size_t... CCAs
1989 , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1990 (
sizeof...( CCAs ) == 0UL || !RemoveReference_t<MT>::compileTimeArgs ) >* =
nullptr >
1995 const ColumnData<CCAs...> cd( args... );
1998 if(
columns.columns() <= cd.column() ) {
2047 ,
typename... CCAs >
2053 for(
size_t i=0UL; i<
columns.rows(); ++i )
2054 for(
size_t j=0UL; j<
columns.columns(); ++j )
2055 if( !isDefault<RF>(
columns(i,j) ) )
2059 for(
size_t j=0UL; j<
columns.columns(); ++j )
2060 for(
size_t i=0UL; i<
columns.rows(); ++i )
2061 if( !isDefault<RF>(
columns(i,j) ) )
2101 ,
typename... CCAs >
2106 for(
size_t j=0UL; j<
columns.columns(); ++j ) {
2107 for(
auto element=
columns.cbegin(j); element!=
columns.cend(j); ++element )
2108 if( !isDefault<RF>( element->value() ) )
return false;
2135template<
typename MT
2139 ,
typename... CCAs >
2140inline bool isIntact(
const Columns<MT,SO,DF,SF,CCAs...>&
columns )
noexcept
2163template<
typename MT
2169inline bool isSame(
const Columns<MT,SO1,DF,SF,CCAs...>& a,
const Matrix<MT,SO2>& b )
noexcept
2171 if( !
isSame( a.operand(), *b ) || ( a.rows() != (*b).rows() ) || ( a.columns() != (*b).columns() ) )
2174 for(
size_t j=0UL; j<a.columns(); ++j ) {
2198template<
typename MT
2204inline bool isSame(
const Matrix<MT,SO1>& a,
const Columns<MT,SO2,DF,SF,CCAs...>& b )
noexcept
2225template<
typename MT
2233inline bool isSame(
const Columns<MT,SO1,DF,SF,CCAs...>& a,
const Submatrix<MT,AF,SO2,DF,CSAs...>& b )
noexcept
2235 if( !
isSame( a.operand(), b.operand() ) || ( a.rows() != (*b).rows() ) || ( a.columns() != (*b).columns() ) )
2238 for(
size_t j=0UL; j<a.columns(); ++j ) {
2239 if( a.idx(j) != b.column()+j )
2262template<
typename MT
2269 ,
typename... CCAs >
2270inline bool isSame(
const Submatrix<MT,AF,SO1,DF,CSAs...>& a,
const Columns<MT,SO2,DF,SF,CCAs...>& b )
noexcept
2291template<
typename MT
2296 ,
typename... CCAs2 >
2297inline bool isSame(
const Columns<MT,SO,DF,SF,CCAs1...>& a,
2298 const Columns<MT,SO,DF,SF,CCAs2...>& b )
noexcept
2300 if( !
isSame( a.operand(), b.operand() ) || a.rows() != b.rows() || a.columns() != b.columns() )
2303 for(
size_t i=0UL; i<a.columns(); ++i ) {
2304 if( a.idx(i) != b.idx(i) )
2357 ,
typename... CCAs >
2358inline auto invert( Columns<MT,SO,true,SF,CCAs...>& c )
2359 -> DisableIf_t< HasMutableDataAccess_v<MT> >
2361 using RT =
ResultType_t< Columns<MT,SO,
true,SF,CCAs...> >;
2390template<
typename MT
2396inline bool trySet(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2401 return trySet( c.operand(), c.idx(i), j, value );
2425template<
typename MT
2432 trySet(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2439 const size_t jend(
column + n );
2441 for(
size_t j=
column; j<jend; ++j ) {
2442 if( !trySet( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2468template<
typename MT
2474inline bool tryAdd(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2479 return tryAdd( c.operand(), c.idx(i), j, value );
2503template<
typename MT
2510 tryAdd(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2517 const size_t jend(
column + n );
2519 for(
size_t j=
column; j<jend; ++j ) {
2520 if( !tryAdd( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2546template<
typename MT
2552inline bool trySub(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2557 return trySub( c.operand(), c.idx(i), j, value );
2581template<
typename MT
2588 trySub(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2595 const size_t jend(
column + n );
2597 for(
size_t j=
column; j<jend; ++j ) {
2598 if( !trySub( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2624template<
typename MT
2630inline bool tryMult(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2635 return tryMult( c.operand(), c.idx(i), j, value );
2659template<
typename MT
2666 tryMult(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2673 const size_t jend(
column + n );
2675 for(
size_t j=
column; j<jend; ++j ) {
2676 if( !tryMult( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2702template<
typename MT
2708inline bool tryDiv(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2713 return tryDiv( c.operand(), c.idx(i), j, value );
2737template<
typename MT
2744 tryDiv(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2751 const size_t jend(
column + n );
2753 for(
size_t j=
column; j<jend; ++j ) {
2754 if( !tryDiv( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2780template<
typename MT
2784 ,
typename... CCAs >
2785inline bool tryShift(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
int count )
2790 return tryShift( c.operand(), c.idx(i), j, count );
2814template<
typename MT
2818 ,
typename... CCAs >
2820 tryShift(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
int count )
2827 const size_t jend(
column + n );
2829 for(
size_t j=
column; j<jend; ++j ) {
2830 if( !tryShift( c.operand(),
row, c.idx(j), m, 1UL, count ) )
2856template<
typename MT
2862inline bool tryBitand(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2867 return tryBitand( c.operand(), c.idx(i), j, value );
2891template<
typename MT
2898 tryBitand(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2905 const size_t jend(
column + n );
2907 for(
size_t j=
column; j<jend; ++j ) {
2908 if( !tryBitand( c.operand(),
row, c.idx(j), m, 1UL, value ) )
2934template<
typename MT
2940inline bool tryBitor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
2945 return tryBitor( c.operand(), c.idx(i), j, value );
2969template<
typename MT
2976 tryBitor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
2983 const size_t jend(
column + n );
2985 for(
size_t j=
column; j<jend; ++j ) {
2986 if( !tryBitor( c.operand(),
row, c.idx(j), m, 1UL, value ) )
3012template<
typename MT
3018inline bool tryBitxor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t i,
size_t j,
const ET& value )
3023 return tryBitxor( c.operand(), c.idx(i), j, value );
3047template<
typename MT
3054 tryBitxor(
const Columns<MT,SO,DF,SF,CCAs...>& c,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
3061 const size_t jend(
column + n );
3063 for(
size_t j=
column; j<jend; ++j ) {
3064 if( !tryBitxor( c.operand(),
row, c.idx(j), m, 1UL, value ) )
3090template<
typename MT
3096inline bool tryAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3097 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3103 return tryAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
3125template<
typename MT
3131inline bool tryAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3132 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3138 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3139 if( !trySet( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
3167template<
typename MT
3174inline bool tryAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3184 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3185 if( !trySet( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
3211template<
typename MT1
3218inline bool tryAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3219 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3226 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
3254template<
typename MT
3260inline bool tryAddAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3261 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3267 return tryAddAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
3290template<
typename MT
3296inline bool tryAddAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3297 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3303 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3304 if( !tryAdd( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
3332template<
typename MT
3339inline bool tryAddAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3349 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3350 if( !tryAdd( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
3376template<
typename MT1
3383inline bool tryAddAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3384 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3391 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
3419template<
typename MT
3425inline bool trySubAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3426 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3432 return trySubAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
3455template<
typename MT
3461inline bool trySubAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3462 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3468 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3469 if( !trySub( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
3497template<
typename MT
3504inline bool trySubAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3514 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3515 if( !trySub( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
3542template<
typename MT1
3549inline bool trySubAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3550 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3557 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
3585template<
typename MT
3591inline bool tryMultAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3592 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3598 return tryMultAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
3621template<
typename MT
3627inline bool tryMultAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3628 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3634 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3635 if( !tryMult( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
3663template<
typename MT
3670inline bool tryMultAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3680 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3681 if( !tryMult( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
3708template<
typename MT1
3715inline bool trySchurAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3716 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
3723 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
3751template<
typename MT
3757inline bool tryDivAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3758 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3764 return tryDivAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
3787template<
typename MT
3793inline bool tryDivAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3794 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3800 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3801 if( !tryDiv( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
3829template<
typename MT
3836inline bool tryDivAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3846 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3847 if( !tryDiv( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
3874template<
typename MT
3880inline bool tryShiftAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3881 const Vector<VT,false>& rhs,
size_t row,
size_t column )
3887 return tryShiftAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
3910template<
typename MT
3916inline bool tryShiftAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3917 const Vector<VT,true>& rhs,
size_t row,
size_t column )
3923 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3924 if( !tryShift( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
3952template<
typename MT
3959inline bool tryShiftAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3969 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
3970 if( !tryShift( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
3996template<
typename MT1
4003inline bool tryShiftAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4004 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
4011 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
4039template<
typename MT
4045inline bool tryBitandAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4046 const Vector<VT,false>& rhs,
size_t row,
size_t column )
4052 return tryBitandAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
4075template<
typename MT
4081inline bool tryBitandAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4082 const Vector<VT,true>& rhs,
size_t row,
size_t column )
4088 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
4089 if( !tryBitand( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
4117template<
typename MT
4124inline bool tryBitandAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4134 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
4135 if( !tryBitand( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
4162template<
typename MT1
4169inline bool tryBitandAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4170 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
4177 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
4205template<
typename MT
4211inline bool tryBitorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4212 const Vector<VT,false>& rhs,
size_t row,
size_t column )
4218 return tryBitorAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
4241template<
typename MT
4247inline bool tryBitorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4248 const Vector<VT,true>& rhs,
size_t row,
size_t column )
4254 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
4255 if( !tryBitor( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
4283template<
typename MT
4290inline bool tryBitorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4300 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
4301 if( !tryBitor( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
4328template<
typename MT1
4335inline bool tryBitorAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4336 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
4343 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
4371template<
typename MT
4377inline bool tryBitxorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4378 const Vector<VT,false>& rhs,
size_t row,
size_t column )
4384 return tryBitxorAssign( lhs.operand(), *rhs,
row, lhs.idx(
column ) );
4407template<
typename MT
4413inline bool tryBitxorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4414 const Vector<VT,true>& rhs,
size_t row,
size_t column )
4420 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
4421 if( !tryBitxor( lhs.operand(),
row, lhs.idx(
column+i ), (*rhs)[i] ) )
4449template<
typename MT
4456inline bool tryBitxorAssign(
const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4466 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
4467 if( !tryBitxor( lhs.operand(),
row+i, lhs.idx(
column+i ), (*rhs)[i] ) )
4494template<
typename MT1
4501inline bool tryBitxorAssign(
const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4502 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
4509 for(
size_t j=0UL; j<(*rhs).columns(); ++j ) {
4535template<
typename MT
4539 ,
typename... CCAs >
4540inline decltype(
auto) derestrict( Columns<MT,SO,DF,SF,CCAs...>& c )
4563template<
typename MT
4567 ,
typename... CCAs >
4568inline decltype(
auto) derestrict( Columns<MT,SO,DF,SF,CCAs...>&& c )
4589template<
typename MT
4593 ,
typename... CCAs >
4594inline decltype(
auto) unview( Columns<MT,SO,DF,SF,CCAs...>& c )
4616template<
typename MT
4620 ,
typename... CCAs >
4621inline decltype(
auto) unview(
const Columns<MT,SO,DF,SF,CCAs...>& c )
4639template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CCAs >
4640struct Size< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
4641 :
public Size<MT,0UL>
4644template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t I,
size_t... Is,
typename... CCAs >
4645struct Size< Columns<MT,SO,DF,SF,
index_sequence<I,Is...>,CCAs...>, 1UL >
4646 :
public Ptrdiff_t< static_cast<ptrdiff_t>( 1UL+sizeof...(Is) ) >
4662template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CCAs >
4663struct MaxSize< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
4664 :
public MaxSize<MT,0UL>
4667template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t I,
size_t... Is,
typename... CCAs >
4668struct MaxSize< Columns<MT,SO,DF,SF,
index_sequence<I,Is...>,CCAs...>, 1UL >
4669 :
public Ptrdiff_t< static_cast<ptrdiff_t>( 1UL+sizeof...(Is) ) >
4685template<
typename MT,
bool SO,
bool DF,
bool SF,
typename... CCAs >
4686struct IsRestricted< Columns<MT,SO,DF,SF,CCAs...> >
4687 :
public IsRestricted<MT>
4703template<
typename MT,
bool SO,
bool SF,
typename... CCAs >
4704struct HasConstDataAccess< Columns<MT,SO,true,SF,CCAs...> >
4705 :
public HasConstDataAccess<MT>
4721template<
typename MT,
bool SO,
bool SF,
typename... CCAs >
4722struct HasMutableDataAccess< Columns<MT,SO,true,SF,CCAs...> >
4723 :
public HasMutableDataAccess<MT>
4739template<
typename MT,
bool SO,
bool SF,
typename... CCAs >
4740struct IsAligned< Columns<MT,SO,true,SF,CCAs...> >
4741 :
public IsAligned<MT>
Header file for auxiliary alias declarations.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
Header file for the alignment flag enumeration.
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the ColumnData class template.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the HasConstDataAccess type trait.
Header file for the HasMutableDataAccess type trait.
Header file for the integer_sequence and index_sequence aliases.
Header file for the IntegralConstant class template.
Header file for the dense matrix inversion flags.
Header file for the IsAligned type trait.
Header file for the IsColumnMajorMatrix type trait.
Header file for the IsColumns type trait.
Header file for the isDefault shim.
Header file for the IsPointer type trait.
Header file for the IsRestricted type trait.
Header file for the MaxSize type trait.
Header file for the MAYBE_UNUSED function template.
Constraint on the data type.
Header file for the reduction flags.
Header file for the relaxation flag enumeration.
Header file for the RemoveReference type trait.
Header file for the SmallArray implementation.
Base class for matrices.
Definition: Matrix.h:85
Index sequence type of the Blaze library.
Pointer difference type of the Blaze library.
Size type of the Blaze library.
Constraint on the data type.
Header file for the DeclExpr base class.
Header file for the MatEvalExpr base class.
Header file for the MatMapExpr base class.
Header file for the MatMatAddExpr base class.
Header file for the MatMatKronExpr base class.
Header file for the MatMatMapExpr base class.
Header file for the MatMatMultExpr base class.
Header file for the MatMatSubExpr base class.
Header file for the MatNoAliasExpr base class.
Header file for the MatNoSIMDExpr base class.
Header file for the MatReduceExpr base class.
Header file for the MatRepeatExpr base class.
Header file for the MatScalarDivExpr base class.
Header file for the MatScalarMultExpr base class.
Header file for the MatSerialExpr base class.
Header file for the MatTransExpr base class.
Header file for the Matrix base class.
Header file for the SchurExpr base class.
Header file for the TVecMatMultExpr base class.
Header file for the VecExpandExpr base class.
Header file for the VecTVecMapExpr base class.
Header file for the VecTVecMultExpr base class.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:140
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) columns(MT &&matrix, const std::vector< T > &indices, RCAs... args)
Creating a view on a selection of columns of the given matrix.
Definition: Columns.h:703
decltype(auto) noalias(const DenseMatrix< MT, SO > &dm)
Forces the non-aliased evaluation of the given dense matrix expression dm.
Definition: DMatNoAliasExpr.h:679
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:790
decltype(auto) repeat(const DenseMatrix< MT, SO > &dm, size_t m, size_t n)
Repeats the given dense matrix.
Definition: DMatRepeatExpr.h:543
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Elementwise evaluation of the given binary operation on each single element of the dense matrices lhs...
Definition: DMatDMatMapExpr.h:1144
decltype(auto) nosimd(const DenseMatrix< MT, SO > &dm)
Disables the SIMD evaluation of the given dense matrix expression dm.
Definition: DMatNoSIMDExpr.h:717
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) expand(const DenseVector< VT, TF > &dv, size_t expansion)
Expansion of the given dense vector.
Definition: DVecExpandExpr.h:746
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition: DiagonalMatrix.h:169
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:143
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:693
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.
Definition: MutableDataAccess.h:61
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
InversionFlag
Inversion flag.
Definition: InversionFlag.h:102
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition: AlignmentFlag.h:63
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
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:1424
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.
Definition: IntegralConstant.h:237
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
constexpr bool isChecked(const Ts &... args)
Extracting blaze::Check arguments from a given list of arguments.
Definition: Check.h:225
constexpr Unchecked unchecked
Global Unchecked instance.
Definition: Check.h:146
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Header file for the matrix storage order types.
Header file for the Size type trait.
Header file for all forward declarations for views.
Header file for the serial shim.
Header file for basic type definitions.
Header file for the implementation of the Columns base template.
Columns specialization for dense matrices.
Columns specialization for sparse matrices.