Navigation

Operators and Keywords

Function List:

C++ API

ops.h File Reference

#include "Array-util.h"

Include dependency graph for ops.h:

Go to the source code of this file.


Defines

#define octave_ops_h   1
#define CONCAT2X(x, y)   x ## y
#define CONCAT2(x, y)   CONCAT2X(x,y)
#define CONCAT3X(x, y, z)   x ## y ## z
#define CONCAT3(x, y, z)   CONCAT3X(x,y,z)
#define INSTALL_UNOP(op, t, f)
#define INSTALL_NCUNOP(op, t, f)
#define INSTALL_BINOP(op, t1, t2, f)
#define INSTALL_CATOP(t1, t2, f)
#define INSTALL_ASSIGNOP(op, t1, t2, f)
#define INSTALL_ASSIGNANYOP(op, t1, f)
#define INSTALL_ASSIGNCONV(t1, t2, tr)
#define INSTALL_CONVOP(t1, t2, f)
#define INSTALL_WIDENOP(t1, t2, f)
#define CAST_UNOP_ARG(t)   t v = dynamic_cast<t> (a)
#define CAST_BINOP_ARGS(t1, t2)
#define CAST_CONV_ARG(t)   t v = dynamic_cast<t> (a)
#define ASSIGNOPDECL(name)
#define NULLASSIGNOPDECL(name)
#define ASSIGNANYOPDECL(name)
#define DEFASSIGNOP(name, t1, t2)   ASSIGNOPDECL (name)
#define DEFASSIGNOP_FN(name, t1, t2, f)
#define DEFNULLASSIGNOP_FN(name, t, f)
#define DEFNDASSIGNOP_FN(name, t1, t2, e, f)
#define DEFNDASSIGNOP_OP(name, t1, t2, f, op)
#define DEFNDASSIGNOP_FNOP(name, t1, t2, f, fnop)
#define DEFASSIGNANYOP_FN(name, t1, f)
#define CONVDECL(name)
#define CONVDECLX(name)
#define DEFCONV(name, a_dummy, b_dummy)   CONVDECL (name)
#define DEFCONVFNX(name, tfrom, ovtto, tto, e)
#define DEFCONVFNX2(name, tfrom, ovtto, e)
#define DEFDBLCONVFN(name, ovtfrom, e)
#define DEFFLTCONVFN(name, ovtfrom, e)
#define DEFSTRINTCONVFN(name, tto)   DEFCONVFNX(name, char_matrix_str, CONCAT2(tto, _matrix), tto, char_)
#define DEFSTRDBLCONVFN(name, tfrom)   DEFCONVFNX(name, tfrom, matrix, , char_)
#define DEFSTRFLTCONVFN(name, tfrom)   DEFCONVFNX(name, tfrom, float_matrix, Float, char_)
#define DEFCONVFN(name, tfrom, tto)   DEFCONVFNX2 (name, tfrom, CONCAT2(tto, _matrix), CONCAT2(tto, _))
#define DEFCONVFN2(name, tfrom, sm, tto)   DEFCONVFNX2 (name, CONCAT3(tfrom, _, sm), CONCAT2(tto, _matrix), CONCAT2(tto, _))
#define UNOPDECL(name, a)
#define DEFUNOPX(name, t)   UNOPDECL (name, , )
#define DEFUNOP(name, t)   UNOPDECL (name, a)
#define DEFUNOP_OP(name, t, op)
#define DEFNDUNOP_OP(name, t, e, op)
#define DEFUNOP_FN(name, t, f)
#define DEFNDUNOP_FN(name, t, e, f)
#define DEFNCUNOP_METHOD(name, t, method)
#define BINOPDECL(name, a1, a2)
#define DEFBINOPX(name, t1, t2)   BINOPDECL (name, , )
#define DEFBINOP(name, t1, t2)   BINOPDECL (name, a1, a2)
#define DEFBINOP_OP(name, t1, t2, op)
#define DEFCMPLXCMPOP_OP(name, t1, t2, op)
#define DEFSCALARBOOLOP_OP(name, t1, t2, op)
#define DEFNDBINOP_OP(name, t1, t2, e1, e2, op)
#define DEFBINOP_FN(name, t1, t2, f)
#define DEFNDBINOP_FN(name, t1, t2, e1, e2, f)
#define DEFNDCMPLXCMPOP_FN(name, t1, t2, e1, e2, f)
#define BINOP_NONCONFORMANT(msg)
#define CATOPDECL(name, a1, a2)
#define DEFCATOPX(name, t1, t2)   CATOPDECL (name, , )
#define DEFCATOP(name, t1, t2)   CATOPDECL (name, a1, a2)
#define DEFCATOP_FN(name, t1, t2, f)
#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f)
#define DEFNDCHARCATOP_FN(name, t1, t2, f)
#define DEFNDCATOP_FN2(name, t1, t2, tc1, tc2, e1, e2, f)
#define CATOP_NONCONFORMANT(msg)

