Mercurial > hg > octave-nkf
comparison liboctave/Quad.cc @ 1935:23c350d0cf9d
[project @ 1996-02-12 04:03:05 by jwe]
author | jwe |
---|---|
date | Mon, 12 Feb 1996 04:03:05 +0000 |
parents | 1281a23a34dd |
children | 1b57120c997b |
comparison
equal
deleted
inserted
replaced
1934:0e591d443ff0 | 1935:23c350d0cf9d |
---|---|
80 DefQuad::integrate (int& ier, int& neval, double& abserr) | 80 DefQuad::integrate (int& ier, int& neval, double& abserr) |
81 { | 81 { |
82 int npts = singularities.capacity () + 2; | 82 int npts = singularities.capacity () + 2; |
83 double *points = singularities.fortran_vec (); | 83 double *points = singularities.fortran_vec (); |
84 double result = 0.0; | 84 double result = 0.0; |
85 | |
85 int leniw = 183*npts - 122; | 86 int leniw = 183*npts - 122; |
87 Array<int> iwork (leniw); | |
88 int *piwork = iwork.fortran_vec (); | |
89 | |
86 int lenw = 2*leniw - npts; | 90 int lenw = 2*leniw - npts; |
87 int *iwork = new int [leniw]; | 91 Array<double> work (lenw); |
88 double *work = new double [lenw]; | 92 double *pwork = work.fortran_vec (); |
93 | |
89 user_fcn = f; | 94 user_fcn = f; |
90 int last; | 95 int last; |
91 | 96 |
92 double abs_tol = absolute_tolerance (); | 97 double abs_tol = absolute_tolerance (); |
93 double rel_tol = relative_tolerance (); | 98 double rel_tol = relative_tolerance (); |
94 | 99 |
95 F77_FCN (dqagp, DQAGP) (user_function, lower_limit, upper_limit, | 100 F77_XFCN (dqagp, DQAGP, (user_function, lower_limit, upper_limit, |
96 npts, points, abs_tol, rel_tol, result, | 101 npts, points, abs_tol, rel_tol, result, |
97 abserr, neval, ier, leniw, lenw, last, | 102 abserr, neval, ier, leniw, lenw, last, |
98 iwork, work); | 103 piwork, pwork)); |
99 | 104 |
100 delete [] iwork; | 105 if (f77_exception_encountered) |
101 delete [] work; | 106 (*current_liboctave_error_handler) ("unrecoverable error in dqagp"); |
102 | 107 |
103 return result; | 108 return result; |
104 } | 109 } |
105 | 110 |
106 double | 111 double |
107 IndefQuad::integrate (int& ier, int& neval, double& abserr) | 112 IndefQuad::integrate (int& ier, int& neval, double& abserr) |
108 { | 113 { |
109 double result = 0.0; | 114 double result = 0.0; |
115 | |
110 int leniw = 128; | 116 int leniw = 128; |
117 Array<int> iwork (leniw); | |
118 int *piwork = iwork.fortran_vec (); | |
119 | |
111 int lenw = 8*leniw; | 120 int lenw = 8*leniw; |
112 int *iwork = new int [leniw]; | 121 Array<double> work (lenw); |
113 double *work = new double [lenw]; | 122 double *pwork = work.fortran_vec (); |
123 | |
114 user_fcn = f; | 124 user_fcn = f; |
115 int last; | 125 int last; |
116 | 126 |
117 int inf; | 127 int inf; |
118 switch (type) | 128 switch (type) |
135 } | 145 } |
136 | 146 |
137 double abs_tol = absolute_tolerance (); | 147 double abs_tol = absolute_tolerance (); |
138 double rel_tol = relative_tolerance (); | 148 double rel_tol = relative_tolerance (); |
139 | 149 |
140 F77_FCN (dqagi, DQAGI) (user_function, bound, inf, abs_tol, rel_tol, | 150 F77_XFCN (dqagi, DQAGI, (user_function, bound, inf, abs_tol, rel_tol, |
141 result, abserr, neval, ier, leniw, lenw, | 151 result, abserr, neval, ier, leniw, lenw, |
142 last, iwork, work); | 152 last, piwork, pwork)); |
143 | 153 |
144 delete [] iwork; | 154 if (f77_exception_encountered) |
145 delete [] work; | 155 (*current_liboctave_error_handler) ("unrecoverable error in dqagi"); |
146 | 156 |
147 return result; | 157 return result; |
148 } | 158 } |
149 | 159 |
150 /* | 160 /* |