14 typedef long long BLASLONG;
15 typedef unsigned long long BLASULONG;
17 typedef long BLASLONG;
18 typedef unsigned long BLASULONG;
22 typedef BLASLONG blasint;
24 #define blasabs(x) llabs(x)
26 #define blasabs(x) labs(x)
30 #define blasabs(x) abs(x)
33 typedef blasint integer;
35 typedef unsigned int uinteger;
36 typedef char *address;
37 typedef short int shortint;
39 typedef double doublereal;
40 typedef struct { real r, i; } complex;
41 typedef struct { doublereal r, i; } doublecomplex;
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;}
48 static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
49 static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
50 static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
51 static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
53 #define pCf(z) (*_pCf(z))
54 #define pCd(z) (*_pCd(z))
56 typedef short int shortlogical;
57 typedef char logical1;
58 typedef char integer1;
63 /* Extern is for use with -E */
74 /*external read, write*/
83 /*internal read, write*/
113 /*rewind, backspace, endfile*/
125 ftnint *inex; /*parameters in standard's order*/
151 union Multitype { /* for multiple entry points */
162 typedef union Multitype Multitype;
164 struct Vardesc { /* for Namelist */
170 typedef struct Vardesc Vardesc;
177 typedef struct Namelist Namelist;
179 #define abs(x) ((x) >= 0 ? (x) : -(x))
180 #define dabs(x) (fabs(x))
181 #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)))
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)); }
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]);}
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);}
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 pow_dd(ap, bp) ( pow(*(ap), *(bp)))
239 #define pow_si(B,E) spow_ui(*(B),*(E))
240 #define pow_ri(B,E) spow_ui(*(B),*(E))
241 #define pow_di(B,E) dpow_ui(*(B),*(E))
242 #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
243 #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
244 #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
245 #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++ = ' '; }
246 #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
247 #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]; }
248 #define sig_die(s, kill) { exit(1); }
249 #define s_stop(s, n) {exit(0);}
250 static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
251 #define z_abs(z) (cabs(Cd(z)))
252 #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
253 #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
254 #define myexit_() break;
255 #define mycycle() continue;
256 #define myceiling(w) {ceil(w)}
257 #define myhuge(w) {HUGE_VAL}
258 //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
259 #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
261 /* procedure parameter types for -A and -C++ */
263 #define F2C_proc_par_types 1
265 typedef logical (*L_fp)(...);
267 typedef logical (*L_fp)();
270 static float spow_ui(float x, integer n) {
271 float pow=1.0; unsigned long int u;
273 if(n < 0) n = -n, x = 1/x;
282 static double dpow_ui(double x, integer n) {
283 double pow=1.0; unsigned long int u;
285 if(n < 0) n = -n, x = 1/x;
295 static _Fcomplex cpow_ui(complex x, integer n) {
296 complex pow={1.0,0.0}; unsigned long int u;
298 if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
300 if(u & 01) pow.r *= x.r, pow.i *= x.i;
301 if(u >>= 1) x.r *= x.r, x.i *= x.i;
305 _Fcomplex p={pow.r, pow.i};
309 static _Complex float cpow_ui(_Complex float x, integer n) {
310 _Complex float pow=1.0; unsigned long int u;
312 if(n < 0) n = -n, x = 1/x;
323 static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
324 _Dcomplex pow={1.0,0.0}; unsigned long int u;
326 if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
328 if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
329 if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
333 _Dcomplex p = {pow._Val[0], pow._Val[1]};
337 static _Complex double zpow_ui(_Complex double x, integer n) {
338 _Complex double pow=1.0; unsigned long int u;
340 if(n < 0) n = -n, x = 1/x;
350 static integer pow_ii(integer x, integer n) {
351 integer pow; unsigned long int u;
353 if (n == 0 || x == 1) pow = 1;
354 else if (x != -1) pow = x == 0 ? 1/x : 0;
357 if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
367 static integer dmaxloc_(double *w, integer s, integer e, integer *n)
369 double m; integer i, mi;
370 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
371 if (w[i-1]>m) mi=i ,m=w[i-1];
374 static integer smaxloc_(float *w, integer s, integer e, integer *n)
376 float m; integer i, mi;
377 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
378 if (w[i-1]>m) mi=i ,m=w[i-1];
381 static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
382 integer n = *n_, incx = *incx_, incy = *incy_, i;
384 _Fcomplex zdotc = {0.0, 0.0};
385 if (incx == 1 && incy == 1) {
386 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
387 zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
388 zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
391 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
392 zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
393 zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
399 _Complex float zdotc = 0.0;
400 if (incx == 1 && incy == 1) {
401 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
402 zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
405 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
406 zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
412 static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
413 integer n = *n_, incx = *incx_, incy = *incy_, i;
415 _Dcomplex zdotc = {0.0, 0.0};
416 if (incx == 1 && incy == 1) {
417 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
418 zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
419 zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
422 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
423 zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
424 zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
430 _Complex double zdotc = 0.0;
431 if (incx == 1 && incy == 1) {
432 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
433 zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
436 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
437 zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
443 static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
444 integer n = *n_, incx = *incx_, incy = *incy_, i;
446 _Fcomplex zdotc = {0.0, 0.0};
447 if (incx == 1 && incy == 1) {
448 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
449 zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
450 zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
453 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
454 zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
455 zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
461 _Complex float zdotc = 0.0;
462 if (incx == 1 && incy == 1) {
463 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
464 zdotc += Cf(&x[i]) * Cf(&y[i]);
467 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
468 zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
474 static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
475 integer n = *n_, incx = *incx_, incy = *incy_, i;
477 _Dcomplex zdotc = {0.0, 0.0};
478 if (incx == 1 && incy == 1) {
479 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
480 zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
481 zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
484 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
485 zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
486 zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
492 _Complex double zdotc = 0.0;
493 if (incx == 1 && incy == 1) {
494 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
495 zdotc += Cd(&x[i]) * Cd(&y[i]);
498 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
499 zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
505 /* -- translated by f2c (version 20000121).
506 You must link the resulting object file with the libraries:
507 -lf2c -lm (in that order)
513 /* Table of constant values */
515 static complex c_b6 = {-1.f,0.f};
516 static integer c__1 = 1;
517 static complex c_b8 = {1.f,0.f};
518 static complex c_b19 = {0.f,0.f};
520 /* > \brief \b CLASYF_AA */
522 /* =========== DOCUMENTATION =========== */
524 /* Online html documentation available at */
525 /* http://www.netlib.org/lapack/explore-html/ */
528 /* > Download CLASYF_AA + dependencies */
529 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clasyf_
532 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clasyf_
535 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clasyf_
543 /* SUBROUTINE CLASYF_AA( UPLO, J1, M, NB, A, LDA, IPIV, */
547 /* INTEGER J1, M, NB, LDA, LDH */
548 /* INTEGER IPIV( * ) */
549 /* COMPLEX A( LDA, * ), H( LDH, * ), WORK( * ) */
552 /* > \par Purpose: */
557 /* > DLATRF_AA factorizes a panel of a complex symmetric matrix A using */
558 /* > the Aasen's algorithm. The panel consists of a set of NB rows of A */
559 /* > when UPLO is U, or a set of NB columns when UPLO is L. */
561 /* > In order to factorize the panel, the Aasen's algorithm requires the */
562 /* > last row, or column, of the previous panel. The first row, or column, */
563 /* > of A is set to be the first row, or column, of an identity matrix, */
564 /* > which is used to factorize the first panel. */
566 /* > The resulting J-th row of U, or J-th column of L, is stored in the */
567 /* > (J-1)-th row, or column, of A (without the unit diagonals), while */
568 /* > the diagonal and subdiagonal of A are overwritten by those of T. */
575 /* > \param[in] UPLO */
577 /* > UPLO is CHARACTER*1 */
578 /* > = 'U': Upper triangle of A is stored; */
579 /* > = 'L': Lower triangle of A is stored. */
582 /* > \param[in] J1 */
584 /* > J1 is INTEGER */
585 /* > The location of the first row, or column, of the panel */
586 /* > within the submatrix of A, passed to this routine, e.g., */
587 /* > when called by CSYTRF_AA, for the first panel, J1 is 1, */
588 /* > while for the remaining panels, J1 is 2. */
594 /* > The dimension of the submatrix. M >= 0. */
597 /* > \param[in] NB */
599 /* > NB is INTEGER */
600 /* > The dimension of the panel to be facotorized. */
603 /* > \param[in,out] A */
605 /* > A is COMPLEX array, dimension (LDA,M) for */
606 /* > the first panel, while dimension (LDA,M+1) for the */
607 /* > remaining panels. */
609 /* > On entry, A contains the last row, or column, of */
610 /* > the previous panel, and the trailing submatrix of A */
611 /* > to be factorized, except for the first panel, only */
612 /* > the panel is passed. */
614 /* > On exit, the leading panel is factorized. */
617 /* > \param[in] LDA */
619 /* > LDA is INTEGER */
620 /* > The leading dimension of the array A. LDA >= f2cmax(1,M). */
623 /* > \param[out] IPIV */
625 /* > IPIV is INTEGER array, dimension (M) */
626 /* > Details of the row and column interchanges, */
627 /* > the row and column k were interchanged with the row and */
628 /* > column IPIV(k). */
631 /* > \param[in,out] H */
633 /* > H is COMPLEX workspace, dimension (LDH,NB). */
637 /* > \param[in] LDH */
639 /* > LDH is INTEGER */
640 /* > The leading dimension of the workspace H. LDH >= f2cmax(1,M). */
643 /* > \param[out] WORK */
645 /* > WORK is COMPLEX workspace, dimension (M). */
652 /* > \author Univ. of Tennessee */
653 /* > \author Univ. of California Berkeley */
654 /* > \author Univ. of Colorado Denver */
655 /* > \author NAG Ltd. */
657 /* > \date November 2017 */
659 /* > \ingroup complexSYcomputational */
661 /* ===================================================================== */
662 /* Subroutine */ int clasyf_aa_(char *uplo, integer *j1, integer *m, integer
663 *nb, complex *a, integer *lda, integer *ipiv, complex *h__, integer *
666 /* System generated locals */
667 integer a_dim1, a_offset, h_dim1, h_offset, i__1, i__2;
670 /* Local variables */
673 extern /* Subroutine */ int cscal_(integer *, complex *, complex *,
675 extern logical lsame_(char *, char *);
676 extern /* Subroutine */ int cgemv_(char *, integer *, integer *, complex *
677 , complex *, integer *, complex *, integer *, complex *, complex *
678 , integer *), ccopy_(integer *, complex *, integer *,
679 complex *, integer *), cswap_(integer *, complex *, integer *,
680 complex *, integer *), caxpy_(integer *, complex *, complex *,
681 integer *, complex *, integer *);
682 integer i1, k1, i2, mj;
683 extern integer icamax_(integer *, complex *, integer *);
684 extern /* Subroutine */ int claset_(char *, integer *, integer *, complex
685 *, complex *, complex *, integer *);
689 /* -- LAPACK computational routine (version 3.8.0) -- */
690 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
691 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
696 /* ===================================================================== */
699 /* Parameter adjustments */
701 a_offset = 1 + a_dim1 * 1;
705 h_offset = 1 + h_dim1 * 1;
712 /* K1 is the first column of the panel to be factorized */
713 /* i.e., K1 is 2 for the first block column, and 1 for the rest of the blocks */
717 if (lsame_(uplo, "U")) {
719 /* ..................................................... */
720 /* Factorize A as U**T*D*U using the upper triangle of A */
721 /* ..................................................... */
724 if (j > f2cmin(*m,*nb)) {
728 /* K is the column to be factorized */
729 /* when being called from CSYTRF_AA, */
730 /* > for the first block column, J1 is 1, hence J1+J-1 is J, */
731 /* > for the rest of the columns, J1 is 2, and J1+J-1 is J+1, */
736 /* Only need to compute T(J, J) */
743 /* H(J:M, J) := A(J, J:M) - H(J:M, 1:(J-1)) * L(J1:(J-1), J), */
744 /* where H(J:M, J) has been initialized to be A(J, J:M) */
748 /* K is the column to be factorized */
749 /* > for the first block column, K is J, skipping the first two */
751 /* > for the rest of the columns, K is J+1, skipping only the */
755 cgemv_("No transpose", &mj, &i__1, &c_b6, &h__[j + k1 * h_dim1],
756 ldh, &a[j * a_dim1 + 1], &c__1, &c_b8, &h__[j + j *
760 /* Copy H(i:M, i) into WORK */
762 ccopy_(&mj, &h__[j + j * h_dim1], &c__1, &work[1], &c__1);
766 /* Compute WORK := WORK - L(J-1, J:M) * T(J-1,J), */
767 /* where A(J-1, J) stores T(J-1, J) and A(J-2, J:M) stores U(J-1, J:M) */
769 i__1 = k - 1 + j * a_dim1;
770 q__1.r = -a[i__1].r, q__1.i = -a[i__1].i;
771 alpha.r = q__1.r, alpha.i = q__1.i;
772 caxpy_(&mj, &alpha, &a[k - 2 + j * a_dim1], lda, &work[1], &c__1);
775 /* Set A(J, J) = T(J, J) */
777 i__1 = k + j * a_dim1;
778 a[i__1].r = work[1].r, a[i__1].i = work[1].i;
782 /* Compute WORK(2:M) = T(J, J) L(J, (J+1):M) */
783 /* where A(J, J) stores T(J, J) and A(J-1, (J+1):M) stores U(J, (J+1):M) */
786 i__1 = k + j * a_dim1;
787 q__1.r = -a[i__1].r, q__1.i = -a[i__1].i;
788 alpha.r = q__1.r, alpha.i = q__1.i;
790 caxpy_(&i__1, &alpha, &a[k - 1 + (j + 1) * a_dim1], lda, &
794 /* Find f2cmax(|WORK(2:M)|) */
797 i2 = icamax_(&i__1, &work[2], &c__1) + 1;
799 piv.r = work[i__1].r, piv.i = work[i__1].i;
801 /* Apply symmetric pivot */
803 if (i2 != 2 && (piv.r != 0.f || piv.i != 0.)) {
805 /* Swap WORK(I1) and WORK(I2) */
810 work[i__1].r = work[i__2].r, work[i__1].i = work[i__2].i;
812 work[i__1].r = piv.r, work[i__1].i = piv.i;
814 /* Swap A(I1, I1+1:M) with A(I1+1:M, I2) */
819 cswap_(&i__1, &a[*j1 + i1 - 1 + (i1 + 1) * a_dim1], lda, &a[*
820 j1 + i1 + i2 * a_dim1], &c__1);
822 /* Swap A(I1, I2+1:M) with A(I2, I2+1:M) */
826 cswap_(&i__1, &a[*j1 + i1 - 1 + (i2 + 1) * a_dim1], lda, &
827 a[*j1 + i2 - 1 + (i2 + 1) * a_dim1], lda);
830 /* Swap A(I1, I1) with A(I2,I2) */
832 i__1 = i1 + *j1 - 1 + i1 * a_dim1;
833 piv.r = a[i__1].r, piv.i = a[i__1].i;
834 i__1 = *j1 + i1 - 1 + i1 * a_dim1;
835 i__2 = *j1 + i2 - 1 + i2 * a_dim1;
836 a[i__1].r = a[i__2].r, a[i__1].i = a[i__2].i;
837 i__1 = *j1 + i2 - 1 + i2 * a_dim1;
838 a[i__1].r = piv.r, a[i__1].i = piv.i;
840 /* Swap H(I1, 1:J1) with H(I2, 1:J1) */
843 cswap_(&i__1, &h__[i1 + h_dim1], ldh, &h__[i2 + h_dim1], ldh);
848 /* Swap L(1:I1-1, I1) with L(1:I1-1, I2), */
849 /* skipping the first column */
852 cswap_(&i__1, &a[i1 * a_dim1 + 1], &c__1, &a[i2 * a_dim1
859 /* Set A(J, J+1) = T(J, J+1) */
861 i__1 = k + (j + 1) * a_dim1;
862 a[i__1].r = work[2].r, a[i__1].i = work[2].i;
866 /* Copy A(J+1:M, J+1) into H(J:M, J), */
869 ccopy_(&i__1, &a[k + 1 + (j + 1) * a_dim1], lda, &h__[j + 1 +
870 (j + 1) * h_dim1], &c__1);
873 /* Compute L(J+2, J+1) = WORK( 3:M ) / T(J, J+1), */
874 /* where A(J, J+1) = T(J, J+1) and A(J+2:M, J) = L(J+2:M, J+1) */
877 i__1 = k + (j + 1) * a_dim1;
878 if (a[i__1].r != 0.f || a[i__1].i != 0.f) {
879 c_div(&q__1, &c_b8, &a[k + (j + 1) * a_dim1]);
880 alpha.r = q__1.r, alpha.i = q__1.i;
882 ccopy_(&i__1, &work[3], &c__1, &a[k + (j + 2) * a_dim1],
885 cscal_(&i__1, &alpha, &a[k + (j + 2) * a_dim1], lda);
888 claset_("Full", &c__1, &i__1, &c_b19, &c_b19, &a[k + (j +
900 /* ..................................................... */
901 /* Factorize A as L*D*L**T using the lower triangle of A */
902 /* ..................................................... */
905 if (j > f2cmin(*m,*nb)) {
909 /* K is the column to be factorized */
910 /* when being called from CSYTRF_AA, */
911 /* > for the first block column, J1 is 1, hence J1+J-1 is J, */
912 /* > for the rest of the columns, J1 is 2, and J1+J-1 is J+1, */
917 /* Only need to compute T(J, J) */
924 /* H(J:M, J) := A(J:M, J) - H(J:M, 1:(J-1)) * L(J, J1:(J-1))^T, */
925 /* where H(J:M, J) has been initialized to be A(J:M, J) */
929 /* K is the column to be factorized */
930 /* > for the first block column, K is J, skipping the first two */
932 /* > for the rest of the columns, K is J+1, skipping only the */
936 cgemv_("No transpose", &mj, &i__1, &c_b6, &h__[j + k1 * h_dim1],
937 ldh, &a[j + a_dim1], lda, &c_b8, &h__[j + j * h_dim1], &
941 /* Copy H(J:M, J) into WORK */
943 ccopy_(&mj, &h__[j + j * h_dim1], &c__1, &work[1], &c__1);
947 /* Compute WORK := WORK - L(J:M, J-1) * T(J-1,J), */
948 /* where A(J-1, J) = T(J-1, J) and A(J, J-2) = L(J, J-1) */
950 i__1 = j + (k - 1) * a_dim1;
951 q__1.r = -a[i__1].r, q__1.i = -a[i__1].i;
952 alpha.r = q__1.r, alpha.i = q__1.i;
953 caxpy_(&mj, &alpha, &a[j + (k - 2) * a_dim1], &c__1, &work[1], &
957 /* Set A(J, J) = T(J, J) */
959 i__1 = j + k * a_dim1;
960 a[i__1].r = work[1].r, a[i__1].i = work[1].i;
964 /* Compute WORK(2:M) = T(J, J) L((J+1):M, J) */
965 /* where A(J, J) = T(J, J) and A((J+1):M, J-1) = L((J+1):M, J) */
968 i__1 = j + k * a_dim1;
969 q__1.r = -a[i__1].r, q__1.i = -a[i__1].i;
970 alpha.r = q__1.r, alpha.i = q__1.i;
972 caxpy_(&i__1, &alpha, &a[j + 1 + (k - 1) * a_dim1], &c__1, &
976 /* Find f2cmax(|WORK(2:M)|) */
979 i2 = icamax_(&i__1, &work[2], &c__1) + 1;
981 piv.r = work[i__1].r, piv.i = work[i__1].i;
983 /* Apply symmetric pivot */
985 if (i2 != 2 && (piv.r != 0.f || piv.i != 0.)) {
987 /* Swap WORK(I1) and WORK(I2) */
992 work[i__1].r = work[i__2].r, work[i__1].i = work[i__2].i;
994 work[i__1].r = piv.r, work[i__1].i = piv.i;
996 /* Swap A(I1+1:M, I1) with A(I2, I1+1:M) */
1001 cswap_(&i__1, &a[i1 + 1 + (*j1 + i1 - 1) * a_dim1], &c__1, &a[
1002 i2 + (*j1 + i1) * a_dim1], lda);
1004 /* Swap A(I2+1:M, I1) with A(I2+1:M, I2) */
1008 cswap_(&i__1, &a[i2 + 1 + (*j1 + i1 - 1) * a_dim1], &c__1,
1009 &a[i2 + 1 + (*j1 + i2 - 1) * a_dim1], &c__1);
1012 /* Swap A(I1, I1) with A(I2, I2) */
1014 i__1 = i1 + (*j1 + i1 - 1) * a_dim1;
1015 piv.r = a[i__1].r, piv.i = a[i__1].i;
1016 i__1 = i1 + (*j1 + i1 - 1) * a_dim1;
1017 i__2 = i2 + (*j1 + i2 - 1) * a_dim1;
1018 a[i__1].r = a[i__2].r, a[i__1].i = a[i__2].i;
1019 i__1 = i2 + (*j1 + i2 - 1) * a_dim1;
1020 a[i__1].r = piv.r, a[i__1].i = piv.i;
1022 /* Swap H(I1, I1:J1) with H(I2, I2:J1) */
1025 cswap_(&i__1, &h__[i1 + h_dim1], ldh, &h__[i2 + h_dim1], ldh);
1030 /* Swap L(1:I1-1, I1) with L(1:I1-1, I2), */
1031 /* skipping the first column */
1034 cswap_(&i__1, &a[i1 + a_dim1], lda, &a[i2 + a_dim1], lda);
1037 ipiv[j + 1] = j + 1;
1040 /* Set A(J+1, J) = T(J+1, J) */
1042 i__1 = j + 1 + k * a_dim1;
1043 a[i__1].r = work[2].r, a[i__1].i = work[2].i;
1047 /* Copy A(J+1:M, J+1) into H(J+1:M, J), */
1050 ccopy_(&i__1, &a[j + 1 + (k + 1) * a_dim1], &c__1, &h__[j + 1
1051 + (j + 1) * h_dim1], &c__1);
1054 /* Compute L(J+2, J+1) = WORK( 3:M ) / T(J, J+1), */
1055 /* where A(J, J+1) = T(J, J+1) and A(J+2:M, J) = L(J+2:M, J+1) */
1058 i__1 = j + 1 + k * a_dim1;
1059 if (a[i__1].r != 0.f || a[i__1].i != 0.f) {
1060 c_div(&q__1, &c_b8, &a[j + 1 + k * a_dim1]);
1061 alpha.r = q__1.r, alpha.i = q__1.i;
1063 ccopy_(&i__1, &work[3], &c__1, &a[j + 2 + k * a_dim1], &
1066 cscal_(&i__1, &alpha, &a[j + 2 + k * a_dim1], &c__1);
1069 claset_("Full", &i__1, &c__1, &c_b19, &c_b19, &a[j + 2 +
1081 /* End of CLASYF_AA */