35 #ifndef _BLAZE_MATH_VIEWS_BAND_H_ 36 #define _BLAZE_MATH_VIEWS_BAND_H_ 130 template< ptrdiff_t I
134 inline decltype(
auto)
band(
Matrix<MT,SO>& matrix, RBAs... args )
183 inline decltype(
auto)
band( const
Matrix<MT,SO>& matrix, RBAs... args )
211 inline decltype(
auto)
band(
Matrix<MT,SO>&& matrix, RBAs... args )
257 template<
typename MT
306 template<
typename MT
334 template<
typename MT
371 template<
typename MT
378 return band<0L>( ~matrix, args... );
406 template<
typename MT
413 return band<0L>( ~matrix, args... );
430 template<
typename MT
437 return band<0L>( ~matrix, args... );
469 return band<CBAs...>( (~matrix).leftOperand(), args... ) +
470 band<CBAs...>( (~matrix).rightOperand(), args... );
495 return band<CBAs...>( (~matrix).leftOperand(), args... ) -
496 band<CBAs...>( (~matrix).rightOperand(), args... );
520 return band<CBAs...>( (~matrix).leftOperand(), args... ) *
521 band<CBAs...>( (~matrix).rightOperand(), args... );
543 decltype(
auto) leftOperand ( (~matrix).leftOperand() );
544 decltype(
auto) rightOperand( (~matrix).rightOperand() );
546 const size_t row ( I < 0L ? -I : 0UL );
547 const size_t column( I >= 0L ? I : 0UL );
548 const size_t size (
min( leftOperand.size() -
row, rightOperand.size() -
column ) );
550 return transTo<defaultTransposeFlag>(
subvector( leftOperand , row , size ) ) *
551 transTo<defaultTransposeFlag>(
subvector( rightOperand, column, size ) );
568 template<
typename MT >
573 decltype(
auto) leftOperand ( (~matrix).leftOperand() );
574 decltype(
auto) rightOperand( (~matrix).rightOperand() );
576 const size_t row ( index < 0L ? -index : 0UL );
577 const size_t column( index >= 0L ? index : 0UL );
578 const size_t size (
min( leftOperand.size() -
row, rightOperand.size() -
column ) );
580 return transTo<defaultTransposeFlag>(
subvector( leftOperand , row , size ) ) *
581 transTo<defaultTransposeFlag>(
subvector( rightOperand, column, size ) );
606 return band<CBAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
631 return band<CBAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
656 return map( band<CBAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
681 return map( band<CBAs...>( (~matrix).leftOperand(), args... ),
682 band<CBAs...>( (~matrix).rightOperand(), args... ),
683 (~matrix).operation() );
708 return eval( band<CBAs...>( (~matrix).operand(), args... ) );
733 return serial( band<CBAs...>( (~matrix).operand(), args... ) );
758 return band<CBAs...>( (~matrix).operand(), args... );
783 return band<-CBAs...>( (~matrix).operand(), -args... );
817 inline decltype(
auto)
subvector( Band<MT,TF,DF,MF,I2>& b, RSAs... args )
821 constexpr
size_t row ( ( I2 >= 0L ? 0UL : -I2 ) + I1 );
822 constexpr
size_t column( ( I2 >= 0L ? I2 : 0UL ) + I1 );
824 return diagonal( submatrix<AF,row,column,N,N>( b.operand(), args... ),
unchecked );
851 inline decltype(
auto)
subvector(
const Band<MT,TF,DF,MF,I2>& b, RSAs... args )
855 constexpr
size_t row ( ( I2 >= 0L ? 0UL : -I2 ) + I1 );
856 constexpr
size_t column( ( I2 >= 0L ? I2 : 0UL ) + I1 );
858 return diagonal( submatrix<AF,row,column,N,N>( b.operand(), args... ),
unchecked );
885 inline decltype(
auto)
subvector( Band<MT,TF,DF,MF,I2>&& b, RSAs... args )
889 constexpr
size_t row ( ( I2 >= 0L ? 0UL : -I2 ) + I1 );
890 constexpr
size_t column( ( I2 >= 0L ? I2 : 0UL ) + I1 );
892 return diagonal( submatrix<AF,row,column,N,N>( b.operand(), args... ),
unchecked );
917 inline decltype(
auto)
subvector( Band<MT,TF,DF,MF,CBAs...>& b, RSAs... args )
923 const size_t row ( b.row() + sd.offset() );
924 const size_t column( b.column() + sd.offset() );
952 inline decltype(
auto)
subvector(
const Band<MT,TF,DF,MF,CBAs...>& b, RSAs... args )
958 const size_t row ( b.row() + sd.offset() );
959 const size_t column( b.column() + sd.offset() );
987 inline decltype(
auto)
subvector( Band<MT,TF,DF,MF,CBAs...>&& b, RSAs... args )
993 const size_t row ( b.row() + sd.offset() );
994 const size_t column( b.column() + sd.offset() );
1018 template<
typename MT
1023 inline void reset( Band<MT,TF,DF,MF,CBAs...>&
band )
1039 template<
typename MT
1044 inline void reset( Band<MT,TF,DF,MF,CBAs...>&& band )
1062 template<
typename MT
1067 inline void clear( Band<MT,TF,DF,MF,CBAs...>& band )
1085 template<
typename MT
1090 inline void clear( Band<MT,TF,DF,MF,CBAs...>&& band )
1129 inline bool isDefault(
const Band<MT,TF,true,MF,CBAs...>& band )
1133 for(
size_t i=0UL; i<band.size(); ++i )
1134 if( !isDefault<RF>( band[i] ) )
return false;
1172 inline bool isDefault(
const Band<MT,TF,false,MF,CBAs...>& band )
1176 for(
const auto& element : band )
1177 if( !isDefault<RF>( element.value() ) )
return false;
1202 template<
typename MT
1207 inline bool isIntact(
const Band<MT,TF,DF,MF,CBAs...>& band ) noexcept
1211 return ( ( index >= 0L ||
size_t( -index ) < band.operand().rows() ) &&
1212 ( index < 0L ||
size_t( index ) < band.operand().columns() ) &&
1232 template<
typename MT1
1240 isSame_backend(
const Band<MT1,TF,DF,MF,CBAs1...>& a,
1241 const Band<MT2,TF,DF,MF,CBAs2...>& b ) noexcept
1243 return (
isSame( a.operand(), b.operand() ) && ( a.band() == b.band() ) );
1262 template<
typename MT1
1270 isSame_backend(
const Band<MT1,TF,DF,MF,CBAs1...>& a,
1271 const Band<MT2,TF,DF,MF,CBAs2...>& b ) noexcept
1273 return (
isSame( a.operand().operand(), b.operand() ) &&
1274 ( a.size() == b.size() ) &&
1275 ( a.row() + a.operand().row() == b.row() ) &&
1276 ( a.column() + a.operand().column() == b.column() ) );
1295 template<
typename MT1
1303 isSame_backend(
const Band<MT1,TF,DF,MF,CBAs1...>& a,
1304 const Band<MT2,TF,DF,MF,CBAs2...>& b ) noexcept
1306 return (
isSame( a.operand(), b.operand().operand() ) &&
1307 ( a.size() == b.size() ) &&
1308 ( a.row() == b.row() + b.operand().row() ) &&
1309 ( a.column() == b.column() + b.operand().column() ) );
1328 template<
typename MT1
1335 inline EnableIf_< And< IsSubmatrix<MT1>, IsSubmatrix<MT2> >,
bool >
1336 isSame_backend(
const Band<MT1,TF,DF,MF,CBAs1...>& a,
1337 const Band<MT2,TF,DF,MF,CBAs2...>& b ) noexcept
1339 return (
isSame( a.operand().operand(), b.operand().operand() ) &&
1340 ( a.size() == b.size() ) &&
1341 ( a.row() + a.operand().row() == b.row() + b.operand().row() ) &&
1342 ( a.column() + a.operand().column() == b.column() + b.operand().column() ) );
1361 template<
typename MT1
1368 inline bool isSame(
const Band<MT1,TF,DF,MF,CBAs1...>& a,
1369 const Band<MT2,TF,DF,MF,CBAs2...>& b ) noexcept
1371 return isSame_backend( a, b );
1392 template<
typename MT
1398 inline bool trySet(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
const ET& value )
1402 return trySet( band.operand(), band.row()+index, band.column()+index, value );
1423 template<
typename MT
1429 inline bool tryAdd(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
const ET& value )
1433 return tryAdd( band.operand(), band.row()+index, band.column()+index, value );
1454 template<
typename MT
1460 inline bool trySub(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
const ET& value )
1464 return trySub( band.operand(), band.row()+index, band.column()+index, value );
1485 template<
typename MT
1491 inline bool tryMult(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
const ET& value )
1495 return tryMult( band.operand(), band.row()+index, band.column()+index, value );
1517 template<
typename MT
1524 tryMult(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
size_t size,
const ET& value )
1529 const size_t iend( index + size );
1531 for(
size_t i=index; i<iend; ++i ) {
1532 if( !tryMult( band.operand(), band.row()+i, band.column()+i, value ) )
1557 template<
typename MT
1563 inline bool tryDiv(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
const ET& value )
1567 return tryDiv( band.operand(), band.row()+index, band.column()+index, value );
1589 template<
typename MT
1596 tryDiv(
const Band<MT,TF,DF,MF,CBAs...>& band,
size_t index,
size_t size,
const ET& value )
1601 const size_t iend( index + size );
1603 for(
size_t i=index; i<iend; ++i ) {
1604 if( !tryDiv( band.operand(), band.row()+i, band.column()+i, value ) )
1629 template<
typename MT
1635 inline bool tryAssign(
const Band<MT,TF,DF,MF,CBAs...>& lhs,
1641 return tryAssign( lhs.operand(), ~rhs, lhs.band(), lhs.row()+index, lhs.column()+index );
1662 template<
typename MT
1668 inline bool tryAddAssign(
const Band<MT,TF,DF,MF,CBAs...>& lhs,
1674 return tryAddAssign( lhs.operand(), ~rhs, lhs.band(), lhs.row()+index, lhs.column()+index );
1695 template<
typename MT
1701 inline bool trySubAssign(
const Band<MT,TF,DF,MF,CBAs...>& lhs,
1707 return trySubAssign( lhs.operand(), ~rhs, lhs.band(), lhs.row()+index, lhs.column()+index );
1728 template<
typename MT
1734 inline bool tryMultAssign(
const Band<MT,TF,DF,MF,CBAs...>& lhs,
1740 return tryMultAssign( lhs.operand(), ~rhs, lhs.band(), lhs.row()+index, lhs.column()+index );
1761 template<
typename MT
1767 inline bool tryDivAssign(
const Band<MT,TF,DF,MF,CBAs...>& lhs,
1773 return tryDivAssign( lhs.operand(), ~rhs, lhs.band(), lhs.row()+index, lhs.column()+index );
1794 template<
typename MT
1799 inline decltype(
auto) derestrict( Band<MT,TF,DF,MF,I>& b )
1801 return band<I>( derestrict( b.operand() ),
unchecked );
1822 template<
typename MT
1827 inline decltype(
auto) derestrict( Band<MT,TF,DF,MF,I>&& b )
1829 return band<I>( derestrict( b.operand() ),
unchecked );
1850 template<
typename MT
1854 inline decltype(
auto) derestrict( Band<MT,TF,DF,MF>& b )
1856 return band( derestrict( b.operand() ), b.band(),
unchecked );
1877 template<
typename MT
1881 inline decltype(
auto) derestrict( Band<MT,TF,DF,MF>&& b )
1883 return band( derestrict( b.operand() ), b.band(),
unchecked );
1899 template<
typename MT,
bool TF,
bool DF,
bool MF, ptrdiff_t I >
1900 struct Size< Band<MT,TF,DF,MF,I>, 0UL >
1901 :
public IfTrue_< ( Size<MT,0UL>::value >= 0L && Size<MT,1UL>::value >= 0L )
1902 ,
Minimum< PtrdiffT< Size<MT,0UL>::value - ( I >= 0L ? 0L : -I ) >
1903 ,
PtrdiffT< Size<MT,1UL>::value - ( I >= 0L ? I : 0L ) > >
1920 template<
typename MT,
bool TF,
bool DF,
bool MF,
ptrdiff_t... CBAs >
1938 template<
typename MT,
bool TF,
bool MF,
ptrdiff_t... CBAs >
1956 template<
typename MT,
bool TF,
bool MF,
ptrdiff_t... CBAs >
1974 template<
typename MT,
bool TF,
bool DF,
bool MF,
ptrdiff_t... CBAs >
1992 template<
typename MT,
bool TF,
bool DF,
bool MF,
ptrdiff_t... CBAs,
size_t... CSAs >
2011 template<
typename MT,
bool TF,
bool DF,
bool MF,
ptrdiff_t... CBAs,
size_t... CEAs >
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:329
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
Pointer difference type of the Blaze library.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Header file for the blaze::checked and blaze::unchecked instances.
Base class for all binary matrix map expression templates.The MatMatMapExpr class serves as a tag for...
Definition: MatMatMapExpr.h:66
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
BLAZE_ALWAYS_INLINE 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:949
Header file for basic type definitions.
Base class for all matrix serial evaluation expression templates.The MatSerialExpr class serves as a ...
Definition: MatSerialExpr.h:67
Base class for all matrix/scalar division expression templates.The MatScalarDivExpr class serves as a...
Definition: MatScalarDivExpr.h:66
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Header file for the MatTransExpr base class.
Compile time check for resizable data types.This type trait tests whether the given data type is an o...
Definition: IsOpposedView.h:81
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Base class for all matrix/scalar multiplication expression templates.The MatScalarMultExpr class serv...
Definition: MatScalarMultExpr.h:67
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Header file for the MatEvalExpr base class.
Auxiliary class template for the data members of the Subvector class.The auxiliary SubvectorData clas...
Definition: SubvectorData.h:64
Header file for the implementation of the Band base template.
typename ElementsTrait< VT, CEAs... >::Type ElementsTrait_
Auxiliary alias declaration for the ElementsTrait type trait.The ElementsTrait_ alias declaration pro...
Definition: ElementsTrait.h:144
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the elements trait.
Header file for the band trait.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:109
Compile time check for low-level access to mutable data.This type trait tests whether the given data ...
Definition: HasMutableDataAccess.h:75
Header file for the MatMapExpr base class.
Band specialization for sparse matrices.
Header file for the DisableIf class template.
Base class for all matrix/matrix subtraction expression templates.The MatMatSubExpr class serves as a...
Definition: MatMatSubExpr.h:67
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 If class template.
Header file for the IsSubmatrix type trait.
Header file for the Not class template.
Header file for the implementation of the SubvectorData class template.
Header file for the subvector trait.
Base class for all matrix/matrix addition expression templates.The MatMatAddExpr class serves as a ta...
Definition: MatMatAddExpr.h:66
Header file for the MatMatSubExpr base class.
Base class for all unary matrix map expression templates.The MatMapExpr class serves as a tag for all...
Definition: MatMapExpr.h:66
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:794
Base template for the ElementsTrait class.
Definition: ElementsTrait.h:108
decltype(auto) diagonal(Matrix< MT, SO > &matrix, RDAs... args)
Creating a view on the diagonal of the given matrix.
Definition: Band.h:374
Header file for all forward declarations for expression class templates.
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:608
typename SubvectorTrait< VT, CSAs... >::Type SubvectorTrait_
Auxiliary alias declaration for the SubvectorTrait type trait.The SubvectorTrait_ alias declaration p...
Definition: SubvectorTrait.h:145
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:134
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 PtrdiffT class template.
Header file for all forward declarations for views.
Header file for the MatScalarMultExpr base class.
Base class for all Schur product expression templates.The SchurExpr class serves as a tag for all exp...
Definition: SchurExpr.h:66
Header file for run time assertion macros.
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:131
Compile time integral constant wrapper for ptrdiff_t.The PtrdiffT class template represents an integr...
Definition: PtrdiffT.h:72
Base class for all matrix evaluation expression templates.The MatEvalExpr class serves as a tag for a...
Definition: MatEvalExpr.h:66
#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
Compile time type negation.The Not alias declaration negates the given compile time condition...
Definition: Not.h:70
Header file for the isDefault shim.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
Base class for all matrix transposition expression templates.The MatTransExpr class serves as a tag f...
Definition: MatTransExpr.h:66
Header file for the HasMutableDataAccess type trait.
Header file for the MatMatAddExpr base class.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Base class for all outer product expression templates.The VecTVecMultExpr class serves as a tag for a...
Definition: VecTVecMultExpr.h:67
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Compile time check for submatrices.This type trait tests whether or not the given template parameter ...
Definition: IsSubmatrix.h:90
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:177
Band specialization for dense matrices.
Header file for the MatMatMapExpr base class.
Header file for the default transpose flag for all vectors of the Blaze library.
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
Header file for the Minimum class template.
Header file for the MatScalarDivExpr base class.
Header file for the IsRestricted type trait.
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.
Compile time value evaluation.The Minimum alias declaration selects the smaller of the two given temp...
Definition: Minimum.h:73
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:1134