10 #ifndef EIGEN_SELFADJOINT_MATRIX_VECTOR_H
11 #define EIGEN_SELFADJOINT_MATRIX_VECTOR_H
14 #include "../InternalHeaderCheck.h"
26 template <
typename Scalar,
typename Index,
int StorageOrder,
int UpLo,
bool ConjugateLhs,
bool ConjugateRhs,
28 struct selfadjoint_matrix_vector_product;
30 template <
typename Scalar,
typename Index,
int StorageOrder,
int UpLo,
bool ConjugateLhs,
bool ConjugateRhs,
39 template <
typename Scalar,
typename Index,
int StorageOrder,
int UpLo,
bool ConjugateLhs,
bool ConjugateRhs,
49 IsRowMajor = StorageOrder ==
RowMajor ? 1 : 0,
50 IsLower = UpLo ==
Lower ? 1 : 0,
51 FirstTriangular = IsRowMajor == IsLower
65 if (FirstTriangular) bound =
size - bound;
67 for (
Index j = FirstTriangular ? bound : 0;
j < (FirstTriangular ?
size : bound);
j += 2) {
72 Packet ptmp0 = pset1<Packet>(t0);
73 Scalar t1 = cjAlpha * rhs[
j + 1];
74 Packet ptmp1 = pset1<Packet>(t1);
77 Packet ptmp2 = pset1<Packet>(t2);
79 Packet ptmp3 = pset1<Packet>(t3);
81 Index starti = FirstTriangular ? 0 :
j + 2;
84 Index alignedEnd = alignedStart + ((endi - alignedStart) / (PacketSize)) * (PacketSize);
88 if (FirstTriangular) {
90 t3 += cj1.
pmul(A1[
j], rhs[
j]);
93 t2 += cj1.
pmul(A0[
j + 1], rhs[
j + 1]);
96 for (
Index i = starti;
i < alignedStart; ++
i) {
98 t2 += cj1.
pmul(A0[
i], rhs[
i]);
99 t3 += cj1.
pmul(A1[
i], rhs[
i]);
107 for (
Index i = alignedStart;
i < alignedEnd;
i += PacketSize) {
108 Packet A0i = ploadu<Packet>(a0It);
110 Packet A1i = ploadu<Packet>(a1It);
114 Packet Xi = pload<Packet>(resIt);
116 Xi = pcj0.
pmadd(A0i, ptmp0, pcj0.
pmadd(A1i, ptmp1, Xi));
117 ptmp2 = pcj1.
pmadd(A0i,
Bi, ptmp2);
118 ptmp3 = pcj1.
pmadd(A1i,
Bi, ptmp3);
122 for (
Index i = alignedEnd;
i < endi;
i++) {
124 t2 += cj1.
pmul(A0[
i], rhs[
i]);
125 t3 += cj1.
pmul(A1[
i], rhs[
i]);
131 for (
Index j = FirstTriangular ? 0 : bound;
j < (FirstTriangular ? bound :
size);
j++) {
137 for (
Index i = FirstTriangular ? 0 :
j + 1;
i < (FirstTriangular ?
j :
size);
i++) {
139 t2 += cj1.
pmul(A0[
i], rhs[
i]);
153 template <
typename Lhs,
int LhsMode,
typename Rhs>
167 template <
typename Dest>
174 eigen_assert(dest.rows() == a_lhs.rows() && dest.cols() == a_rhs.cols());
179 Scalar actualAlpha =
alpha * LhsBlasTraits::extractScalarFactor(a_lhs) * RhsBlasTraits::extractScalarFactor(a_rhs);
182 EvalToDest = (Dest::InnerStrideAtCompileTime == 1),
183 UseRhs = (ActualRhsTypeCleaned::InnerStrideAtCompileTime == 1)
189 ActualRhsTypeCleaned::MaxSizeAtCompileTime, !UseRhs>
193 EvalToDest ? dest.data() : static_dest.data());
196 UseRhs ?
const_cast<RhsScalar*
>(rhs.data()) : static_rhs.data());
199 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
200 constexpr
int Size = Dest::SizeAtCompileTime;
202 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
204 MappedDest(actualDestPtr, dest.size()) = dest;
208 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
209 constexpr
int Size = ActualRhsTypeCleaned::SizeAtCompileTime;
211 EIGEN_DENSE_STORAGE_CTOR_PLUGIN
218 int(LhsUpLo),
bool(LhsBlasTraits::NeedToConjugate),
219 bool(RhsBlasTraits::NeedToConjugate)>
::run(lhs.rows(),
220 &lhs.coeffRef(0, 0), lhs.outerStride(),
226 if (!EvalToDest) dest = MappedDest(actualDestPtr, dest.size());
230 template <
typename Lhs,
typename Rhs,
int RhsMode>
235 template <
typename Dest>
240 0,
true>
::run(destT, a_rhs.transpose(), a_lhs.transpose(),
alpha);
AnnoyingScalar conj(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:133
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define EIGEN_RESTRICT
Definition: Macros.h:1067
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_DONT_INLINE
Definition: Macros.h:853
#define eigen_assert(x)
Definition: Macros.h:910
#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
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
internal::packet_traits< Scalar >::type Packet
Definition: benchmark-blocking-sizes.cpp:54
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:202
Expression of the transpose of a matrix.
Definition: Transpose.h:56
float real
Definition: datatypes.h:10
@ Lower
Definition: Constants.h:211
@ Upper
Definition: Constants.h:213
@ AlignedMax
Definition: Constants.h:254
@ Specialized
Definition: Constants.h:311
@ ColMajor
Definition: Constants.h:318
@ RowMajor
Definition: Constants.h:320
const unsigned int RowMajorBit
Definition: Constants.h:70
RealScalar alpha
Definition: level1_cplx_impl.h:151
constexpr int plain_enum_min(A a, B b)
Definition: Meta.h:649
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
constexpr bool logical_xor(bool a, bool b)
Definition: Meta.h:737
static Index first_default_aligned(const DenseBase< Derived > &m)
Definition: DenseCoeffsBase.h:539
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:891
EIGEN_DEVICE_FUNC unpacket_traits< Packet >::type predux(const Packet &a)
Definition: GenericPacketMath.h:1232
typename add_const_on_value_type< T >::type add_const_on_value_type_t
Definition: Meta.h:274
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Definition: MathFunctions.h:926
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
double Bi
Biot number.
Definition: thermal_fibre.cc:85
Definition: Eigen_Colamd.h:49
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: BlasUtil.h:459
std::conditional_t< bool(HasUsableDirectAccess), ExtractType, typename ExtractType_::PlainObject > DirectLinearAccessType
Definition: BlasUtil.h:475
Definition: ConjHelper.h:71
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmadd(const LhsType &x, const RhsType &y, const ResultType &c) const
Definition: ConjHelper.h:74
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(const LhsType &x, const RhsType &y) const
Definition: ConjHelper.h:79
Definition: GeneralProduct.h:228
Definition: GenericPacketMath.h:108
Definition: SelfadjointMatrixVector.h:34
static EIGEN_DONT_INLINE EIGEN_DEVICE_FUNC void run(Index size, const Scalar *lhs, Index lhsStride, const Scalar *rhs, Scalar *res, Scalar alpha)
Definition: SelfadjointMatrixVector.h:42
static void run(Dest &dest, const Lhs &a_lhs, const Rhs &a_rhs, const Scalar &alpha)
Definition: SelfadjointMatrixVector.h:236
Product< Lhs, Rhs >::Scalar Scalar
Definition: SelfadjointMatrixVector.h:232
static EIGEN_DEVICE_FUNC void run(Dest &dest, const Lhs &a_lhs, const Rhs &a_rhs, const Scalar &alpha)
Definition: SelfadjointMatrixVector.h:168
Product< Lhs, Rhs >::Scalar Scalar
Definition: SelfadjointMatrixVector.h:155
LhsBlasTraits::DirectLinearAccessType ActualLhsType
Definition: SelfadjointMatrixVector.h:158
internal::blas_traits< Lhs > LhsBlasTraits
Definition: SelfadjointMatrixVector.h:157
RhsBlasTraits::DirectLinearAccessType ActualRhsType
Definition: SelfadjointMatrixVector.h:162
internal::remove_all_t< ActualRhsType > ActualRhsTypeCleaned
Definition: SelfadjointMatrixVector.h:163
internal::remove_all_t< ActualLhsType > ActualLhsTypeCleaned
Definition: SelfadjointMatrixVector.h:159
internal::blas_traits< Rhs > RhsBlasTraits
Definition: SelfadjointMatrixVector.h:161
Definition: ProductEvaluators.h:768
Definition: ForwardDeclarations.h:21
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
Definition: ZVector/PacketMath.h:50