Mercurial > octave
comparison scripts/general/integral.m @ 24159:c4dac7a0da7e
integral.m: Remove specific code to preserve single type.
* integral.m: Remove code to cast output to single, now that all underlying
quadrature routines correctly return a single output when any input is single.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 19 Oct 2017 08:14:52 -0700 |
parents | 47dd094a6239 |
children | 194eb4bd202b |
comparison
equal
deleted
inserted
replaced
24158:f9549e90d620 | 24159:c4dac7a0da7e |
---|---|
107 if (nargin < 3 || (mod (nargin, 2) == 0)) | 107 if (nargin < 3 || (mod (nargin, 2) == 0)) |
108 print_usage (); | 108 print_usage (); |
109 endif | 109 endif |
110 | 110 |
111 if (nargin == 3) | 111 if (nargin == 3) |
112 issingle = isa (a, "single") || isa (b, "single"); | |
113 ## Pass the simplest case directly to general integrator. | 112 ## Pass the simplest case directly to general integrator. |
114 ## Let quadcc function handle input checks on function and limits. | 113 ## Let quadcc function handle input checks on function and limits. |
115 q = quadcc (f, a, b); | 114 q = quadcc (f, a, b); |
116 else | 115 else |
117 ## Parse options to determine how to call integrator. | 116 ## Parse options to determine how to call integrator. |
143 | 142 |
144 issingle = (isa (a, "single") || isa (b, "single") | 143 issingle = (isa (a, "single") || isa (b, "single") |
145 || isa (waypoints, "single")); | 144 || isa (waypoints, "single")); |
146 | 145 |
147 if (arrayvalued) | 146 if (arrayvalued) |
148 ## Pass vector valued function to quadv, checking for conflicting params | 147 ## Pass vector-valued function to quadv, checking for conflicting params |
149 | 148 |
150 ## FIXME: Replace warning when have array compatible call with waypoints | 149 ## FIXME: Replace warning when have array compatible call with waypoints |
151 if (! isempty (waypoints)) | 150 if (! isempty (waypoints)) |
152 warning(["integral: array-valued quadrature routine currently ", ... | 151 warning(["integral: array-valued quadrature routine currently ", ... |
153 "unable to handle WayPoints. WayPoints are ignored."]); | 152 "unable to handle WayPoints. WayPoints are ignored."]); |
177 "WayPoints", waypoints); | 176 "WayPoints", waypoints); |
178 else | 177 else |
179 q = quadcc (f, a, b, [abstol, reltol]); | 178 q = quadcc (f, a, b, [abstol, reltol]); |
180 endif | 179 endif |
181 endif | 180 endif |
182 endif | |
183 | |
184 ## Preserve type single for output which quadcc may have discarded | |
185 if (issingle) | |
186 q = single (q); | |
187 endif | 181 endif |
188 | 182 |
189 endfunction | 183 endfunction |
190 | 184 |
191 | 185 |