comparison scripts/general/quadgk.m @ 20652:a3b9ee5c040a

Replace bsxfun with broadcasting for performance with complex inputs (bug #38628). cumtrapz.m, quadgk.m, trapz.m, center.m, zscore.m: Replace bsxfun with broadcasting for performance where inputs might be complex.
author Rik <rik@octave.org>
date Mon, 12 Oct 2015 21:28:32 -0700
parents 7503499a252b
children
comparison
equal deleted inserted replaced
20651:e54ecb33727e 20652:a3b9ee5c040a
418 0.3818300505051889e+00, 0.2797053914892767e+00, ... 418 0.3818300505051889e+00, 0.2797053914892767e+00, ...
419 0.1294849661688697e+00]); 419 0.1294849661688697e+00]);
420 420
421 halfwidth = diff (subs, [], 2) ./ 2; 421 halfwidth = diff (subs, [], 2) ./ 2;
422 center = sum (subs, 2) ./ 2;; 422 center = sum (subs, 2) ./ 2;;
423 x = bsxfun (@plus, halfwidth * abscissa, center); 423 x = (halfwidth * abscissa) + center;
424 y = reshape (f (x(:)), size (x)); 424 y = reshape (f (x(:)), size (x));
425 425
426 ## This is faster than using bsxfun as the * operator can use a 426 ## This is faster than using bsxfun as the * operator can use a
427 ## single BLAS call, rather than rows(sub) calls to the @times 427 ## single BLAS call, rather than rows(sub) calls to the @times
428 ## function. 428 ## function.