Defines | Functions

ops.h File Reference

#include "Array-util.h"
Include dependency graph for ops.h:

Go to the source code of this file.

Defines

#define ASSIGNANYOPDECL(name)
#define ASSIGNOPDECL(name)
#define BINOP_NONCONFORMANT(msg)
#define BINOPDECL(name, a1, a2)
#define CAST_BINOP_ARGS(t1, t2)
#define CAST_CONV_ARG(t)   t v = dynamic_cast<t> (a)
#define CAST_UNOP_ARG(t)   t v = dynamic_cast<t> (a)
#define CATOP_NONCONFORMANT(msg)
#define CATOPDECL(name, a1, a2)
#define CONCAT2(x, y)   CONCAT2X(x,y)
#define CONCAT2X(x, y)   x ## y
#define CONCAT3(x, y, z)   CONCAT3X(x,y,z)
#define CONCAT3X(x, y, z)   x ## y ## z
#define CONVDECL(name)
#define CONVDECLX(name)
#define DEFASSIGNANYOP_FN(name, t1, f)
#define DEFASSIGNOP(name, t1, t2)   ASSIGNOPDECL (name)
#define DEFASSIGNOP_FN(name, t1, t2, f)
#define DEFBINOP(name, t1, t2)   BINOPDECL (name, a1, a2)
#define DEFBINOP_FN(name, t1, t2, f)
#define DEFBINOP_OP(name, t1, t2, op)
#define DEFBINOPX(name, t1, t2)   BINOPDECL (name, , )
#define DEFCATOP(name, t1, t2)   CATOPDECL (name, a1, a2)
#define DEFCATOP_FN(name, t1, t2, f)
#define DEFCATOPX(name, t1, t2)   CATOPDECL (name, , )
#define DEFCMPLXCMPOP_OP(name, t1, t2, op)
#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)
#define DEFCONVFNX2(name, tfrom, ovtto, e)
#define DEFDBLCONVFN(name, ovtfrom, e)
#define DEFFLTCONVFN(name, ovtfrom, e)
#define DEFNCUNOP_METHOD(name, t, method)
#define DEFNDASSIGNOP_FN(name, t1, t2, e, f)
#define DEFNDASSIGNOP_FNOP(name, t1, t2, f, fnop)
#define DEFNDASSIGNOP_OP(name, t1, t2, f, op)
#define DEFNDBINOP_FN(name, t1, t2, e1, e2, f)
#define DEFNDBINOP_OP(name, t1, t2, e1, e2, op)
#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f)
#define DEFNDCATOP_FN2(name, t1, t2, tc1, tc2, e1, e2, f)
#define DEFNDCHARCATOP_FN(name, t1, t2, f)
#define DEFNDCMPLXCMPOP_FN(name, t1, t2, e1, e2, f)
#define DEFNDUNOP_FN(name, t, e, f)
#define DEFNDUNOP_OP(name, t, e, op)
#define DEFNULLASSIGNOP_FN(name, t, f)
#define DEFSCALARBOOLOP_OP(name, t1, t2, op)
#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, t)   UNOPDECL (name, a)
#define DEFUNOP_FN(name, t, f)
#define DEFUNOP_OP(name, t, op)
#define DEFUNOPX(name, t)   UNOPDECL (name, , )
#define INSTALL_ASSIGNANYOP(op, t1, f)
#define INSTALL_ASSIGNCONV(t1, t2, tr)
#define INSTALL_ASSIGNOP(op, t1, t2, f)
#define INSTALL_BINOP(op, t1, t2, f)
#define INSTALL_CATOP(t1, t2, f)
#define INSTALL_CONVOP(t1, t2, f)
#define INSTALL_NCUNOP(op, t, f)
#define INSTALL_UNOP(op, t, f)
#define INSTALL_WIDENOP(t1, t2, f)
#define NULLASSIGNOPDECL(name)
#define UNOPDECL(name, a)

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)

Definition at line 98 of file ops.h.

#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)

Definition at line 86 of file ops.h.

#define BINOP_NONCONFORMANT (   msg  ) 
Value:
gripe_nonconformant (msg, \
                       a1.rows (), a1.columns (), \
                       a2.rows (), a2.columns ()); \
  return octave_value ()

Definition at line 344 of file ops.h.

#define BINOPDECL (   name,
  a1,
  a2 
)
Value:
static octave_value \
  CONCAT2(oct_binop_, name) (const octave_base_value& a1, const octave_base_value& a2)

Definition at line 272 of file ops.h.

#define CAST_BINOP_ARGS (   t1,
  t2 
)
Value:
t1 v1 = dynamic_cast<t1> (a1);                \
  t2 v2 = dynamic_cast<t2> (a2)

Definition at line 79 of file ops.h.

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

Definition at line 76 of file ops.h.

Referenced by DEFUNOP(), and UNOPDECL().

#define CATOP_NONCONFORMANT (   msg  ) 
Value:
gripe_nonconformant (msg, \
                       a1.rows (), a1.columns (), \
                       a2.rows (), a2.columns ()); \
  return octave_value ()

