10 #ifndef EIGEN_SKYLINEPRODUCT_H
11 #define EIGEN_SKYLINEPRODUCT_H
17 template<
typename Lhs,
typename Rhs,
int ProductMode>
19 typedef const typename internal::nested_eval<Lhs, Rhs::RowsAtCompileTime>::type
LhsNested;
20 typedef const typename internal::nested_eval<Rhs, Lhs::RowsAtCompileTime>::type
RhsNested;
25 template<
typename LhsNested,
typename RhsNested,
int ProductMode>
26 struct internal::traits<
SkylineProduct<LhsNested, RhsNested, ProductMode> > {
30 typedef typename LhsNested_::Scalar Scalar;
33 LhsCoeffReadCost = LhsNested_::CoeffReadCost,
34 RhsCoeffReadCost = RhsNested_::CoeffReadCost,
35 LhsFlags = LhsNested_::Flags,
36 RhsFlags = RhsNested_::Flags,
38 RowsAtCompileTime = LhsNested_::RowsAtCompileTime,
39 ColsAtCompileTime = RhsNested_::ColsAtCompileTime,
42 MaxRowsAtCompileTime = LhsNested_::MaxRowsAtCompileTime,
43 MaxColsAtCompileTime = RhsNested_::MaxColsAtCompileTime,
45 EvalToRowMajor = (RhsFlags & LhsFlags &
RowMajorBit),
57 typedef std::conditional_t<ResultIsSkyline,
58 SkylineMatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> >,
59 MatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> > > Base;
63 template<
typename LhsNested,
typename RhsNested,
int ProductMode>
65 public traits<SkylineProduct<LhsNested, RhsNested, ProductMode> >::Base {
77 template<
typename Lhs,
typename Rhs>
78 EIGEN_STRONG_INLINE SkylineProduct(
const Lhs& lhs,
const Rhs& rhs)
79 : m_lhs(lhs), m_rhs(rhs) {
83 ProductIsValid = LhsNested_::ColsAtCompileTime ==
Dynamic
84 || RhsNested_::RowsAtCompileTime ==
Dynamic
85 || int(LhsNested_::ColsAtCompileTime) == int(RhsNested_::RowsAtCompileTime),
86 AreVectors = LhsNested_::IsVectorAtCompileTime && RhsNested_::IsVectorAtCompileTime,
93 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
95 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
107 EIGEN_STRONG_INLINE
const LhsNested_& lhs()
const {
111 EIGEN_STRONG_INLINE
const RhsNested_& rhs()
const {
123 template<
typename Lhs,
typename Rhs,
typename Dest>
131 LhsIsSelfAdjoint = (Lhs_::Flags & SelfAdjointBit) == SelfAdjointBit,
132 ProcessFirstHalf = LhsIsSelfAdjoint
133 && (((Lhs_::Flags & (UpperTriangularBit | LowerTriangularBit)) == 0)
134 || ((Lhs_::Flags & UpperTriangularBit) && !LhsIsRowMajor)
135 || ((Lhs_::Flags & LowerTriangularBit) && LhsIsRowMajor)),
136 ProcessSecondHalf = LhsIsSelfAdjoint && (!ProcessFirstHalf)
147 typename Lhs_::InnerLowerIterator lIt(lhs,
row);
148 const Index stop = lIt.col() + lIt.size();
166 for (
Index lhscol = 0; lhscol < lhs.cols(); lhscol++) {
167 typename Lhs_::InnerUpperIterator uIt(lhs, lhscol);
168 const Index stop = uIt.size() + uIt.row();
169 for (
Index rhscol = 0; rhscol < rhs.cols(); rhscol++) {
172 const Scalar rhsCoeff = rhs.coeff(lhscol, rhscol);
186 template<
typename Lhs,
typename Rhs,
typename Dest>
194 LhsIsSelfAdjoint = (Lhs_::Flags & SelfAdjointBit) == SelfAdjointBit,
195 ProcessFirstHalf = LhsIsSelfAdjoint
196 && (((Lhs_::Flags & (UpperTriangularBit | LowerTriangularBit)) == 0)
197 || ((Lhs_::Flags & UpperTriangularBit) && !LhsIsRowMajor)
198 || ((Lhs_::Flags & LowerTriangularBit) && LhsIsRowMajor)),
199 ProcessSecondHalf = LhsIsSelfAdjoint && (!ProcessFirstHalf)
211 typename Lhs_::InnerUpperIterator uIt(lhs,
row);
212 const Index stop = uIt.col() + uIt.size();
231 for (
Index lhscol = 0; lhscol < lhs.cols(); lhscol++) {
232 typename Lhs_::InnerLowerIterator lIt(lhs, lhscol);
233 const Index stop = lIt.size() + lIt.row();
234 for (
Index rhscol = 0; rhscol < rhs.cols(); rhscol++) {
236 const Scalar rhsCoeff = rhs.coeff(lhscol, rhscol);
250 template<
typename Lhs,
typename Rhs,
typename ResultType,
252 struct skyline_product_selector;
254 template<
typename Lhs,
typename Rhs,
typename ResultType>
258 static void run(
const Lhs& lhs,
const Rhs& rhs, ResultType & res) {
259 skyline_row_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
263 template<
typename Lhs,
typename Rhs,
typename ResultType>
267 static void run(
const Lhs& lhs,
const Rhs& rhs, ResultType & res) {
268 skyline_col_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
287 template<
typename Derived>
288 template<
typename OtherDerived >
RowXpr row(Index i) const
ColXpr col(Index i) const
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
#define EIGEN_DONT_INLINE
#define EIGEN_STATIC_ASSERT(X, MSG)
#define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0, TYPE1)
const SkylineProductReturnType< Derived, OtherDerived >::Type operator*(const MatrixBase< OtherDerived > &other) const
EIGEN_DEPRECATED const unsigned int EvalBeforeAssigningBit
const unsigned int EvalBeforeNestingBit
const unsigned int RowMajorBit
EIGEN_DONT_INLINE void skyline_row_major_time_dense_product(const Lhs &lhs, const Rhs &rhs, Dest &dst)
constexpr int min_size_prefer_fixed(A a, B b)
typename remove_all< T >::type remove_all_t
EIGEN_DONT_INLINE void skyline_col_major_time_dense_product(const Lhs &lhs, const Rhs &rhs, Dest &dst)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
@ SkylineTimeSkylineProduct
const unsigned int HereditaryBits
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
const unsigned int SkylineBit
SkylineProduct< LhsNested, RhsNested, ProductMode > Type
const internal::nested_eval< Lhs, Rhs::RowsAtCompileTime >::type LhsNested
const internal::nested_eval< Rhs, Lhs::RowsAtCompileTime >::type RhsNested