10#ifndef EIGEN_TRIANGULAR_SOLVER_MATRIX_H
11#define EIGEN_TRIANGULAR_SOLVER_MATRIX_H
18template <
typename Scalar,
typename Index,
int S
ide,
int Mode,
bool Conjugate,
int TriStorageOrder>
22 Index size, Index cols,
38template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder>
41 static EIGEN_DONT_INLINE
void run(
47template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder>
64 SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
69 Index mc = (std::min)(size,
blocking.mc());
71 std::size_t
sizeA = kc*mc;
72 std::size_t
sizeB = kc*cols;
74 ei_declare_aligned_stack_constructed_variable(Scalar, blockA,
sizeA,
blocking.blockA());
75 ei_declare_aligned_stack_constructed_variable(Scalar, blockB,
sizeB,
blocking.blockB());
85 manage_caching_sizes(GetAction, &
l1, &
l2, &
l3);
87 subcols = std::max<Index>((
subcols/Traits::nr)*Traits::nr, Traits::nr);
89 for(Index
k2=IsLower ? 0 : size;
91 IsLower ?
k2+=kc :
k2-=kc)
93 const Index
actual_kc = (std::min)(IsLower ? size-
k2 :
k2, kc);
119 Index i = IsLower ?
k2+
k1+k :
k2-
k1-k-1;
122 : IsLower ? i+1 : i-rs;
130 const Scalar* l = &
tri(i,s);
131 Scalar* r = &other(s,
j);
132 for (Index
i3=0;
i3<k; ++
i3)
135 other(i,
j) = (other(i,
j) - b)*a;
139 Scalar b = (other(i,j) *= a);
140 Scalar* r = &other(s,j);
141 const Scalar* l = &tri(s,i);
142 for (Index i3=0;i3<rs;++i3)
143 r[i3] -= b * conj(l[i3]);
148 Index lengthTarget = actual_kc-k1-actualPanelWidth;
149 Index startBlock = IsLower ? k2+k1 : k2-k1-actualPanelWidth;
150 Index blockBOffset = IsLower ? k1 : lengthTarget;
153 pack_rhs(blockB+actual_kc*j2, other.getSubMapper(startBlock,j2), actualPanelWidth, actual_cols, actual_kc, blockBOffset);
158 Index startTarget = IsLower ? k2+k1+actualPanelWidth : k2-actual_kc;
160 pack_lhs(blockA, tri.getSubMapper(startTarget,startBlock), actualPanelWidth, lengthTarget);
162 gebp_kernel(other.getSubMapper(startTarget,j2), blockA, blockB+actual_kc*j2, lengthTarget, actualPanelWidth, actual_cols, Scalar(-1),
163 actualPanelWidth, actual_kc, 0, blockBOffset);
170 Index start = IsLower ? k2+kc : 0;
171 Index end = IsLower ? size : k2-kc;
172 for(Index i2=start; i2<end; i2+=mc)
174 const Index actual_mc = (std::min)(mc,end-i2);
177 pack_lhs(blockA, tri.getSubMapper(i2, IsLower ? k2 : k2-kc), actual_kc, actual_mc);
179 gebp_kernel(other.getSubMapper(i2, 0), blockA, blockB, actual_mc, actual_kc, cols, Scalar(-1), -1, -1, 0, 0);
188template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder>
191 static EIGEN_DONT_INLINE
void run(
197template <
typename Scalar,
typename Index,
int Mode,
bool Conjugate,
int TriStorageOrder>
214 SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Traits::mr,Traits::nr),
219 Index mc = (std::min)(rows,
blocking.mc());
221 std::size_t
sizeA = kc*mc;
222 std::size_t
sizeB = kc*size;
224 ei_declare_aligned_stack_constructed_variable(Scalar, blockA,
sizeA,
blocking.blockA());
225 ei_declare_aligned_stack_constructed_variable(Scalar, blockB,
sizeB,
blocking.blockB());
233 for(Index
k2=IsLower ? size : 0;
234 IsLower ?
k2>0 :
k2<size;
235 IsLower ?
k2-=kc :
k2+=kc)
237 const Index
actual_kc = (std::min)(IsLower ?
k2 : size-
k2, kc);
264 for(Index i2=0; i2<rows; i2+=mc)
266 const Index actual_mc = (std::min)(mc,rows-i2);
271 for (Index j2 = IsLower
272 ? (actual_kc - ((actual_kc%SmallPanelWidth) ? Index(actual_kc%SmallPanelWidth)
273 : Index(SmallPanelWidth)))
275 IsLower ? j2>=0 : j2<actual_kc;
276 IsLower ? j2-=SmallPanelWidth : j2+=SmallPanelWidth)
278 Index actualPanelWidth = std::min<Index>(actual_kc-j2, SmallPanelWidth);
279 Index absolute_j2 = actual_k2 + j2;
280 Index panelOffset = IsLower ? j2+actualPanelWidth : 0;
281 Index panelLength = IsLower ? actual_kc - j2 - actualPanelWidth : j2;
286 gebp_kernel(lhs.getSubMapper(i2,absolute_j2),
287 blockA, blockB+j2*actual_kc,
288 actual_mc, panelLength, actualPanelWidth,
290 actual_kc, actual_kc,
291 panelOffset, panelOffset);
295 for (Index k=0; k<actualPanelWidth; ++k)
297 Index j = IsLower ? absolute_j2+actualPanelWidth-k-1 : absolute_j2+k;
299 Scalar* r = &lhs(i2,j);
300 for (Index k3=0; k3<k; ++k3)
302 Scalar b = conj(rhs(IsLower ? j+1+k3 : absolute_j2+k3,j));
303 Scalar* a = &lhs(i2,IsLower ? j+1+k3 : absolute_j2+k3);
304 for (Index i=0; i<actual_mc; ++i)
309 Scalar b = conj(rhs(j,j));
310 for (Index i=0; i<actual_mc; ++i)
316 pack_lhs_panel(blockA, LhsMapper(_other+absolute_j2*otherStride+i2, otherStride),
317 actualPanelWidth, actual_mc,
323 gebp_kernel(lhs.getSubMapper(i2, startPanel), blockA, geb,
324 actual_mc, actual_kc, rs, Scalar(-1),
Definition ForwardDeclarations.h:89
Pseudo expression representing a solving operation.
Definition Solve.h:63
@ UnitDiag
Matrix has ones on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:208
@ Lower
View matrix as a lower triangular matrix.
Definition Constants.h:204
@ Upper
View matrix as an upper triangular matrix.
Definition Constants.h:206
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:320
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:322
@ OnTheLeft
Apply transformation on the left.
Definition Constants.h:333
@ OnTheRight
Apply transformation on the right.
Definition Constants.h:335
Holds information about the various numeric (i.e.
Definition NumTraits.h:108
Definition SolveTriangular.h:23