LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
clalsa.f
Go to the documentation of this file.
1 *> \brief \b CLALSA computes the SVD of the coefficient matrix in compact form. Used by sgelsd.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download CLALSA + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clalsa.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clalsa.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clalsa.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE CLALSA( ICOMPQ, SMLSIZ, N, NRHS, B, LDB, BX, LDBX, U,
22 * LDU, VT, K, DIFL, DIFR, Z, POLES, GIVPTR,
23 * GIVCOL, LDGCOL, PERM, GIVNUM, C, S, RWORK,
24 * IWORK, INFO )
25 *
26 * .. Scalar Arguments ..
27 * INTEGER ICOMPQ, INFO, LDB, LDBX, LDGCOL, LDU, N, NRHS,
28 * $ SMLSIZ
29 * ..
30 * .. Array Arguments ..
31 * INTEGER GIVCOL( LDGCOL, * ), GIVPTR( * ), IWORK( * ),
32 * $ K( * ), PERM( LDGCOL, * )
33 * REAL C( * ), DIFL( LDU, * ), DIFR( LDU, * ),
34 * $ GIVNUM( LDU, * ), POLES( LDU, * ), RWORK( * ),
35 * $ S( * ), U( LDU, * ), VT( LDU, * ), Z( LDU, * )
36 * COMPLEX B( LDB, * ), BX( LDBX, * )
37 * ..
38 *
39 *
40 *> \par Purpose:
41 * =============
42 *>
43 *> \verbatim
44 *>
45 *> CLALSA is an itermediate step in solving the least squares problem
46 *> by computing the SVD of the coefficient matrix in compact form (The
47 *> singular vectors are computed as products of simple orthorgonal
48 *> matrices.).
49 *>
50 *> If ICOMPQ = 0, CLALSA applies the inverse of the left singular vector
51 *> matrix of an upper bidiagonal matrix to the right hand side; and if
52 *> ICOMPQ = 1, CLALSA applies the right singular vector matrix to the
53 *> right hand side. The singular vector matrices were generated in
54 *> compact form by CLALSA.
55 *> \endverbatim
56 *
57 * Arguments:
58 * ==========
59 *
60 *> \param[in] ICOMPQ
61 *> \verbatim
62 *> ICOMPQ is INTEGER
63 *> Specifies whether the left or the right singular vector
64 *> matrix is involved.
65 *> = 0: Left singular vector matrix
66 *> = 1: Right singular vector matrix
67 *> \endverbatim
68 *>
69 *> \param[in] SMLSIZ
70 *> \verbatim
71 *> SMLSIZ is INTEGER
72 *> The maximum size of the subproblems at the bottom of the
73 *> computation tree.
74 *> \endverbatim
75 *>
76 *> \param[in] N
77 *> \verbatim
78 *> N is INTEGER
79 *> The row and column dimensions of the upper bidiagonal matrix.
80 *> \endverbatim
81 *>
82 *> \param[in] NRHS
83 *> \verbatim
84 *> NRHS is INTEGER
85 *> The number of columns of B and BX. NRHS must be at least 1.
86 *> \endverbatim
87 *>
88 *> \param[in,out] B
89 *> \verbatim
90 *> B is COMPLEX array, dimension ( LDB, NRHS )
91 *> On input, B contains the right hand sides of the least
92 *> squares problem in rows 1 through M.
93 *> On output, B contains the solution X in rows 1 through N.
94 *> \endverbatim
95 *>
96 *> \param[in] LDB
97 *> \verbatim
98 *> LDB is INTEGER
99 *> The leading dimension of B in the calling subprogram.
100 *> LDB must be at least max(1,MAX( M, N ) ).
101 *> \endverbatim
102 *>
103 *> \param[out] BX
104 *> \verbatim
105 *> BX is COMPLEX array, dimension ( LDBX, NRHS )
106 *> On exit, the result of applying the left or right singular
107 *> vector matrix to B.
108 *> \endverbatim
109 *>
110 *> \param[in] LDBX
111 *> \verbatim
112 *> LDBX is INTEGER
113 *> The leading dimension of BX.
114 *> \endverbatim
115 *>
116 *> \param[in] U
117 *> \verbatim
118 *> U is REAL array, dimension ( LDU, SMLSIZ ).
119 *> On entry, U contains the left singular vector matrices of all
120 *> subproblems at the bottom level.
121 *> \endverbatim
122 *>
123 *> \param[in] LDU
124 *> \verbatim
125 *> LDU is INTEGER, LDU = > N.
126 *> The leading dimension of arrays U, VT, DIFL, DIFR,
127 *> POLES, GIVNUM, and Z.
128 *> \endverbatim
129 *>
130 *> \param[in] VT
131 *> \verbatim
132 *> VT is REAL array, dimension ( LDU, SMLSIZ+1 ).
133 *> On entry, VT**H contains the right singular vector matrices of
134 *> all subproblems at the bottom level.
135 *> \endverbatim
136 *>
137 *> \param[in] K
138 *> \verbatim
139 *> K is INTEGER array, dimension ( N ).
140 *> \endverbatim
141 *>
142 *> \param[in] DIFL
143 *> \verbatim
144 *> DIFL is REAL array, dimension ( LDU, NLVL ).
145 *> where NLVL = INT(log_2 (N/(SMLSIZ+1))) + 1.
146 *> \endverbatim
147 *>
148 *> \param[in] DIFR
149 *> \verbatim
150 *> DIFR is REAL array, dimension ( LDU, 2 * NLVL ).
151 *> On entry, DIFL(*, I) and DIFR(*, 2 * I -1) record
152 *> distances between singular values on the I-th level and
153 *> singular values on the (I -1)-th level, and DIFR(*, 2 * I)
154 *> record the normalizing factors of the right singular vectors
155 *> matrices of subproblems on I-th level.
156 *> \endverbatim
157 *>
158 *> \param[in] Z
159 *> \verbatim
160 *> Z is REAL array, dimension ( LDU, NLVL ).
161 *> On entry, Z(1, I) contains the components of the deflation-
162 *> adjusted updating row vector for subproblems on the I-th
163 *> level.
164 *> \endverbatim
165 *>
166 *> \param[in] POLES
167 *> \verbatim
168 *> POLES is REAL array, dimension ( LDU, 2 * NLVL ).
169 *> On entry, POLES(*, 2 * I -1: 2 * I) contains the new and old
170 *> singular values involved in the secular equations on the I-th
171 *> level.
172 *> \endverbatim
173 *>
174 *> \param[in] GIVPTR
175 *> \verbatim
176 *> GIVPTR is INTEGER array, dimension ( N ).
177 *> On entry, GIVPTR( I ) records the number of Givens
178 *> rotations performed on the I-th problem on the computation
179 *> tree.
180 *> \endverbatim
181 *>
182 *> \param[in] GIVCOL
183 *> \verbatim
184 *> GIVCOL is INTEGER array, dimension ( LDGCOL, 2 * NLVL ).
185 *> On entry, for each I, GIVCOL(*, 2 * I - 1: 2 * I) records the
186 *> locations of Givens rotations performed on the I-th level on
187 *> the computation tree.
188 *> \endverbatim
189 *>
190 *> \param[in] LDGCOL
191 *> \verbatim
192 *> LDGCOL is INTEGER, LDGCOL = > N.
193 *> The leading dimension of arrays GIVCOL and PERM.
194 *> \endverbatim
195 *>
196 *> \param[in] PERM
197 *> \verbatim
198 *> PERM is INTEGER array, dimension ( LDGCOL, NLVL ).
199 *> On entry, PERM(*, I) records permutations done on the I-th
200 *> level of the computation tree.
201 *> \endverbatim
202 *>
203 *> \param[in] GIVNUM
204 *> \verbatim
205 *> GIVNUM is REAL array, dimension ( LDU, 2 * NLVL ).
206 *> On entry, GIVNUM(*, 2 *I -1 : 2 * I) records the C- and S-
207 *> values of Givens rotations performed on the I-th level on the
208 *> computation tree.
209 *> \endverbatim
210 *>
211 *> \param[in] C
212 *> \verbatim
213 *> C is REAL array, dimension ( N ).
214 *> On entry, if the I-th subproblem is not square,
215 *> C( I ) contains the C-value of a Givens rotation related to
216 *> the right null space of the I-th subproblem.
217 *> \endverbatim
218 *>
219 *> \param[in] S
220 *> \verbatim
221 *> S is REAL array, dimension ( N ).
222 *> On entry, if the I-th subproblem is not square,
223 *> S( I ) contains the S-value of a Givens rotation related to
224 *> the right null space of the I-th subproblem.
225 *> \endverbatim
226 *>
227 *> \param[out] RWORK
228 *> \verbatim
229 *> RWORK is REAL array, dimension at least
230 *> MAX( (SMLSZ+1)*NRHS*3, N*(1+NRHS) + 2*NRHS ).
231 *> \endverbatim
232 *>
233 *> \param[out] IWORK
234 *> \verbatim
235 *> IWORK is INTEGER array, dimension (3*N)
236 *> \endverbatim
237 *>
238 *> \param[out] INFO
239 *> \verbatim
240 *> INFO is INTEGER
241 *> = 0: successful exit.
242 *> < 0: if INFO = -i, the i-th argument had an illegal value.
243 *> \endverbatim
244 *
245 * Authors:
246 * ========
247 *
248 *> \author Univ. of Tennessee
249 *> \author Univ. of California Berkeley
250 *> \author Univ. of Colorado Denver
251 *> \author NAG Ltd.
252 *
253 *> \date June 2017
254 *
255 *> \ingroup complexOTHERcomputational
256 *
257 *> \par Contributors:
258 * ==================
259 *>
260 *> Ming Gu and Ren-Cang Li, Computer Science Division, University of
261 *> California at Berkeley, USA \n
262 *> Osni Marques, LBNL/NERSC, USA \n
263 *
264 * =====================================================================
265  SUBROUTINE clalsa( ICOMPQ, SMLSIZ, N, NRHS, B, LDB, BX, LDBX, U,
266  $ LDU, VT, K, DIFL, DIFR, Z, POLES, GIVPTR,
267  $ GIVCOL, LDGCOL, PERM, GIVNUM, C, S, RWORK,
268  $ IWORK, INFO )
269 *
270 * -- LAPACK computational routine (version 3.7.1) --
271 * -- LAPACK is a software package provided by Univ. of Tennessee, --
272 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
273 * June 2017
274 *
275 * .. Scalar Arguments ..
276  INTEGER ICOMPQ, INFO, LDB, LDBX, LDGCOL, LDU, N, NRHS,
277  $ smlsiz
278 * ..
279 * .. Array Arguments ..
280  INTEGER GIVCOL( ldgcol, * ), GIVPTR( * ), IWORK( * ),
281  $ k( * ), perm( ldgcol, * )
282  REAL C( * ), DIFL( ldu, * ), DIFR( ldu, * ),
283  $ givnum( ldu, * ), poles( ldu, * ), rwork( * ),
284  $ s( * ), u( ldu, * ), vt( ldu, * ), z( ldu, * )
285  COMPLEX B( ldb, * ), BX( ldbx, * )
286 * ..
287 *
288 * =====================================================================
289 *
290 * .. Parameters ..
291  REAL ZERO, ONE
292  parameter( zero = 0.0e0, one = 1.0e0 )
293 * ..
294 * .. Local Scalars ..
295  INTEGER I, I1, IC, IM1, INODE, J, JCOL, JIMAG, JREAL,
296  $ jrow, lf, ll, lvl, lvl2, nd, ndb1, ndiml,
297  $ ndimr, nl, nlf, nlp1, nlvl, nr, nrf, nrp1, sqre
298 * ..
299 * .. External Subroutines ..
300  EXTERNAL ccopy, clals0, sgemm, slasdt, xerbla
301 * ..
302 * .. Intrinsic Functions ..
303  INTRINSIC aimag, cmplx, real
304 * ..
305 * .. Executable Statements ..
306 *
307 * Test the input parameters.
308 *
309  info = 0
310 *
311  IF( ( icompq.LT.0 ) .OR. ( icompq.GT.1 ) ) THEN
312  info = -1
313  ELSE IF( smlsiz.LT.3 ) THEN
314  info = -2
315  ELSE IF( n.LT.smlsiz ) THEN
316  info = -3
317  ELSE IF( nrhs.LT.1 ) THEN
318  info = -4
319  ELSE IF( ldb.LT.n ) THEN
320  info = -6
321  ELSE IF( ldbx.LT.n ) THEN
322  info = -8
323  ELSE IF( ldu.LT.n ) THEN
324  info = -10
325  ELSE IF( ldgcol.LT.n ) THEN
326  info = -19
327  END IF
328  IF( info.NE.0 ) THEN
329  CALL xerbla( 'CLALSA', -info )
330  RETURN
331  END IF
332 *
333 * Book-keeping and setting up the computation tree.
334 *
335  inode = 1
336  ndiml = inode + n
337  ndimr = ndiml + n
338 *
339  CALL slasdt( n, nlvl, nd, iwork( inode ), iwork( ndiml ),
340  $ iwork( ndimr ), smlsiz )
341 *
342 * The following code applies back the left singular vector factors.
343 * For applying back the right singular vector factors, go to 170.
344 *
345  IF( icompq.EQ.1 ) THEN
346  GO TO 170
347  END IF
348 *
349 * The nodes on the bottom level of the tree were solved
350 * by SLASDQ. The corresponding left and right singular vector
351 * matrices are in explicit form. First apply back the left
352 * singular vector matrices.
353 *
354  ndb1 = ( nd+1 ) / 2
355  DO 130 i = ndb1, nd
356 *
357 * IC : center row of each node
358 * NL : number of rows of left subproblem
359 * NR : number of rows of right subproblem
360 * NLF: starting row of the left subproblem
361 * NRF: starting row of the right subproblem
362 *
363  i1 = i - 1
364  ic = iwork( inode+i1 )
365  nl = iwork( ndiml+i1 )
366  nr = iwork( ndimr+i1 )
367  nlf = ic - nl
368  nrf = ic + 1
369 *
370 * Since B and BX are complex, the following call to SGEMM
371 * is performed in two steps (real and imaginary parts).
372 *
373 * CALL SGEMM( 'T', 'N', NL, NRHS, NL, ONE, U( NLF, 1 ), LDU,
374 * $ B( NLF, 1 ), LDB, ZERO, BX( NLF, 1 ), LDBX )
375 *
376  j = nl*nrhs*2
377  DO 20 jcol = 1, nrhs
378  DO 10 jrow = nlf, nlf + nl - 1
379  j = j + 1
380  rwork( j ) = REAL( B( JROW, JCOL ) )
381  10 CONTINUE
382  20 CONTINUE
383  CALL sgemm( 'T', 'N', nl, nrhs, nl, one, u( nlf, 1 ), ldu,
384  $ rwork( 1+nl*nrhs*2 ), nl, zero, rwork( 1 ), nl )
385  j = nl*nrhs*2
386  DO 40 jcol = 1, nrhs
387  DO 30 jrow = nlf, nlf + nl - 1
388  j = j + 1
389  rwork( j ) = aimag( b( jrow, jcol ) )
390  30 CONTINUE
391  40 CONTINUE
392  CALL sgemm( 'T', 'N', nl, nrhs, nl, one, u( nlf, 1 ), ldu,
393  $ rwork( 1+nl*nrhs*2 ), nl, zero, rwork( 1+nl*nrhs ),
394  $ nl )
395  jreal = 0
396  jimag = nl*nrhs
397  DO 60 jcol = 1, nrhs
398  DO 50 jrow = nlf, nlf + nl - 1
399  jreal = jreal + 1
400  jimag = jimag + 1
401  bx( jrow, jcol ) = cmplx( rwork( jreal ),
402  $ rwork( jimag ) )
403  50 CONTINUE
404  60 CONTINUE
405 *
406 * Since B and BX are complex, the following call to SGEMM
407 * is performed in two steps (real and imaginary parts).
408 *
409 * CALL SGEMM( 'T', 'N', NR, NRHS, NR, ONE, U( NRF, 1 ), LDU,
410 * $ B( NRF, 1 ), LDB, ZERO, BX( NRF, 1 ), LDBX )
411 *
412  j = nr*nrhs*2
413  DO 80 jcol = 1, nrhs
414  DO 70 jrow = nrf, nrf + nr - 1
415  j = j + 1
416  rwork( j ) = REAL( B( JROW, JCOL ) )
417  70 CONTINUE
418  80 CONTINUE
419  CALL sgemm( 'T', 'N', nr, nrhs, nr, one, u( nrf, 1 ), ldu,
420  $ rwork( 1+nr*nrhs*2 ), nr, zero, rwork( 1 ), nr )
421  j = nr*nrhs*2
422  DO 100 jcol = 1, nrhs
423  DO 90 jrow = nrf, nrf + nr - 1
424  j = j + 1
425  rwork( j ) = aimag( b( jrow, jcol ) )
426  90 CONTINUE
427  100 CONTINUE
428  CALL sgemm( 'T', 'N', nr, nrhs, nr, one, u( nrf, 1 ), ldu,
429  $ rwork( 1+nr*nrhs*2 ), nr, zero, rwork( 1+nr*nrhs ),
430  $ nr )
431  jreal = 0
432  jimag = nr*nrhs
433  DO 120 jcol = 1, nrhs
434  DO 110 jrow = nrf, nrf + nr - 1
435  jreal = jreal + 1
436  jimag = jimag + 1
437  bx( jrow, jcol ) = cmplx( rwork( jreal ),
438  $ rwork( jimag ) )
439  110 CONTINUE
440  120 CONTINUE
441 *
442  130 CONTINUE
443 *
444 * Next copy the rows of B that correspond to unchanged rows
445 * in the bidiagonal matrix to BX.
446 *
447  DO 140 i = 1, nd
448  ic = iwork( inode+i-1 )
449  CALL ccopy( nrhs, b( ic, 1 ), ldb, bx( ic, 1 ), ldbx )
450  140 CONTINUE
451 *
452 * Finally go through the left singular vector matrices of all
453 * the other subproblems bottom-up on the tree.
454 *
455  j = 2**nlvl
456  sqre = 0
457 *
458  DO 160 lvl = nlvl, 1, -1
459  lvl2 = 2*lvl - 1
460 *
461 * find the first node LF and last node LL on
462 * the current level LVL
463 *
464  IF( lvl.EQ.1 ) THEN
465  lf = 1
466  ll = 1
467  ELSE
468  lf = 2**( lvl-1 )
469  ll = 2*lf - 1
470  END IF
471  DO 150 i = lf, ll
472  im1 = i - 1
473  ic = iwork( inode+im1 )
474  nl = iwork( ndiml+im1 )
475  nr = iwork( ndimr+im1 )
476  nlf = ic - nl
477  nrf = ic + 1
478  j = j - 1
479  CALL clals0( icompq, nl, nr, sqre, nrhs, bx( nlf, 1 ), ldbx,
480  $ b( nlf, 1 ), ldb, perm( nlf, lvl ),
481  $ givptr( j ), givcol( nlf, lvl2 ), ldgcol,
482  $ givnum( nlf, lvl2 ), ldu, poles( nlf, lvl2 ),
483  $ difl( nlf, lvl ), difr( nlf, lvl2 ),
484  $ z( nlf, lvl ), k( j ), c( j ), s( j ), rwork,
485  $ info )
486  150 CONTINUE
487  160 CONTINUE
488  GO TO 330
489 *
490 * ICOMPQ = 1: applying back the right singular vector factors.
491 *
492  170 CONTINUE
493 *
494 * First now go through the right singular vector matrices of all
495 * the tree nodes top-down.
496 *
497  j = 0
498  DO 190 lvl = 1, nlvl
499  lvl2 = 2*lvl - 1
500 *
501 * Find the first node LF and last node LL on
502 * the current level LVL.
503 *
504  IF( lvl.EQ.1 ) THEN
505  lf = 1
506  ll = 1
507  ELSE
508  lf = 2**( lvl-1 )
509  ll = 2*lf - 1
510  END IF
511  DO 180 i = ll, lf, -1
512  im1 = i - 1
513  ic = iwork( inode+im1 )
514  nl = iwork( ndiml+im1 )
515  nr = iwork( ndimr+im1 )
516  nlf = ic - nl
517  nrf = ic + 1
518  IF( i.EQ.ll ) THEN
519  sqre = 0
520  ELSE
521  sqre = 1
522  END IF
523  j = j + 1
524  CALL clals0( icompq, nl, nr, sqre, nrhs, b( nlf, 1 ), ldb,
525  $ bx( nlf, 1 ), ldbx, perm( nlf, lvl ),
526  $ givptr( j ), givcol( nlf, lvl2 ), ldgcol,
527  $ givnum( nlf, lvl2 ), ldu, poles( nlf, lvl2 ),
528  $ difl( nlf, lvl ), difr( nlf, lvl2 ),
529  $ z( nlf, lvl ), k( j ), c( j ), s( j ), rwork,
530  $ info )
531  180 CONTINUE
532  190 CONTINUE
533 *
534 * The nodes on the bottom level of the tree were solved
535 * by SLASDQ. The corresponding right singular vector
536 * matrices are in explicit form. Apply them back.
537 *
538  ndb1 = ( nd+1 ) / 2
539  DO 320 i = ndb1, nd
540  i1 = i - 1
541  ic = iwork( inode+i1 )
542  nl = iwork( ndiml+i1 )
543  nr = iwork( ndimr+i1 )
544  nlp1 = nl + 1
545  IF( i.EQ.nd ) THEN
546  nrp1 = nr
547  ELSE
548  nrp1 = nr + 1
549  END IF
550  nlf = ic - nl
551  nrf = ic + 1
552 *
553 * Since B and BX are complex, the following call to SGEMM is
554 * performed in two steps (real and imaginary parts).
555 *
556 * CALL SGEMM( 'T', 'N', NLP1, NRHS, NLP1, ONE, VT( NLF, 1 ), LDU,
557 * $ B( NLF, 1 ), LDB, ZERO, BX( NLF, 1 ), LDBX )
558 *
559  j = nlp1*nrhs*2
560  DO 210 jcol = 1, nrhs
561  DO 200 jrow = nlf, nlf + nlp1 - 1
562  j = j + 1
563  rwork( j ) = REAL( B( JROW, JCOL ) )
564  200 CONTINUE
565  210 CONTINUE
566  CALL sgemm( 'T', 'N', nlp1, nrhs, nlp1, one, vt( nlf, 1 ), ldu,
567  $ rwork( 1+nlp1*nrhs*2 ), nlp1, zero, rwork( 1 ),
568  $ nlp1 )
569  j = nlp1*nrhs*2
570  DO 230 jcol = 1, nrhs
571  DO 220 jrow = nlf, nlf + nlp1 - 1
572  j = j + 1
573  rwork( j ) = aimag( b( jrow, jcol ) )
574  220 CONTINUE
575  230 CONTINUE
576  CALL sgemm( 'T', 'N', nlp1, nrhs, nlp1, one, vt( nlf, 1 ), ldu,
577  $ rwork( 1+nlp1*nrhs*2 ), nlp1, zero,
578  $ rwork( 1+nlp1*nrhs ), nlp1 )
579  jreal = 0
580  jimag = nlp1*nrhs
581  DO 250 jcol = 1, nrhs
582  DO 240 jrow = nlf, nlf + nlp1 - 1
583  jreal = jreal + 1
584  jimag = jimag + 1
585  bx( jrow, jcol ) = cmplx( rwork( jreal ),
586  $ rwork( jimag ) )
587  240 CONTINUE
588  250 CONTINUE
589 *
590 * Since B and BX are complex, the following call to SGEMM is
591 * performed in two steps (real and imaginary parts).
592 *
593 * CALL SGEMM( 'T', 'N', NRP1, NRHS, NRP1, ONE, VT( NRF, 1 ), LDU,
594 * $ B( NRF, 1 ), LDB, ZERO, BX( NRF, 1 ), LDBX )
595 *
596  j = nrp1*nrhs*2
597  DO 270 jcol = 1, nrhs
598  DO 260 jrow = nrf, nrf + nrp1 - 1
599  j = j + 1
600  rwork( j ) = REAL( B( JROW, JCOL ) )
601  260 CONTINUE
602  270 CONTINUE
603  CALL sgemm( 'T', 'N', nrp1, nrhs, nrp1, one, vt( nrf, 1 ), ldu,
604  $ rwork( 1+nrp1*nrhs*2 ), nrp1, zero, rwork( 1 ),
605  $ nrp1 )
606  j = nrp1*nrhs*2
607  DO 290 jcol = 1, nrhs
608  DO 280 jrow = nrf, nrf + nrp1 - 1
609  j = j + 1
610  rwork( j ) = aimag( b( jrow, jcol ) )
611  280 CONTINUE
612  290 CONTINUE
613  CALL sgemm( 'T', 'N', nrp1, nrhs, nrp1, one, vt( nrf, 1 ), ldu,
614  $ rwork( 1+nrp1*nrhs*2 ), nrp1, zero,
615  $ rwork( 1+nrp1*nrhs ), nrp1 )
616  jreal = 0
617  jimag = nrp1*nrhs
618  DO 310 jcol = 1, nrhs
619  DO 300 jrow = nrf, nrf + nrp1 - 1
620  jreal = jreal + 1
621  jimag = jimag + 1
622  bx( jrow, jcol ) = cmplx( rwork( jreal ),
623  $ rwork( jimag ) )
624  300 CONTINUE
625  310 CONTINUE
626 *
627  320 CONTINUE
628 *
629  330 CONTINUE
630 *
631  RETURN
632 *
633 * End of CLALSA
634 *
635  END
subroutine ccopy(N, CX, INCX, CY, INCY)
CCOPY
Definition: ccopy.f:83
subroutine clals0(ICOMPQ, NL, NR, SQRE, NRHS, B, LDB, BX, LDBX, PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM, POLES, DIFL, DIFR, Z, K, C, S, RWORK, INFO)
CLALS0 applies back multiplying factors in solving the least squares problem using divide and conquer...
Definition: clals0.f:272
subroutine slasdt(N, LVL, ND, INODE, NDIML, NDIMR, MSUB)
SLASDT creates a tree of subproblems for bidiagonal divide and conquer. Used by sbdsdc.
Definition: slasdt.f:107
subroutine clalsa(ICOMPQ, SMLSIZ, N, NRHS, B, LDB, BX, LDBX, U, LDU, VT, K, DIFL, DIFR, Z, POLES, GIVPTR, GIVCOL, LDGCOL, PERM, GIVNUM, C, S, RWORK, IWORK, INFO)
CLALSA computes the SVD of the coefficient matrix in compact form. Used by sgelsd.
Definition: clalsa.f:269
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189