Functions

void install_ops (void)

Define Documentation

#define ASSIGNANYOPDECL ( name   ) 

Value:

static octave_value \
  CONCAT2(oct_assignop_, name) (octave_base_value& a1, \
                         const octave_value_list& idx, \
                         const octave_value& a2)

#define ASSIGNOPDECL ( name   ) 

Value:

static octave_value \
  CONCAT2(oct_assignop_, name) (octave_base_value& a1, \
                         const octave_value_list& idx, \
                         const octave_base_value& a2)

#define BINOP_NONCONFORMANT ( msg   ) 

Value:

gripe_nonconformant (msg, \
                       a1.rows (), a1.columns (), \
                       a2.rows (), a2.columns ()); \
  return octave_value ()

#define BINOPDECL ( name,
a1,
a2   ) 

Value:

static octave_value \
  CONCAT2(oct_binop_, name) (const octave_base_value& a1, const octave_base_value& a2)

#define CAST_BINOP_ARGS ( t1,
t2   ) 

Value:

t1 v1 = dynamic_cast<t1> (a1);          \
  t2 v2 = dynamic_cast<t2> (a2)

#define CAST_CONV_ARG (  )     t v = dynamic_cast<t> (a)

#define CAST_UNOP_ARG (  )     t v = dynamic_cast<t> (a)

#define CATOP_NONCONFORMANT ( msg   ) 

Value:

gripe_nonconformant (msg, \
                       a1.rows (), a1.columns (), \
                       a2.rows (), a2.columns ()); \
  return octave_value ()

#define CATOPDECL ( name,
a1,
a2   ) 

Value:

static octave_value \
  CONCAT2(oct_catop_, name) (octave_base_value& a1, const octave_base_value& a2, \
                      const Array<octave_idx_type>& ra_idx)

#define CONCAT2 ( x,
 )     CONCAT2X(x,y)

#define CONCAT2X ( x,
 )     x ## y

#define CONCAT3 ( x,
y,
 )     CONCAT3X(x,y,z)

#define CONCAT3X ( x,
y,
 )     x ## y ## z

#define CONVDECL ( name   ) 

Value:

static octave_base_value * \
  CONCAT2(oct_conv_, name) (const octave_base_value& a)

#define CONVDECLX ( name   ) 

Value:

static octave_base_value * \
  CONCAT2(oct_conv_, name) (const octave_base_value&)

#define DEFASSIGNANYOP_FN ( name,
t1,
 ) 

Value:

ASSIGNANYOPDECL (name) \
  { \
    CONCAT2(octave_, t1)& v1 = dynamic_cast<CONCAT2(octave_, t1)&> (a1); \
 \
    v1.f (idx, a2); \
    return octave_value (); \
  }

#define DEFASSIGNOP ( name,
t1,
t2   )     ASSIGNOPDECL (name)

#define DEFASSIGNOP_FN ( name,
t1,
t2,
 ) 

Value:

ASSIGNOPDECL (name) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
 \
    v1.f (idx, v2.CONCAT2(t1, _value) ()); \
    return octave_value (); \
  }

#define DEFBINOP ( name,
t1,
t2   )     BINOPDECL (name, a1, a2)

#define DEFBINOP_FN ( name,
t1,
t2,
 ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value (f (v1.CONCAT2(t1, _value) (), v2.CONCAT2(t2, _value) ())); \
  }

#define DEFBINOP_OP ( name,
t1,
t2,
op   ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value \
      (v1.CONCAT2(t1, _value) () op v2.CONCAT2(t2, _value) ()); \
  }

#define DEFBINOPX ( name,
t1,
t2   )     BINOPDECL (name, , )

#define DEFCATOP ( name,
t1,
t2   )     CATOPDECL (name, a1, a2)

#define DEFCATOP_FN ( name,
t1,
t2,
 ) 

Value:

CATOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value (v1.CONCAT2(t1, _value) () . f (v2.CONCAT2(t2, _value) (), ra_idx)); \
  }

#define DEFCATOPX ( name,
t1,
t2   )     CATOPDECL (name, , )

#define DEFCMPLXCMPOP_OP ( name,
t1,
t2,
op   ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    gripe_warn_complex_cmp (); \
    return octave_value \
      (v1.CONCAT2(t1, _value) () op v2.CONCAT2(t2, _value) ()); \
  }

#define DEFCONV ( name,
a_dummy,
b_dummy   )     CONVDECL (name)

#define DEFCONVFN ( name,
tfrom,
tto   )     DEFCONVFNX2 (name, tfrom, CONCAT2(tto, _matrix), CONCAT2(tto, _))

#define DEFCONVFN2 ( name,
tfrom,
sm,
tto   )     DEFCONVFNX2 (name, CONCAT3(tfrom, _, sm), CONCAT2(tto, _matrix), CONCAT2(tto, _))

#define DEFCONVFNX ( name,
tfrom,
ovtto,
tto,
e   ) 

Value:

CONVDECL (name) \
  { \
    CAST_CONV_ARG (const CONCAT2(octave_, tfrom)&); \
 \
    return new CONCAT2(octave_, ovtto) (CONCAT2(tto, NDArray) (v.CONCAT2(e, array_value) ())); \
  }

#define DEFCONVFNX2 ( name,
tfrom,
ovtto,
e   ) 

Value:

CONVDECL (name) \
  { \
    CAST_CONV_ARG (const CONCAT2(octave_, tfrom)&); \
 \
    return new CONCAT2(octave_, ovtto) (v.CONCAT2(e, array_value) ()); \
  }

#define DEFDBLCONVFN ( name,
ovtfrom,
e   ) 

Value:

CONVDECL (name) \
  { \
    CAST_CONV_ARG (const CONCAT2(octave_, ovtfrom)&); \
 \
    return new octave_matrix (NDArray (v.CONCAT2(e, _value) ())); \
  }

#define DEFFLTCONVFN ( name,
ovtfrom,
e   ) 

Value:

CONVDECL (name) \
  { \
    CAST_CONV_ARG (const CONCAT2(octave_, ovtfrom)&); \
 \
    return new octave_float_matrix (FloatNDArray (v.CONCAT2(e, _value) ())); \
  }

#define DEFNCUNOP_METHOD ( name,
t,
method   ) 

Value:

static void \
  CONCAT2(oct_unop_, name) (octave_base_value& a) \
  { \
    CAST_UNOP_ARG (CONCAT2(octave_, t)&); \
    v.method (); \
  }

#define DEFNDASSIGNOP_FN ( name,
t1,
t2,
e,
 ) 

Value:

ASSIGNOPDECL (name) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
 \
    v1.f (idx, v2.CONCAT2(e, _value) ()); \
    return octave_value (); \
  }

#define DEFNDASSIGNOP_FNOP ( name,
t1,
t2,
f,
fnop   ) 

Value:

ASSIGNOPDECL (name) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
 \
    assert (idx.empty ()); \
    fnop (v1.matrix_ref (), v2.CONCAT2(f, _value) ()); \
 \
    return octave_value (); \
  }

#define DEFNDASSIGNOP_OP ( name,
t1,
t2,
f,
op   ) 

Value:

ASSIGNOPDECL (name) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
 \
    assert (idx.empty ()); \
    v1.matrix_ref () op v2.CONCAT2(f, _value) (); \
 \
    return octave_value (); \
  }

#define DEFNDBINOP_FN ( name,
t1,
t2,
e1,
e2,
 ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value (f (v1.CONCAT2(e1, _value) (), v2.CONCAT2(e2, _value) ())); \
  }

#define DEFNDBINOP_OP ( name,
t1,
t2,
e1,
e2,
op   ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value \
      (v1.CONCAT2(e1, _value) () op v2.CONCAT2(e2, _value) ()); \
  }

#define DEFNDCATOP_FN ( name,
t1,
t2,
e1,
e2,
 ) 

Value:

CATOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value (v1.CONCAT2(e1, _value) () . f (v2.CONCAT2(e2, _value) (), ra_idx)); \
  }

#define DEFNDCATOP_FN2 ( name,
t1,
t2,
tc1,
tc2,
e1,
e2,
 ) 

Value:

CATOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value (tc1 (v1.CONCAT2(e1, _value) ()) . f (tc2 (v2.CONCAT2(e2, _value) ()), ra_idx)); \
  }

#define DEFNDCHARCATOP_FN ( name,
t1,
t2,
 ) 

Value:

CATOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
 \
    return octave_value (v1.char_array_value () . f (v2.char_array_value (), ra_idx), \
                         ((a1.is_sq_string () || a2.is_sq_string ()) \
                          ? '\'' : '"')); \
  }

#define DEFNDCMPLXCMPOP_FN ( name,
t1,
t2,
e1,
e2,
 ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    return octave_value (f (v1.CONCAT2(e1, _value) (), v2.CONCAT2(e2, _value) ())); \
  }

#define DEFNDUNOP_FN ( name,
t,
e,
 ) 

Value:

UNOPDECL (name, a) \
  { \
    CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \
    return octave_value (f (v.CONCAT2(e, _value) ())); \
  }

#define DEFNDUNOP_OP ( name,
t,
e,
op   ) 

Value:

UNOPDECL (name, a) \
  { \
    CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \
    return octave_value (op v.CONCAT2(e, _value) ()); \
  }

#define DEFNULLASSIGNOP_FN ( name,
t,
 ) 

Value:

NULLASSIGNOPDECL (name) \
  { \
    CAST_UNOP_ARG (CONCAT2(octave_, t)&); \
 \
    v.f (idx); \
    return octave_value (); \
  }

#define DEFSCALARBOOLOP_OP ( name,
t1,
t2,
op   ) 

Value:

BINOPDECL (name, a1, a2) \
  { \
    CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \
    if (xisnan (v1.CONCAT2(t1, _value) ()) || xisnan (v2.CONCAT2(t2, _value) ())) \
      { \
        error ("invalid conversion from NaN to logical"); \
        return octave_value (); \
      } \
    else \
      return octave_value \
        (v1.CONCAT2(t1, _value) () op v2.CONCAT2(t2, _value) ()); \
  }

#define DEFSTRDBLCONVFN ( name,
tfrom   )     DEFCONVFNX(name, tfrom, matrix, , char_)

#define DEFSTRFLTCONVFN ( name,
tfrom   )     DEFCONVFNX(name, tfrom, float_matrix, Float, char_)

#define DEFSTRINTCONVFN ( name,
tto   )     DEFCONVFNX(name, char_matrix_str, CONCAT2(tto, _matrix), tto, char_)

#define DEFUNOP ( name,
 )     UNOPDECL (name, a)

#define DEFUNOP_FN ( name,
t,
 ) 

Value:

UNOPDECL (name, a) \
  { \
    CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \
    return octave_value (f (v.CONCAT2(t, _value) ())); \
  }

#define DEFUNOP_OP ( name,
t,
op   ) 

Value:

UNOPDECL (name, a) \
  { \
    CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \
    return octave_value (op v.CONCAT2(t, _value) ()); \
  }

#define DEFUNOPX ( name,
 )     UNOPDECL (name, , )

#define INSTALL_ASSIGNANYOP ( op,
t1,
 ) 

Value:

octave_value_typeinfo::register_assignany_op \
    (octave_value::op, t1::static_type_id (), CONCAT2(oct_assignop_, f));

#define INSTALL_ASSIGNCONV ( t1,
t2,
tr   ) 

Value:

octave_value_typeinfo::register_pref_assign_conv \
    (t1::static_type_id (), t2::static_type_id (), tr::static_type_id ());

#define INSTALL_ASSIGNOP ( op,
t1,
t2,
 ) 

Value:

octave_value_typeinfo::register_assign_op \
    (octave_value::op, t1::static_type_id (), t2::static_type_id (), \
     CONCAT2(oct_assignop_, f));

#define INSTALL_BINOP ( op,
t1,
t2,
 ) 

Value:

octave_value_typeinfo::register_binary_op \
    (octave_value::op, t1::static_type_id (), t2::static_type_id (), \
     CONCAT2(oct_binop_, f));

#define INSTALL_CATOP ( t1,
t2,
 ) 

Value:

octave_value_typeinfo::register_cat_op \
    (t1::static_type_id (), t2::static_type_id (), CONCAT2(oct_catop_, f));

#define INSTALL_CONVOP ( t1,
t2,
 ) 

Value:

octave_value_typeinfo::register_type_conv_op \
    (t1::static_type_id (), t2::static_type_id (), CONCAT2(oct_conv_, f));

#define INSTALL_NCUNOP ( op,
t,
 ) 

Value:

#define INSTALL_UNOP ( op,
t,
 ) 

Value:

octave_value_typeinfo::register_unary_op \
    (octave_value::op, t::static_type_id (), CONCAT2(oct_unop_, f));

#define INSTALL_WIDENOP ( t1,
t2,
 ) 

Value:

octave_value_typeinfo::register_widening_op \
    (t1::static_type_id (), t2::static_type_id (), CONCAT2(oct_conv_, f));

#define NULLASSIGNOPDECL ( name   ) 

Value:

static octave_value \
  CONCAT2(oct_assignop_, name) (octave_base_value& a, \
                         const octave_value_list& idx, \
                         const octave_base_value&)

#define octave_ops_h   1

#define UNOPDECL ( name,
 ) 

Value:

static octave_value \
  CONCAT2(oct_unop_, name) (const octave_base_value& a)


Function Documentation

void install_ops ( void   )