10#ifndef EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
11#define EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
15template<
typename Scalar,
typename Index,
int StorageOrder,
int UpLo,
bool ConjLhs,
bool ConjRhs>
28template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int mr,
int nr,
bool ConjLhs,
bool ConjRhs,
int ResInnerStr
ide,
int UpLo>
32template <
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>
39template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
40 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
41 int ResInnerStride,
int UpLo,
int Version>
42struct 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);
57template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
58 typename RhsScalar,
int RhsStorageOrder,
bool ConjugateRhs,
59 int ResInnerStride,
int UpLo,
int Version>
60struct general_matrix_matrix_triangular_product<
Index,LhsScalar,LhsStorageOrder,ConjugateLhs,RhsScalar,RhsStorageOrder,ConjugateRhs,
ColMajor,ResInnerStride,UpLo,Version>
64 const RhsScalar* _rhs,
Index rhsStride,
73 LhsMapper lhs(_lhs,lhsStride);
74 RhsMapper rhs(_rhs,rhsStride);
75 ResMapper res(_res, resStride, resIncr);
82 mc = (mc/Traits::nr)*Traits::nr;
84 std::size_t sizeA = kc*mc;
85 std::size_t sizeB = kc*
size;
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,
138template<
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);
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)
188 Index i = j+actualBlockSize;
189 gebp_kernel1(res.getSubMapper(i, j), blockA+depth*i, actual_b,
size-i,
190 depth, actualBlockSize, alpha, -1, -1, 0, 0);
200template<
typename MatrixType,
typename ProductType,
int UpLo,
bool IsOuterProduct>
204template<
typename MatrixType,
typename ProductType,
int UpLo>
207 static void run(MatrixType& mat,
const ProductType& prod,
const typename MatrixType::Scalar& alpha,
bool beta)
209 typedef typename MatrixType::Scalar Scalar;
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()));
248 ::run(actualLhs.size(), mat.data(), mat.outerStride(), actualLhsPtr, actualRhsPtr, actualAlpha);
252template<
typename MatrixType,
typename ProductType,
int UpLo>
255 static void run(MatrixType& mat,
const ProductType& prod,
const typename MatrixType::Scalar& alpha,
bool beta)
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,
284 Index depth = actualLhs.cols();
287 MatrixType::MaxColsAtCompileTime, MatrixType::MaxColsAtCompileTime, _ActualRhs::MaxColsAtCompileTime> BlockingType;
289 BlockingType blocking(
size,
size, depth, 1,
false);
292 typename Lhs::Scalar, LhsIsRowMajor ?
RowMajor :
ColMajor, LhsBlasTraits::NeedToConjugate,
293 typename Rhs::Scalar, RhsIsRowMajor ?
RowMajor :
ColMajor, RhsBlasTraits::NeedToConjugate,
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);
303template<
typename MatrixType,
unsigned int UpLo>
304template<
typename ProductType>
305EIGEN_DEVICE_FUNC TriangularView<MatrixType,UpLo>& TriangularViewImpl<MatrixType,UpLo,Dense>::_assignProduct(
const ProductType& prod,
const Scalar& alpha,
bool beta)
308 eigen_assert(derived().nestedExpression().rows() == prod.rows() && derived().cols() == prod.cols());
310 general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize==1>::run(derived().nestedExpression().const_cast_derived(), prod, alpha,
beta);
#define EIGEN_PLAIN_ENUM_MAX(a, b)
Definition: Macros.h:1299
#define EIGEN_PLAIN_ENUM_MIN(a, b)
Definition: Macros.h:1298
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition: Memory.h:768
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
constexpr common_return_t< T1, T2 > beta(const T1 a, const T2 b) noexcept
Compile-time beta function.
Definition: beta.hpp:36
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
Definition: BlasUtil.h:270
Definition: BlasUtil.h:389
Definition: GeneralBlockPanelKernel.h:419
ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
Definition: GeneralBlockPanelKernel.h:423
Definition: GeneralMatrixMatrix.h:248
Definition: GeneralMatrixMatrix.h:252
RhsScalar * blockB()
Definition: GeneralMatrixMatrix.h:275
Index kc() const
Definition: GeneralMatrixMatrix.h:272
Index mc() const
Definition: GeneralMatrixMatrix.h:270
LhsScalar * blockA()
Definition: GeneralMatrixMatrix.h:274
\rst A contiguous memory buffer with an optional growing ability.
Definition: core.h:862
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data.
Definition: core.h:908
@ UnitDiag
Matrix has ones on the diagonal; to be used in combination with Lower or Upper.
Definition: Constants.h:213
@ ZeroDiag
Matrix has zeros on the diagonal; to be used in combination with Lower or Upper.
Definition: Constants.h:215
@ Lower
View matrix as a lower triangular matrix.
Definition: Constants.h:209
@ Upper
View matrix as an upper triangular matrix.
Definition: Constants.h:211
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:321
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:66
constexpr common_t< T1, T2 > max(const T1 x, const T2 y) noexcept
Compile-time pairwise maximum function.
Definition: max.hpp:35
constexpr common_t< T1, T2 > min(const T1 x, const T2 y) noexcept
Compile-time pairwise minimum function.
Definition: min.hpp:35
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Namespace containing all symbols from the Eigen library.
Definition: MatrixExponential.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
@ Specialized
Definition: Constants.h:310
Definition: Eigen_Colamd.h:50
static constexpr uint64_t k2
Definition: Hashing.h:172
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition: XprHelper.h:806
static void run(MatrixType &mat, const ProductType &prod, const typename MatrixType::Scalar &alpha, bool beta)
Definition: GeneralMatrixMatrixTriangular.h:255
static void run(MatrixType &mat, const ProductType &prod, const typename MatrixType::Scalar &alpha, bool beta)
Definition: GeneralMatrixMatrixTriangular.h:207
Definition: GeneralMatrixMatrixTriangular.h:201
const T type
Definition: Meta.h:214
Definition: BlasUtil.h:403
Definition: DenseStorage.h:25
Definition: GeneralBlockPanelKernel.h:1058
Definition: BlasUtil.h:28
Definition: BlasUtil.h:25
Definition: GeneralProduct.h:161
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)
Definition: GeneralMatrixMatrixTriangular.h:45
Eigen::internal::general_matrix_matrix_triangular_product< Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, RowMajor, ResInnerStride, UpLo, Version >::ResScalar ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
Definition: GeneralMatrixMatrixTriangular.h:44
Eigen::internal::general_matrix_matrix_triangular_product< Index, LhsScalar, LhsStorageOrder, ConjugateLhs, RhsScalar, RhsStorageOrder, ConjugateRhs, ColMajor, ResInnerStride, UpLo, Version >::ResScalar ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
Definition: GeneralMatrixMatrixTriangular.h:62
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)
Definition: GeneralMatrixMatrixTriangular.h:63
Definition: GeneralMatrixMatrixTriangular.h:36
T type
Definition: Meta.h:126
Definition: ForwardDeclarations.h:17
Definition: GeneralMatrixMatrixTriangular.h:140
@ BlockSize
Definition: GeneralMatrixMatrixTriangular.h:145
Traits::ResScalar ResScalar
Definition: GeneralMatrixMatrixTriangular.h:142
gebp_traits< LhsScalar, RhsScalar, ConjLhs, ConjRhs > Traits
Definition: GeneralMatrixMatrixTriangular.h:141
void operator()(ResScalar *_res, Index resIncr, Index resStride, const LhsScalar *blockA, const RhsScalar *blockB, Index size, Index depth, const ResScalar &alpha)
Definition: GeneralMatrixMatrixTriangular.h:147
Definition: GeneralMatrixMatrixTriangular.h:16