Mercurial > hg > octave-nkf
diff liboctave/bsxfun-defs.cc @ 9827:c15a5ed0da58
optimize bsxfun (@power, ...)
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 18 Nov 2009 12:03:07 +0100 |
parents | 7bda650b691a |
children | 36ea14c8992d |
line wrap: on
line diff
--- a/liboctave/bsxfun-defs.cc +++ b/liboctave/bsxfun-defs.cc @@ -117,6 +117,8 @@ OCTAVE_LOCAL_BUFFER_INIT (octave_idx_type, idx, nd, 0); for (octave_idx_type iter = 0; iter < niter; iter++) { + OCTAVE_QUIT; + // Compute indices. // FIXME: performance impact noticeable? octave_idx_type xidx = cdvx.cum_compute_index (idx); @@ -141,6 +143,9 @@ #define BSXFUN_OP_DEF(OP, ARRAY) \ ARRAY bsxfun_ ## OP (const ARRAY& x, const ARRAY& y) +#define BSXFUN_OP2_DEF(OP, ARRAY, ARRAY1, ARRAY2) \ +ARRAY bsxfun_ ## OP (const ARRAY1& x, const ARRAY2& y) + #define BSXFUN_REL_DEF(OP, ARRAY) \ boolNDArray bsxfun_ ## OP (const ARRAY& x, const ARRAY& y) @@ -148,6 +153,10 @@ BSXFUN_OP_DEF(OP, ARRAY) \ { return do_bsxfun_op<ARRAY, ARRAY, ARRAY> (x, y, LOOP, LOOP, LOOP); } +#define BSXFUN_OP2_DEF_MXLOOP(OP, ARRAY, ARRAY1, ARRAY2, LOOP) \ + BSXFUN_OP2_DEF(OP, ARRAY, ARRAY1, ARRAY2) \ + { return do_bsxfun_op<ARRAY, ARRAY1, ARRAY2> (x, y, LOOP, LOOP, LOOP); } + #define BSXFUN_REL_DEF_MXLOOP(OP, ARRAY, LOOP) \ BSXFUN_REL_DEF(OP, ARRAY) \ { return do_bsxfun_op<boolNDArray, ARRAY, ARRAY> (x, y, LOOP, LOOP, LOOP); }