35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_H_ 182 inline decltype(
auto)
column( const
Matrix<MT,SO>& matrix, RCAs... args )
256 template<
typename MT
259 inline decltype(
auto)
column(
Matrix<MT,SO>& matrix,
size_t index, RCAs... args )
305 template<
typename MT
308 inline decltype(
auto)
column( const
Matrix<MT,SO>& matrix,
size_t index, RCAs... args )
333 template<
typename MT
336 inline decltype(
auto)
column(
Matrix<MT,SO>&& matrix,
size_t index, RCAs... args )
366 template<
size_t... CCAs
369 inline decltype(
auto)
column( const MatMatAddExpr<MT>& matrix, RCAs... args )
373 return column<CCAs...>( (~matrix).leftOperand(), args... ) +
374 column<CCAs...>( (~matrix).rightOperand(), args... );
392 template<
size_t... CCAs
395 inline decltype(
auto)
column( const MatMatSubExpr<MT>& matrix, RCAs... args )
399 return column<CCAs...>( (~matrix).leftOperand(), args... ) -
400 column<CCAs...>( (~matrix).rightOperand(), args... );
418 template<
size_t... CCAs
421 inline decltype(
auto)
column( const SchurExpr<MT>& matrix, RCAs... args )
425 return column<CCAs...>( (~matrix).leftOperand(), args... ) *
426 column<CCAs...>( (~matrix).rightOperand(), args... );
444 template<
size_t... CCAs
447 inline decltype(
auto)
column( const MatMatMultExpr<MT>& matrix, RCAs... args )
451 return (~matrix).leftOperand() *
column<CCAs...>( (~matrix).rightOperand(), args... );
473 inline decltype(
auto)
column( const VecTVecMultExpr<MT>& matrix, RCAs... args )
480 if( (~matrix).
columns() <= I ) {
485 return (~matrix).leftOperand() * (~matrix).rightOperand()[I];
505 template<
typename MT
507 inline decltype(
auto)
column( const VecTVecMultExpr<MT>& matrix,
size_t index, RCAs... args )
514 if( (~matrix).
columns() <= index ) {
519 return (~matrix).leftOperand() * (~matrix).rightOperand()[index];
537 template<
size_t... CCAs
540 inline decltype(
auto)
column( const MatScalarMultExpr<MT>& matrix, RCAs... args )
544 return column<CCAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
562 template<
size_t... CCAs
565 inline decltype(
auto)
column( const MatScalarDivExpr<MT>& matrix, RCAs... args )
569 return column<CCAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
587 template<
size_t... CCAs
590 inline decltype(
auto)
column( const MatMapExpr<MT>& matrix, RCAs... args )
594 return map( column<CCAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
612 template<
size_t... CCAs
615 inline decltype(
auto)
column( const MatMatMapExpr<MT>& matrix, RCAs... args )
619 return map( column<CCAs...>( (~matrix).leftOperand(), args... ),
620 column<CCAs...>( (~matrix).rightOperand(), args... ),
621 (~matrix).operation() );
639 template<
size_t... CCAs
642 inline decltype(
auto)
column( const MatEvalExpr<MT>& matrix, RCAs... args )
646 return eval( column<CCAs...>( (~matrix).operand(), args... ) );
664 template<
size_t... CCAs
667 inline decltype(
auto)
column( const MatSerialExpr<MT>& matrix, RCAs... args )
671 return serial( column<CCAs...>( (~matrix).operand(), args... ) );
689 template<
size_t... CCAs
692 inline decltype(
auto)
column( const DeclExpr<MT>& matrix, RCAs... args )
696 return column<CCAs...>( (~matrix).operand(), args... );
714 template<
size_t... CCAs
717 inline decltype(
auto)
column( const MatTransExpr<MT>& matrix, RCAs... args )
721 return trans( row<CCAs...>( (~matrix).operand(), args... ) );
739 template<
size_t... CCAs
743 , EnableIf_t< IsColumnMajorMatrix_v<MT> >* =
nullptr >
744 inline decltype(
auto)
column( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
750 return subvector( (~matrix).operand(), 0UL, (~matrix).
rows() );
768 template<
size_t... CCAs
772 , EnableIf_t< !IsColumnMajorMatrix_v<MT> >* =
nullptr >
773 inline decltype(
auto)
column( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
777 using ET = ElementType_t< MatrixType_t<MT> >;
779 const ColumnData<CCAs...> cd( args... );
781 return UniformVector<ET,columnVector>( (~matrix).
rows(), (~matrix).operand()[cd.column()] );
803 template<
typename MT
808 inline void reset( Column<MT,SO,DF,SF,CCAs...>&
column )
824 template<
typename MT
829 inline void reset( Column<MT,SO,DF,SF,CCAs...>&&
column )
847 template<
typename MT
852 inline void clear( Column<MT,SO,DF,SF,CCAs...>&
column )
870 template<
typename MT
875 inline void clear( Column<MT,SO,DF,SF,CCAs...>&&
column )
918 for(
size_t i=0UL; i<
column.size(); ++i )
919 if( !isDefault<RF>(
column[i] ) )
return false;
961 for(
const auto& element :
column )
962 if( !isDefault<RF>( element.value() ) )
return false;
987 template<
typename MT
992 inline bool isIntact(
const Column<MT,SO,DF,SF,CCAs...>&
column ) noexcept
994 return (
column.column() <
column.operand().columns() &&
1014 template<
typename MT1
1022 inline bool isSame(
const Column<MT1,SO,DF,SF1,CCAs1...>& a,
1023 const Column<MT2,SO,DF,SF2,CCAs2...>& b ) noexcept
1025 return (
isSame( a.operand(), b.operand() ) && ( a.column() == b.column() ) );
1046 template<
typename MT
1052 inline bool trySet(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1056 return trySet(
column.operand(), index,
column.column(), value );
1077 template<
typename MT
1083 inline bool tryAdd(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1087 return tryAdd(
column.operand(), index,
column.column(), value );
1108 template<
typename MT
1114 inline bool trySub(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1118 return trySub(
column.operand(), index,
column.column(), value );
1139 template<
typename MT
1145 inline bool tryMult(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1149 return tryMult(
column.operand(), index,
column.column(), value );
1171 template<
typename MT
1178 tryMult(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1183 return tryMult(
column.operand(), index,
column.column(),
size, 1UL, value );
1204 template<
typename MT
1210 inline bool tryDiv(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1214 return tryDiv(
column.operand(), index,
column.column(), value );
1236 template<
typename MT
1243 tryDiv(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1248 return tryDiv(
column.operand(), index,
column.column(),
size, 1UL, value );
1269 template<
typename MT
1275 inline bool tryAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1276 const Vector<VT,false>& rhs,
size_t index )
1281 return tryAssign( lhs.operand(), ~rhs, index, lhs.column() );
1302 template<
typename MT
1308 inline bool tryAddAssign(
const Column<MT,SO,SF,SF,CCAs...>& lhs,
1309 const Vector<VT,false>& rhs,
size_t index )
1314 return tryAddAssign( lhs.operand(), ~rhs, index, lhs.column() );
1335 template<
typename MT
1341 inline bool trySubAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1342 const Vector<VT,false>& rhs,
size_t index )
1347 return trySubAssign( lhs.operand(), ~rhs, index, lhs.column() );
1368 template<
typename MT
1374 inline bool tryMultAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1375 const Vector<VT,false>& rhs,
size_t index )
1380 return tryMultAssign( lhs.operand(), ~rhs, index, lhs.column() );
1401 template<
typename MT
1407 inline bool tryDivAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1408 const Vector<VT,false>& rhs,
size_t index )
1413 return tryDivAssign( lhs.operand(), ~rhs, index, lhs.column() );
1434 template<
typename MT
1439 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF,I>& c )
1441 return column<I>( derestrict( c.operand() ),
unchecked );
1462 template<
typename MT
1467 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF,I>&& c )
1469 return column<I>( derestrict( c.operand() ),
unchecked );
1490 template<
typename MT
1494 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF>& c )
1517 template<
typename MT
1521 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF>&& c )
1539 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
1540 struct Size< Column<MT,SO,DF,SF,CRAs...>, 0UL >
1541 :
public Size<MT,0UL>
1557 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
1558 struct MaxSize< Column<MT,SO,DF,SF,CRAs...>, 0UL >
1559 :
public MaxSize<MT,0UL>
1575 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CCAs >
1576 struct IsRestricted< Column<MT,SO,DF,SF,CCAs...> >
1577 :
public IsRestricted<MT>
1593 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
1594 struct HasConstDataAccess< Column<MT,SO,true,SF,CCAs...> >
1595 :
public HasConstDataAccess<MT>
1611 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
1612 struct HasMutableDataAccess< Column<MT,SO,true,SF,CCAs...> >
1613 :
public HasMutableDataAccess<MT>
1629 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
1630 struct IsAligned< Column<MT,SO,true,SF,CCAs...> >
1631 :
public BoolConstant< IsAligned_v<MT> && ( IsColumnMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1647 template<
typename MT,
bool SF,
size_t... CCAs >
1648 struct IsContiguous< Column<MT,true,true,SF,CCAs...> >
1649 :
public IsContiguous<MT>
1665 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
1666 struct IsPadded< Column<MT,SO,true,SF,CCAs...> >
1667 :
BoolConstant< IsPadded_v<MT> && ( IsColumnMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1683 template<
typename MT,
bool DF,
size_t... CCAs >
1684 struct IsOpposedView< Column<MT,false,DF,false,CCAs...> >
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
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the 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.
Header file for the IsColumnMajorMatrix type trait.
Header file for the implementation of the Column base template.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Header file for the MatEvalExpr base class.
Header file for the MatMatMultExpr base class.
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
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
Column specialization for dense matrices.
Header file for the MatMapExpr base class.
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.
#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 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
Column specialization for sparse matrices.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the implementation of the ColumnData class template.
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