10 #ifndef EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
11 #define EIGEN_GENERAL_MATRIX_MATRIX_TRIANGULAR_H
14 #include "../InternalHeaderCheck.h"
18 template <
typename Scalar,
typename Index,
int StorageOrder,
int UpLo,
bool ConjLhs,
bool ConjRhs>
31 template <
typename LhsScalar,
typename RhsScalar,
typename Index,
int mr,
int nr,
bool ConjLhs,
bool ConjRhs,
32 int ResInnerStride,
int UpLo>
36 template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
typename RhsScalar,
37 int RhsStorageOrder,
bool ConjugateRhs,
int ResStorageOrder,
int ResInnerStride,
int UpLo,
42 template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
typename RhsScalar,
43 int RhsStorageOrder,
bool ConjugateRhs,
int ResInnerStride,
int UpLo,
int Version>
45 RhsStorageOrder, ConjugateRhs,
RowMajor, ResInnerStride, UpLo,
54 ConjugateLhs,
ColMajor, ResInnerStride,
56 lhsStride,
res, resIncr, resStride,
61 template <
typename Index,
typename LhsScalar,
int LhsStorageOrder,
bool ConjugateLhs,
typename RhsScalar,
62 int RhsStorageOrder,
bool ConjugateRhs,
int ResInnerStride,
int UpLo,
int Version>
64 RhsStorageOrder, ConjugateRhs,
ColMajor, ResInnerStride, UpLo,
80 LhsMapper lhs(lhs_, lhsStride);
81 RhsMapper rhs(rhs_, rhsStride);
82 ResMapper
res(res_, resStride, resIncr);
89 if (mc > Traits::nr) {
91 mc = (UnsignedIndex(mc) / Traits::nr) * Traits::nr;
94 std::size_t sizeA = kc * mc;
95 std::size_t sizeB = kc *
size;
100 gemm_pack_lhs<LhsScalar,
Index, LhsMapper, Traits::mr, Traits::LhsProgress,
typename Traits::LhsPacket4Packing,
108 for (
Index k2 = 0; k2 < depth; k2 += kc) {
112 pack_rhs(blockB, rhs.getSubMapper(k2, 0), actual_kc,
size);
114 for (
Index i2 = 0; i2 <
size; i2 += mc) {
117 pack_lhs(blockA, lhs.getSubMapper(i2, k2), actual_kc, actual_mc);
124 gebp(
res.getSubMapper(i2, 0), blockA, blockB, actual_mc, actual_kc, (
std::min)(
size, i2),
alpha, -1, -1, 0,
127 sybb(res_ + resStride * i2 + resIncr * i2, resIncr, resStride, blockA, blockB + actual_kc * i2, actual_mc,
131 Index j2 = i2 + actual_mc;
132 gebp(
res.getSubMapper(i2, j2), blockA, blockB + actual_kc * j2, actual_mc, actual_kc,
149 template <
typename LhsScalar,
typename RhsScalar,
typename Index,
int mr,
int nr,
bool ConjLhs,
bool ConjRhs,
150 int ResInnerStride,
int UpLo>
160 ResMapper
res(res_, resStride, resIncr);
170 const RhsScalar*
actual_b = blockB +
j * depth;
173 gebp_kernel1(
res.getSubMapper(0,
j), blockA,
actual_b,
j, depth, actualBlockSize,
alpha, -1, -1, 0, 0);
180 gebp_kernel2(BufferMapper(buffer.
data(),
BlockSize), blockA + depth *
i,
actual_b, actualBlockSize, depth,
181 actualBlockSize,
alpha, -1, -1, 0, 0);
184 for (
Index j1 = 0; j1 < actualBlockSize; ++j1) {
185 typename ResMapper::LinearMapper
r =
res.getLinearMapper(
i,
j + j1);
186 for (
Index i1 = UpLo ==
Lower ? j1 : 0; UpLo ==
Lower ? i1 < actualBlockSize : i1 <= j1; ++i1)
187 r(i1) += buffer(i1, j1);
204 template <
typename MatrixType,
typename ProductType,
int UpLo,
bool IsOuterProduct>
207 template <
typename MatrixType,
typename ProductType,
int UpLo>
214 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
220 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
224 Scalar actualAlpha =
alpha * LhsBlasTraits::extractScalarFactor(
prod.
lhs().derived()) *
225 RhsBlasTraits::extractScalarFactor(
prod.
rhs().derived());
231 UseLhsDirectly = ActualLhs_::InnerStrideAtCompileTime == 1,
232 UseRhsDirectly = ActualRhs_::InnerStrideAtCompileTime == 1
238 Scalar, actualLhsPtr, actualLhs.size(),
239 (UseLhsDirectly ?
const_cast<Scalar*
>(actualLhs.data()) : static_lhs.data()));
245 Scalar, actualRhsPtr, actualRhs.size(),
246 (UseRhsDirectly ?
const_cast<Scalar*
>(actualRhs.data()) : static_rhs.data()));
252 mat.outerStride(), actualLhsPtr,
253 actualRhsPtr, actualAlpha);
257 template <
typename MatrixType,
typename ProductType,
int UpLo>
262 typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
268 typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
273 RhsBlasTraits::extractScalarFactor(
prod.
rhs().derived());
279 LhsIsRowMajor = ActualLhs_::Flags &
RowMajorBit ? 1 : 0,
280 RhsIsRowMajor = ActualRhs_::Flags &
RowMajorBit ? 1 : 0,
285 if (SkipDiag)
size--;
286 Index depth = actualLhs.cols();
289 MatrixType::MaxColsAtCompileTime, MatrixType::MaxColsAtCompileTime,
290 ActualRhs_::MaxColsAtCompileTime>
293 BlockingType blocking(
size,
size, depth, 1,
false);
300 actualLhs.outerStride(),
301 &actualRhs.coeffRef(0, SkipDiag && (UpLo &
Upper) ==
Upper ? 1 : 0),
302 actualRhs.outerStride(),
307 mat.innerStride(),
mat.outerStride(), actualAlpha, blocking);
311 template <
typename MatrixType,
unsigned int UpLo>
312 template <
typename ProductType>
313 EIGEN_DEVICE_FUNC TriangularView<MatrixType, UpLo>& TriangularViewImpl<MatrixType, UpLo, Dense>::_assignProduct(
318 general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize == 1>
::
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition: Memory.h:806
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
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: Eigen/Eigen/src/Core/Matrix.h:186
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Product.h:227
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const LhsNestedCleaned & lhs() const
Definition: Product.h:230
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const RhsNestedCleaned & rhs() const
Definition: Product.h:231
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Product.h:228
void setZero()
Definition: SparseMatrix.h:303
Index cols() const
Definition: SparseMatrix.h:161
constexpr Storage & data()
Definition: SparseMatrix.h:205
Definition: BlasUtil.h:304
Definition: BlasUtil.h:443
Definition: products/GeneralBlockPanelKernel.h:397
ScalarBinaryOpTraits< LhsScalar, RhsScalar >::ReturnType ResScalar
Definition: products/GeneralBlockPanelKernel.h:401
Definition: GeneralMatrixMatrix.h:223
Definition: GeneralMatrixMatrix.h:226
RhsScalar * blockB()
Definition: GeneralMatrixMatrix.h:246
LhsScalar * blockA()
Definition: GeneralMatrixMatrix.h:245
Index mc() const
Definition: GeneralMatrixMatrix.h:241
Index kc() const
Definition: GeneralMatrixMatrix.h:243
#define min(a, b)
Definition: datatypes.h:22
#define max(a, b)
Definition: datatypes.h:23
@ UnitDiag
Definition: Constants.h:215
@ ZeroDiag
Definition: Constants.h:217
@ Lower
Definition: Constants.h:211
@ Upper
Definition: Constants.h:213
@ Specialized
Definition: Constants.h:311
@ ColMajor
Definition: Constants.h:318
@ RowMajor
Definition: Constants.h:320
const unsigned int RowMajorBit
Definition: Constants.h:70
Eigen::DenseIndex ret
Definition: level1_cplx_impl.h:43
RealScalar alpha
Definition: level1_cplx_impl.h:151
Scalar beta
Definition: level2_cplx_impl.h:36
if(code !=NOTR) std const Scalar * actual_b
Definition: level2_impl.h:67
constexpr int plain_enum_min(A a, B b)
Definition: Meta.h:649
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
constexpr int plain_enum_max(A a, B b)
Definition: Meta.h:656
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
typename add_const_on_value_type< T >::type add_const_on_value_type_t
Definition: Meta.h:274
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)
Definition: evaluators.cpp:7
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition: XprHelper.h:1043
static void run(MatrixType &mat, const ProductType &prod, const typename MatrixType::Scalar &alpha, bool beta)
Definition: GeneralMatrixMatrixTriangular.h:259
static void run(MatrixType &mat, const ProductType &prod, const typename MatrixType::Scalar &alpha, bool beta)
Definition: GeneralMatrixMatrixTriangular.h:209
Definition: GeneralMatrixMatrixTriangular.h:205
Definition: BlasUtil.h:459
Definition: products/GeneralBlockPanelKernel.h:960
Definition: BlasUtil.h:34
Definition: BlasUtil.h:30
Definition: GeneralProduct.h:228
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:67
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:66
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:48
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:47
Definition: GeneralMatrixMatrixTriangular.h:39
Definition: ForwardDeclarations.h:21
Definition: GeneralMatrixMatrixTriangular.h:151
Traits::ResScalar ResScalar
Definition: GeneralMatrixMatrixTriangular.h:153
@ BlockSize
Definition: GeneralMatrixMatrixTriangular.h:155
void operator()(ResScalar *res_, Index resIncr, Index resStride, const LhsScalar *blockA, const RhsScalar *blockB, Index size, Index depth, const ResScalar &alpha)
Definition: GeneralMatrixMatrixTriangular.h:156
gebp_traits< LhsScalar, RhsScalar, ConjLhs, ConjRhs > Traits
Definition: GeneralMatrixMatrixTriangular.h:152
Definition: GeneralMatrixMatrixTriangular.h:19
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2