Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int sgtts2_(integer *itrans, integer *n, integer *nrhs, real
00017 *dl, real *d__, real *du, real *du2, integer *ipiv, real *b, integer *
00018 ldb)
00019 {
00020
00021 integer b_dim1, b_offset, i__1, i__2;
00022
00023
00024 integer i__, j, ip;
00025 real temp;
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
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 --dl;
00098 --d__;
00099 --du;
00100 --du2;
00101 --ipiv;
00102 b_dim1 = *ldb;
00103 b_offset = 1 + b_dim1;
00104 b -= b_offset;
00105
00106
00107 if (*n == 0 || *nrhs == 0) {
00108 return 0;
00109 }
00110
00111 if (*itrans == 0) {
00112
00113
00114
00115
00116 if (*nrhs <= 1) {
00117 j = 1;
00118 L10:
00119
00120
00121
00122 i__1 = *n - 1;
00123 for (i__ = 1; i__ <= i__1; ++i__) {
00124 ip = ipiv[i__];
00125 temp = b[i__ + 1 - ip + i__ + j * b_dim1] - dl[i__] * b[ip +
00126 j * b_dim1];
00127 b[i__ + j * b_dim1] = b[ip + j * b_dim1];
00128 b[i__ + 1 + j * b_dim1] = temp;
00129
00130 }
00131
00132
00133
00134 b[*n + j * b_dim1] /= d__[*n];
00135 if (*n > 1) {
00136 b[*n - 1 + j * b_dim1] = (b[*n - 1 + j * b_dim1] - du[*n - 1]
00137 * b[*n + j * b_dim1]) / d__[*n - 1];
00138 }
00139 for (i__ = *n - 2; i__ >= 1; --i__) {
00140 b[i__ + j * b_dim1] = (b[i__ + j * b_dim1] - du[i__] * b[i__
00141 + 1 + j * b_dim1] - du2[i__] * b[i__ + 2 + j * b_dim1]
00142 ) / d__[i__];
00143
00144 }
00145 if (j < *nrhs) {
00146 ++j;
00147 goto L10;
00148 }
00149 } else {
00150 i__1 = *nrhs;
00151 for (j = 1; j <= i__1; ++j) {
00152
00153
00154
00155 i__2 = *n - 1;
00156 for (i__ = 1; i__ <= i__2; ++i__) {
00157 if (ipiv[i__] == i__) {
00158 b[i__ + 1 + j * b_dim1] -= dl[i__] * b[i__ + j *
00159 b_dim1];
00160 } else {
00161 temp = b[i__ + j * b_dim1];
00162 b[i__ + j * b_dim1] = b[i__ + 1 + j * b_dim1];
00163 b[i__ + 1 + j * b_dim1] = temp - dl[i__] * b[i__ + j *
00164 b_dim1];
00165 }
00166
00167 }
00168
00169
00170
00171 b[*n + j * b_dim1] /= d__[*n];
00172 if (*n > 1) {
00173 b[*n - 1 + j * b_dim1] = (b[*n - 1 + j * b_dim1] - du[*n
00174 - 1] * b[*n + j * b_dim1]) / d__[*n - 1];
00175 }
00176 for (i__ = *n - 2; i__ >= 1; --i__) {
00177 b[i__ + j * b_dim1] = (b[i__ + j * b_dim1] - du[i__] * b[
00178 i__ + 1 + j * b_dim1] - du2[i__] * b[i__ + 2 + j *
00179 b_dim1]) / d__[i__];
00180
00181 }
00182
00183 }
00184 }
00185 } else {
00186
00187
00188
00189 if (*nrhs <= 1) {
00190
00191
00192
00193 j = 1;
00194 L70:
00195 b[j * b_dim1 + 1] /= d__[1];
00196 if (*n > 1) {
00197 b[j * b_dim1 + 2] = (b[j * b_dim1 + 2] - du[1] * b[j * b_dim1
00198 + 1]) / d__[2];
00199 }
00200 i__1 = *n;
00201 for (i__ = 3; i__ <= i__1; ++i__) {
00202 b[i__ + j * b_dim1] = (b[i__ + j * b_dim1] - du[i__ - 1] * b[
00203 i__ - 1 + j * b_dim1] - du2[i__ - 2] * b[i__ - 2 + j *
00204 b_dim1]) / d__[i__];
00205
00206 }
00207
00208
00209
00210 for (i__ = *n - 1; i__ >= 1; --i__) {
00211 ip = ipiv[i__];
00212 temp = b[i__ + j * b_dim1] - dl[i__] * b[i__ + 1 + j * b_dim1]
00213 ;
00214 b[i__ + j * b_dim1] = b[ip + j * b_dim1];
00215 b[ip + j * b_dim1] = temp;
00216
00217 }
00218 if (j < *nrhs) {
00219 ++j;
00220 goto L70;
00221 }
00222
00223 } else {
00224 i__1 = *nrhs;
00225 for (j = 1; j <= i__1; ++j) {
00226
00227
00228
00229 b[j * b_dim1 + 1] /= d__[1];
00230 if (*n > 1) {
00231 b[j * b_dim1 + 2] = (b[j * b_dim1 + 2] - du[1] * b[j *
00232 b_dim1 + 1]) / d__[2];
00233 }
00234 i__2 = *n;
00235 for (i__ = 3; i__ <= i__2; ++i__) {
00236 b[i__ + j * b_dim1] = (b[i__ + j * b_dim1] - du[i__ - 1] *
00237 b[i__ - 1 + j * b_dim1] - du2[i__ - 2] * b[i__ -
00238 2 + j * b_dim1]) / d__[i__];
00239
00240 }
00241 for (i__ = *n - 1; i__ >= 1; --i__) {
00242 if (ipiv[i__] == i__) {
00243 b[i__ + j * b_dim1] -= dl[i__] * b[i__ + 1 + j *
00244 b_dim1];
00245 } else {
00246 temp = b[i__ + 1 + j * b_dim1];
00247 b[i__ + 1 + j * b_dim1] = b[i__ + j * b_dim1] - dl[
00248 i__] * temp;
00249 b[i__ + j * b_dim1] = temp;
00250 }
00251
00252 }
00253
00254 }
00255 }
00256 }
00257
00258
00259
00260 return 0;
00261 }