35 #ifndef _BLAZE_MATH_VIEWS_ROW_H_ 36 #define _BLAZE_MATH_VIEWS_ROW_H_ 133 inline decltype(
auto)
row(
Matrix<MT,SO>& matrix, RRAs... args )
137 using ReturnType = Row_<MT,I>;
138 return ReturnType( ~matrix, args... );
182 inline decltype(
auto)
row( const
Matrix<MT,SO>& matrix, RRAs... args )
186 using ReturnType =
const Row_<const MT,I>;
187 return ReturnType( ~matrix, args... );
210 inline decltype(
auto)
row(
Matrix<MT,SO>&& matrix, RRAs... args )
214 using ReturnType = Row_<MT,I>;
215 return ReturnType( ~matrix, args... );
256 template<
typename MT
259 inline decltype(
auto)
row(
Matrix<MT,SO>& matrix,
size_t index, RRAs... args )
263 using ReturnType = Row_<MT>;
264 return ReturnType( ~matrix, index, args... );
305 template<
typename MT
308 inline decltype(
auto)
row( const
Matrix<MT,SO>& matrix,
size_t index, RRAs... args )
312 using ReturnType =
const Row_<const MT>;
313 return ReturnType( ~matrix, index, args... );
333 template<
typename MT
336 inline decltype(
auto)
row(
Matrix<MT,SO>&& matrix,
size_t index, RRAs... args )
340 using ReturnType = Row_<MT>;
341 return ReturnType( ~matrix, index, args... );
366 template<
size_t... CRAs
369 inline decltype(
auto)
row( const MatMatAddExpr<MT>& matrix, RRAs... args )
373 return row<CRAs...>( (~matrix).leftOperand(), args... ) +
374 row<CRAs...>( (~matrix).rightOperand(), args... );
392 template<
size_t... CRAs
395 inline decltype(
auto)
row( const MatMatSubExpr<MT>& matrix, RRAs... args )
399 return row<CRAs...>( (~matrix).leftOperand(), args... ) -
400 row<CRAs...>( (~matrix).rightOperand(), args... );
417 template<
size_t... CRAs
420 inline decltype(
auto)
row( const SchurExpr<MT>& matrix, RRAs... args )
424 return row<CRAs...>( (~matrix).leftOperand(), args... ) *
425 row<CRAs...>( (~matrix).rightOperand(), args... );
443 template<
size_t... CRAs
446 inline decltype(
auto)
row( const MatMatMultExpr<MT>& matrix, RRAs... args )
450 return row<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
468 template<
size_t... CRAs
471 inline decltype(
auto)
row( const MatMatKronExpr<MT>& matrix, RRAs... args )
477 const RowData<CRAs...> rd( args... );
480 if( (~matrix).
rows() <= rd.row() ) {
485 const size_t rows( (~matrix).rightOperand().
rows() );
487 return kron(
row( (~matrix).leftOperand(), rd.row()/
rows ),
488 row( (~matrix).rightOperand(), rd.row()%
rows ) );
509 inline decltype(
auto)
row( const VecTVecMultExpr<MT>& matrix, RRAs... args )
516 if( (~matrix).
rows() <= I ) {
521 return (~matrix).leftOperand()[I] * (~matrix).rightOperand();
540 template<
typename MT
542 inline decltype(
auto)
row( const VecTVecMultExpr<MT>& matrix,
size_t index, RRAs... args )
549 if( (~matrix).
rows() <= index ) {
554 return (~matrix).leftOperand()[index] * (~matrix).rightOperand();
572 template<
size_t... CRAs
575 inline decltype(
auto)
row( const MatScalarMultExpr<MT>& matrix, RRAs... args )
579 return row<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
597 template<
size_t... CRAs
600 inline decltype(
auto)
row( const MatScalarDivExpr<MT>& matrix, RRAs... args )
604 return row<CRAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
622 template<
size_t... CRAs
625 inline decltype(
auto)
row( const MatMapExpr<MT>& matrix, RRAs... args )
629 return map( row<CRAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
647 template<
size_t... CRAs
650 inline decltype(
auto)
row( const MatMatMapExpr<MT>& matrix, RRAs... args )
654 return map( row<CRAs...>( (~matrix).leftOperand(), args... ),
655 row<CRAs...>( (~matrix).rightOperand(), args... ),
656 (~matrix).operation() );
674 template<
size_t... CRAs
677 inline decltype(
auto)
row( const MatEvalExpr<MT>& matrix, RRAs... args )
681 return eval( row<CRAs...>( (~matrix).operand(), args... ) );
699 template<
size_t... CRAs
702 inline decltype(
auto)
row( const MatSerialExpr<MT>& matrix, RRAs... args )
706 return serial( row<CRAs...>( (~matrix).operand(), args... ) );
724 template<
size_t... CRAs
727 inline decltype(
auto)
row( const DeclExpr<MT>& matrix, RRAs... args )
731 return row<CRAs...>( (~matrix).operand(), args... );
749 template<
size_t... CRAs
752 inline decltype(
auto)
row( const MatTransExpr<MT>& matrix, RRAs... args )
756 return trans( column<CRAs...>( (~matrix).operand(), args... ) );
774 template<
size_t... CRAs
778 , EnableIf_t< IsRowMajorMatrix_v<MT> >* =
nullptr >
779 inline decltype(
auto)
row( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
803 template<
size_t... CRAs
807 , EnableIf_t< !IsRowMajorMatrix_v<MT> >* =
nullptr >
808 inline decltype(
auto)
row( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
812 using ET = ElementType_t< MatrixType_t<MT> >;
814 const RowData<CRAs...> rd( args... );
816 return UniformVector<ET,rowVector>( (~matrix).
columns(), (~matrix).operand()[rd.row()] );
838 template<
typename MT
843 inline void reset( Row<MT,SO,DF,SF,CRAs...>&
row )
859 template<
typename MT
864 inline void reset( Row<MT,SO,DF,SF,CRAs...>&&
row )
882 template<
typename MT
887 inline void clear( Row<MT,SO,DF,SF,CRAs...>&
row )
905 template<
typename MT
910 inline void clear( Row<MT,SO,DF,SF,CRAs...>&&
row )
949 inline bool isDefault(
const Row<MT,SO,true,SF,CRAs...>&
row )
953 for(
size_t i=0UL; i<
row.size(); ++i )
954 if( !isDefault<RF>(
row[i] ) )
return false;
992 inline bool isDefault(
const Row<MT,SO,false,SF,CRAs...>&
row )
996 for(
const auto& element :
row )
997 if( !isDefault<RF>( element.value() ) )
return false;
1022 template<
typename MT
1027 inline bool isIntact(
const Row<MT,SO,DF,SF,CRAs...>&
row ) noexcept
1029 return (
row.row() <
row.operand().rows() &&
1049 template<
typename MT1
1057 inline bool isSame(
const Row<MT1,SO,DF,SF1,CRAs1...>& a,
1058 const Row<MT2,SO,DF,SF2,CRAs2...>& b ) noexcept
1060 return (
isSame( a.operand(), b.operand() ) && ( a.row() == b.row() ) );
1081 template<
typename MT
1087 inline bool trySet(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1091 return trySet(
row.operand(),
row.row(), index, value );
1113 template<
typename MT
1120 trySet(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1125 return trySet(
row.operand(),
row.row(), index, 1UL,
size, value );
1146 template<
typename MT
1152 inline bool tryAdd(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1156 return tryAdd(
row.operand(),
row.row(), index, value );
1178 template<
typename MT
1185 tryAdd(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1190 return tryAdd(
row.operand(),
row.row(), index, 1UL,
size, value );
1211 template<
typename MT
1217 inline bool trySub(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1221 return trySub(
row.operand(),
row.row(), index, value );
1243 template<
typename MT
1250 trySub(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1255 return trySub(
row.operand(),
row.row(), index, 1UL,
size, value );
1276 template<
typename MT
1282 inline bool tryMult(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1286 return tryMult(
row.operand(),
row.row(), index, value );
1308 template<
typename MT
1315 tryMult(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1320 return tryMult(
row.operand(),
row.row(), index, 1UL,
size, value );
1341 template<
typename MT
1347 inline bool tryDiv(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1351 return tryDiv(
row.operand(),
row.row(), index, value );
1373 template<
typename MT
1380 tryDiv(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1385 return tryDiv(
row.operand(),
row.row(), index, 1UL,
size, value );
1406 template<
typename MT
1411 inline bool tryShift(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
int count )
1415 return tryShift(
row.operand(),
row.row(), index, count );
1437 template<
typename MT
1443 tryShift(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
int count )
1448 return tryShift(
row.operand(),
row.row(), index, 1UL,
size, count );
1469 template<
typename MT
1475 inline bool tryBitand(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1479 return tryBitand(
row.operand(),
row.row(), index, value );
1501 template<
typename MT
1508 tryBitand(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1513 return tryBitand(
row.operand(),
row.row(), index, 1UL,
size, value );
1534 template<
typename MT
1540 inline bool tryBitor(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1544 return tryBitor(
row.operand(),
row.row(), index, value );
1566 template<
typename MT
1573 tryBitor(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1578 return tryBitor(
row.operand(),
row.row(), index, 1UL,
size, value );
1599 template<
typename MT
1605 inline bool tryBitxor(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1609 return tryBitxor(
row.operand(),
row.row(), index, value );
1631 template<
typename MT
1638 tryBitxor(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1643 return tryBitxor(
row.operand(),
row.row(), index, 1UL,
size, value );
1664 template<
typename MT
1670 inline bool tryAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1671 const Vector<VT,true>& rhs,
size_t index )
1676 return tryAssign( lhs.operand(), ~rhs, lhs.row(), index );
1697 template<
typename MT
1703 inline bool tryAddAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1704 const Vector<VT,true>& rhs,
size_t index )
1709 return tryAddAssign( lhs.operand(), ~rhs, lhs.row(), index );
1730 template<
typename MT
1736 inline bool trySubAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1737 const Vector<VT,true>& rhs,
size_t index )
1742 return trySubAssign( lhs.operand(), ~rhs, lhs.row(), index );
1763 template<
typename MT
1769 inline bool tryMultAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1770 const Vector<VT,true>& rhs,
size_t index )
1775 return tryMultAssign( lhs.operand(), ~rhs, lhs.row(), index );
1796 template<
typename MT
1802 inline bool tryDivAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1803 const Vector<VT,true>& rhs,
size_t index )
1808 return tryDivAssign( lhs.operand(), ~rhs, lhs.row(), index );
1829 template<
typename MT
1835 inline bool tryShiftAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1836 const Vector<VT,true>& rhs,
size_t index )
1841 return tryShiftAssign( lhs.operand(), ~rhs, lhs.row(), index );
1862 template<
typename MT
1868 inline bool tryBitandAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1869 const Vector<VT,true>& rhs,
size_t index )
1874 return tryBitandAssign( lhs.operand(), ~rhs, lhs.row(), index );
1895 template<
typename MT
1901 inline bool tryBitorAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1902 const Vector<VT,true>& rhs,
size_t index )
1907 return tryBitorAssign( lhs.operand(), ~rhs, lhs.row(), index );
1928 template<
typename MT
1934 inline bool tryBitxorAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1935 const Vector<VT,true>& rhs,
size_t index )
1940 return tryBitxorAssign( lhs.operand(), ~rhs, lhs.row(), index );
1961 template<
typename MT
1966 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF,I>& r )
1968 return row<I>( derestrict( r.operand() ),
unchecked );
1989 template<
typename MT
1994 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF,I>&& r )
1996 return row<I>( derestrict( r.operand() ),
unchecked );
2017 template<
typename MT
2021 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF>& r )
2023 return row( derestrict( r.operand() ), r.row(),
unchecked );
2044 template<
typename MT
2048 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF>&& r )
2050 return row( derestrict( r.operand() ), r.row(),
unchecked );
2066 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
2067 struct Size< Row<MT,SO,DF,SF,CRAs...>, 0UL >
2068 :
public Size<MT,1UL>
2084 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
2085 struct MaxSize< Row<MT,SO,DF,SF,CRAs...>, 0UL >
2086 :
public MaxSize<MT,1UL>
2102 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
2103 struct IsRestricted< Row<MT,SO,DF,SF,CRAs...> >
2104 :
public IsRestricted<MT>
2120 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
2121 struct HasConstDataAccess< Row<MT,SO,true,SF,CRAs...> >
2122 :
public HasConstDataAccess<MT>
2138 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
2139 struct HasMutableDataAccess< Row<MT,SO,true,SF,CRAs...> >
2140 :
public HasMutableDataAccess<MT>
2156 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
2157 struct IsAligned< Row<MT,SO,true,SF,CRAs...> >
2158 :
public BoolConstant< IsAligned_v<MT> && ( IsRowMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
2174 template<
typename MT,
bool SF,
size_t... CRAs >
2175 struct IsContiguous< Row<MT,true,true,SF,CRAs...> >
2176 :
public IsContiguous<MT>
2192 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
2193 struct IsPadded< Row<MT,SO,true,SF,CRAs...> >
2194 :
public BoolConstant< IsPadded_v<MT> && ( IsRowMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
2210 template<
typename MT,
bool DF,
size_t... CRAs >
2211 struct IsOpposedView< Row<MT,false,DF,false,CRAs...> >
#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 the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the RowData class template.
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 MatTransExpr base class.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Row specialization for dense matrices.
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.
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:154
Header file for the MAYBE_UNUSED function template.
Header file for the MatMatMultExpr base class.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Row specialization for sparse matrices.
Header file for the MaxSize type trait.
decltype(auto) kron(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the Kronecker product of two dense matrices ( ).
Definition: DMatDMatKronExpr.h:954
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 MatMapExpr base class.
Header file for the implementation of the Row base template.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
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.
Header file for the IsOpposedView type trait.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:786
Header file for the exception macros of the math module.
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
Header file for the IsPadded type trait.
Header file for the HasConstDataAccess type trait.
Header file for the DeclExpr base class.
Header file for the Matrix base class.
Header file for the MatScalarMultExpr base class.
Header file for run time assertion macros.
Header file for the Unique class template.
Header file for the IsContiguous type trait.
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) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#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
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.
Header file for the MatMatAddExpr base class.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
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 IsRowMajorMatrix type trait.
Header file for the MatMatMapExpr base class.
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 MatScalarDivExpr base class.
Header file for the Size type trait.
#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 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