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 )
182 inline decltype(
auto)
row( const
Matrix<MT,SO>& matrix, RRAs... args )
210 inline decltype(
auto)
row(
Matrix<MT,SO>&& matrix, RRAs... args )
256 template<
typename MT
259 inline decltype(
auto)
row(
Matrix<MT,SO>& matrix,
size_t index, RRAs... args )
305 template<
typename MT
308 inline decltype(
auto)
row( const
Matrix<MT,SO>& matrix,
size_t index, RRAs... args )
333 template<
typename MT
336 inline decltype(
auto)
row(
Matrix<MT,SO>&& matrix,
size_t index, RRAs... 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();
471 inline decltype(
auto)
row( const VecTVecMultExpr<MT>& matrix, RRAs... args )
478 if( (~matrix).
rows() <= I ) {
483 return (~matrix).leftOperand()[I] * (~matrix).rightOperand();
502 template<
typename MT
504 inline decltype(
auto)
row( const VecTVecMultExpr<MT>& matrix,
size_t index, RRAs... args )
511 if( (~matrix).
rows() <= index ) {
516 return (~matrix).leftOperand()[index] * (~matrix).rightOperand();
534 template<
size_t... CRAs
537 inline decltype(
auto)
row( const MatScalarMultExpr<MT>& matrix, RRAs... args )
541 return row<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
559 template<
size_t... CRAs
562 inline decltype(
auto)
row( const MatScalarDivExpr<MT>& matrix, RRAs... args )
566 return row<CRAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
584 template<
size_t... CRAs
587 inline decltype(
auto)
row( const MatMapExpr<MT>& matrix, RRAs... args )
591 return map( row<CRAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
609 template<
size_t... CRAs
612 inline decltype(
auto)
row( const MatMatMapExpr<MT>& matrix, RRAs... args )
616 return map( row<CRAs...>( (~matrix).leftOperand(), args... ),
617 row<CRAs...>( (~matrix).rightOperand(), args... ),
618 (~matrix).operation() );
636 template<
size_t... CRAs
639 inline decltype(
auto)
row( const MatEvalExpr<MT>& matrix, RRAs... args )
643 return eval( row<CRAs...>( (~matrix).operand(), args... ) );
661 template<
size_t... CRAs
664 inline decltype(
auto)
row( const MatSerialExpr<MT>& matrix, RRAs... args )
668 return serial( row<CRAs...>( (~matrix).operand(), args... ) );
686 template<
size_t... CRAs
689 inline decltype(
auto)
row( const DeclExpr<MT>& matrix, RRAs... args )
693 return row<CRAs...>( (~matrix).operand(), args... );
711 template<
size_t... CRAs
714 inline decltype(
auto)
row( const MatTransExpr<MT>& matrix, RRAs... args )
718 return trans( column<CRAs...>( (~matrix).operand(), args... ) );
736 template<
size_t... CRAs
740 , EnableIf_t< IsRowMajorMatrix_v<MT> >* =
nullptr >
741 inline decltype(
auto)
row( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
765 template<
size_t... CRAs
769 , EnableIf_t< !IsRowMajorMatrix_v<MT> >* =
nullptr >
770 inline decltype(
auto)
row( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
774 using ET = ElementType_t< MatrixType_t<MT> >;
776 const RowData<CRAs...> rd( args... );
778 return UniformVector<ET,rowVector>( (~matrix).
columns(), (~matrix).operand()[rd.row()] );
800 template<
typename MT
805 inline void reset( Row<MT,SO,DF,SF,CRAs...>&
row )
821 template<
typename MT
826 inline void reset( Row<MT,SO,DF,SF,CRAs...>&&
row )
844 template<
typename MT
849 inline void clear( Row<MT,SO,DF,SF,CRAs...>&
row )
867 template<
typename MT
872 inline void clear( Row<MT,SO,DF,SF,CRAs...>&&
row )
911 inline bool isDefault(
const Row<MT,SO,true,SF,CRAs...>&
row )
915 for(
size_t i=0UL; i<
row.size(); ++i )
916 if( !isDefault<RF>(
row[i] ) )
return false;
954 inline bool isDefault(
const Row<MT,SO,false,SF,CRAs...>&
row )
958 for(
const auto& element :
row )
959 if( !isDefault<RF>( element.value() ) )
return false;
984 template<
typename MT
989 inline bool isIntact(
const Row<MT,SO,DF,SF,CRAs...>&
row ) noexcept
991 return (
row.row() <
row.operand().rows() &&
1011 template<
typename MT1
1019 inline bool isSame(
const Row<MT1,SO,DF,SF1,CRAs1...>& a,
1020 const Row<MT2,SO,DF,SF2,CRAs2...>& b ) noexcept
1022 return (
isSame( a.operand(), b.operand() ) && ( a.row() == b.row() ) );
1043 template<
typename MT
1049 inline bool trySet(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1053 return trySet(
row.operand(),
row.row(), index, value );
1074 template<
typename MT
1080 inline bool tryAdd(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1084 return tryAdd(
row.operand(),
row.row(), index, value );
1105 template<
typename MT
1111 inline bool trySub(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1115 return trySub(
row.operand(),
row.row(), index, value );
1136 template<
typename MT
1142 inline bool tryMult(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1146 return tryMult(
row.operand(),
row.row(), index, value );
1168 template<
typename MT
1175 tryMult(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1180 return tryMult(
row.operand(),
row.row(), index, 1UL,
size, value );
1201 template<
typename MT
1207 inline bool tryDiv(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
const ET& value )
1211 return tryDiv(
row.operand(),
row.row(), index, value );
1233 template<
typename MT
1240 tryDiv(
const Row<MT,SO,DF,SF,CRAs...>&
row,
size_t index,
size_t size,
const ET& value )
1245 return tryDiv(
row.operand(),
row.row(), index, 1UL,
size, value );
1266 template<
typename MT
1272 inline bool tryAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1273 const Vector<VT,true>& rhs,
size_t index )
1278 return tryAssign( lhs.operand(), ~rhs, lhs.row(), index );
1299 template<
typename MT
1305 inline bool tryAddAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1306 const Vector<VT,true>& rhs,
size_t index )
1311 return tryAddAssign( lhs.operand(), ~rhs, lhs.row(), index );
1332 template<
typename MT
1338 inline bool trySubAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1339 const Vector<VT,true>& rhs,
size_t index )
1344 return trySubAssign( lhs.operand(), ~rhs, lhs.row(), index );
1365 template<
typename MT
1371 inline bool tryMultAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1372 const Vector<VT,true>& rhs,
size_t index )
1377 return tryMultAssign( lhs.operand(), ~rhs, lhs.row(), index );
1398 template<
typename MT
1404 inline bool tryDivAssign(
const Row<MT,SO,DF,SF,CRAs...>& lhs,
1405 const Vector<VT,true>& rhs,
size_t index )
1410 return tryDivAssign( lhs.operand(), ~rhs, lhs.row(), index );
1431 template<
typename MT
1436 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF,I>& r )
1438 return row<I>( derestrict( r.operand() ),
unchecked );
1459 template<
typename MT
1464 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF,I>&& r )
1466 return row<I>( derestrict( r.operand() ),
unchecked );
1487 template<
typename MT
1491 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF>& r )
1493 return row( derestrict( r.operand() ), r.row(),
unchecked );
1514 template<
typename MT
1518 inline decltype(
auto) derestrict( Row<MT,SO,DF,SF>&& r )
1520 return row( derestrict( r.operand() ), r.row(),
unchecked );
1536 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
1537 struct Size< Row<MT,SO,DF,SF,CRAs...>, 0UL >
1538 :
public Size<MT,1UL>
1554 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
1555 struct MaxSize< Row<MT,SO,DF,SF,CRAs...>, 0UL >
1556 :
public MaxSize<MT,1UL>
1572 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
1573 struct IsRestricted< Row<MT,SO,DF,SF,CRAs...> >
1574 :
public IsRestricted<MT>
1590 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
1591 struct HasConstDataAccess< Row<MT,SO,true,SF,CRAs...> >
1592 :
public HasConstDataAccess<MT>
1608 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
1609 struct HasMutableDataAccess< Row<MT,SO,true,SF,CRAs...> >
1610 :
public HasMutableDataAccess<MT>
1626 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
1627 struct IsAligned< Row<MT,SO,true,SF,CRAs...> >
1628 :
public BoolConstant< IsAligned_v<MT> && ( IsRowMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1644 template<
typename MT,
bool SF,
size_t... CRAs >
1645 struct IsContiguous< Row<MT,true,true,SF,CRAs...> >
1646 :
public IsContiguous<MT>
1662 template<
typename MT,
bool SO,
bool SF,
size_t... CRAs >
1663 struct IsPadded< Row<MT,SO,true,SF,CRAs...> >
1664 :
public BoolConstant< IsPadded_v<MT> && ( IsRowMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1680 template<
typename MT,
bool DF,
size_t... CRAs >
1681 struct IsOpposedView< Row<MT,false,DF,false,CRAs...> >
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:329
#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.
Header file for the UNUSED_PARAMETER function 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:591
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.
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: TrueType.h:61
Row specialization for sparse matrices.
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 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:139
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:611
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:109
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 class template represents ...
Definition: IntegralConstant.h:101
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.
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:263
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 Size type trait.
#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 TrueType type/value trait base class.
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