35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_H_ 36 #define _BLAZE_MATH_VIEWS_COLUMN_H_ 137 using ReturnType = Column_<MT,I>;
138 return ReturnType( ~matrix, args... );
182 inline decltype(
auto)
column( const
Matrix<MT,SO>& matrix, RCAs... args )
186 using ReturnType =
const Column_<const MT,I>;
187 return ReturnType( ~matrix, args... );
214 using ReturnType = Column_<MT,I>;
215 return ReturnType( ~matrix, args... );
256 template<
typename MT
259 inline decltype(
auto)
column(
Matrix<MT,SO>& matrix,
size_t index, RCAs... args )
263 using ReturnType = Column_<MT>;
264 return ReturnType( ~matrix, index, args... );
305 template<
typename MT
308 inline decltype(
auto)
column( const
Matrix<MT,SO>& matrix,
size_t index, RCAs... args )
312 using ReturnType =
const Column_<const MT>;
313 return ReturnType( ~matrix, index, args... );
333 template<
typename MT
336 inline decltype(
auto)
column(
Matrix<MT,SO>&& matrix,
size_t index, RCAs... args )
340 using ReturnType = Column_<MT>;
341 return ReturnType( ~matrix, index, 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... );
469 template<
size_t... CCAs
472 inline decltype(
auto)
column( const MatMatKronExpr<MT>& matrix, RCAs... args )
478 const ColumnData<CCAs...> cd( args... );
481 if( (~matrix).
columns() <= cd.column() ) {
511 inline decltype(
auto)
column( const VecTVecMultExpr<MT>& matrix, RCAs... args )
518 if( (~matrix).
columns() <= I ) {
523 return (~matrix).leftOperand() * (~matrix).rightOperand()[I];
543 template<
typename MT
545 inline decltype(
auto)
column( const VecTVecMultExpr<MT>& matrix,
size_t index, RCAs... args )
552 if( (~matrix).
columns() <= index ) {
557 return (~matrix).leftOperand() * (~matrix).rightOperand()[index];
575 template<
size_t... CCAs
578 inline decltype(
auto)
column( const MatScalarMultExpr<MT>& matrix, RCAs... args )
582 return column<CCAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
600 template<
size_t... CCAs
603 inline decltype(
auto)
column( const MatScalarDivExpr<MT>& matrix, RCAs... args )
607 return column<CCAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
625 template<
size_t... CCAs
628 inline decltype(
auto)
column( const MatMapExpr<MT>& matrix, RCAs... args )
632 return map( column<CCAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
650 template<
size_t... CCAs
653 inline decltype(
auto)
column( const MatMatMapExpr<MT>& matrix, RCAs... args )
657 return map( column<CCAs...>( (~matrix).leftOperand(), args... ),
658 column<CCAs...>( (~matrix).rightOperand(), args... ),
659 (~matrix).operation() );
677 template<
size_t... CCAs
680 inline decltype(
auto)
column( const MatEvalExpr<MT>& matrix, RCAs... args )
684 return eval( column<CCAs...>( (~matrix).operand(), args... ) );
702 template<
size_t... CCAs
705 inline decltype(
auto)
column( const MatSerialExpr<MT>& matrix, RCAs... args )
709 return serial( column<CCAs...>( (~matrix).operand(), args... ) );
727 template<
size_t... CCAs
730 inline decltype(
auto)
column( const DeclExpr<MT>& matrix, RCAs... args )
734 return column<CCAs...>( (~matrix).operand(), args... );
752 template<
size_t... CCAs
755 inline decltype(
auto)
column( const MatTransExpr<MT>& matrix, RCAs... args )
759 return trans( row<CCAs...>( (~matrix).operand(), args... ) );
777 template<
size_t... CCAs
781 , EnableIf_t< IsColumnMajorMatrix_v<MT> >* =
nullptr >
782 inline decltype(
auto)
column( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
788 return subvector( (~matrix).operand(), 0UL, (~matrix).
rows() );
806 template<
size_t... CCAs
810 , EnableIf_t< !IsColumnMajorMatrix_v<MT> >* =
nullptr >
811 inline decltype(
auto)
column( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
815 using ET = ElementType_t< MatrixType_t<MT> >;
817 const ColumnData<CCAs...> cd( args... );
819 return UniformVector<ET,columnVector>( (~matrix).
rows(), (~matrix).operand()[cd.column()] );
841 template<
typename MT
846 inline void reset( Column<MT,SO,DF,SF,CCAs...>&
column )
862 template<
typename MT
867 inline void reset( Column<MT,SO,DF,SF,CCAs...>&&
column )
885 template<
typename MT
890 inline void clear( Column<MT,SO,DF,SF,CCAs...>&
column )
908 template<
typename MT
913 inline void clear( Column<MT,SO,DF,SF,CCAs...>&&
column )
956 for(
size_t i=0UL; i<
column.size(); ++i )
957 if( !isDefault<RF>(
column[i] ) )
return false;
999 for(
const auto& element :
column )
1000 if( !isDefault<RF>( element.value() ) )
return false;
1025 template<
typename MT
1030 inline bool isIntact(
const Column<MT,SO,DF,SF,CCAs...>&
column ) noexcept
1032 return (
column.column() <
column.operand().columns() &&
1052 template<
typename MT1
1060 inline bool isSame(
const Column<MT1,SO,DF,SF1,CCAs1...>& a,
1061 const Column<MT2,SO,DF,SF2,CCAs2...>& b ) noexcept
1063 return (
isSame( a.operand(), b.operand() ) && ( a.column() == b.column() ) );
1084 template<
typename MT
1090 inline bool trySet(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1094 return trySet(
column.operand(), index,
column.column(), value );
1116 template<
typename MT
1123 trySet(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1128 return trySet(
column.operand(), index,
column.column(),
size, 1UL, value );
1149 template<
typename MT
1155 inline bool tryAdd(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1159 return tryAdd(
column.operand(), index,
column.column(), value );
1181 template<
typename MT
1188 tryAdd(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1193 return tryAdd(
column.operand(), index,
column.column(),
size, 1UL, value );
1214 template<
typename MT
1220 inline bool trySub(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1224 return trySub(
column.operand(), index,
column.column(), value );
1246 template<
typename MT
1253 trySub(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1258 return trySub(
column.operand(), index,
column.column(),
size, 1UL, value );
1279 template<
typename MT
1285 inline bool tryMult(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1289 return tryMult(
column.operand(), index,
column.column(), value );
1311 template<
typename MT
1318 tryMult(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1323 return tryMult(
column.operand(), index,
column.column(),
size, 1UL, value );
1344 template<
typename MT
1350 inline bool tryDiv(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1354 return tryDiv(
column.operand(), index,
column.column(), value );
1376 template<
typename MT
1383 tryDiv(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1388 return tryDiv(
column.operand(), index,
column.column(),
size, 1UL, value );
1409 template<
typename MT
1414 inline bool tryShift(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
int count )
1418 return tryShift(
column.operand(), index,
column.column(), count );
1440 template<
typename MT
1446 tryShift(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
int count )
1451 return tryShift(
column.operand(), index,
column.column(),
size, 1UL, count );
1472 template<
typename MT
1478 inline bool tryBitand(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1482 return tryBitand(
column.operand(), index,
column.column(), value );
1504 template<
typename MT
1511 tryBitand(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1516 return tryBitand(
column.operand(), index,
column.column(),
size, 1UL, value );
1537 template<
typename MT
1543 inline bool tryBitor(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1547 return tryBitor(
column.operand(), index,
column.column(), value );
1569 template<
typename MT
1576 tryBitor(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1581 return tryBitor(
column.operand(), index,
column.column(),
size, 1UL, value );
1602 template<
typename MT
1608 inline bool tryBitxor(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
const ET& value )
1612 return tryBitxor(
column.operand(), index,
column.column(), value );
1634 template<
typename MT
1641 tryBitxor(
const Column<MT,SO,DF,SF,CCAs...>&
column,
size_t index,
size_t size,
const ET& value )
1646 return tryBitxor(
column.operand(), index,
column.column(),
size, 1UL, value );
1667 template<
typename MT
1673 inline bool tryAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1674 const Vector<VT,false>& rhs,
size_t index )
1679 return tryAssign( lhs.operand(), ~rhs, index, lhs.column() );
1700 template<
typename MT
1706 inline bool tryAddAssign(
const Column<MT,SO,SF,SF,CCAs...>& lhs,
1707 const Vector<VT,false>& rhs,
size_t index )
1712 return tryAddAssign( lhs.operand(), ~rhs, index, lhs.column() );
1733 template<
typename MT
1739 inline bool trySubAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1740 const Vector<VT,false>& rhs,
size_t index )
1745 return trySubAssign( lhs.operand(), ~rhs, index, lhs.column() );
1766 template<
typename MT
1772 inline bool tryMultAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1773 const Vector<VT,false>& rhs,
size_t index )
1778 return tryMultAssign( lhs.operand(), ~rhs, index, lhs.column() );
1799 template<
typename MT
1805 inline bool tryDivAssign(
const Column<MT,SO,DF,SF,CCAs...>& lhs,
1806 const Vector<VT,false>& rhs,
size_t index )
1811 return tryDivAssign( lhs.operand(), ~rhs, index, lhs.column() );
1832 template<
typename MT
1838 inline bool tryShiftAssign(
const Column<MT,SO,SF,SF,CCAs...>& lhs,
1839 const Vector<VT,false>& rhs,
size_t index )
1844 return tryShiftAssign( lhs.operand(), ~rhs, index, lhs.column() );
1865 template<
typename MT
1871 inline bool tryBitandAssign(
const Column<MT,SO,SF,SF,CCAs...>& lhs,
1872 const Vector<VT,false>& rhs,
size_t index )
1877 return tryBitandAssign( lhs.operand(), ~rhs, index, lhs.column() );
1898 template<
typename MT
1904 inline bool tryBitorAssign(
const Column<MT,SO,SF,SF,CCAs...>& lhs,
1905 const Vector<VT,false>& rhs,
size_t index )
1910 return tryBitorAssign( lhs.operand(), ~rhs, index, lhs.column() );
1931 template<
typename MT
1937 inline bool tryBitxorAssign(
const Column<MT,SO,SF,SF,CCAs...>& lhs,
1938 const Vector<VT,false>& rhs,
size_t index )
1943 return tryBitxorAssign( lhs.operand(), ~rhs, index, lhs.column() );
1964 template<
typename MT
1969 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF,I>& c )
1971 return column<I>( derestrict( c.operand() ),
unchecked );
1992 template<
typename MT
1997 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF,I>&& c )
1999 return column<I>( derestrict( c.operand() ),
unchecked );
2020 template<
typename MT
2024 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF>& c )
2047 template<
typename MT
2051 inline decltype(
auto) derestrict( Column<MT,SO,DF,SF>&& c )
2069 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
2070 struct Size< Column<MT,SO,DF,SF,CRAs...>, 0UL >
2071 :
public Size<MT,0UL>
2087 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CRAs >
2088 struct MaxSize< Column<MT,SO,DF,SF,CRAs...>, 0UL >
2089 :
public MaxSize<MT,0UL>
2105 template<
typename MT,
bool SO,
bool DF,
bool SF,
size_t... CCAs >
2106 struct IsRestricted< Column<MT,SO,DF,SF,CCAs...> >
2107 :
public IsRestricted<MT>
2123 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
2124 struct HasConstDataAccess< Column<MT,SO,true,SF,CCAs...> >
2125 :
public HasConstDataAccess<MT>
2141 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
2142 struct HasMutableDataAccess< Column<MT,SO,true,SF,CCAs...> >
2143 :
public HasMutableDataAccess<MT>
2159 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
2160 struct IsAligned< Column<MT,SO,true,SF,CCAs...> >
2161 :
public BoolConstant< IsAligned_v<MT> && ( IsColumnMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
2177 template<
typename MT,
bool SF,
size_t... CCAs >
2178 struct IsContiguous< Column<MT,true,true,SF,CCAs...> >
2179 :
public IsContiguous<MT>
2195 template<
typename MT,
bool SO,
bool SF,
size_t... CCAs >
2196 struct IsPadded< Column<MT,SO,true,SF,CCAs...> >
2197 :
BoolConstant< IsPadded_v<MT> && ( IsColumnMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
2213 template<
typename MT,
bool DF,
size_t... CCAs >
2214 struct IsOpposedView< Column<MT,false,DF,false,CCAs...> >
#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.
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:595
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
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.
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: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.
#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 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
Column specialization for sparse matrices.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
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,...
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