Mercurial > hg > octave-lyh
comparison liboctave/CMatrix.cc @ 1321:64819a909ed7
[project @ 1995-08-22 05:39:43 by jwe]
author | jwe |
---|---|
date | Tue, 22 Aug 1995 05:41:48 +0000 |
parents | 611d403c7f3d |
children | 7eb93d12654c |
comparison
equal
deleted
inserted
replaced
1320:c9aecc02c6d4 | 1321:64819a909ed7 |
---|---|
906 F77_FCN (cffti, CFFTI) (npts, wsave); | 906 F77_FCN (cffti, CFFTI) (npts, wsave); |
907 | 907 |
908 for (int j = 0; j < nsamples; j++) | 908 for (int j = 0; j < nsamples; j++) |
909 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); | 909 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); |
910 | 910 |
911 for (j = 0; j < npts*nsamples; j++) | 911 for (int j = 0; j < npts*nsamples; j++) |
912 tmp_data[j] = tmp_data[j] / (double) npts; | 912 tmp_data[j] = tmp_data[j] / (double) npts; |
913 | 913 |
914 delete [] wsave; | 914 delete [] wsave; |
915 | 915 |
916 return ComplexMatrix (tmp_data, nr, nc); | 916 return ComplexMatrix (tmp_data, nr, nc); |
950 wsave = new Complex [nn]; | 950 wsave = new Complex [nn]; |
951 Complex *row = new Complex[npts]; | 951 Complex *row = new Complex[npts]; |
952 | 952 |
953 F77_FCN (cffti, CFFTI) (npts, wsave); | 953 F77_FCN (cffti, CFFTI) (npts, wsave); |
954 | 954 |
955 for (j = 0; j < nsamples; j++) | 955 for (int j = 0; j < nsamples; j++) |
956 { | 956 { |
957 for (int i = 0; i < npts; i++) | 957 for (int i = 0; i < npts; i++) |
958 row[i] = tmp_data[i*nr + j]; | 958 row[i] = tmp_data[i*nr + j]; |
959 | 959 |
960 F77_FCN (cfftf, CFFTF) (npts, row, wsave); | 960 F77_FCN (cfftf, CFFTF) (npts, row, wsave); |
961 | 961 |
962 for (i = 0; i < npts; i++) | 962 for (int i = 0; i < npts; i++) |
963 tmp_data[i*nr + j] = row[i]; | 963 tmp_data[i*nr + j] = row[i]; |
964 } | 964 } |
965 | 965 |
966 delete [] wsave; | 966 delete [] wsave; |
967 delete [] row; | 967 delete [] row; |
995 for (int j = 0; j < nsamples; j++) | 995 for (int j = 0; j < nsamples; j++) |
996 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); | 996 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); |
997 | 997 |
998 delete [] wsave; | 998 delete [] wsave; |
999 | 999 |
1000 for (j = 0; j < npts*nsamples; j++) | 1000 for (int j = 0; j < npts*nsamples; j++) |
1001 tmp_data[j] = tmp_data[j] / (double) npts; | 1001 tmp_data[j] = tmp_data[j] / (double) npts; |
1002 | 1002 |
1003 npts = nc; | 1003 npts = nc; |
1004 nsamples = nr; | 1004 nsamples = nr; |
1005 nn = 4*npts+15; | 1005 nn = 4*npts+15; |
1006 wsave = new Complex [nn]; | 1006 wsave = new Complex [nn]; |
1007 Complex *row = new Complex[npts]; | 1007 Complex *row = new Complex[npts]; |
1008 | 1008 |
1009 F77_FCN (cffti, CFFTI) (npts, wsave); | 1009 F77_FCN (cffti, CFFTI) (npts, wsave); |
1010 | 1010 |
1011 for (j = 0; j < nsamples; j++) | 1011 for (int j = 0; j < nsamples; j++) |
1012 { | 1012 { |
1013 for (int i = 0; i < npts; i++) | 1013 for (int i = 0; i < npts; i++) |
1014 row[i] = tmp_data[i*nr + j]; | 1014 row[i] = tmp_data[i*nr + j]; |
1015 | 1015 |
1016 F77_FCN (cfftb, CFFTB) (npts, row, wsave); | 1016 F77_FCN (cfftb, CFFTB) (npts, row, wsave); |
1017 | 1017 |
1018 for (i = 0; i < npts; i++) | 1018 for (int i = 0; i < npts; i++) |
1019 tmp_data[i*nr + j] = row[i] / (double) npts; | 1019 tmp_data[i*nr + j] = row[i] / (double) npts; |
1020 } | 1020 } |
1021 | 1021 |
1022 delete [] wsave; | 1022 delete [] wsave; |
1023 delete [] row; | 1023 delete [] row; |
1261 Complex *tmp_data = dup (data (), length ()); | 1261 Complex *tmp_data = dup (data (), length ()); |
1262 | 1262 |
1263 int nrr = m > n ? m : n; | 1263 int nrr = m > n ? m : n; |
1264 ComplexMatrix result (nrr, nrhs); | 1264 ComplexMatrix result (nrr, nrhs); |
1265 | 1265 |
1266 int i, j; | 1266 for (int j = 0; j < nrhs; j++) |
1267 for (j = 0; j < nrhs; j++) | 1267 for (int i = 0; i < m; i++) |
1268 for (i = 0; i < m; i++) | |
1269 result.elem (i, j) = b.elem (i, j); | 1268 result.elem (i, j) = b.elem (i, j); |
1270 | 1269 |
1271 Complex *presult = result.fortran_vec (); | 1270 Complex *presult = result.fortran_vec (); |
1272 | 1271 |
1273 int len_s = m < n ? m : n; | 1272 int len_s = m < n ? m : n; |
1287 | 1286 |
1288 F77_FCN (zgelss, ZGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, | 1287 F77_FCN (zgelss, ZGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, |
1289 rcond, rank, work, lwork, rwork, info); | 1288 rcond, rank, work, lwork, rwork, info); |
1290 | 1289 |
1291 ComplexMatrix retval (n, nrhs); | 1290 ComplexMatrix retval (n, nrhs); |
1292 for (j = 0; j < nrhs; j++) | 1291 for (int j = 0; j < nrhs; j++) |
1293 for (i = 0; i < n; i++) | 1292 for (int i = 0; i < n; i++) |
1294 retval.elem (i, j) = result.elem (i, j); | 1293 retval.elem (i, j) = result.elem (i, j); |
1295 | 1294 |
1296 delete [] tmp_data; | 1295 delete [] tmp_data; |
1297 delete [] s; | 1296 delete [] s; |
1298 delete [] work; | 1297 delete [] work; |
1335 Complex *tmp_data = dup (data (), length ()); | 1334 Complex *tmp_data = dup (data (), length ()); |
1336 | 1335 |
1337 int nrr = m > n ? m : n; | 1336 int nrr = m > n ? m : n; |
1338 ComplexColumnVector result (nrr); | 1337 ComplexColumnVector result (nrr); |
1339 | 1338 |
1340 int i; | 1339 for (int i = 0; i < m; i++) |
1341 for (i = 0; i < m; i++) | |
1342 result.elem (i) = b.elem (i); | 1340 result.elem (i) = b.elem (i); |
1343 | 1341 |
1344 Complex *presult = result.fortran_vec (); | 1342 Complex *presult = result.fortran_vec (); |
1345 | 1343 |
1346 int len_s = m < n ? m : n; | 1344 int len_s = m < n ? m : n; |
1360 | 1358 |
1361 F77_FCN (zgelss, ZGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, | 1359 F77_FCN (zgelss, ZGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, |
1362 rcond, rank, work, lwork, rwork, info); | 1360 rcond, rank, work, lwork, rwork, info); |
1363 | 1361 |
1364 ComplexColumnVector retval (n); | 1362 ComplexColumnVector retval (n); |
1365 for (i = 0; i < n; i++) | 1363 for (int i = 0; i < n; i++) |
1366 retval.elem (i) = result.elem (i); | 1364 retval.elem (i) = result.elem (i); |
1367 | 1365 |
1368 delete [] tmp_data; | 1366 delete [] tmp_data; |
1369 delete [] s; | 1367 delete [] s; |
1370 delete [] work; | 1368 delete [] work; |