00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static real c_b6 = 1.f;
00019 static real c_b7 = 0.f;
00020 static integer c__1 = 1;
00021 static real c_b12 = -1.f;
00022
00023 int ssgt01_(integer *itype, char *uplo, integer *n, integer *
00024 m, real *a, integer *lda, real *b, integer *ldb, real *z__, integer *
00025 ldz, real *d__, real *work, real *result)
00026 {
00027
00028 integer a_dim1, a_offset, b_dim1, b_offset, z_dim1, z_offset, i__1;
00029
00030
00031 integer i__;
00032 real ulp;
00033 extern int sscal_(integer *, real *, real *, integer *);
00034 real anorm;
00035 extern int ssymm_(char *, char *, integer *, integer *,
00036 real *, real *, integer *, real *, integer *, real *, real *,
00037 integer *);
00038 extern doublereal slamch_(char *), slange_(char *, integer *,
00039 integer *, real *, integer *, real *), slansy_(char *,
00040 char *, integer *, real *, integer *, real *);
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 a_dim1 = *lda;
00136 a_offset = 1 + a_dim1;
00137 a -= a_offset;
00138 b_dim1 = *ldb;
00139 b_offset = 1 + b_dim1;
00140 b -= b_offset;
00141 z_dim1 = *ldz;
00142 z_offset = 1 + z_dim1;
00143 z__ -= z_offset;
00144 --d__;
00145 --work;
00146 --result;
00147
00148
00149 result[1] = 0.f;
00150 if (*n <= 0) {
00151 return 0;
00152 }
00153
00154 ulp = slamch_("Epsilon");
00155
00156
00157
00158 anorm = slansy_("1", uplo, n, &a[a_offset], lda, &work[1]) * slange_("1", n, m, &z__[z_offset], ldz, &work[1]);
00159 if (anorm == 0.f) {
00160 anorm = 1.f;
00161 }
00162
00163 if (*itype == 1) {
00164
00165
00166
00167 ssymm_("Left", uplo, n, m, &c_b6, &a[a_offset], lda, &z__[z_offset],
00168 ldz, &c_b7, &work[1], n);
00169 i__1 = *m;
00170 for (i__ = 1; i__ <= i__1; ++i__) {
00171 sscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00172
00173 }
00174 ssymm_("Left", uplo, n, m, &c_b6, &b[b_offset], ldb, &z__[z_offset],
00175 ldz, &c_b12, &work[1], n);
00176
00177 result[1] = slange_("1", n, m, &work[1], n, &work[1]) /
00178 anorm / (*n * ulp);
00179
00180 } else if (*itype == 2) {
00181
00182
00183
00184 ssymm_("Left", uplo, n, m, &c_b6, &b[b_offset], ldb, &z__[z_offset],
00185 ldz, &c_b7, &work[1], n);
00186 i__1 = *m;
00187 for (i__ = 1; i__ <= i__1; ++i__) {
00188 sscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00189
00190 }
00191 ssymm_("Left", uplo, n, m, &c_b6, &a[a_offset], lda, &work[1], n, &
00192 c_b12, &z__[z_offset], ldz);
00193
00194 result[1] = slange_("1", n, m, &z__[z_offset], ldz, &work[1]) / anorm / (*n * ulp);
00195
00196 } else if (*itype == 3) {
00197
00198
00199
00200 ssymm_("Left", uplo, n, m, &c_b6, &a[a_offset], lda, &z__[z_offset],
00201 ldz, &c_b7, &work[1], n);
00202 i__1 = *m;
00203 for (i__ = 1; i__ <= i__1; ++i__) {
00204 sscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00205
00206 }
00207 ssymm_("Left", uplo, n, m, &c_b6, &b[b_offset], ldb, &work[1], n, &
00208 c_b12, &z__[z_offset], ldz);
00209
00210 result[1] = slange_("1", n, m, &z__[z_offset], ldz, &work[1]) / anorm / (*n * ulp);
00211 }
00212
00213 return 0;
00214
00215
00216
00217 }