Definition at line 397 of file ops.h.

#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)

Definition at line 350 of file ops.h.

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

Definition at line 31 of file ops.h.

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

Definition at line 30 of file ops.h.

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

Definition at line 34 of file ops.h.

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

Definition at line 33 of file ops.h.

#define CONVDECL (   name  ) 
Value:
static octave_base_value * \
  CONCAT2(oct_conv_, name) (const octave_base_value& a)

Definition at line 166 of file ops.h.

#define CONVDECLX (   name  ) 
Value:
static octave_base_value * \
  CONCAT2(oct_conv_, name) (const octave_base_value&)

Definition at line 170 of file ops.h.

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

Definition at line 157 of file ops.h.

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

Definition at line 104 of file ops.h.

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

Definition at line 107 of file ops.h.

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

Definition at line 279 of file ops.h.

#define DEFBINOP_FN (   name,
  t1,
  t2,
  f 
)
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) ())); \
  }

Definition at line 323 of file ops.h.

#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) ()); \
  }

Definition at line 282 of file ops.h.

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

Definition at line 276 of file ops.h.

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

Definition at line 358 of file ops.h.

#define DEFCATOP_FN (   name,
  t1,
  t2,
  f 
)
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)); \
  }

Definition at line 363 of file ops.h.

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

Definition at line 355 of file ops.h.

#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) ()); \
  }

Definition at line 290 of file ops.h.

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

Definition at line 174 of file ops.h.

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

Definition at line 218 of file ops.h.

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

Definition at line 221 of file ops.h.

#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) ())); \
  }

Definition at line 177 of file ops.h.

#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) ()); \
  }

Definition at line 185 of file ops.h.

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

Definition at line 193 of file ops.h.

#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) ())); \
  }

Definition at line 201 of file ops.h.

#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 (); \
  }

Definition at line 264 of file ops.h.

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

Definition at line 125 of file ops.h.

#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 (); \
  }

Definition at line 146 of file ops.h.

#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 (); \
  }

Definition at line 135 of file ops.h.

#define DEFNDBINOP_FN (   name,
  t1,
  t2,
  e1,
  e2,
  f 
)
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) ())); \
  }

Definition at line 330 of file ops.h.

#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) ()); \
  }

Definition at line 313 of file ops.h.

#define DEFNDCATOP_FN (   name,
  t1,
  t2,
  e1,
  e2,
  f 
)
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)); \
  }

Definition at line 370 of file ops.h.

#define DEFNDCATOP_FN2 (   name,
  t1,
  t2,
  tc1,
  tc2,
  e1,
  e2,
  f 
)
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)); \
  }

Definition at line 390 of file ops.h.

#define DEFNDCHARCATOP_FN (   name,
  t1,
  t2,
  f 
)
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 ()) \
                          ? '\'' : '"')); \
  }

Definition at line 377 of file ops.h.

#define DEFNDCMPLXCMPOP_FN (   name,
  t1,
  t2,
  e1,
  e2,
  f 
)
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) ())); \
  }

Definition at line 337 of file ops.h.

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

Definition at line 257 of file ops.h.

#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) ()); \
  }

Definition at line 241 of file ops.h.

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

Definition at line 116 of file ops.h.

#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) ())) \
      { \
        gripe_nan_to_logical_conversion (); \
        return octave_value (); \
      } \
    else \
      return octave_value \
        (v1.CONCAT2(t1, _value) () op v2.CONCAT2(t2, _value) ()); \
  }

Definition at line 299 of file ops.h.

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

Definition at line 212 of file ops.h.

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

Definition at line 215 of file ops.h.

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

Definition at line 209 of file ops.h.

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

Definition at line 231 of file ops.h.

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

Definition at line 250 of file ops.h.

#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) ()); \
  }

Definition at line 234 of file ops.h.

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

Definition at line 228 of file ops.h.

#define INSTALL_ASSIGNANYOP (   op,
  t1,
  f 
)
Value:
octave_value_typeinfo::register_assignany_op \
    (octave_value::op, t1::static_type_id (), CONCAT2(oct_assignop_, f));

Definition at line 60 of file ops.h.

Referenced by install_cell_ops().

#define INSTALL_ASSIGNCONV (   t1,
  t2,
  tr 
)
#define INSTALL_ASSIGNOP (   op,
  t1,
  t2,
  f 
)
#define INSTALL_BINOP (   op,
  t1,
  t2,
  f 
)
#define INSTALL_CATOP (   t1,
  t2,
  f 
)
#define INSTALL_CONVOP (   t1,
  t2,
  f 
)
#define INSTALL_NCUNOP (   op,
  t,
  f 
)
#define INSTALL_UNOP (   op,
  t,
  f 
)
#define INSTALL_WIDENOP (   t1,
  t2,
  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&)

Definition at line 92 of file ops.h.

#define UNOPDECL (   name,
  a 
)
Value:
static octave_value \
  CONCAT2(oct_unop_, name) (const octave_base_value& a)

Definition at line 224 of file ops.h.


Function Documentation

void install_ops ( void   ) 

Referenced by octave_main().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines