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 integer c__2 = 2;
00019 static complex c_b6 = {0.f,0.f};
00020
00021 int clahilb_(integer *n, integer *nrhs, complex *a, integer *
00022 lda, complex *x, integer *ldx, complex *b, integer *ldb, real *work,
00023 integer *info, char *path)
00024 {
00025
00026
00027 static complex d1[8] = { {-1.f,0.f},{0.f,1.f},{-1.f,-1.f},{0.f,-1.f},{1.f,
00028 0.f},{-1.f,1.f},{1.f,1.f},{1.f,-1.f} };
00029 static complex d2[8] = { {-1.f,0.f},{0.f,-1.f},{-1.f,1.f},{0.f,1.f},{1.f,
00030 0.f},{-1.f,-1.f},{1.f,-1.f},{1.f,1.f} };
00031 static complex invd1[8] = { {-1.f,0.f},{0.f,-1.f},{-.5f,.5f},{0.f,1.f},{
00032 1.f,0.f},{-.5f,-.5f},{.5f,-.5f},{.5f,.5f} };
00033 static complex invd2[8] = { {-1.f,0.f},{0.f,1.f},{-.5f,-.5f},{0.f,-1.f},{
00034 1.f,0.f},{-.5f,.5f},{.5f,.5f},{.5f,-.5f} };
00035
00036
00037 integer a_dim1, a_offset, x_dim1, x_offset, b_dim1, b_offset, i__1, i__2,
00038 i__3, i__4, i__5;
00039 real r__1;
00040 complex q__1, q__2;
00041
00042
00043 int s_copy(char *, char *, ftnlen, ftnlen);
00044
00045
00046 integer i__, j, m, r__;
00047 char c2[2];
00048 integer ti, tm;
00049 complex tmp;
00050 extern int claset_(char *, integer *, integer *, complex
00051 *, complex *, complex *, integer *), xerbla_(char *,
00052 integer *);
00053 extern logical lsamen_(integer *, char *, char *);
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
00139
00140 --work;
00141 a_dim1 = *lda;
00142 a_offset = 1 + a_dim1;
00143 a -= a_offset;
00144 x_dim1 = *ldx;
00145 x_offset = 1 + x_dim1;
00146 x -= x_offset;
00147 b_dim1 = *ldb;
00148 b_offset = 1 + b_dim1;
00149 b -= b_offset;
00150
00151
00152
00153
00154
00155
00156 s_copy(c2, path + 1, (ftnlen)2, (ftnlen)2);
00157
00158
00159
00160 *info = 0;
00161 if (*n < 0 || *n > 11) {
00162 *info = -1;
00163 } else if (*nrhs < 0) {
00164 *info = -2;
00165 } else if (*lda < *n) {
00166 *info = -4;
00167 } else if (*ldx < *n) {
00168 *info = -6;
00169 } else if (*ldb < *n) {
00170 *info = -8;
00171 }
00172 if (*info < 0) {
00173 i__1 = -(*info);
00174 xerbla_("CLAHILB", &i__1);
00175 return 0;
00176 }
00177 if (*n > 6) {
00178 *info = 1;
00179 }
00180
00181
00182 m = 1;
00183 i__1 = (*n << 1) - 1;
00184 for (i__ = 2; i__ <= i__1; ++i__) {
00185 tm = m;
00186 ti = i__;
00187 r__ = tm % ti;
00188 while(r__ != 0) {
00189 tm = ti;
00190 ti = r__;
00191 r__ = tm % ti;
00192 }
00193 m = m / ti * i__;
00194 }
00195
00196
00197 if (lsamen_(&c__2, c2, "SY")) {
00198 i__1 = *n;
00199 for (j = 1; j <= i__1; ++j) {
00200 i__2 = *n;
00201 for (i__ = 1; i__ <= i__2; ++i__) {
00202 i__3 = i__ + j * a_dim1;
00203 i__4 = j % 8;
00204 r__1 = (real) m / (i__ + j - 1);
00205 q__2.r = r__1 * d1[i__4].r, q__2.i = r__1 * d1[i__4].i;
00206 i__5 = i__ % 8;
00207 q__1.r = q__2.r * d1[i__5].r - q__2.i * d1[i__5].i, q__1.i =
00208 q__2.r * d1[i__5].i + q__2.i * d1[i__5].r;
00209 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00210 }
00211 }
00212 } else {
00213 i__1 = *n;
00214 for (j = 1; j <= i__1; ++j) {
00215 i__2 = *n;
00216 for (i__ = 1; i__ <= i__2; ++i__) {
00217 i__3 = i__ + j * a_dim1;
00218 i__4 = j % 8;
00219 r__1 = (real) m / (i__ + j - 1);
00220 q__2.r = r__1 * d1[i__4].r, q__2.i = r__1 * d1[i__4].i;
00221 i__5 = i__ % 8;
00222 q__1.r = q__2.r * d2[i__5].r - q__2.i * d2[i__5].i, q__1.i =
00223 q__2.r * d2[i__5].i + q__2.i * d2[i__5].r;
00224 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00225 }
00226 }
00227 }
00228
00229
00230 r__1 = (real) m;
00231 tmp.r = r__1, tmp.i = 0.f;
00232 claset_("Full", n, nrhs, &c_b6, &tmp, &b[b_offset], ldb);
00233
00234
00235
00236 work[1] = (real) (*n);
00237 i__1 = *n;
00238 for (j = 2; j <= i__1; ++j) {
00239 work[j] = work[j - 1] / (j - 1) * (j - 1 - *n) / (j - 1) * (*n + j -
00240 1);
00241 }
00242
00243 if (lsamen_(&c__2, c2, "SY")) {
00244 i__1 = *nrhs;
00245 for (j = 1; j <= i__1; ++j) {
00246 i__2 = *n;
00247 for (i__ = 1; i__ <= i__2; ++i__) {
00248 i__3 = i__ + j * x_dim1;
00249 i__4 = j % 8;
00250 r__1 = work[i__] * work[j] / (i__ + j - 1);
00251 q__2.r = r__1 * invd1[i__4].r, q__2.i = r__1 * invd1[i__4].i;
00252 i__5 = i__ % 8;
00253 q__1.r = q__2.r * invd1[i__5].r - q__2.i * invd1[i__5].i,
00254 q__1.i = q__2.r * invd1[i__5].i + q__2.i * invd1[i__5]
00255 .r;
00256 x[i__3].r = q__1.r, x[i__3].i = q__1.i;
00257 }
00258 }
00259 } else {
00260 i__1 = *nrhs;
00261 for (j = 1; j <= i__1; ++j) {
00262 i__2 = *n;
00263 for (i__ = 1; i__ <= i__2; ++i__) {
00264 i__3 = i__ + j * x_dim1;
00265 i__4 = j % 8;
00266 r__1 = work[i__] * work[j] / (i__ + j - 1);
00267 q__2.r = r__1 * invd2[i__4].r, q__2.i = r__1 * invd2[i__4].i;
00268 i__5 = i__ % 8;
00269 q__1.r = q__2.r * invd1[i__5].r - q__2.i * invd1[i__5].i,
00270 q__1.i = q__2.r * invd1[i__5].i + q__2.i * invd1[i__5]
00271 .r;
00272 x[i__3].r = q__1.r, x[i__3].i = q__1.i;
00273 }
00274 }
00275 }
00276 return 0;
00277 }