10 #ifndef EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H 11 #define EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H 15 template<
typename Scalar,
typename Index,
int StorageOrder,
int UpLo,
bool ConjLhs,
bool ConjRhs>
28 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int mr,
int nr,
bool ConjLhs,
bool ConjRhs,
int ResInnerStr
ide,
int UpLo>
32 template <
typename Index,
33 typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
34 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
35 int ResStorageOrder,
int ResInnerStride,
int UpLo,
int Version =
Specialized>
39 template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
40 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
41 int ResInnerStride,
int UpLo,
int Version>
42 struct general_matrix_matrix_triangular_product<
Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,
RowMajor,ResInnerStride,UpLo,Version>
53 ::run(size,depth,rhs,rhsStride,lhs,lhsStride,res,resIncr,resStride,alpha,blocking);
57 template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
58 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
59 int ResInnerStride,
int UpLo,
int Version>
60 struct general_matrix_matrix_triangular_product<
Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,
ColMajor,ResInnerStride,UpLo,Version>
64 const RhsScalar* _rhs,
Index rhsStride,
65 ResScalar* _res,
Index resIncr,
Index resStride,
73 LhsMapper lhs(_lhs,lhsStride);
74 RhsMapper rhs(_rhs,rhsStride);
75 ResMapper
res(_res, resStride, resIncr);
82 mc = (mc/Traits::nr)*Traits::nr;
100 pack_rhs(blockB, rhs.getSubMapper(k2,0), actual_kc,
size);
106 pack_lhs(blockA, lhs.getSubMapper(i2, k2), actual_kc, actual_mc);
113 gebp(res.getSubMapper(i2, 0), blockA, blockB, actual_mc, actual_kc,
116 sybb(_res+resStride*i2 + resIncr*i2, resIncr, resStride, blockA, blockB + actual_kc*i2, actual_mc, actual_kc, alpha);
120 Index j2 = i2+actual_mc;
121 gebp(res.getSubMapper(i2, j2), blockA, blockB+actual_kc*j2, actual_mc,
122 actual_kc, (
std::max)(
Index(0), size-j2), alpha, -1, -1, 0, 0);
138 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int mr,
int nr,
bool ConjLhs,
bool ConjRhs,
int ResInnerStr
ide,
int UpLo>
151 ResMapper
res(_res, resStride, resIncr);
161 Index actualBlockSize = std::min<Index>(BlockSize,size -
j);
162 const RhsScalar* actual_b = blockB+
j*
depth;
165 gebp_kernel1(res.getSubMapper(0,
j), blockA, actual_b,
j,
depth, actualBlockSize,
alpha,
173 gebp_kernel2(BufferMapper(buffer.
data(), BlockSize), blockA+depth*i, actual_b, actualBlockSize, depth, actualBlockSize, alpha,
177 for(
Index j1=0; j1<actualBlockSize; ++j1)
179 typename ResMapper::LinearMapper r = res.getLinearMapper(i,j+j1);
181 UpLo==
Lower ? i1<actualBlockSize : i1<=j1; ++i1)
182 r(i1) += buffer(i1,j1);
188 Index i = j+actualBlockSize;
189 gebp_kernel1(res.getSubMapper(i, j), blockA+depth*
i, actual_b, size-
i,
200 template<
typename MatrixType,
typename ProductType,
int UpLo,
bool IsOuterProduct>
204 template<
typename MatrixType,
typename ProductType,
int UpLo>
213 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
219 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
223 Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived());
226 mat.template triangularView<UpLo>().
setZero();
230 UseLhsDirectly = _ActualLhs::InnerStrideAtCompileTime==1,
231 UseRhsDirectly = _ActualRhs::InnerStrideAtCompileTime==1
236 (UseLhsDirectly ?
const_cast<Scalar*
>(actualLhs.data()) : static_lhs.data()));
241 (UseRhsDirectly ?
const_cast<Scalar*
>(actualRhs.data()) : static_rhs.data()));
247 RhsBlasTraits::NeedToConjugate && NumTraits<Scalar>::IsComplex>
248 ::run(actualLhs.size(), mat.data(), mat.outerStride(), actualLhsPtr, actualRhsPtr, actualAlpha);
252 template<
typename MatrixType,
typename ProductType,
int UpLo>
259 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
265 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
269 typename ProductType::Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived());
272 mat.template triangularView<UpLo>().
setZero();
276 LhsIsRowMajor = _ActualLhs::Flags&
RowMajorBit ? 1 : 0,
277 RhsIsRowMajor = _ActualRhs::Flags&RowMajorBit ? 1 : 0,
287 MatrixType::MaxColsAtCompileTime, MatrixType::MaxColsAtCompileTime, _ActualRhs::MaxColsAtCompileTime> BlockingType;
289 BlockingType blocking(size, size, depth, 1,
false);
296 &actualLhs.coeffRef(SkipDiag&&(UpLo&
Lower)==Lower ? 1 : 0,0), actualLhs.outerStride(),
297 &actualRhs.coeffRef(0,SkipDiag&&(UpLo&
Upper)==Upper ? 1 : 0), actualRhs.outerStride(),
298 mat.data() + (SkipDiag ? (bool(IsRowMajor) != ((UpLo&
Lower)==Lower) ? mat.innerStride() : mat.outerStride() ) : 0),
299 mat.innerStride(), mat.outerStride(), actualAlpha, blocking);
303 template<
typename MatrixType,
unsigned int UpLo>
304 template<
typename ProductType>
308 eigen_assert(derived().nestedExpression().
rows() == prod.rows() && derived().cols() == prod.cols());
317 #endif // EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
Eigen::internal::general_matrix_matrix_triangular_product< Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, ColMajor, ResInnerStride, UpLo, Version >::ResScalar ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & setZero(Index size)
ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
A matrix or vector expression mapping an existing array of data.
Eigen::internal::general_matrix_matrix_triangular_product< Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, RowMajor, ResInnerStride, UpLo, Version >::ResScalar ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
const unsigned int RowMajorBit
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Eigen::internal::general_matrix_matrix_triangular_product< Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, ColMajor, ResInnerStride, UpLo, Version >::run static EIGEN_STRONG_INLINE void run(Index size, Index depth, const LhsScalar *_lhs, Index lhsStride, const RhsScalar *_rhs, Index rhsStride, ResScalar *_res, Index resIncr, Index resStride, const ResScalar &alpha, level3_blocking< LhsScalar, RhsScalar > &blocking)
Traits::ResScalar ResScalar
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
static void run(MatrixType &mat, const ProductType &prod, const typename MatrixType::Scalar &alpha, bool beta)
void operator()(ResScalar *_res, Index resIncr, Index resStride, const LhsScalar *blockA, const RhsScalar *blockB, Index size, Index depth, const ResScalar &alpha)
gebp_traits< LhsScalar, RhsScalar, ConjLhs, ConjRhs > Traits
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
EIGEN_CONSTEXPR Index size(const T &x)
#define EIGEN_DEVICE_FUNC
Eigen::internal::general_matrix_matrix_triangular_product< Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, RowMajor, ResInnerStride, UpLo, Version >::run static EIGEN_STRONG_INLINE void run(Index size, Index depth, const LhsScalar *lhs, Index lhsStride, const RhsScalar *rhs, Index rhsStride, ResScalar *res, Index resIncr, Index resStride, const ResScalar &alpha, level3_blocking< RhsScalar, LhsScalar > &blocking)
Expression of a triangular part in a matrix.
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
static void run(MatrixType &mat, const ProductType &prod, const typename MatrixType::Scalar &alpha, bool beta)
The matrix class, also used for vectors and row-vectors.
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)