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 complex c_b1 = {0.f,0.f};
00019 static complex c_b2 = {1.f,0.f};
00020 static integer c__1 = 1;
00021
00022 int csgt01_(integer *itype, char *uplo, integer *n, integer *
00023 m, complex *a, integer *lda, complex *b, integer *ldb, complex *z__,
00024 integer *ldz, real *d__, complex *work, real *rwork, real *result)
00025 {
00026
00027 integer a_dim1, a_offset, b_dim1, b_offset, z_dim1, z_offset, i__1;
00028 complex q__1;
00029
00030
00031 integer i__;
00032 real ulp;
00033 extern int chemm_(char *, char *, integer *, integer *,
00034 complex *, complex *, integer *, complex *, integer *, complex *,
00035 complex *, integer *);
00036 real anorm;
00037 extern doublereal clange_(char *, integer *, integer *, complex *,
00038 integer *, real *), clanhe_(char *, char *, integer *,
00039 complex *, integer *, real *), slamch_(char *);
00040 extern int csscal_(integer *, real *, complex *, integer
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
00136
00137
00138 a_dim1 = *lda;
00139 a_offset = 1 + a_dim1;
00140 a -= a_offset;
00141 b_dim1 = *ldb;
00142 b_offset = 1 + b_dim1;
00143 b -= b_offset;
00144 z_dim1 = *ldz;
00145 z_offset = 1 + z_dim1;
00146 z__ -= z_offset;
00147 --d__;
00148 --work;
00149 --rwork;
00150 --result;
00151
00152
00153 result[1] = 0.f;
00154 if (*n <= 0) {
00155 return 0;
00156 }
00157
00158 ulp = slamch_("Epsilon");
00159
00160
00161
00162 anorm = clanhe_("1", uplo, n, &a[a_offset], lda, &rwork[1]) * clange_("1", n, m, &z__[z_offset], ldz, &rwork[1]);
00163 if (anorm == 0.f) {
00164 anorm = 1.f;
00165 }
00166
00167 if (*itype == 1) {
00168
00169
00170
00171 chemm_("Left", uplo, n, m, &c_b2, &a[a_offset], lda, &z__[z_offset],
00172 ldz, &c_b1, &work[1], n);
00173 i__1 = *m;
00174 for (i__ = 1; i__ <= i__1; ++i__) {
00175 csscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00176
00177 }
00178 q__1.r = -1.f, q__1.i = -0.f;
00179 chemm_("Left", uplo, n, m, &c_b2, &b[b_offset], ldb, &z__[z_offset],
00180 ldz, &q__1, &work[1], n);
00181
00182 result[1] = clange_("1", n, m, &work[1], n, &rwork[1]) /
00183 anorm / (*n * ulp);
00184
00185 } else if (*itype == 2) {
00186
00187
00188
00189 chemm_("Left", uplo, n, m, &c_b2, &b[b_offset], ldb, &z__[z_offset],
00190 ldz, &c_b1, &work[1], n);
00191 i__1 = *m;
00192 for (i__ = 1; i__ <= i__1; ++i__) {
00193 csscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00194
00195 }
00196 q__1.r = -1.f, q__1.i = -0.f;
00197 chemm_("Left", uplo, n, m, &c_b2, &a[a_offset], lda, &work[1], n, &
00198 q__1, &z__[z_offset], ldz);
00199
00200 result[1] = clange_("1", n, m, &z__[z_offset], ldz, &rwork[1]) / anorm / (*n * ulp);
00201
00202 } else if (*itype == 3) {
00203
00204
00205
00206 chemm_("Left", uplo, n, m, &c_b2, &a[a_offset], lda, &z__[z_offset],
00207 ldz, &c_b1, &work[1], n);
00208 i__1 = *m;
00209 for (i__ = 1; i__ <= i__1; ++i__) {
00210 csscal_(n, &d__[i__], &z__[i__ * z_dim1 + 1], &c__1);
00211
00212 }
00213 q__1.r = -1.f, q__1.i = -0.f;
00214 chemm_("Left", uplo, n, m, &c_b2, &b[b_offset], ldb, &work[1], n, &
00215 q__1, &z__[z_offset], ldz);
00216
00217 result[1] = clange_("1", n, m, &z__[z_offset], ldz, &rwork[1]) / anorm / (*n * ulp);
00218 }
00219
00220 return 0;
00221
00222
00223
00224 }