📄 clalsa.c
字号:
i__3 = nlf + nl - 1;
for (jrow = nlf; jrow <= i__3; ++jrow) {
++j;
rwork[j] = r_imag(&b_ref(jrow, jcol));
/* L30: */
}
/* L40: */
}
latime_1.ops += sopbl3_("SGEMM ", &nl, nrhs, &nl);
sgemm_("T", "N", &nl, nrhs, &nl, &c_b10, &u_ref(nlf, 1), ldu, &rwork[(
nl * *nrhs << 1) + 1], &nl, &c_b11, &rwork[nl * *nrhs + 1], &
nl);
jreal = 0;
jimag = nl * *nrhs;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nlf + nl - 1;
for (jrow = nlf; jrow <= i__3; ++jrow) {
++jreal;
++jimag;
i__4 = bx_subscr(jrow, jcol);
i__5 = jreal;
i__6 = jimag;
q__1.r = rwork[i__5], q__1.i = rwork[i__6];
bx[i__4].r = q__1.r, bx[i__4].i = q__1.i;
/* L50: */
}
/* L60: */
}
/* Since B and BX are complex, the following call to SGEMM
is performed in two steps (real and imaginary parts).
CALL SGEMM( 'T', 'N', NR, NRHS, NR, ONE, U( NRF, 1 ), LDU,
$ B( NRF, 1 ), LDB, ZERO, BX( NRF, 1 ), LDBX ) */
j = nr * *nrhs << 1;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nrf + nr - 1;
for (jrow = nrf; jrow <= i__3; ++jrow) {
++j;
i__4 = b_subscr(jrow, jcol);
rwork[j] = b[i__4].r;
/* L70: */
}
/* L80: */
}
latime_1.ops += sopbl3_("SGEMM ", &nr, nrhs, &nr);
sgemm_("T", "N", &nr, nrhs, &nr, &c_b10, &u_ref(nrf, 1), ldu, &rwork[(
nr * *nrhs << 1) + 1], &nr, &c_b11, &rwork[1], &nr);
j = nr * *nrhs << 1;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nrf + nr - 1;
for (jrow = nrf; jrow <= i__3; ++jrow) {
++j;
rwork[j] = r_imag(&b_ref(jrow, jcol));
/* L90: */
}
/* L100: */
}
latime_1.ops += sopbl3_("SGEMM ", &nr, nrhs, &nr);
sgemm_("T", "N", &nr, nrhs, &nr, &c_b10, &u_ref(nrf, 1), ldu, &rwork[(
nr * *nrhs << 1) + 1], &nr, &c_b11, &rwork[nr * *nrhs + 1], &
nr);
jreal = 0;
jimag = nr * *nrhs;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nrf + nr - 1;
for (jrow = nrf; jrow <= i__3; ++jrow) {
++jreal;
++jimag;
i__4 = bx_subscr(jrow, jcol);
i__5 = jreal;
i__6 = jimag;
q__1.r = rwork[i__5], q__1.i = rwork[i__6];
bx[i__4].r = q__1.r, bx[i__4].i = q__1.i;
/* L110: */
}
/* L120: */
}
/* L130: */
}
/* Next copy the rows of B that correspond to unchanged rows
in the bidiagonal matrix to BX. */
i__1 = nd;
for (i__ = 1; i__ <= i__1; ++i__) {
ic = iwork[inode + i__ - 1];
ccopy_(nrhs, &b_ref(ic, 1), ldb, &bx_ref(ic, 1), ldbx);
/* L140: */
}
/* Finally go through the left singular vector matrices of all
the other subproblems bottom-up on the tree. */
j = pow_ii(&c__2, &nlvl);
sqre = 0;
for (lvl = nlvl; lvl >= 1; --lvl) {
lvl2 = (lvl << 1) - 1;
/* find the first node LF and last node LL on
the current level LVL */
if (lvl == 1) {
lf = 1;
ll = 1;
} else {
i__1 = lvl - 1;
lf = pow_ii(&c__2, &i__1);
ll = (lf << 1) - 1;
}
i__1 = ll;
for (i__ = lf; i__ <= i__1; ++i__) {
im1 = i__ - 1;
ic = iwork[inode + im1];
nl = iwork[ndiml + im1];
nr = iwork[ndimr + im1];
nlf = ic - nl;
nrf = ic + 1;
--j;
clals0_(icompq, &nl, &nr, &sqre, nrhs, &bx_ref(nlf, 1), ldbx, &
b_ref(nlf, 1), ldb, &perm_ref(nlf, lvl), &givptr[j], &
givcol_ref(nlf, lvl2), ldgcol, &givnum_ref(nlf, lvl2),
ldu, &poles_ref(nlf, lvl2), &difl_ref(nlf, lvl), &
difr_ref(nlf, lvl2), &z___ref(nlf, lvl), &k[j], &c__[j], &
s[j], &rwork[1], info);
/* L150: */
}
/* L160: */
}
goto L330;
/* ICOMPQ = 1: applying back the right singular vector factors. */
L170:
/* First now go through the right singular vector matrices of all
the tree nodes top-down. */
j = 0;
i__1 = nlvl;
for (lvl = 1; lvl <= i__1; ++lvl) {
lvl2 = (lvl << 1) - 1;
/* Find the first node LF and last node LL on
the current level LVL. */
if (lvl == 1) {
lf = 1;
ll = 1;
} else {
i__2 = lvl - 1;
lf = pow_ii(&c__2, &i__2);
ll = (lf << 1) - 1;
}
i__2 = lf;
for (i__ = ll; i__ >= i__2; --i__) {
im1 = i__ - 1;
ic = iwork[inode + im1];
nl = iwork[ndiml + im1];
nr = iwork[ndimr + im1];
nlf = ic - nl;
nrf = ic + 1;
if (i__ == ll) {
sqre = 0;
} else {
sqre = 1;
}
++j;
clals0_(icompq, &nl, &nr, &sqre, nrhs, &b_ref(nlf, 1), ldb, &
bx_ref(nlf, 1), ldbx, &perm_ref(nlf, lvl), &givptr[j], &
givcol_ref(nlf, lvl2), ldgcol, &givnum_ref(nlf, lvl2),
ldu, &poles_ref(nlf, lvl2), &difl_ref(nlf, lvl), &
difr_ref(nlf, lvl2), &z___ref(nlf, lvl), &k[j], &c__[j], &
s[j], &rwork[1], info);
/* L180: */
}
/* L190: */
}
/* The nodes on the bottom level of the tree were solved
by SLASDQ. The corresponding right singular vector
matrices are in explicit form. Apply them back. */
ndb1 = (nd + 1) / 2;
i__1 = nd;
for (i__ = ndb1; i__ <= i__1; ++i__) {
i1 = i__ - 1;
ic = iwork[inode + i1];
nl = iwork[ndiml + i1];
nr = iwork[ndimr + i1];
nlp1 = nl + 1;
if (i__ == nd) {
nrp1 = nr;
} else {
nrp1 = nr + 1;
}
nlf = ic - nl;
nrf = ic + 1;
/* Since B and BX are complex, the following call to SGEMM is
performed in two steps (real and imaginary parts).
CALL SGEMM( 'T', 'N', NLP1, NRHS, NLP1, ONE, VT( NLF, 1 ), LDU,
$ B( NLF, 1 ), LDB, ZERO, BX( NLF, 1 ), LDBX ) */
j = nlp1 * *nrhs << 1;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nlf + nlp1 - 1;
for (jrow = nlf; jrow <= i__3; ++jrow) {
++j;
i__4 = b_subscr(jrow, jcol);
rwork[j] = b[i__4].r;
/* L200: */
}
/* L210: */
}
latime_1.ops += sopbl3_("SGEMM ", &nlp1, nrhs, &nlp1);
sgemm_("T", "N", &nlp1, nrhs, &nlp1, &c_b10, &vt_ref(nlf, 1), ldu, &
rwork[(nlp1 * *nrhs << 1) + 1], &nlp1, &c_b11, &rwork[1], &
nlp1);
j = nlp1 * *nrhs << 1;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nlf + nlp1 - 1;
for (jrow = nlf; jrow <= i__3; ++jrow) {
++j;
rwork[j] = r_imag(&b_ref(jrow, jcol));
/* L220: */
}
/* L230: */
}
latime_1.ops += sopbl3_("SGEMM ", &nlp1, nrhs, &nlp1);
sgemm_("T", "N", &nlp1, nrhs, &nlp1, &c_b10, &vt_ref(nlf, 1), ldu, &
rwork[(nlp1 * *nrhs << 1) + 1], &nlp1, &c_b11, &rwork[nlp1 * *
nrhs + 1], &nlp1);
jreal = 0;
jimag = nlp1 * *nrhs;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nlf + nlp1 - 1;
for (jrow = nlf; jrow <= i__3; ++jrow) {
++jreal;
++jimag;
i__4 = bx_subscr(jrow, jcol);
i__5 = jreal;
i__6 = jimag;
q__1.r = rwork[i__5], q__1.i = rwork[i__6];
bx[i__4].r = q__1.r, bx[i__4].i = q__1.i;
/* L240: */
}
/* L250: */
}
/* Since B and BX are complex, the following call to SGEMM is
performed in two steps (real and imaginary parts).
CALL SGEMM( 'T', 'N', NRP1, NRHS, NRP1, ONE, VT( NRF, 1 ), LDU,
$ B( NRF, 1 ), LDB, ZERO, BX( NRF, 1 ), LDBX ) */
j = nrp1 * *nrhs << 1;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nrf + nrp1 - 1;
for (jrow = nrf; jrow <= i__3; ++jrow) {
++j;
i__4 = b_subscr(jrow, jcol);
rwork[j] = b[i__4].r;
/* L260: */
}
/* L270: */
}
latime_1.ops += sopbl3_("SGEMM ", &nrp1, nrhs, &nrp1);
sgemm_("T", "N", &nrp1, nrhs, &nrp1, &c_b10, &vt_ref(nrf, 1), ldu, &
rwork[(nrp1 * *nrhs << 1) + 1], &nrp1, &c_b11, &rwork[1], &
nrp1);
j = nrp1 * *nrhs << 1;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nrf + nrp1 - 1;
for (jrow = nrf; jrow <= i__3; ++jrow) {
++j;
rwork[j] = r_imag(&b_ref(jrow, jcol));
/* L280: */
}
/* L290: */
}
latime_1.ops += sopbl3_("SGEMM ", &nrp1, nrhs, &nrp1);
sgemm_("T", "N", &nrp1, nrhs, &nrp1, &c_b10, &vt_ref(nrf, 1), ldu, &
rwork[(nrp1 * *nrhs << 1) + 1], &nrp1, &c_b11, &rwork[nrp1 * *
nrhs + 1], &nrp1);
jreal = 0;
jimag = nrp1 * *nrhs;
i__2 = *nrhs;
for (jcol = 1; jcol <= i__2; ++jcol) {
i__3 = nrf + nrp1 - 1;
for (jrow = nrf; jrow <= i__3; ++jrow) {
++jreal;
++jimag;
i__4 = bx_subscr(jrow, jcol);
i__5 = jreal;
i__6 = jimag;
q__1.r = rwork[i__5], q__1.i = rwork[i__6];
bx[i__4].r = q__1.r, bx[i__4].i = q__1.i;
/* L300: */
}
/* L310: */
}
/* L320: */
}
L330:
return 0;
/* End of CLALSA */
} /* clalsa_ */
#undef givnum_ref
#undef givcol_ref
#undef vt_ref
#undef bx_ref
#undef bx_subscr
#undef poles_ref
#undef z___ref
#undef u_ref
#undef b_ref
#undef b_subscr
#undef perm_ref
#undef difr_ref
#undef difl_ref
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -