Mercurial > octave
comparison liboctave/dMatrix.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 |
---|---|
634 F77_FCN (cffti, CFFTI) (npts, wsave); | 634 F77_FCN (cffti, CFFTI) (npts, wsave); |
635 | 635 |
636 for (int j = 0; j < nsamples; j++) | 636 for (int j = 0; j < nsamples; j++) |
637 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); | 637 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); |
638 | 638 |
639 for (j = 0; j < npts*nsamples; j++) | 639 for (int j = 0; j < npts*nsamples; j++) |
640 tmp_data[j] = tmp_data[j] / (double) npts; | 640 tmp_data[j] = tmp_data[j] / (double) npts; |
641 | 641 |
642 delete [] wsave; | 642 delete [] wsave; |
643 | 643 |
644 return ComplexMatrix (tmp_data, nr, nc); | 644 return ComplexMatrix (tmp_data, nr, nc); |
678 wsave = new Complex [nn]; | 678 wsave = new Complex [nn]; |
679 Complex *row = new Complex[npts]; | 679 Complex *row = new Complex[npts]; |
680 | 680 |
681 F77_FCN (cffti, CFFTI) (npts, wsave); | 681 F77_FCN (cffti, CFFTI) (npts, wsave); |
682 | 682 |
683 for (j = 0; j < nsamples; j++) | 683 for (int j = 0; j < nsamples; j++) |
684 { | 684 { |
685 for (int i = 0; i < npts; i++) | 685 for (int i = 0; i < npts; i++) |
686 row[i] = tmp_data[i*nr + j]; | 686 row[i] = tmp_data[i*nr + j]; |
687 | 687 |
688 F77_FCN (cfftf, CFFTF) (npts, row, wsave); | 688 F77_FCN (cfftf, CFFTF) (npts, row, wsave); |
689 | 689 |
690 for (i = 0; i < npts; i++) | 690 for (int i = 0; i < npts; i++) |
691 tmp_data[i*nr + j] = row[i]; | 691 tmp_data[i*nr + j] = row[i]; |
692 } | 692 } |
693 | 693 |
694 delete [] wsave; | 694 delete [] wsave; |
695 delete [] row; | 695 delete [] row; |
723 for (int j = 0; j < nsamples; j++) | 723 for (int j = 0; j < nsamples; j++) |
724 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); | 724 F77_FCN (cfftb, CFFTB) (npts, &tmp_data[npts*j], wsave); |
725 | 725 |
726 delete [] wsave; | 726 delete [] wsave; |
727 | 727 |
728 for (j = 0; j < npts*nsamples; j++) | 728 for (int j = 0; j < npts*nsamples; j++) |
729 tmp_data[j] = tmp_data[j] / (double) npts; | 729 tmp_data[j] = tmp_data[j] / (double) npts; |
730 | 730 |
731 npts = nc; | 731 npts = nc; |
732 nsamples = nr; | 732 nsamples = nr; |
733 nn = 4*npts+15; | 733 nn = 4*npts+15; |
734 wsave = new Complex [nn]; | 734 wsave = new Complex [nn]; |
735 Complex *row = new Complex[npts]; | 735 Complex *row = new Complex[npts]; |
736 | 736 |
737 F77_FCN (cffti, CFFTI) (npts, wsave); | 737 F77_FCN (cffti, CFFTI) (npts, wsave); |
738 | 738 |
739 for (j = 0; j < nsamples; j++) | 739 for (int j = 0; j < nsamples; j++) |
740 { | 740 { |
741 for (int i = 0; i < npts; i++) | 741 for (int i = 0; i < npts; i++) |
742 row[i] = tmp_data[i*nr + j]; | 742 row[i] = tmp_data[i*nr + j]; |
743 | 743 |
744 F77_FCN (cfftb, CFFTB) (npts, row, wsave); | 744 F77_FCN (cfftb, CFFTB) (npts, row, wsave); |
745 | 745 |
746 for (i = 0; i < npts; i++) | 746 for (int i = 0; i < npts; i++) |
747 tmp_data[i*nr + j] = row[i] / (double) npts; | 747 tmp_data[i*nr + j] = row[i] / (double) npts; |
748 } | 748 } |
749 | 749 |
750 delete [] wsave; | 750 delete [] wsave; |
751 delete [] row; | 751 delete [] row; |
1008 double *tmp_data = dup (data (), length ()); | 1008 double *tmp_data = dup (data (), length ()); |
1009 | 1009 |
1010 int nrr = m > n ? m : n; | 1010 int nrr = m > n ? m : n; |
1011 Matrix result (nrr, nrhs); | 1011 Matrix result (nrr, nrhs); |
1012 | 1012 |
1013 int i, j; | 1013 for (int j = 0; j < nrhs; j++) |
1014 for (j = 0; j < nrhs; j++) | 1014 for (int i = 0; i < m; i++) |
1015 for (i = 0; i < m; i++) | |
1016 result.elem (i, j) = b.elem (i, j); | 1015 result.elem (i, j) = b.elem (i, j); |
1017 | 1016 |
1018 double *presult = result.fortran_vec (); | 1017 double *presult = result.fortran_vec (); |
1019 | 1018 |
1020 int len_s = m < n ? m : n; | 1019 int len_s = m < n ? m : n; |
1030 | 1029 |
1031 F77_FCN (dgelss, DGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, | 1030 F77_FCN (dgelss, DGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, |
1032 rcond, rank, work, lwork, info); | 1031 rcond, rank, work, lwork, info); |
1033 | 1032 |
1034 Matrix retval (n, nrhs); | 1033 Matrix retval (n, nrhs); |
1035 for (j = 0; j < nrhs; j++) | 1034 for (int j = 0; j < nrhs; j++) |
1036 for (i = 0; i < n; i++) | 1035 for (int i = 0; i < n; i++) |
1037 retval.elem (i, j) = result.elem (i, j); | 1036 retval.elem (i, j) = result.elem (i, j); |
1038 | 1037 |
1039 delete [] tmp_data; | 1038 delete [] tmp_data; |
1040 delete [] s; | 1039 delete [] s; |
1041 delete [] work; | 1040 delete [] work; |
1096 double *tmp_data = dup (data (), length ()); | 1095 double *tmp_data = dup (data (), length ()); |
1097 | 1096 |
1098 int nrr = m > n ? m : n; | 1097 int nrr = m > n ? m : n; |
1099 ColumnVector result (nrr); | 1098 ColumnVector result (nrr); |
1100 | 1099 |
1101 int i; | 1100 for (int i = 0; i < m; i++) |
1102 for (i = 0; i < m; i++) | |
1103 result.elem (i) = b.elem (i); | 1101 result.elem (i) = b.elem (i); |
1104 | 1102 |
1105 double *presult = result.fortran_vec (); | 1103 double *presult = result.fortran_vec (); |
1106 | 1104 |
1107 int len_s = m < n ? m : n; | 1105 int len_s = m < n ? m : n; |
1117 | 1115 |
1118 F77_FCN (dgelss, DGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, | 1116 F77_FCN (dgelss, DGELSS) (m, n, nrhs, tmp_data, m, presult, nrr, s, |
1119 rcond, rank, work, lwork, info); | 1117 rcond, rank, work, lwork, info); |
1120 | 1118 |
1121 ColumnVector retval (n); | 1119 ColumnVector retval (n); |
1122 for (i = 0; i < n; i++) | 1120 for (int i = 0; i < n; i++) |
1123 retval.elem (i) = result.elem (i); | 1121 retval.elem (i) = result.elem (i); |
1124 | 1122 |
1125 delete [] tmp_data; | 1123 delete [] tmp_data; |
1126 delete [] s; | 1124 delete [] s; |
1127 delete [] work; | 1125 delete [] work; |