23 #if ! defined (octave_oct_binmap_h) 24 #define octave_oct_binmap_h 1 26 #include "octave-config.h" 65 template <
typename R,
typename X,
typename Y,
typename F>
79 op_mm (
size_t n, R *r,
const X *
x ,
const Y *
y)
81 for (
size_t i = 0;
i < n;
i++)
88 for (
size_t i = 0;
i < n;
i++)
95 for (
size_t i = 0;
i < n;
i++)
101 template <
typename R,
typename X,
typename Y,
typename F>
105 template <
typename U,
typename T,
typename R,
typename F>
111 const R *
y = ya.
data ();
117 for (
i = 0;
i < len - 3;
i += 4)
136 template <
typename U,
typename T,
typename R,
typename F>
142 const R *
x = xa.
data ();
148 for (
i = 0;
i < len - 3;
i += 4)
167 template <
typename U,
typename T,
typename R,
typename F>
173 if (xa.
numel () == 1)
174 return binmap<U, T, R, F> (xa(0), ya,
fcn);
175 else if (ya.
numel () == 1)
176 return binmap<U, T, R, F> (xa, ya(0),
fcn);
191 const T *
x = xa.
data ();
192 const T *
y = ya.
data ();
198 for (
i = 0;
i < len - 3;
i += 4)
217 template <
typename U,
typename T,
typename R,
typename F>
222 U fz =
fcn (
x, yzero);
240 retval.maybe_compress (
true);
248 template <
typename U,
typename T,
typename R,
typename F>
253 U fz =
fcn (xzero,
y);
271 retval.maybe_compress (
true);
279 template <
typename U,
typename T,
typename R,
typename F>
283 if (xs.
rows () == 1 && xs.
cols () == 1)
284 return binmap<U, T, R, F> (xs(0,0), ys,
fcn);
285 else if (ys.
rows () == 1 && ys.
cols () == 1)
286 return binmap<U, T, R, F> (xs, ys(0,0),
fcn);
292 U fz =
fcn (xzero, yzero);
308 bool jx_lt_max = jx < jx_max;
312 bool jy_lt_max = jy < jy_max;
314 while (jx_lt_max || jy_lt_max)
317 || (jx_lt_max && (xs.
ridx (jx) < ys.
ridx (jy))))
322 jx_lt_max = jx < jx_max;
325 || (jy_lt_max && (ys.
ridx (jy) < xs.
ridx (jx))))
330 jy_lt_max = jy < jy_max;
337 jx_lt_max = jx < jx_max;
339 jy_lt_max = jy < jy_max;
346 retval.maybe_compress (
true);
358 template <
typename U,
typename T,
typename R>
362 {
return binmap<U, T, R, U (*) (T, R)> (xa, ya,
fcn,
name); }
364 template <
typename U,
typename T,
typename R>
367 {
return binmap<U, T, R, U (*) (T, R)> (
x, ya,
fcn); }
369 template <
typename U,
typename T,
typename R>
372 {
return binmap<U, T, R, U (*) (T, R)> (xa,
y,
fcn); }
374 template <
typename U,
typename T,
typename R>
378 {
return binmap<U, T, R, U (*) (T, R)> (xa, ya,
fcn,
name); }
380 template <
typename U,
typename T,
typename R>
383 {
return binmap<U, T, R, U (*) (T, R)> (
x, ya,
fcn); }
385 template <
typename U,
typename T,
typename R>
388 {
return binmap<U, T, R, U (*) (T, R)> (xa,
y,
fcn); }
392 template <
typename U,
typename T,
typename R>
396 {
return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya,
fcn,
name); }
398 template <
typename U,
typename T,
typename R>
401 {
return binmap<U, T, R, U (*) (const T&, const R&)> (
x, ya,
fcn); }
403 template <
typename U,
typename T,
typename R>
406 {
return binmap<U, T, R, U (*) (const T&, const R&)> (xa,
y,
fcn); }
408 template <
typename U,
typename T,
typename R>
412 {
return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya,
fcn,
name); }
414 template <
typename U,
typename T,
typename R>
417 {
return binmap<U, T, R, U (*) (const T&, const R&)> (
x, ya,
fcn); }
419 template <
typename U,
typename T,
typename R>
422 {
return binmap<U, T, R, U (*) (const T&, const R&)> (xa,
y,
fcn); }
426 template <
typename U,
typename T,
typename R>
430 {
return binmap<U, T, R, U (*) (const T&, R)> (xa, ya,
fcn,
name); }
432 template <
typename U,
typename T,
typename R>
435 {
return binmap<U, T, R, U (*) (const T&, R)> (
x, ya,
fcn); }
437 template <
typename U,
typename T,
typename R>
440 {
return binmap<U, T, R, U (*) (const T&, R)> (xa,
y,
fcn); }
442 template <
typename U,
typename T,
typename R>
446 {
return binmap<U, T, R, U (*) (const T&, R)> (xa, ya,
fcn,
name); }
448 template <
typename U,
typename T,
typename R>
451 {
return binmap<U, T, R, U (*) (const T&, R)> (
x, ya,
fcn); }
453 template <
typename U,
typename T,
typename R>
456 {
return binmap<U, T, R, U (*) (const T&, R)> (xa,
y,
fcn); }
460 template <
typename U,
typename T,
typename R>
464 {
return binmap<U, T, R, U (*) (T, const R&)> (xa, ya,
fcn,
name); }
466 template <
typename U,
typename T,
typename R>
469 {
return binmap<U, T, R, U (*) (T, const R&)> (
x, ya,
fcn); }
471 template <
typename U,
typename T,
typename R>
474 {
return binmap<U, T, R, U (*) (T, const R&)> (xa,
y,
fcn); }
476 template <
typename U,
typename T,
typename R>
480 {
return binmap<U, T, R, U (*) (T, const R&)> (xa, ya,
fcn,
name); }
482 template <
typename U,
typename T,
typename R>
485 {
return binmap<U, T, R, U (*) (T, const R&)> (
x, ya,
fcn); }
487 template <
typename U,
typename T,
typename R>
490 {
return binmap<U, T, R, U (*) (T, const R&)> (xa,
y,
fcn); }
bool is_valid_bsxfun(const std::string &name, const dim_vector &xdv, const dim_vector &ydv)
const T * data(void) const
octave_idx_type * cidx(void)
static void set_f(const F &f_in)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
static void op_sm(size_t n, R *r, X x, const Y *y)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
nd deftypefn *std::string name
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
octave_idx_type * ridx(void)
Array< T > array_value(void) const
With real return the complex result
Array< U > binmap(const T &x, const Array< R > &ya, F fcn)
octave_idx_type cols(void) const
N Dimensional Array with copy-on-write semantics.
static void op_mm(size_t n, R *r, const X *x, const Y *y)
the element is set to zero In other the statement xample y
dim_vector dims(void) const
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
static void op_ms(size_t n, R *r, const X *x, Y y)
octave_idx_type rows(void) const
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
Array< R > do_bsxfun_op(const Array< X > &x, const Array< Y > &y, void(*op_vv)(size_t, R *, const X *, const Y *), void(*op_sv)(size_t, R *, X, const Y *), void(*op_vs)(size_t, R *, const X *, Y))
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)