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 real c_b23 = -1.f;
516 static real c_b27 = 1.f;
518 /* > \brief \b STFSM solves a matrix equation (one operand is a triangular matrix in RFP format). */
520 /* =========== DOCUMENTATION =========== */
522 /* Online html documentation available at */
523 /* http://www.netlib.org/lapack/explore-html/ */
526 /* > Download STFSM + dependencies */
527 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stfsm.f
530 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stfsm.f
533 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stfsm.f
541 /* SUBROUTINE STFSM( TRANSR, SIDE, UPLO, TRANS, DIAG, M, N, ALPHA, A, */
544 /* CHARACTER TRANSR, DIAG, SIDE, TRANS, UPLO */
545 /* INTEGER LDB, M, N */
547 /* REAL A( 0: * ), B( 0: LDB-1, 0: * ) */
550 /* > \par Purpose: */
555 /* > Level 3 BLAS like routine for A in RFP Format. */
557 /* > STFSM solves the matrix equation */
559 /* > op( A )*X = alpha*B or X*op( A ) = alpha*B */
561 /* > where alpha is a scalar, X and B are m by n matrices, A is a unit, or */
562 /* > non-unit, upper or lower triangular matrix and op( A ) is one of */
564 /* > op( A ) = A or op( A ) = A**T. */
566 /* > A is in Rectangular Full Packed (RFP) Format. */
568 /* > The matrix X is overwritten on B. */
574 /* > \param[in] TRANSR */
576 /* > TRANSR is CHARACTER*1 */
577 /* > = 'N': The Normal Form of RFP A is stored; */
578 /* > = 'T': The Transpose Form of RFP A is stored. */
581 /* > \param[in] SIDE */
583 /* > SIDE is CHARACTER*1 */
584 /* > On entry, SIDE specifies whether op( A ) appears on the left */
585 /* > or right of X as follows: */
587 /* > SIDE = 'L' or 'l' op( A )*X = alpha*B. */
589 /* > SIDE = 'R' or 'r' X*op( A ) = alpha*B. */
591 /* > Unchanged on exit. */
594 /* > \param[in] UPLO */
596 /* > UPLO is CHARACTER*1 */
597 /* > On entry, UPLO specifies whether the RFP matrix A came from */
598 /* > an upper or lower triangular matrix as follows: */
599 /* > UPLO = 'U' or 'u' RFP A came from an upper triangular matrix */
600 /* > UPLO = 'L' or 'l' RFP A came from a lower triangular matrix */
602 /* > Unchanged on exit. */
605 /* > \param[in] TRANS */
607 /* > TRANS is CHARACTER*1 */
608 /* > On entry, TRANS specifies the form of op( A ) to be used */
609 /* > in the matrix multiplication as follows: */
611 /* > TRANS = 'N' or 'n' op( A ) = A. */
613 /* > TRANS = 'T' or 't' op( A ) = A'. */
615 /* > Unchanged on exit. */
618 /* > \param[in] DIAG */
620 /* > DIAG is CHARACTER*1 */
621 /* > On entry, DIAG specifies whether or not RFP A is unit */
622 /* > triangular as follows: */
624 /* > DIAG = 'U' or 'u' A is assumed to be unit triangular. */
626 /* > DIAG = 'N' or 'n' A is not assumed to be unit */
629 /* > Unchanged on exit. */
635 /* > On entry, M specifies the number of rows of B. M must be at */
637 /* > Unchanged on exit. */
643 /* > On entry, N specifies the number of columns of B. N must be */
644 /* > at least zero. */
645 /* > Unchanged on exit. */
648 /* > \param[in] ALPHA */
650 /* > ALPHA is REAL */
651 /* > On entry, ALPHA specifies the scalar alpha. When alpha is */
652 /* > zero then A is not referenced and B need not be set before */
654 /* > Unchanged on exit. */
659 /* > A is REAL array, dimension (NT) */
660 /* > NT = N*(N+1)/2. On entry, the matrix A in RFP Format. */
661 /* > RFP Format is described by TRANSR, UPLO and N as follows: */
662 /* > If TRANSR='N' then RFP A is (0:N,0:K-1) when N is even; */
663 /* > K=N/2. RFP A is (0:N-1,0:K) when N is odd; K=N/2. If */
664 /* > TRANSR = 'T' then RFP is the transpose of RFP A as */
665 /* > defined when TRANSR = 'N'. The contents of RFP A are defined */
666 /* > by UPLO as follows: If UPLO = 'U' the RFP A contains the NT */
667 /* > elements of upper packed A either in normal or */
668 /* > transpose Format. If UPLO = 'L' the RFP A contains */
669 /* > the NT elements of lower packed A either in normal or */
670 /* > transpose Format. The LDA of RFP A is (N+1)/2 when */
671 /* > TRANSR = 'T'. When TRANSR is 'N' the LDA is N+1 when N is */
672 /* > even and is N when is odd. */
673 /* > See the Note below for more details. Unchanged on exit. */
676 /* > \param[in,out] B */
678 /* > B is REAL array, dimension (LDB,N) */
679 /* > Before entry, the leading m by n part of the array B must */
680 /* > contain the right-hand side matrix B, and on exit is */
681 /* > overwritten by the solution matrix X. */
684 /* > \param[in] LDB */
686 /* > LDB is INTEGER */
687 /* > On entry, LDB specifies the first dimension of B as declared */
688 /* > in the calling (sub) program. LDB must be at least */
689 /* > f2cmax( 1, m ). */
690 /* > Unchanged on exit. */
696 /* > \author Univ. of Tennessee */
697 /* > \author Univ. of California Berkeley */
698 /* > \author Univ. of Colorado Denver */
699 /* > \author NAG Ltd. */
701 /* > \date June 2017 */
703 /* > \ingroup realOTHERcomputational */
705 /* > \par Further Details: */
706 /* ===================== */
710 /* > We first consider Rectangular Full Packed (RFP) Format when N is */
711 /* > even. We give an example where N = 6. */
713 /* > AP is Upper AP is Lower */
715 /* > 00 01 02 03 04 05 00 */
716 /* > 11 12 13 14 15 10 11 */
717 /* > 22 23 24 25 20 21 22 */
718 /* > 33 34 35 30 31 32 33 */
719 /* > 44 45 40 41 42 43 44 */
720 /* > 55 50 51 52 53 54 55 */
723 /* > Let TRANSR = 'N'. RFP holds AP as follows: */
724 /* > For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last */
725 /* > three columns of AP upper. The lower triangle A(4:6,0:2) consists of */
726 /* > the transpose of the first three columns of AP upper. */
727 /* > For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first */
728 /* > three columns of AP lower. The upper triangle A(0:2,0:2) consists of */
729 /* > the transpose of the last three columns of AP lower. */
730 /* > This covers the case N even and TRANSR = 'N'. */
734 /* > 03 04 05 33 43 53 */
735 /* > 13 14 15 00 44 54 */
736 /* > 23 24 25 10 11 55 */
737 /* > 33 34 35 20 21 22 */
738 /* > 00 44 45 30 31 32 */
739 /* > 01 11 55 40 41 42 */
740 /* > 02 12 22 50 51 52 */
742 /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
743 /* > transpose of RFP A above. One therefore gets: */
748 /* > 03 13 23 33 00 01 02 33 00 10 20 30 40 50 */
749 /* > 04 14 24 34 44 11 12 43 44 11 21 31 41 51 */
750 /* > 05 15 25 35 45 55 22 53 54 55 22 32 42 52 */
753 /* > We then consider Rectangular Full Packed (RFP) Format when N is */
754 /* > odd. We give an example where N = 5. */
756 /* > AP is Upper AP is Lower */
758 /* > 00 01 02 03 04 00 */
759 /* > 11 12 13 14 10 11 */
760 /* > 22 23 24 20 21 22 */
761 /* > 33 34 30 31 32 33 */
762 /* > 44 40 41 42 43 44 */
765 /* > Let TRANSR = 'N'. RFP holds AP as follows: */
766 /* > For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last */
767 /* > three columns of AP upper. The lower triangle A(3:4,0:1) consists of */
768 /* > the transpose of the first two columns of AP upper. */
769 /* > For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first */
770 /* > three columns of AP lower. The upper triangle A(0:1,1:2) consists of */
771 /* > the transpose of the last two columns of AP lower. */
772 /* > This covers the case N odd and TRANSR = 'N'. */
776 /* > 02 03 04 00 33 43 */
777 /* > 12 13 14 10 11 44 */
778 /* > 22 23 24 20 21 22 */
779 /* > 00 33 34 30 31 32 */
780 /* > 01 11 44 40 41 42 */
782 /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
783 /* > transpose of RFP A above. One therefore gets: */
787 /* > 02 12 22 00 01 00 10 20 30 40 50 */
788 /* > 03 13 23 33 11 33 11 21 31 41 51 */
789 /* > 04 14 24 34 44 43 44 22 32 42 52 */
792 /* ===================================================================== */
793 /* Subroutine */ int stfsm_(char *transr, char *side, char *uplo, char *trans,
794 char *diag, integer *m, integer *n, real *alpha, real *a, real *b,
797 /* System generated locals */
798 integer b_dim1, b_offset, i__1, i__2;
800 /* Local variables */
801 integer info, i__, j, k;
802 logical normaltransr, lside;
803 extern logical lsame_(char *, char *);
804 extern /* Subroutine */ int sgemm_(char *, char *, integer *, integer *,
805 integer *, real *, real *, integer *, real *, integer *, real *,
808 integer m1, m2, n1, n2;
809 extern /* Subroutine */ int strsm_(char *, char *, char *, char *,
810 integer *, integer *, real *, real *, integer *, real *, integer *
811 ), xerbla_(char *, integer *, ftnlen);
812 logical misodd, nisodd, notrans;
815 /* -- LAPACK computational routine (version 3.7.1) -- */
816 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
817 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
821 /* ===================================================================== */
824 /* Test the input parameters. */
826 /* Parameter adjustments */
827 b_dim1 = *ldb - 1 - 0 + 1;
828 b_offset = 0 + b_dim1 * 0;
833 normaltransr = lsame_(transr, "N");
834 lside = lsame_(side, "L");
835 lower = lsame_(uplo, "L");
836 notrans = lsame_(trans, "N");
837 if (! normaltransr && ! lsame_(transr, "T")) {
839 } else if (! lside && ! lsame_(side, "R")) {
841 } else if (! lower && ! lsame_(uplo, "U")) {
843 } else if (! notrans && ! lsame_(trans, "T")) {
845 } else if (! lsame_(diag, "N") && ! lsame_(diag,
852 } else if (*ldb < f2cmax(1,*m)) {
857 xerbla_("STFSM ", &i__1, (ftnlen)6);
861 /* Quick return when ( (N.EQ.0).OR.(M.EQ.0) ) */
863 if (*m == 0 || *n == 0) {
867 /* Quick return when ALPHA.EQ.(0D+0) */
871 for (j = 0; j <= i__1; ++j) {
873 for (i__ = 0; i__ <= i__2; ++i__) {
874 b[i__ + j * b_dim1] = 0.f;
887 /* If M is odd, set NISODD = .TRUE., and M1 and M2. */
888 /* If M is even, NISODD = .FALSE., and M. */
906 /* SIDE = 'L' and N is odd */
910 /* SIDE = 'L', N is odd, and TRANSR = 'N' */
914 /* SIDE ='L', N is odd, TRANSR = 'N', and UPLO = 'L' */
918 /* SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'L', and */
922 strsm_("L", "L", "N", diag, &m1, n, alpha, a, m, &
925 strsm_("L", "L", "N", diag, &m1, n, alpha, a, m, &
927 sgemm_("N", "N", &m2, n, &m1, &c_b23, &a[m1], m, &
928 b[b_offset], ldb, alpha, &b[m1], ldb);
929 strsm_("L", "U", "T", diag, &m2, n, &c_b27, &a[*m]
935 /* SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'L', and */
939 strsm_("L", "L", "T", diag, &m1, n, alpha, a, m, &
942 strsm_("L", "U", "N", diag, &m2, n, alpha, &a[*m],
944 sgemm_("T", "N", &m1, n, &m2, &c_b23, &a[m1], m, &
945 b[m1], ldb, alpha, &b[b_offset], ldb);
946 strsm_("L", "L", "T", diag, &m1, n, &c_b27, a, m,
954 /* SIDE ='L', N is odd, TRANSR = 'N', and UPLO = 'U' */
958 /* SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'U', and */
961 strsm_("L", "L", "N", diag, &m1, n, alpha, &a[m2], m,
963 sgemm_("T", "N", &m2, n, &m1, &c_b23, a, m, &b[
964 b_offset], ldb, alpha, &b[m1], ldb);
965 strsm_("L", "U", "T", diag, &m2, n, &c_b27, &a[m1], m,
970 /* SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'U', and */
973 strsm_("L", "U", "N", diag, &m2, n, alpha, &a[m1], m,
975 sgemm_("N", "N", &m1, n, &m2, &c_b23, a, m, &b[m1],
976 ldb, alpha, &b[b_offset], ldb);
977 strsm_("L", "L", "T", diag, &m1, n, &c_b27, &a[m2], m,
986 /* SIDE = 'L', N is odd, and TRANSR = 'T' */
990 /* SIDE ='L', N is odd, TRANSR = 'T', and UPLO = 'L' */
994 /* SIDE ='L', N is odd, TRANSR = 'T', UPLO = 'L', and */
998 strsm_("L", "U", "T", diag, &m1, n, alpha, a, &m1,
1001 strsm_("L", "U", "T", diag, &m1, n, alpha, a, &m1,
1003 sgemm_("T", "N", &m2, n, &m1, &c_b23, &a[m1 * m1],
1004 &m1, &b[b_offset], ldb, alpha, &b[m1],
1006 strsm_("L", "L", "N", diag, &m2, n, &c_b27, &a[1],
1012 /* SIDE ='L', N is odd, TRANSR = 'T', UPLO = 'L', and */
1016 strsm_("L", "U", "N", diag, &m1, n, alpha, a, &m1,
1019 strsm_("L", "L", "T", diag, &m2, n, alpha, &a[1],
1021 sgemm_("N", "N", &m1, n, &m2, &c_b23, &a[m1 * m1],
1022 &m1, &b[m1], ldb, alpha, &b[b_offset],
1024 strsm_("L", "U", "N", diag, &m1, n, &c_b27, a, &
1025 m1, &b[b_offset], ldb);
1032 /* SIDE ='L', N is odd, TRANSR = 'T', and UPLO = 'U' */
1036 /* SIDE ='L', N is odd, TRANSR = 'T', UPLO = 'U', and */
1039 strsm_("L", "U", "T", diag, &m1, n, alpha, &a[m2 * m2]
1040 , &m2, &b[b_offset], ldb);
1041 sgemm_("N", "N", &m2, n, &m1, &c_b23, a, &m2, &b[
1042 b_offset], ldb, alpha, &b[m1], ldb);
1043 strsm_("L", "L", "N", diag, &m2, n, &c_b27, &a[m1 *
1044 m2], &m2, &b[m1], ldb);
1048 /* SIDE ='L', N is odd, TRANSR = 'T', UPLO = 'U', and */
1051 strsm_("L", "L", "T", diag, &m2, n, alpha, &a[m1 * m2]
1052 , &m2, &b[m1], ldb);
1053 sgemm_("T", "N", &m1, n, &m2, &c_b23, a, &m2, &b[m1],
1054 ldb, alpha, &b[b_offset], ldb);
1055 strsm_("L", "U", "N", diag, &m1, n, &c_b27, &a[m2 *
1056 m2], &m2, &b[b_offset], ldb);
1066 /* SIDE = 'L' and N is even */
1070 /* SIDE = 'L', N is even, and TRANSR = 'N' */
1074 /* SIDE ='L', N is even, TRANSR = 'N', and UPLO = 'L' */
1078 /* SIDE ='L', N is even, TRANSR = 'N', UPLO = 'L', */
1079 /* and TRANS = 'N' */
1082 strsm_("L", "L", "N", diag, &k, n, alpha, &a[1], &
1083 i__1, &b[b_offset], ldb);
1085 sgemm_("N", "N", &k, n, &k, &c_b23, &a[k + 1], &i__1,
1086 &b[b_offset], ldb, alpha, &b[k], ldb);
1088 strsm_("L", "U", "T", diag, &k, n, &c_b27, a, &i__1, &
1093 /* SIDE ='L', N is even, TRANSR = 'N', UPLO = 'L', */
1094 /* and TRANS = 'T' */
1097 strsm_("L", "U", "N", diag, &k, n, alpha, a, &i__1, &
1100 sgemm_("T", "N", &k, n, &k, &c_b23, &a[k + 1], &i__1,
1101 &b[k], ldb, alpha, &b[b_offset], ldb);
1103 strsm_("L", "L", "T", diag, &k, n, &c_b27, &a[1], &
1104 i__1, &b[b_offset], ldb);
1110 /* SIDE ='L', N is even, TRANSR = 'N', and UPLO = 'U' */
1114 /* SIDE ='L', N is even, TRANSR = 'N', UPLO = 'U', */
1115 /* and TRANS = 'N' */
1118 strsm_("L", "L", "N", diag, &k, n, alpha, &a[k + 1], &
1119 i__1, &b[b_offset], ldb);
1121 sgemm_("T", "N", &k, n, &k, &c_b23, a, &i__1, &b[
1122 b_offset], ldb, alpha, &b[k], ldb);
1124 strsm_("L", "U", "T", diag, &k, n, &c_b27, &a[k], &
1129 /* SIDE ='L', N is even, TRANSR = 'N', UPLO = 'U', */
1130 /* and TRANS = 'T' */
1132 strsm_("L", "U", "N", diag, &k, n, alpha, &a[k], &
1135 sgemm_("N", "N", &k, n, &k, &c_b23, a, &i__1, &b[k],
1136 ldb, alpha, &b[b_offset], ldb);
1138 strsm_("L", "L", "T", diag, &k, n, &c_b27, &a[k + 1],
1139 &i__1, &b[b_offset], ldb);
1147 /* SIDE = 'L', N is even, and TRANSR = 'T' */
1151 /* SIDE ='L', N is even, TRANSR = 'T', and UPLO = 'L' */
1155 /* SIDE ='L', N is even, TRANSR = 'T', UPLO = 'L', */
1156 /* and TRANS = 'N' */
1158 strsm_("L", "U", "T", diag, &k, n, alpha, &a[k], &k, &
1160 sgemm_("T", "N", &k, n, &k, &c_b23, &a[k * (k + 1)], &
1161 k, &b[b_offset], ldb, alpha, &b[k], ldb);
1162 strsm_("L", "L", "N", diag, &k, n, &c_b27, a, &k, &b[
1167 /* SIDE ='L', N is even, TRANSR = 'T', UPLO = 'L', */
1168 /* and TRANS = 'T' */
1170 strsm_("L", "L", "T", diag, &k, n, alpha, a, &k, &b[k]
1172 sgemm_("N", "N", &k, n, &k, &c_b23, &a[k * (k + 1)], &
1173 k, &b[k], ldb, alpha, &b[b_offset], ldb);
1174 strsm_("L", "U", "N", diag, &k, n, &c_b27, &a[k], &k,
1181 /* SIDE ='L', N is even, TRANSR = 'T', and UPLO = 'U' */
1185 /* SIDE ='L', N is even, TRANSR = 'T', UPLO = 'U', */
1186 /* and TRANS = 'N' */
1188 strsm_("L", "U", "T", diag, &k, n, alpha, &a[k * (k +
1189 1)], &k, &b[b_offset], ldb);
1190 sgemm_("N", "N", &k, n, &k, &c_b23, a, &k, &b[
1191 b_offset], ldb, alpha, &b[k], ldb);
1192 strsm_("L", "L", "N", diag, &k, n, &c_b27, &a[k * k],
1197 /* SIDE ='L', N is even, TRANSR = 'T', UPLO = 'U', */
1198 /* and TRANS = 'T' */
1200 strsm_("L", "L", "T", diag, &k, n, alpha, &a[k * k], &
1202 sgemm_("T", "N", &k, n, &k, &c_b23, a, &k, &b[k], ldb,
1203 alpha, &b[b_offset], ldb);
1204 strsm_("L", "U", "N", diag, &k, n, &c_b27, &a[k * (k
1205 + 1)], &k, &b[b_offset], ldb);
1220 /* If N is odd, set NISODD = .TRUE., and N1 and N2. */
1221 /* If N is even, NISODD = .FALSE., and K. */
1239 /* SIDE = 'R' and N is odd */
1243 /* SIDE = 'R', N is odd, and TRANSR = 'N' */
1247 /* SIDE ='R', N is odd, TRANSR = 'N', and UPLO = 'L' */
1251 /* SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'L', and */
1254 strsm_("R", "U", "T", diag, m, &n2, alpha, &a[*n], n,
1255 &b[n1 * b_dim1], ldb);
1256 sgemm_("N", "N", m, &n1, &n2, &c_b23, &b[n1 * b_dim1],
1257 ldb, &a[n1], n, alpha, b, ldb);
1258 strsm_("R", "L", "N", diag, m, &n1, &c_b27, a, n, b,
1263 /* SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'L', and */
1266 strsm_("R", "L", "T", diag, m, &n1, alpha, a, n, b,
1268 sgemm_("N", "T", m, &n2, &n1, &c_b23, b, ldb, &a[n1],
1269 n, alpha, &b[n1 * b_dim1], ldb);
1270 strsm_("R", "U", "N", diag, m, &n2, &c_b27, &a[*n], n,
1271 &b[n1 * b_dim1], ldb);
1277 /* SIDE ='R', N is odd, TRANSR = 'N', and UPLO = 'U' */
1281 /* SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'U', and */
1284 strsm_("R", "L", "T", diag, m, &n1, alpha, &a[n2], n,
1286 sgemm_("N", "N", m, &n2, &n1, &c_b23, b, ldb, a, n,
1287 alpha, &b[n1 * b_dim1], ldb);
1288 strsm_("R", "U", "N", diag, m, &n2, &c_b27, &a[n1], n,
1289 &b[n1 * b_dim1], ldb);
1293 /* SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'U', and */
1296 strsm_("R", "U", "T", diag, m, &n2, alpha, &a[n1], n,
1297 &b[n1 * b_dim1], ldb);
1298 sgemm_("N", "T", m, &n1, &n2, &c_b23, &b[n1 * b_dim1],
1299 ldb, a, n, alpha, b, ldb);
1300 strsm_("R", "L", "N", diag, m, &n1, &c_b27, &a[n2], n,
1309 /* SIDE = 'R', N is odd, and TRANSR = 'T' */
1313 /* SIDE ='R', N is odd, TRANSR = 'T', and UPLO = 'L' */
1317 /* SIDE ='R', N is odd, TRANSR = 'T', UPLO = 'L', and */
1320 strsm_("R", "L", "N", diag, m, &n2, alpha, &a[1], &n1,
1321 &b[n1 * b_dim1], ldb);
1322 sgemm_("N", "T", m, &n1, &n2, &c_b23, &b[n1 * b_dim1],
1323 ldb, &a[n1 * n1], &n1, alpha, b, ldb);
1324 strsm_("R", "U", "T", diag, m, &n1, &c_b27, a, &n1, b,
1329 /* SIDE ='R', N is odd, TRANSR = 'T', UPLO = 'L', and */
1332 strsm_("R", "U", "N", diag, m, &n1, alpha, a, &n1, b,
1334 sgemm_("N", "N", m, &n2, &n1, &c_b23, b, ldb, &a[n1 *
1335 n1], &n1, alpha, &b[n1 * b_dim1], ldb);
1336 strsm_("R", "L", "T", diag, m, &n2, &c_b27, &a[1], &
1337 n1, &b[n1 * b_dim1], ldb);
1343 /* SIDE ='R', N is odd, TRANSR = 'T', and UPLO = 'U' */
1347 /* SIDE ='R', N is odd, TRANSR = 'T', UPLO = 'U', and */
1350 strsm_("R", "U", "N", diag, m, &n1, alpha, &a[n2 * n2]
1352 sgemm_("N", "T", m, &n2, &n1, &c_b23, b, ldb, a, &n2,
1353 alpha, &b[n1 * b_dim1], ldb);
1354 strsm_("R", "L", "T", diag, m, &n2, &c_b27, &a[n1 *
1355 n2], &n2, &b[n1 * b_dim1], ldb);
1359 /* SIDE ='R', N is odd, TRANSR = 'T', UPLO = 'U', and */
1362 strsm_("R", "L", "N", diag, m, &n2, alpha, &a[n1 * n2]
1363 , &n2, &b[n1 * b_dim1], ldb);
1364 sgemm_("N", "N", m, &n1, &n2, &c_b23, &b[n1 * b_dim1],
1365 ldb, a, &n2, alpha, b, ldb);
1366 strsm_("R", "U", "T", diag, m, &n1, &c_b27, &a[n2 *
1377 /* SIDE = 'R' and N is even */
1381 /* SIDE = 'R', N is even, and TRANSR = 'N' */
1385 /* SIDE ='R', N is even, TRANSR = 'N', and UPLO = 'L' */
1389 /* SIDE ='R', N is even, TRANSR = 'N', UPLO = 'L', */
1390 /* and TRANS = 'N' */
1393 strsm_("R", "U", "T", diag, m, &k, alpha, a, &i__1, &
1394 b[k * b_dim1], ldb);
1396 sgemm_("N", "N", m, &k, &k, &c_b23, &b[k * b_dim1],
1397 ldb, &a[k + 1], &i__1, alpha, b, ldb);
1399 strsm_("R", "L", "N", diag, m, &k, &c_b27, &a[1], &
1404 /* SIDE ='R', N is even, TRANSR = 'N', UPLO = 'L', */
1405 /* and TRANS = 'T' */
1408 strsm_("R", "L", "T", diag, m, &k, alpha, &a[1], &
1411 sgemm_("N", "T", m, &k, &k, &c_b23, b, ldb, &a[k + 1],
1412 &i__1, alpha, &b[k * b_dim1], ldb);
1414 strsm_("R", "U", "N", diag, m, &k, &c_b27, a, &i__1, &
1415 b[k * b_dim1], ldb);
1421 /* SIDE ='R', N is even, TRANSR = 'N', and UPLO = 'U' */
1425 /* SIDE ='R', N is even, TRANSR = 'N', UPLO = 'U', */
1426 /* and TRANS = 'N' */
1429 strsm_("R", "L", "T", diag, m, &k, alpha, &a[k + 1], &
1432 sgemm_("N", "N", m, &k, &k, &c_b23, b, ldb, a, &i__1,
1433 alpha, &b[k * b_dim1], ldb);
1435 strsm_("R", "U", "N", diag, m, &k, &c_b27, &a[k], &
1436 i__1, &b[k * b_dim1], ldb);
1440 /* SIDE ='R', N is even, TRANSR = 'N', UPLO = 'U', */
1441 /* and TRANS = 'T' */
1444 strsm_("R", "U", "T", diag, m, &k, alpha, &a[k], &
1445 i__1, &b[k * b_dim1], ldb);
1447 sgemm_("N", "T", m, &k, &k, &c_b23, &b[k * b_dim1],
1448 ldb, a, &i__1, alpha, b, ldb);
1450 strsm_("R", "L", "N", diag, m, &k, &c_b27, &a[k + 1],
1459 /* SIDE = 'R', N is even, and TRANSR = 'T' */
1463 /* SIDE ='R', N is even, TRANSR = 'T', and UPLO = 'L' */
1467 /* SIDE ='R', N is even, TRANSR = 'T', UPLO = 'L', */
1468 /* and TRANS = 'N' */
1470 strsm_("R", "L", "N", diag, m, &k, alpha, a, &k, &b[k
1472 sgemm_("N", "T", m, &k, &k, &c_b23, &b[k * b_dim1],
1473 ldb, &a[(k + 1) * k], &k, alpha, b, ldb);
1474 strsm_("R", "U", "T", diag, m, &k, &c_b27, &a[k], &k,
1479 /* SIDE ='R', N is even, TRANSR = 'T', UPLO = 'L', */
1480 /* and TRANS = 'T' */
1482 strsm_("R", "U", "N", diag, m, &k, alpha, &a[k], &k,
1484 sgemm_("N", "N", m, &k, &k, &c_b23, b, ldb, &a[(k + 1)
1485 * k], &k, alpha, &b[k * b_dim1], ldb);
1486 strsm_("R", "L", "T", diag, m, &k, &c_b27, a, &k, &b[
1493 /* SIDE ='R', N is even, TRANSR = 'T', and UPLO = 'U' */
1497 /* SIDE ='R', N is even, TRANSR = 'T', UPLO = 'U', */
1498 /* and TRANS = 'N' */
1500 strsm_("R", "U", "N", diag, m, &k, alpha, &a[(k + 1) *
1502 sgemm_("N", "T", m, &k, &k, &c_b23, b, ldb, a, &k,
1503 alpha, &b[k * b_dim1], ldb);
1504 strsm_("R", "L", "T", diag, m, &k, &c_b27, &a[k * k],
1505 &k, &b[k * b_dim1], ldb);
1509 /* SIDE ='R', N is even, TRANSR = 'T', UPLO = 'U', */
1510 /* and TRANS = 'T' */
1512 strsm_("R", "L", "N", diag, m, &k, alpha, &a[k * k], &
1513 k, &b[k * b_dim1], ldb);
1514 sgemm_("N", "N", m, &k, &k, &c_b23, &b[k * b_dim1],
1515 ldb, a, &k, alpha, b, ldb);
1516 strsm_("R", "U", "T", diag, m, &k, &c_b27, &a[(k + 1)