1 /* generated code, do not edit. */
3 #include "ode/matrix.h"
5 /* solve L^T * x=b, with b containing 1 right hand side.
6 * L is an n*n lower triangular matrix with ones on the diagonal.
7 * L is stored by rows and its leading dimension is lskip.
8 * b is an n*1 matrix that contains the right hand side.
9 * b is overwritten with x.
10 * this processes blocks of 4.
13 void dSolveL1T (const dReal
*L
, dReal
*B
, int n
, int lskip1
)
15 /* declare variables - Z matrix, p and q vectors, etc */
16 dReal Z11
,m11
,Z21
,m21
,Z31
,m31
,Z41
,m41
,p1
,q1
,p2
,p3
,p4
,*ex
;
18 int lskip2
,lskip3
,i
,j
;
19 /* special handling for L and B because we're solving L1 *transpose* */
20 L
= L
+ (n
-1)*(lskip1
+1);
23 /* compute lskip values */
26 /* compute all 4 x 1 blocks of X */
27 for (i
=0; i
<= n
-4; i
+=4) {
28 /* compute all 4 x 1 block of X, from rows i..i+4-1 */
29 /* set the Z matrix to 0 */
36 /* the inner loop that computes outer products and adds them to Z */
37 for (j
=i
-4; j
>= 0; j
-= 4) {
38 /* load p and q values */
44 /* compute outer product and add it to the Z matrix */
54 /* load p and q values */
60 /* compute outer product and add it to the Z matrix */
70 /* load p and q values */
76 /* compute outer product and add it to the Z matrix */
86 /* load p and q values */
92 /* compute outer product and add it to the Z matrix */
103 /* end of inner loop */
105 /* compute left-over iterations */
108 /* load p and q values */
114 /* compute outer product and add it to the Z matrix */
126 /* finish computing the X(i) block */
130 Z21
= ex
[-1] - Z21
- p1
*Z11
;
134 Z31
= ex
[-2] - Z31
- p1
*Z11
- p2
*Z21
;
139 Z41
= ex
[-3] - Z41
- p1
*Z11
- p2
*Z21
- p3
*Z31
;
141 /* end of outer loop */
143 /* compute rows at end that are not a multiple of block size */
145 /* compute all 1 x 1 block of X, from rows i..i+1-1 */
146 /* set the Z matrix to 0 */
150 /* the inner loop that computes outer products and adds them to Z */
151 for (j
=i
-4; j
>= 0; j
-= 4) {
152 /* load p and q values */
155 /* compute outer product and add it to the Z matrix */
159 /* load p and q values */
162 /* compute outer product and add it to the Z matrix */
166 /* load p and q values */
169 /* compute outer product and add it to the Z matrix */
173 /* load p and q values */
176 /* compute outer product and add it to the Z matrix */
181 /* end of inner loop */
183 /* compute left-over iterations */
186 /* load p and q values */
189 /* compute outer product and add it to the Z matrix */
195 /* finish computing the X(i) block */