10 #ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_H
11 #define EIGEN_TRIANGULAR_SOLVER_MATRIX_H
18 template <
typename Scalar,
typename Index,
int S
ide,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherInnerStr
ide>
23 const Scalar* tri,
Index triStride,
24 Scalar* _other,
Index otherIncr,
Index otherStride,
32 ::run(
size, cols, tri, triStride, _other, otherIncr, otherStride, blocking);
38 template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherInnerStr
ide>
43 const Scalar* _tri,
Index triStride,
44 Scalar* _other,
Index otherIncr,
Index otherStride,
47 template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherInnerStr
ide>
50 const Scalar* _tri,
Index triStride,
51 Scalar* _other,
Index otherIncr,
Index otherStride,
54 Index cols = otherSize;
58 TriMapper tri(_tri, triStride);
59 OtherMapper other(_other, otherStride, otherIncr);
71 std::size_t sizeA = kc*mc;
72 std::size_t sizeB = kc*cols;
84 std::ptrdiff_t l1, l2, l3;
86 Index subcols = cols>0 ? l2/(4 *
sizeof(Scalar) * std::max<Index>(otherStride,
size)) : 0;
87 subcols = std::max<Index>((subcols/Traits::nr)*Traits::nr, Traits::nr);
90 IsLower ? k2<size : k2>0;
91 IsLower ? k2+=kc : k2-=kc)
108 for(
Index j2=0; j2<cols; j2+=subcols)
112 for (
Index k1=0; k1<actual_kc; k1+=SmallPanelWidth)
114 Index actualPanelWidth = std::min<Index>(actual_kc-k1, SmallPanelWidth);
116 for (
Index k=0; k<actualPanelWidth; ++k)
119 Index i = IsLower ? k2+k1+k : k2-k1-k-1;
120 Index rs = actualPanelWidth - k - 1;
121 Index s = TriStorageOrder==
RowMajor ? (IsLower ? k2+k1 : i+1)
122 : IsLower ? i+1 : i-rs;
124 Scalar
a = (Mode &
UnitDiag) ? Scalar(1) : Scalar(1)/conj(tri(i,i));
125 for (
Index j=j2; j<j2+actual_cols; ++j)
130 const Scalar* l = &tri(i,s);
131 typename OtherMapper::LinearMapper r = other.getLinearMapper(s,j);
132 for (
Index i3=0; i3<k; ++i3)
133 b += conj(l[i3]) * r(i3);
135 other(i,j) = (other(i,j) - b)*
a;
139 Scalar& otherij = other(i,j);
142 typename OtherMapper::LinearMapper r = other.getLinearMapper(s,j);
143 typename TriMapper::LinearMapper l = tri.getLinearMapper(s,i);
144 for (
Index i3=0;i3<rs;++i3)
145 r(i3) -= b * conj(l(i3));
150 Index lengthTarget = actual_kc-k1-actualPanelWidth;
151 Index startBlock = IsLower ? k2+k1 : k2-k1-actualPanelWidth;
152 Index blockBOffset = IsLower ? k1 : lengthTarget;
155 pack_rhs(blockB+actual_kc*j2, other.getSubMapper(startBlock,j2), actualPanelWidth, actual_cols, actual_kc, blockBOffset);
160 Index startTarget = IsLower ? k2+k1+actualPanelWidth : k2-actual_kc;
162 pack_lhs(blockA, tri.getSubMapper(startTarget,startBlock), actualPanelWidth, lengthTarget);
164 gebp_kernel(other.getSubMapper(startTarget,j2), blockA, blockB+actual_kc*j2, lengthTarget, actualPanelWidth, actual_cols, Scalar(-1),
165 actualPanelWidth, actual_kc, 0, blockBOffset);
172 Index start = IsLower ? k2+kc : 0;
179 pack_lhs(blockA, tri.getSubMapper(i2, IsLower ? k2 : k2-kc), actual_kc, actual_mc);
181 gebp_kernel(other.getSubMapper(i2, 0), blockA, blockB, actual_mc, actual_kc, cols, Scalar(-1), -1, -1, 0, 0);
190 template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherInnerStr
ide>
195 const Scalar* _tri,
Index triStride,
196 Scalar* _other,
Index otherIncr,
Index otherStride,
199 template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherInnerStr
ide>
202 const Scalar* _tri,
Index triStride,
203 Scalar* _other,
Index otherIncr,
Index otherStride,
206 Index rows = otherSize;
211 LhsMapper lhs(_other, otherStride, otherIncr);
212 RhsMapper rhs(_tri, triStride);
216 RhsStorageOrder = TriStorageOrder,
224 std::size_t sizeA = kc*mc;
225 std::size_t sizeB = kc*
size;
237 IsLower ? k2>0 : k2<
size;
238 IsLower ? k2-=kc : k2+=kc)
241 Index actual_k2 = IsLower ? k2-actual_kc : k2 ;
243 Index startPanel = IsLower ? 0 : k2+actual_kc;
244 Index rs = IsLower ? actual_k2 :
size - actual_k2 - actual_kc;
245 Scalar* geb = blockB+actual_kc*actual_kc;
247 if (rs>0) pack_rhs(geb, rhs.getSubMapper(actual_k2,startPanel), actual_kc, rs);
252 for (
Index j2=0; j2<actual_kc; j2+=SmallPanelWidth)
254 Index actualPanelWidth = std::min<Index>(actual_kc-j2, SmallPanelWidth);
255 Index actual_j2 = actual_k2 + j2;
256 Index panelOffset = IsLower ? j2+actualPanelWidth : 0;
257 Index panelLength = IsLower ? actual_kc-j2-actualPanelWidth : j2;
260 pack_rhs_panel(blockB+j2*actual_kc,
261 rhs.getSubMapper(actual_k2+panelOffset, actual_j2),
262 panelLength, actualPanelWidth,
263 actual_kc, panelOffset);
267 for(
Index i2=0; i2<rows; i2+=mc)
274 for (
Index j2 = IsLower
275 ? (actual_kc - ((actual_kc%SmallPanelWidth) ?
Index(actual_kc%SmallPanelWidth)
276 :
Index(SmallPanelWidth)))
278 IsLower ? j2>=0 : j2<actual_kc;
279 IsLower ? j2-=SmallPanelWidth : j2+=SmallPanelWidth)
281 Index actualPanelWidth = std::min<Index>(actual_kc-j2, SmallPanelWidth);
282 Index absolute_j2 = actual_k2 + j2;
283 Index panelOffset = IsLower ? j2+actualPanelWidth : 0;
284 Index panelLength = IsLower ? actual_kc - j2 - actualPanelWidth : j2;
290 blockA, blockB+j2*actual_kc,
291 actual_mc, panelLength, actualPanelWidth,
293 actual_kc, actual_kc,
294 panelOffset, panelOffset);
298 for (
Index k=0; k<actualPanelWidth; ++k)
300 Index j = IsLower ? absolute_j2+actualPanelWidth-k-1 : absolute_j2+k;
302 typename LhsMapper::LinearMapper r = lhs.getLinearMapper(i2,j);
303 for (
Index k3=0; k3<k; ++k3)
305 Scalar b = conj(rhs(IsLower ? j+1+k3 : absolute_j2+k3,j));
306 typename LhsMapper::LinearMapper
a = lhs.getLinearMapper(i2,IsLower ? j+1+k3 : absolute_j2+k3);
307 for (
Index i=0; i<actual_mc; ++i)
312 Scalar inv_rjj = RealScalar(1)/conj(rhs(j,j));
313 for (
Index i=0; i<actual_mc; ++i)
319 pack_lhs_panel(blockA, lhs.getSubMapper(i2,absolute_j2),
320 actualPanelWidth, actual_mc,
326 gebp_kernel(lhs.getSubMapper(i2, startPanel), blockA, geb,
327 actual_mc, actual_kc, rs, Scalar(-1),
#define EIGEN_PLAIN_ENUM_MAX(a, b)
Definition: Macros.h:1289
#define EIGEN_DONT_INLINE
Definition: Macros.h:940
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition: Memory.h:768
Definition: ForwardDeclarations.h:87
Definition: BlasUtil.h:270
Definition: BlasUtil.h:389
Definition: GeneralBlockPanelKernel.h:419
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
@ UnitDiag
Definition: Constants.h:213
@ Lower
Definition: Constants.h:209
@ Upper
Definition: Constants.h:211
@ ColMajor
Definition: Constants.h:319
@ RowMajor
Definition: Constants.h:321
@ OnTheLeft
Definition: Constants.h:332
@ OnTheRight
Definition: Constants.h:334
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16() min(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:571
void manage_caching_sizes(Action action, std::ptrdiff_t *l1, std::ptrdiff_t *l2, std::ptrdiff_t *l3)
Definition: GeneralBlockPanelKernel.h:86
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
@ GetAction
Definition: Constants.h:504
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: document.h:416
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1181
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
Definition: ConjHelper.h:44
Definition: GeneralBlockPanelKernel.h:1058
Definition: BlasUtil.h:28
Definition: BlasUtil.h:25
static void run(Index size, Index cols, const Scalar *tri, Index triStride, Scalar *_other, Index otherIncr, Index otherStride, level3_blocking< Scalar, Scalar > &blocking)
Definition: TriangularSolverMatrix.h:21
Definition: SolveTriangular.h:23