/root/doris/contrib/openblas/lapack-netlib/SRC/slabrd.c
Line | Count | Source |
1 | | #include <math.h> |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include <complex.h> |
6 | | #ifdef complex |
7 | | #undef complex |
8 | | #endif |
9 | | #ifdef I |
10 | | #undef I |
11 | | #endif |
12 | | |
13 | | #if defined(_WIN64) |
14 | | typedef long long BLASLONG; |
15 | | typedef unsigned long long BLASULONG; |
16 | | #else |
17 | | typedef long BLASLONG; |
18 | | typedef unsigned long BLASULONG; |
19 | | #endif |
20 | | |
21 | | #ifdef LAPACK_ILP64 |
22 | | typedef BLASLONG blasint; |
23 | | #if defined(_WIN64) |
24 | | #define blasabs(x) llabs(x) |
25 | | #else |
26 | | #define blasabs(x) labs(x) |
27 | | #endif |
28 | | #else |
29 | | typedef int blasint; |
30 | | #define blasabs(x) abs(x) |
31 | | #endif |
32 | | |
33 | | typedef blasint integer; |
34 | | |
35 | | typedef unsigned int uinteger; |
36 | | typedef char *address; |
37 | | typedef short int shortint; |
38 | | typedef float real; |
39 | | typedef double doublereal; |
40 | | typedef struct { real r, i; } complex; |
41 | | typedef struct { doublereal r, i; } doublecomplex; |
42 | | #ifdef _MSC_VER |
43 | | static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;} |
44 | | static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;} |
45 | | static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;} |
46 | | static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;} |
47 | | #else |
48 | 0 | static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;} |
49 | 0 | static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;} |
50 | 0 | static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;} |
51 | 0 | static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;} |
52 | | #endif |
53 | | #define pCf(z) (*_pCf(z)) |
54 | | #define pCd(z) (*_pCd(z)) |
55 | | typedef blasint logical; |
56 | | |
57 | | typedef char logical1; |
58 | | typedef char integer1; |
59 | | |
60 | | #define TRUE_ (1) |
61 | | #define FALSE_ (0) |
62 | | |
63 | | /* Extern is for use with -E */ |
64 | | #ifndef Extern |
65 | | #define Extern extern |
66 | | #endif |
67 | | |
68 | | /* I/O stuff */ |
69 | | |
70 | | typedef int flag; |
71 | | typedef int ftnlen; |
72 | | typedef int ftnint; |
73 | | |
74 | | /*external read, write*/ |
75 | | typedef struct |
76 | | { flag cierr; |
77 | | ftnint ciunit; |
78 | | flag ciend; |
79 | | char *cifmt; |
80 | | ftnint cirec; |
81 | | } cilist; |
82 | | |
83 | | /*internal read, write*/ |
84 | | typedef struct |
85 | | { flag icierr; |
86 | | char *iciunit; |
87 | | flag iciend; |
88 | | char *icifmt; |
89 | | ftnint icirlen; |
90 | | ftnint icirnum; |
91 | | } icilist; |
92 | | |
93 | | /*open*/ |
94 | | typedef struct |
95 | | { flag oerr; |
96 | | ftnint ounit; |
97 | | char *ofnm; |
98 | | ftnlen ofnmlen; |
99 | | char *osta; |
100 | | char *oacc; |
101 | | char *ofm; |
102 | | ftnint orl; |
103 | | char *oblnk; |
104 | | } olist; |
105 | | |
106 | | /*close*/ |
107 | | typedef struct |
108 | | { flag cerr; |
109 | | ftnint cunit; |
110 | | char *csta; |
111 | | } cllist; |
112 | | |
113 | | /*rewind, backspace, endfile*/ |
114 | | typedef struct |
115 | | { flag aerr; |
116 | | ftnint aunit; |
117 | | } alist; |
118 | | |
119 | | /* inquire */ |
120 | | typedef struct |
121 | | { flag inerr; |
122 | | ftnint inunit; |
123 | | char *infile; |
124 | | ftnlen infilen; |
125 | | ftnint *inex; /*parameters in standard's order*/ |
126 | | ftnint *inopen; |
127 | | ftnint *innum; |
128 | | ftnint *innamed; |
129 | | char *inname; |
130 | | ftnlen innamlen; |
131 | | char *inacc; |
132 | | ftnlen inacclen; |
133 | | char *inseq; |
134 | | ftnlen inseqlen; |
135 | | char *indir; |
136 | | ftnlen indirlen; |
137 | | char *infmt; |
138 | | ftnlen infmtlen; |
139 | | char *inform; |
140 | | ftnint informlen; |
141 | | char *inunf; |
142 | | ftnlen inunflen; |
143 | | ftnint *inrecl; |
144 | | ftnint *innrec; |
145 | | char *inblank; |
146 | | ftnlen inblanklen; |
147 | | } inlist; |
148 | | |
149 | | #define VOID void |
150 | | |
151 | | union Multitype { /* for multiple entry points */ |
152 | | integer1 g; |
153 | | shortint h; |
154 | | integer i; |
155 | | /* longint j; */ |
156 | | real r; |
157 | | doublereal d; |
158 | | complex c; |
159 | | doublecomplex z; |
160 | | }; |
161 | | |
162 | | typedef union Multitype Multitype; |
163 | | |
164 | | struct Vardesc { /* for Namelist */ |
165 | | char *name; |
166 | | char *addr; |
167 | | ftnlen *dims; |
168 | | int type; |
169 | | }; |
170 | | typedef struct Vardesc Vardesc; |
171 | | |
172 | | struct Namelist { |
173 | | char *name; |
174 | | Vardesc **vars; |
175 | | int nvars; |
176 | | }; |
177 | | typedef struct Namelist Namelist; |
178 | | |
179 | | #define abs(x) ((x) >= 0 ? (x) : -(x)) |
180 | | #define dabs(x) (fabs(x)) |
181 | 0 | #define f2cmin(a,b) ((a) <= (b) ? (a) : (b)) |
182 | | #define f2cmax(a,b) ((a) >= (b) ? (a) : (b)) |
183 | | #define dmin(a,b) (f2cmin(a,b)) |
184 | | #define dmax(a,b) (f2cmax(a,b)) |
185 | | #define bit_test(a,b) ((a) >> (b) & 1) |
186 | | #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) |
187 | | #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) |
188 | | |
189 | | #define abort_() { sig_die("Fortran abort routine called", 1); } |
190 | | #define c_abs(z) (cabsf(Cf(z))) |
191 | | #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); } |
192 | | #ifdef _MSC_VER |
193 | | #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);} |
194 | | #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);} |
195 | | #else |
196 | | #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);} |
197 | | #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);} |
198 | | #endif |
199 | | #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));} |
200 | | #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));} |
201 | | #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));} |
202 | | //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));} |
203 | | #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));} |
204 | | #define d_abs(x) (fabs(*(x))) |
205 | | #define d_acos(x) (acos(*(x))) |
206 | | #define d_asin(x) (asin(*(x))) |
207 | | #define d_atan(x) (atan(*(x))) |
208 | | #define d_atn2(x, y) (atan2(*(x),*(y))) |
209 | | #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); } |
210 | | #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); } |
211 | | #define d_cos(x) (cos(*(x))) |
212 | | #define d_cosh(x) (cosh(*(x))) |
213 | | #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 ) |
214 | | #define d_exp(x) (exp(*(x))) |
215 | | #define d_imag(z) (cimag(Cd(z))) |
216 | | #define r_imag(z) (cimagf(Cf(z))) |
217 | | #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) |
218 | | #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) |
219 | | #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) |
220 | | #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) |
221 | | #define d_log(x) (log(*(x))) |
222 | | #define d_mod(x, y) (fmod(*(x), *(y))) |
223 | | #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x))) |
224 | | #define d_nint(x) u_nint(*(x)) |
225 | | #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a))) |
226 | | #define d_sign(a,b) u_sign(*(a),*(b)) |
227 | | #define r_sign(a,b) u_sign(*(a),*(b)) |
228 | | #define d_sin(x) (sin(*(x))) |
229 | | #define d_sinh(x) (sinh(*(x))) |
230 | | #define d_sqrt(x) (sqrt(*(x))) |
231 | | #define d_tan(x) (tan(*(x))) |
232 | | #define d_tanh(x) (tanh(*(x))) |
233 | | #define i_abs(x) abs(*(x)) |
234 | | #define i_dnnt(x) ((integer)u_nint(*(x))) |
235 | | #define i_len(s, n) (n) |
236 | | #define i_nint(x) ((integer)u_nint(*(x))) |
237 | | #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b))) |
238 | | #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; } |
239 | | #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d)))) |
240 | | #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; } |
241 | | #define sig_die(s, kill) { exit(1); } |
242 | | #define s_stop(s, n) {exit(0);} |
243 | | #define z_abs(z) (cabs(Cd(z))) |
244 | | #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));} |
245 | | #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));} |
246 | | #define myexit_() break; |
247 | | #define mycycle() continue; |
248 | | #define myceiling(w) {ceil(w)} |
249 | | #define myhuge(w) {HUGE_VAL} |
250 | | //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);} |
251 | | #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)} |
252 | | |
253 | | /* -- translated by f2c (version 20000121). |
254 | | You must link the resulting object file with the libraries: |
255 | | -lf2c -lm (in that order) |
256 | | */ |
257 | | |
258 | | |
259 | | |
260 | | |
261 | | /* Table of constant values */ |
262 | | |
263 | | static real c_b4 = -1.f; |
264 | | static real c_b5 = 1.f; |
265 | | static integer c__1 = 1; |
266 | | static real c_b16 = 0.f; |
267 | | |
268 | | /* > \brief \b SLABRD reduces the first nb rows and columns of a general matrix to a bidiagonal form. */ |
269 | | |
270 | | /* =========== DOCUMENTATION =========== */ |
271 | | |
272 | | /* Online html documentation available at */ |
273 | | /* http://www.netlib.org/lapack/explore-html/ */ |
274 | | |
275 | | /* > \htmlonly */ |
276 | | /* > Download SLABRD + dependencies */ |
277 | | /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slabrd. |
278 | | f"> */ |
279 | | /* > [TGZ]</a> */ |
280 | | /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slabrd. |
281 | | f"> */ |
282 | | /* > [ZIP]</a> */ |
283 | | /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slabrd. |
284 | | f"> */ |
285 | | /* > [TXT]</a> */ |
286 | | /* > \endhtmlonly */ |
287 | | |
288 | | /* Definition: */ |
289 | | /* =========== */ |
290 | | |
291 | | /* SUBROUTINE SLABRD( M, N, NB, A, LDA, D, E, TAUQ, TAUP, X, LDX, Y, */ |
292 | | /* LDY ) */ |
293 | | |
294 | | /* INTEGER LDA, LDX, LDY, M, N, NB */ |
295 | | /* REAL A( LDA, * ), D( * ), E( * ), TAUP( * ), */ |
296 | | /* $ TAUQ( * ), X( LDX, * ), Y( LDY, * ) */ |
297 | | |
298 | | |
299 | | /* > \par Purpose: */ |
300 | | /* ============= */ |
301 | | /* > */ |
302 | | /* > \verbatim */ |
303 | | /* > */ |
304 | | /* > SLABRD reduces the first NB rows and columns of a real general */ |
305 | | /* > m by n matrix A to upper or lower bidiagonal form by an orthogonal */ |
306 | | /* > transformation Q**T * A * P, and returns the matrices X and Y which */ |
307 | | /* > are needed to apply the transformation to the unreduced part of A. */ |
308 | | /* > */ |
309 | | /* > If m >= n, A is reduced to upper bidiagonal form; if m < n, to lower */ |
310 | | /* > bidiagonal form. */ |
311 | | /* > */ |
312 | | /* > This is an auxiliary routine called by SGEBRD */ |
313 | | /* > \endverbatim */ |
314 | | |
315 | | /* Arguments: */ |
316 | | /* ========== */ |
317 | | |
318 | | /* > \param[in] M */ |
319 | | /* > \verbatim */ |
320 | | /* > M is INTEGER */ |
321 | | /* > The number of rows in the matrix A. */ |
322 | | /* > \endverbatim */ |
323 | | /* > */ |
324 | | /* > \param[in] N */ |
325 | | /* > \verbatim */ |
326 | | /* > N is INTEGER */ |
327 | | /* > The number of columns in the matrix A. */ |
328 | | /* > \endverbatim */ |
329 | | /* > */ |
330 | | /* > \param[in] NB */ |
331 | | /* > \verbatim */ |
332 | | /* > NB is INTEGER */ |
333 | | /* > The number of leading rows and columns of A to be reduced. */ |
334 | | /* > \endverbatim */ |
335 | | /* > */ |
336 | | /* > \param[in,out] A */ |
337 | | /* > \verbatim */ |
338 | | /* > A is REAL array, dimension (LDA,N) */ |
339 | | /* > On entry, the m by n general matrix to be reduced. */ |
340 | | /* > On exit, the first NB rows and columns of the matrix are */ |
341 | | /* > overwritten; the rest of the array is unchanged. */ |
342 | | /* > If m >= n, elements on and below the diagonal in the first NB */ |
343 | | /* > columns, with the array TAUQ, represent the orthogonal */ |
344 | | /* > matrix Q as a product of elementary reflectors; and */ |
345 | | /* > elements above the diagonal in the first NB rows, with the */ |
346 | | /* > array TAUP, represent the orthogonal matrix P as a product */ |
347 | | /* > of elementary reflectors. */ |
348 | | /* > If m < n, elements below the diagonal in the first NB */ |
349 | | /* > columns, with the array TAUQ, represent the orthogonal */ |
350 | | /* > matrix Q as a product of elementary reflectors, and */ |
351 | | /* > elements on and above the diagonal in the first NB rows, */ |
352 | | /* > with the array TAUP, represent the orthogonal matrix P as */ |
353 | | /* > a product of elementary reflectors. */ |
354 | | /* > See Further Details. */ |
355 | | /* > \endverbatim */ |
356 | | /* > */ |
357 | | /* > \param[in] LDA */ |
358 | | /* > \verbatim */ |
359 | | /* > LDA is INTEGER */ |
360 | | /* > The leading dimension of the array A. LDA >= f2cmax(1,M). */ |
361 | | /* > \endverbatim */ |
362 | | /* > */ |
363 | | /* > \param[out] D */ |
364 | | /* > \verbatim */ |
365 | | /* > D is REAL array, dimension (NB) */ |
366 | | /* > The diagonal elements of the first NB rows and columns of */ |
367 | | /* > the reduced matrix. D(i) = A(i,i). */ |
368 | | /* > \endverbatim */ |
369 | | /* > */ |
370 | | /* > \param[out] E */ |
371 | | /* > \verbatim */ |
372 | | /* > E is REAL array, dimension (NB) */ |
373 | | /* > The off-diagonal elements of the first NB rows and columns of */ |
374 | | /* > the reduced matrix. */ |
375 | | /* > \endverbatim */ |
376 | | /* > */ |
377 | | /* > \param[out] TAUQ */ |
378 | | /* > \verbatim */ |
379 | | /* > TAUQ is REAL array, dimension (NB) */ |
380 | | /* > The scalar factors of the elementary reflectors which */ |
381 | | /* > represent the orthogonal matrix Q. See Further Details. */ |
382 | | /* > \endverbatim */ |
383 | | /* > */ |
384 | | /* > \param[out] TAUP */ |
385 | | /* > \verbatim */ |
386 | | /* > TAUP is REAL array, dimension (NB) */ |
387 | | /* > The scalar factors of the elementary reflectors which */ |
388 | | /* > represent the orthogonal matrix P. See Further Details. */ |
389 | | /* > \endverbatim */ |
390 | | /* > */ |
391 | | /* > \param[out] X */ |
392 | | /* > \verbatim */ |
393 | | /* > X is REAL array, dimension (LDX,NB) */ |
394 | | /* > The m-by-nb matrix X required to update the unreduced part */ |
395 | | /* > of A. */ |
396 | | /* > \endverbatim */ |
397 | | /* > */ |
398 | | /* > \param[in] LDX */ |
399 | | /* > \verbatim */ |
400 | | /* > LDX is INTEGER */ |
401 | | /* > The leading dimension of the array X. LDX >= f2cmax(1,M). */ |
402 | | /* > \endverbatim */ |
403 | | /* > */ |
404 | | /* > \param[out] Y */ |
405 | | /* > \verbatim */ |
406 | | /* > Y is REAL array, dimension (LDY,NB) */ |
407 | | /* > The n-by-nb matrix Y required to update the unreduced part */ |
408 | | /* > of A. */ |
409 | | /* > \endverbatim */ |
410 | | /* > */ |
411 | | /* > \param[in] LDY */ |
412 | | /* > \verbatim */ |
413 | | /* > LDY is INTEGER */ |
414 | | /* > The leading dimension of the array Y. LDY >= f2cmax(1,N). */ |
415 | | /* > \endverbatim */ |
416 | | |
417 | | /* Authors: */ |
418 | | /* ======== */ |
419 | | |
420 | | /* > \author Univ. of Tennessee */ |
421 | | /* > \author Univ. of California Berkeley */ |
422 | | /* > \author Univ. of Colorado Denver */ |
423 | | /* > \author NAG Ltd. */ |
424 | | |
425 | | /* > \date June 2017 */ |
426 | | |
427 | | /* > \ingroup realOTHERauxiliary */ |
428 | | |
429 | | /* > \par Further Details: */ |
430 | | /* ===================== */ |
431 | | /* > */ |
432 | | /* > \verbatim */ |
433 | | /* > */ |
434 | | /* > The matrices Q and P are represented as products of elementary */ |
435 | | /* > reflectors: */ |
436 | | /* > */ |
437 | | /* > Q = H(1) H(2) . . . H(nb) and P = G(1) G(2) . . . G(nb) */ |
438 | | /* > */ |
439 | | /* > Each H(i) and G(i) has the form: */ |
440 | | /* > */ |
441 | | /* > H(i) = I - tauq * v * v**T and G(i) = I - taup * u * u**T */ |
442 | | /* > */ |
443 | | /* > where tauq and taup are real scalars, and v and u are real vectors. */ |
444 | | /* > */ |
445 | | /* > If m >= n, v(1:i-1) = 0, v(i) = 1, and v(i:m) is stored on exit in */ |
446 | | /* > A(i:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+1:n) is stored on exit in */ |
447 | | /* > A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i). */ |
448 | | /* > */ |
449 | | /* > If m < n, v(1:i) = 0, v(i+1) = 1, and v(i+1:m) is stored on exit in */ |
450 | | /* > A(i+2:m,i); u(1:i-1) = 0, u(i) = 1, and u(i:n) is stored on exit in */ |
451 | | /* > A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i). */ |
452 | | /* > */ |
453 | | /* > The elements of the vectors v and u together form the m-by-nb matrix */ |
454 | | /* > V and the nb-by-n matrix U**T which are needed, with X and Y, to apply */ |
455 | | /* > the transformation to the unreduced part of the matrix, using a block */ |
456 | | /* > update of the form: A := A - V*Y**T - X*U**T. */ |
457 | | /* > */ |
458 | | /* > The contents of A on exit are illustrated by the following examples */ |
459 | | /* > with nb = 2: */ |
460 | | /* > */ |
461 | | /* > m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n): */ |
462 | | /* > */ |
463 | | /* > ( 1 1 u1 u1 u1 ) ( 1 u1 u1 u1 u1 u1 ) */ |
464 | | /* > ( v1 1 1 u2 u2 ) ( 1 1 u2 u2 u2 u2 ) */ |
465 | | /* > ( v1 v2 a a a ) ( v1 1 a a a a ) */ |
466 | | /* > ( v1 v2 a a a ) ( v1 v2 a a a a ) */ |
467 | | /* > ( v1 v2 a a a ) ( v1 v2 a a a a ) */ |
468 | | /* > ( v1 v2 a a a ) */ |
469 | | /* > */ |
470 | | /* > where a denotes an element of the original matrix which is unchanged, */ |
471 | | /* > vi denotes an element of the vector defining H(i), and ui an element */ |
472 | | /* > of the vector defining G(i). */ |
473 | | /* > \endverbatim */ |
474 | | /* > */ |
475 | | /* ===================================================================== */ |
476 | | /* Subroutine */ void slabrd_(integer *m, integer *n, integer *nb, real *a, |
477 | | integer *lda, real *d__, real *e, real *tauq, real *taup, real *x, |
478 | | integer *ldx, real *y, integer *ldy) |
479 | 0 | { |
480 | | /* System generated locals */ |
481 | 0 | integer a_dim1, a_offset, x_dim1, x_offset, y_dim1, y_offset, i__1, i__2, |
482 | 0 | i__3; |
483 | | |
484 | | /* Local variables */ |
485 | 0 | integer i__; |
486 | 0 | extern /* Subroutine */ void sscal_(integer *, real *, real *, integer *), |
487 | 0 | sgemv_(char *, integer *, integer *, real *, real *, integer *, |
488 | 0 | real *, integer *, real *, real *, integer *), slarfg_( |
489 | 0 | integer *, real *, real *, integer *, real *); |
490 | | |
491 | | |
492 | | /* -- LAPACK auxiliary routine (version 3.7.1) -- */ |
493 | | /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ |
494 | | /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */ |
495 | | /* June 2017 */ |
496 | | |
497 | | |
498 | | /* ===================================================================== */ |
499 | | |
500 | | |
501 | | /* Quick return if possible */ |
502 | | |
503 | | /* Parameter adjustments */ |
504 | 0 | a_dim1 = *lda; |
505 | 0 | a_offset = 1 + a_dim1 * 1; |
506 | 0 | a -= a_offset; |
507 | 0 | --d__; |
508 | 0 | --e; |
509 | 0 | --tauq; |
510 | 0 | --taup; |
511 | 0 | x_dim1 = *ldx; |
512 | 0 | x_offset = 1 + x_dim1 * 1; |
513 | 0 | x -= x_offset; |
514 | 0 | y_dim1 = *ldy; |
515 | 0 | y_offset = 1 + y_dim1 * 1; |
516 | 0 | y -= y_offset; |
517 | | |
518 | | /* Function Body */ |
519 | 0 | if (*m <= 0 || *n <= 0) { |
520 | 0 | return; |
521 | 0 | } |
522 | | |
523 | 0 | if (*m >= *n) { |
524 | | |
525 | | /* Reduce to upper bidiagonal form */ |
526 | |
|
527 | 0 | i__1 = *nb; |
528 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
529 | | |
530 | | /* Update A(i:m,i) */ |
531 | |
|
532 | 0 | i__2 = *m - i__ + 1; |
533 | 0 | i__3 = i__ - 1; |
534 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &a[i__ + a_dim1], lda, |
535 | 0 | &y[i__ + y_dim1], ldy, &c_b5, &a[i__ + i__ * a_dim1], & |
536 | 0 | c__1); |
537 | 0 | i__2 = *m - i__ + 1; |
538 | 0 | i__3 = i__ - 1; |
539 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &x[i__ + x_dim1], ldx, |
540 | 0 | &a[i__ * a_dim1 + 1], &c__1, &c_b5, &a[i__ + i__ * |
541 | 0 | a_dim1], &c__1); |
542 | | |
543 | | /* Generate reflection Q(i) to annihilate A(i+1:m,i) */ |
544 | |
|
545 | 0 | i__2 = *m - i__ + 1; |
546 | | /* Computing MIN */ |
547 | 0 | i__3 = i__ + 1; |
548 | 0 | slarfg_(&i__2, &a[i__ + i__ * a_dim1], &a[f2cmin(i__3,*m) + i__ * |
549 | 0 | a_dim1], &c__1, &tauq[i__]); |
550 | 0 | d__[i__] = a[i__ + i__ * a_dim1]; |
551 | 0 | if (i__ < *n) { |
552 | 0 | a[i__ + i__ * a_dim1] = 1.f; |
553 | | |
554 | | /* Compute Y(i+1:n,i) */ |
555 | |
|
556 | 0 | i__2 = *m - i__ + 1; |
557 | 0 | i__3 = *n - i__; |
558 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b5, &a[i__ + (i__ + 1) * |
559 | 0 | a_dim1], lda, &a[i__ + i__ * a_dim1], &c__1, &c_b16, & |
560 | 0 | y[i__ + 1 + i__ * y_dim1], &c__1); |
561 | 0 | i__2 = *m - i__ + 1; |
562 | 0 | i__3 = i__ - 1; |
563 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b5, &a[i__ + a_dim1], |
564 | 0 | lda, &a[i__ + i__ * a_dim1], &c__1, &c_b16, &y[i__ * |
565 | 0 | y_dim1 + 1], &c__1); |
566 | 0 | i__2 = *n - i__; |
567 | 0 | i__3 = i__ - 1; |
568 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &y[i__ + 1 + |
569 | 0 | y_dim1], ldy, &y[i__ * y_dim1 + 1], &c__1, &c_b5, &y[ |
570 | 0 | i__ + 1 + i__ * y_dim1], &c__1); |
571 | 0 | i__2 = *m - i__ + 1; |
572 | 0 | i__3 = i__ - 1; |
573 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b5, &x[i__ + x_dim1], |
574 | 0 | ldx, &a[i__ + i__ * a_dim1], &c__1, &c_b16, &y[i__ * |
575 | 0 | y_dim1 + 1], &c__1); |
576 | 0 | i__2 = i__ - 1; |
577 | 0 | i__3 = *n - i__; |
578 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b4, &a[(i__ + 1) * |
579 | 0 | a_dim1 + 1], lda, &y[i__ * y_dim1 + 1], &c__1, &c_b5, |
580 | 0 | &y[i__ + 1 + i__ * y_dim1], &c__1); |
581 | 0 | i__2 = *n - i__; |
582 | 0 | sscal_(&i__2, &tauq[i__], &y[i__ + 1 + i__ * y_dim1], &c__1); |
583 | | |
584 | | /* Update A(i,i+1:n) */ |
585 | |
|
586 | 0 | i__2 = *n - i__; |
587 | 0 | sgemv_("No transpose", &i__2, &i__, &c_b4, &y[i__ + 1 + |
588 | 0 | y_dim1], ldy, &a[i__ + a_dim1], lda, &c_b5, &a[i__ + ( |
589 | 0 | i__ + 1) * a_dim1], lda); |
590 | 0 | i__2 = i__ - 1; |
591 | 0 | i__3 = *n - i__; |
592 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b4, &a[(i__ + 1) * |
593 | 0 | a_dim1 + 1], lda, &x[i__ + x_dim1], ldx, &c_b5, &a[ |
594 | 0 | i__ + (i__ + 1) * a_dim1], lda); |
595 | | |
596 | | /* Generate reflection P(i) to annihilate A(i,i+2:n) */ |
597 | |
|
598 | 0 | i__2 = *n - i__; |
599 | | /* Computing MIN */ |
600 | 0 | i__3 = i__ + 2; |
601 | 0 | slarfg_(&i__2, &a[i__ + (i__ + 1) * a_dim1], &a[i__ + f2cmin( |
602 | 0 | i__3,*n) * a_dim1], lda, &taup[i__]); |
603 | 0 | e[i__] = a[i__ + (i__ + 1) * a_dim1]; |
604 | 0 | a[i__ + (i__ + 1) * a_dim1] = 1.f; |
605 | | |
606 | | /* Compute X(i+1:m,i) */ |
607 | |
|
608 | 0 | i__2 = *m - i__; |
609 | 0 | i__3 = *n - i__; |
610 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b5, &a[i__ + 1 + (i__ |
611 | 0 | + 1) * a_dim1], lda, &a[i__ + (i__ + 1) * a_dim1], |
612 | 0 | lda, &c_b16, &x[i__ + 1 + i__ * x_dim1], &c__1); |
613 | 0 | i__2 = *n - i__; |
614 | 0 | sgemv_("Transpose", &i__2, &i__, &c_b5, &y[i__ + 1 + y_dim1], |
615 | 0 | ldy, &a[i__ + (i__ + 1) * a_dim1], lda, &c_b16, &x[ |
616 | 0 | i__ * x_dim1 + 1], &c__1); |
617 | 0 | i__2 = *m - i__; |
618 | 0 | sgemv_("No transpose", &i__2, &i__, &c_b4, &a[i__ + 1 + |
619 | 0 | a_dim1], lda, &x[i__ * x_dim1 + 1], &c__1, &c_b5, &x[ |
620 | 0 | i__ + 1 + i__ * x_dim1], &c__1); |
621 | 0 | i__2 = i__ - 1; |
622 | 0 | i__3 = *n - i__; |
623 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b5, &a[(i__ + 1) * |
624 | 0 | a_dim1 + 1], lda, &a[i__ + (i__ + 1) * a_dim1], lda, & |
625 | 0 | c_b16, &x[i__ * x_dim1 + 1], &c__1); |
626 | 0 | i__2 = *m - i__; |
627 | 0 | i__3 = i__ - 1; |
628 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &x[i__ + 1 + |
629 | 0 | x_dim1], ldx, &x[i__ * x_dim1 + 1], &c__1, &c_b5, &x[ |
630 | 0 | i__ + 1 + i__ * x_dim1], &c__1); |
631 | 0 | i__2 = *m - i__; |
632 | 0 | sscal_(&i__2, &taup[i__], &x[i__ + 1 + i__ * x_dim1], &c__1); |
633 | 0 | } |
634 | | /* L10: */ |
635 | 0 | } |
636 | 0 | } else { |
637 | | |
638 | | /* Reduce to lower bidiagonal form */ |
639 | |
|
640 | 0 | i__1 = *nb; |
641 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
642 | | |
643 | | /* Update A(i,i:n) */ |
644 | |
|
645 | 0 | i__2 = *n - i__ + 1; |
646 | 0 | i__3 = i__ - 1; |
647 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &y[i__ + y_dim1], ldy, |
648 | 0 | &a[i__ + a_dim1], lda, &c_b5, &a[i__ + i__ * a_dim1], |
649 | 0 | lda); |
650 | 0 | i__2 = i__ - 1; |
651 | 0 | i__3 = *n - i__ + 1; |
652 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b4, &a[i__ * a_dim1 + 1], |
653 | 0 | lda, &x[i__ + x_dim1], ldx, &c_b5, &a[i__ + i__ * a_dim1], |
654 | 0 | lda); |
655 | | |
656 | | /* Generate reflection P(i) to annihilate A(i,i+1:n) */ |
657 | |
|
658 | 0 | i__2 = *n - i__ + 1; |
659 | | /* Computing MIN */ |
660 | 0 | i__3 = i__ + 1; |
661 | 0 | slarfg_(&i__2, &a[i__ + i__ * a_dim1], &a[i__ + f2cmin(i__3,*n) * |
662 | 0 | a_dim1], lda, &taup[i__]); |
663 | 0 | d__[i__] = a[i__ + i__ * a_dim1]; |
664 | 0 | if (i__ < *m) { |
665 | 0 | a[i__ + i__ * a_dim1] = 1.f; |
666 | | |
667 | | /* Compute X(i+1:m,i) */ |
668 | |
|
669 | 0 | i__2 = *m - i__; |
670 | 0 | i__3 = *n - i__ + 1; |
671 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b5, &a[i__ + 1 + i__ * |
672 | 0 | a_dim1], lda, &a[i__ + i__ * a_dim1], lda, &c_b16, & |
673 | 0 | x[i__ + 1 + i__ * x_dim1], &c__1); |
674 | 0 | i__2 = *n - i__ + 1; |
675 | 0 | i__3 = i__ - 1; |
676 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b5, &y[i__ + y_dim1], |
677 | 0 | ldy, &a[i__ + i__ * a_dim1], lda, &c_b16, &x[i__ * |
678 | 0 | x_dim1 + 1], &c__1); |
679 | 0 | i__2 = *m - i__; |
680 | 0 | i__3 = i__ - 1; |
681 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &a[i__ + 1 + |
682 | 0 | a_dim1], lda, &x[i__ * x_dim1 + 1], &c__1, &c_b5, &x[ |
683 | 0 | i__ + 1 + i__ * x_dim1], &c__1); |
684 | 0 | i__2 = i__ - 1; |
685 | 0 | i__3 = *n - i__ + 1; |
686 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b5, &a[i__ * a_dim1 + |
687 | 0 | 1], lda, &a[i__ + i__ * a_dim1], lda, &c_b16, &x[i__ * |
688 | 0 | x_dim1 + 1], &c__1); |
689 | 0 | i__2 = *m - i__; |
690 | 0 | i__3 = i__ - 1; |
691 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &x[i__ + 1 + |
692 | 0 | x_dim1], ldx, &x[i__ * x_dim1 + 1], &c__1, &c_b5, &x[ |
693 | 0 | i__ + 1 + i__ * x_dim1], &c__1); |
694 | 0 | i__2 = *m - i__; |
695 | 0 | sscal_(&i__2, &taup[i__], &x[i__ + 1 + i__ * x_dim1], &c__1); |
696 | | |
697 | | /* Update A(i+1:m,i) */ |
698 | |
|
699 | 0 | i__2 = *m - i__; |
700 | 0 | i__3 = i__ - 1; |
701 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &a[i__ + 1 + |
702 | 0 | a_dim1], lda, &y[i__ + y_dim1], ldy, &c_b5, &a[i__ + |
703 | 0 | 1 + i__ * a_dim1], &c__1); |
704 | 0 | i__2 = *m - i__; |
705 | 0 | sgemv_("No transpose", &i__2, &i__, &c_b4, &x[i__ + 1 + |
706 | 0 | x_dim1], ldx, &a[i__ * a_dim1 + 1], &c__1, &c_b5, &a[ |
707 | 0 | i__ + 1 + i__ * a_dim1], &c__1); |
708 | | |
709 | | /* Generate reflection Q(i) to annihilate A(i+2:m,i) */ |
710 | |
|
711 | 0 | i__2 = *m - i__; |
712 | | /* Computing MIN */ |
713 | 0 | i__3 = i__ + 2; |
714 | 0 | slarfg_(&i__2, &a[i__ + 1 + i__ * a_dim1], &a[f2cmin(i__3,*m) + |
715 | 0 | i__ * a_dim1], &c__1, &tauq[i__]); |
716 | 0 | e[i__] = a[i__ + 1 + i__ * a_dim1]; |
717 | 0 | a[i__ + 1 + i__ * a_dim1] = 1.f; |
718 | | |
719 | | /* Compute Y(i+1:n,i) */ |
720 | |
|
721 | 0 | i__2 = *m - i__; |
722 | 0 | i__3 = *n - i__; |
723 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b5, &a[i__ + 1 + (i__ + |
724 | 0 | 1) * a_dim1], lda, &a[i__ + 1 + i__ * a_dim1], &c__1, |
725 | 0 | &c_b16, &y[i__ + 1 + i__ * y_dim1], &c__1); |
726 | 0 | i__2 = *m - i__; |
727 | 0 | i__3 = i__ - 1; |
728 | 0 | sgemv_("Transpose", &i__2, &i__3, &c_b5, &a[i__ + 1 + a_dim1], |
729 | 0 | lda, &a[i__ + 1 + i__ * a_dim1], &c__1, &c_b16, &y[ |
730 | 0 | i__ * y_dim1 + 1], &c__1); |
731 | 0 | i__2 = *n - i__; |
732 | 0 | i__3 = i__ - 1; |
733 | 0 | sgemv_("No transpose", &i__2, &i__3, &c_b4, &y[i__ + 1 + |
734 | 0 | y_dim1], ldy, &y[i__ * y_dim1 + 1], &c__1, &c_b5, &y[ |
735 | 0 | i__ + 1 + i__ * y_dim1], &c__1); |
736 | 0 | i__2 = *m - i__; |
737 | 0 | sgemv_("Transpose", &i__2, &i__, &c_b5, &x[i__ + 1 + x_dim1], |
738 | 0 | ldx, &a[i__ + 1 + i__ * a_dim1], &c__1, &c_b16, &y[ |
739 | 0 | i__ * y_dim1 + 1], &c__1); |
740 | 0 | i__2 = *n - i__; |
741 | 0 | sgemv_("Transpose", &i__, &i__2, &c_b4, &a[(i__ + 1) * a_dim1 |
742 | 0 | + 1], lda, &y[i__ * y_dim1 + 1], &c__1, &c_b5, &y[i__ |
743 | 0 | + 1 + i__ * y_dim1], &c__1); |
744 | 0 | i__2 = *n - i__; |
745 | 0 | sscal_(&i__2, &tauq[i__], &y[i__ + 1 + i__ * y_dim1], &c__1); |
746 | 0 | } |
747 | | /* L20: */ |
748 | 0 | } |
749 | 0 | } |
750 | 0 | return; |
751 | | |
752 | | /* End of SLABRD */ |
753 | |
|
754 | 0 | } /* slabrd_ */ |
755 | | |