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 integer c__1 = 1;
00020 static integer c__0 = 0;
00021
00022 int zqrt13_(integer *scale, integer *m, integer *n,
00023 doublecomplex *a, integer *lda, doublereal *norma, integer *iseed)
00024 {
00025
00026 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
00027 doublereal d__1, d__2, d__3;
00028 doublecomplex z__1, z__2;
00029
00030
00031 double d_sign(doublereal *, doublereal *);
00032
00033
00034 integer j, info;
00035 doublereal dummy[1];
00036 extern int dlabad_(doublereal *, doublereal *);
00037 extern doublereal dlamch_(char *), zlange_(char *, integer *,
00038 integer *, doublecomplex *, integer *, doublereal *);
00039 doublereal bignum;
00040 extern int zlascl_(char *, integer *, integer *,
00041 doublereal *, doublereal *, integer *, integer *, doublecomplex *,
00042 integer *, integer *);
00043 extern doublereal dzasum_(integer *, doublecomplex *, integer *);
00044 doublereal smlnum;
00045 extern int zlarnv_(integer *, integer *, integer *,
00046 doublecomplex *);
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 a_dim1 = *lda;
00108 a_offset = 1 + a_dim1;
00109 a -= a_offset;
00110 --iseed;
00111
00112
00113 if (*m <= 0 || *n <= 0) {
00114 return 0;
00115 }
00116
00117
00118
00119 i__1 = *n;
00120 for (j = 1; j <= i__1; ++j) {
00121 zlarnv_(&c__2, &iseed[1], m, &a[j * a_dim1 + 1]);
00122 if (j <= *m) {
00123 i__2 = j + j * a_dim1;
00124 i__3 = j + j * a_dim1;
00125 d__2 = dzasum_(m, &a[j * a_dim1 + 1], &c__1);
00126 i__4 = j + j * a_dim1;
00127 d__3 = a[i__4].r;
00128 d__1 = d_sign(&d__2, &d__3);
00129 z__2.r = d__1, z__2.i = 0.;
00130 z__1.r = a[i__3].r + z__2.r, z__1.i = a[i__3].i + z__2.i;
00131 a[i__2].r = z__1.r, a[i__2].i = z__1.i;
00132 }
00133
00134 }
00135
00136
00137
00138 if (*scale != 1) {
00139 *norma = zlange_("Max", m, n, &a[a_offset], lda, dummy);
00140 smlnum = dlamch_("Safe minimum");
00141 bignum = 1. / smlnum;
00142 dlabad_(&smlnum, &bignum);
00143 smlnum /= dlamch_("Epsilon");
00144 bignum = 1. / smlnum;
00145
00146 if (*scale == 2) {
00147
00148
00149
00150 zlascl_("General", &c__0, &c__0, norma, &bignum, m, n, &a[
00151 a_offset], lda, &info);
00152 } else if (*scale == 3) {
00153
00154
00155
00156 zlascl_("General", &c__0, &c__0, norma, &smlnum, m, n, &a[
00157 a_offset], lda, &info);
00158 }
00159 }
00160
00161 *norma = zlange_("One-norm", m, n, &a[a_offset], lda, dummy);
00162 return 0;
00163
00164
00165
00166 }