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++)
82 r[
i] = f (x[
i], y[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)
121 p[
i] =
fcn (x, y[i]);
122 p[i+1] =
fcn (x, y[i+1]);
123 p[i+2] =
fcn (x, y[i+2]);
124 p[i+3] =
fcn (x, y[i+3]);
130 p[i] = fcn (x, y[i]);
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)
152 p[
i] =
fcn (x[i], y);
153 p[i+1] =
fcn (x[i+1], y);
154 p[i+2] =
fcn (x[i+2], y);
155 p[i+3] =
fcn (x[i+3], y);
161 p[i] = fcn (x[i], y);
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)
202 p[
i] =
fcn (x[i], y[i]);
203 p[i+1] =
fcn (x[i+1], y[i+1]);
204 p[i+2] =
fcn (x[i+2], y[i+2]);
205 p[i+3] =
fcn (x[i+3], y[i+3]);
211 p[i] = fcn (x[i], y[i]);
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); }
octave_idx_type cols(void) const
octave_idx_type rows(void) const
dim_vector dims(void) const
octave_idx_type numel(void) const
Number of elements in the array.
static void set_f(const F &f_in)
octave_idx_type * cidx(void)
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.
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup calculate Y_a and Y _d item Given Y
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
const T * data(void) const
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
With real return the complex result
Array< U > binmap(const T &x, const Array< R > &ya, F fcn)
N Dimensional Array with copy-on-write semantics.
static void op_mm(size_t n, R *r, const X *x, const Y *y)
octave_idx_type * ridx(void)
=val(i)}if ode{val(i)}occurs in table i
the element is set to zero In other the statement xample y
bool is_valid_bsxfun(const std::string &name, const dim_vector &dx, const dim_vector &dy)
Vector representing the dimensions (size) of an Array.
static void op_ms(size_t n, R *r, const X *x, Y y)
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &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))
Array< T > array_value(void) const
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)