GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
bsxfun.cc File Reference
#include <list>
#include <string>
#include <vector>
#include "lo-mappers.h"
#include "defun.h"
#include "interpreter.h"
#include "oct-map.h"
#include "ov-colon.h"
#include "ov-fcn-handle.h"
#include "parse.h"
#include "unwind-prot.h"
#include "variables.h"
Include dependency graph for bsxfun.cc:

Go to the source code of this file.

Macros

#define BSXDEF(T)
 
#define BSXEND(T)
 
#define BSXINIT(T, CLS, EXTRACTOR)
 
#define BSXLOOP(T, CLS, EXTRACTOR)
 
#define REGISTER_OP_HANDLER(OP, BTYP, NDA, FUNOP)    bsxfun_handler_table[OP][BTYP] = bsxfun_forward_op<NDA, FUNOP>
 
#define REGISTER_REL_HANDLER(REL, BTYP, NDA, FUNREL)    bsxfun_handler_table[REL][BTYP] = bsxfun_forward_rel<NDA, FUNREL>
 
#define REGISTER_STD_HANDLERS(BTYP, NDA)
 

Typedefs

typedef octave_value(* bsxfun_handler) (const octave_value &, const octave_value &)
 

Enumerations

enum  bsxfun_builtin_op {
  bsxfun_builtin_plus = 0 , bsxfun_builtin_minus , bsxfun_builtin_times , bsxfun_builtin_divide ,
  bsxfun_builtin_max , bsxfun_builtin_min , bsxfun_builtin_eq , bsxfun_builtin_ne ,
  bsxfun_builtin_lt , bsxfun_builtin_le , bsxfun_builtin_gt , bsxfun_builtin_ge ,
  bsxfun_builtin_and , bsxfun_builtin_or , bsxfun_builtin_power , bsxfun_builtin_unknown ,
  bsxfun_num_builtin_ops = bsxfun_builtin_unknown
}
 

Functions

static bsxfun_builtin_op bsxfun_builtin_lookup (const std::string &name)
 
template<typename NDA , NDA(bsxfun_op)(const NDA &, const NDA &) >
static octave_value bsxfun_forward_op (const octave_value &x, const octave_value &y)
 
template<typename NDA , boolNDArray(bsxfun_rel)(const NDA &, const NDA &) >
static octave_value bsxfun_forward_rel (const octave_value &x, const octave_value &y)
 
template<typename NDA , typename CNDA >
static octave_value do_bsxfun_real_pow (const octave_value &x, const octave_value &y)
 
OCTAVE_EXPORT octave_value_list Fbsxfun (octave::interpreter &interp, const octave_value_list &args, int)
 
static void maybe_fill_table (void)
 
static octave_value maybe_optimized_builtin (const std::string &name, const octave_value &a, const octave_value &b)
 
static bool maybe_update_column (octave_value &Ac, const octave_value &A, const dim_vector &dva, const dim_vector &dvc, octave_idx_type i, octave_value_list &idx)
 
static void update_index (Array< int > &idx, const dim_vector &dv, octave_idx_type i)
 

Variables

const char * bsxfun_builtin_names []
 
bsxfun_handler bsxfun_handler_table [bsxfun_num_builtin_ops][btyp_num_types]
 

Macro Definition Documentation

◆ BSXDEF

#define BSXDEF (   T)
Value:
T result_ ## T; \
bool have_ ## T = false;

◆ BSXEND

#define BSXEND (   T)
Value:
(have_ ## T) \
retval(0) = result_ ## T;

◆ BSXINIT

#define BSXINIT (   T,
  CLS,
  EXTRACTOR 
)
Value:
(result_type == CLS) \
{ \
have_ ## T = true; \
result_ ## T = tmp(0). EXTRACTOR ## _array_value (); \
result_ ## T .resize (dvc); \
}

◆ BSXLOOP

#define BSXLOOP (   T,
  CLS,
  EXTRACTOR 
)
Value:
(have_ ## T) \
{ \
if (tmp(0).class_name () != CLS) \
{ \
have_ ## T = false; \
C = result_ ## T; \
C = cat_op (C, tmp(0), ra_idx); \
} \
else \
result_ ## T .insert (tmp(0). EXTRACTOR ## _array_value (), ra_idx); \
}
#define C(a, b)
Definition: Faddeeva.cc:259
const octave_base_value const Array< octave_idx_type > & ra_idx
OCTINTERP_API octave_value cat_op(type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)

◆ REGISTER_OP_HANDLER

#define REGISTER_OP_HANDLER (   OP,
  BTYP,
  NDA,
  FUNOP 
)     bsxfun_handler_table[OP][BTYP] = bsxfun_forward_op<NDA, FUNOP>

◆ REGISTER_REL_HANDLER

#define REGISTER_REL_HANDLER (   REL,
  BTYP,
  NDA,
  FUNREL 
)     bsxfun_handler_table[REL][BTYP] = bsxfun_forward_rel<NDA, FUNREL>

◆ REGISTER_STD_HANDLERS

#define REGISTER_STD_HANDLERS (   BTYP,
  NDA 
)
Value:
REGISTER_OP_HANDLER (bsxfun_builtin_minus, BTYP, NDA, bsxfun_sub); \
REGISTER_OP_HANDLER (bsxfun_builtin_times, BTYP, NDA, bsxfun_mul); \
REGISTER_OP_HANDLER (bsxfun_builtin_divide, BTYP, NDA, bsxfun_div); \
REGISTER_OP_HANDLER (bsxfun_builtin_max, BTYP, NDA, bsxfun_max); \
REGISTER_OP_HANDLER (bsxfun_builtin_min, BTYP, NDA, bsxfun_min); \
REGISTER_REL_HANDLER (bsxfun_builtin_eq, BTYP, NDA, bsxfun_eq); \
REGISTER_REL_HANDLER (bsxfun_builtin_ne, BTYP, NDA, bsxfun_ne); \
REGISTER_REL_HANDLER (bsxfun_builtin_lt, BTYP, NDA, bsxfun_lt); \
REGISTER_REL_HANDLER (bsxfun_builtin_le, BTYP, NDA, bsxfun_le); \
REGISTER_REL_HANDLER (bsxfun_builtin_gt, BTYP, NDA, bsxfun_gt); \
REGISTER_REL_HANDLER (bsxfun_builtin_ge, BTYP, NDA, bsxfun_ge)
ComplexNDArray bsxfun_min(const ComplexNDArray &x, const ComplexNDArray &y)
Definition: CNDArray.cc:661
ComplexNDArray bsxfun_add(const ComplexNDArray &x, const ComplexNDArray &y)
Definition: CNDArray.cc:661
ComplexNDArray bsxfun_max(const ComplexNDArray &x, const ComplexNDArray &y)
Definition: CNDArray.cc:661
ComplexNDArray bsxfun_sub(const ComplexNDArray &x, const ComplexNDArray &y)
Definition: CNDArray.cc:661
ComplexNDArray bsxfun_div(const ComplexNDArray &x, const ComplexNDArray &y)
Definition: CNDArray.cc:661
ComplexNDArray bsxfun_mul(const ComplexNDArray &x, const ComplexNDArray &y)
Definition: CNDArray.cc:661
@ bsxfun_builtin_le
Definition: bsxfun.cc:57
@ bsxfun_builtin_min
Definition: bsxfun.cc:53
@ bsxfun_builtin_divide
Definition: bsxfun.cc:51
@ bsxfun_builtin_eq
Definition: bsxfun.cc:54
@ bsxfun_builtin_ge
Definition: bsxfun.cc:59
@ bsxfun_builtin_plus
Definition: bsxfun.cc:48
@ bsxfun_builtin_times
Definition: bsxfun.cc:50
@ bsxfun_builtin_gt
Definition: bsxfun.cc:58
@ bsxfun_builtin_ne
Definition: bsxfun.cc:55
@ bsxfun_builtin_minus
Definition: bsxfun.cc:49
@ bsxfun_builtin_lt
Definition: bsxfun.cc:56
@ bsxfun_builtin_max
Definition: bsxfun.cc:52
#define REGISTER_OP_HANDLER(OP, BTYP, NDA, FUNOP)
boolNDArray bsxfun_ge(const charNDArray &x, const charNDArray &y)
Definition: chNDArray.cc:261
boolNDArray bsxfun_lt(const charNDArray &x, const charNDArray &y)
Definition: chNDArray.cc:261
boolNDArray bsxfun_gt(const charNDArray &x, const charNDArray &y)
Definition: chNDArray.cc:261
boolNDArray bsxfun_eq(const charNDArray &x, const charNDArray &y)
Definition: chNDArray.cc:261
boolNDArray bsxfun_le(const charNDArray &x, const charNDArray &y)
Definition: chNDArray.cc:261
boolNDArray bsxfun_ne(const charNDArray &x, const charNDArray &y)
Definition: chNDArray.cc:261

Typedef Documentation

◆ bsxfun_handler

typedef octave_value(* bsxfun_handler) (const octave_value &, const octave_value &)

Definition at line 96 of file bsxfun.cc.

Enumeration Type Documentation

◆ bsxfun_builtin_op

Enumerator
bsxfun_builtin_plus 
bsxfun_builtin_minus 
bsxfun_builtin_times 
bsxfun_builtin_divide 
bsxfun_builtin_max 
bsxfun_builtin_min 
bsxfun_builtin_eq 
bsxfun_builtin_ne 
bsxfun_builtin_lt 
bsxfun_builtin_le 
bsxfun_builtin_gt 
bsxfun_builtin_ge 
bsxfun_builtin_and 
bsxfun_builtin_or 
bsxfun_builtin_power 
bsxfun_builtin_unknown 
bsxfun_num_builtin_ops 

Definition at line 46 of file bsxfun.cc.

Function Documentation

◆ bsxfun_builtin_lookup()

static bsxfun_builtin_op bsxfun_builtin_lookup ( const std::string &  name)
static

Definition at line 87 of file bsxfun.cc.

References bsxfun_builtin_names, bsxfun_builtin_unknown, and bsxfun_num_builtin_ops.

Referenced by maybe_optimized_builtin().

◆ bsxfun_forward_op()

template<typename NDA , NDA(bsxfun_op)(const NDA &, const NDA &) >
static octave_value bsxfun_forward_op ( const octave_value x,
const octave_value y 
)
static

Definition at line 104 of file bsxfun.cc.

References octave_value(), and x.

◆ bsxfun_forward_rel()

template<typename NDA , boolNDArray(bsxfun_rel)(const NDA &, const NDA &) >
static octave_value bsxfun_forward_rel ( const octave_value x,
const octave_value y 
)
static

Definition at line 113 of file bsxfun.cc.

References octave_value(), and x.

◆ do_bsxfun_real_pow()

template<typename NDA , typename CNDA >
static octave_value do_bsxfun_real_pow ( const octave_value x,
const octave_value y 
)
static

Definition at line 124 of file bsxfun.cc.

References bsxfun_pow(), octave_value(), and x.

◆ Fbsxfun()

◆ maybe_fill_table()

◆ maybe_optimized_builtin()

static octave_value maybe_optimized_builtin ( const std::string &  name,
const octave_value a,
const octave_value b 
)
static

◆ maybe_update_column()

static bool maybe_update_column ( octave_value Ac,
const octave_value A,
const dim_vector dva,
const dim_vector dvc,
octave_idx_type  i,
octave_value_list idx 
)
static

Definition at line 235 of file bsxfun.cc.

References A, dim_vector::ndims(), octave_value(), and octave_value::single_subsref().

Referenced by Fbsxfun().

◆ update_index()

static void update_index ( Array< int > &  idx,
const dim_vector dv,
octave_idx_type  i 
)
static

Definition at line 311 of file bsxfun.cc.

References dim_vector::ndims().

Referenced by Fbsxfun().

Variable Documentation

◆ bsxfun_builtin_names

const char* bsxfun_builtin_names[]
Initial value:
=
{
"plus",
"minus",
"times",
"rdivide",
"max",
"min",
"eq",
"ne",
"lt",
"le",
"gt",
"ge",
"and",
"or",
"power"
}

Definition at line 67 of file bsxfun.cc.

Referenced by bsxfun_builtin_lookup().

◆ bsxfun_handler_table

Definition at line 100 of file bsxfun.cc.

Referenced by maybe_fill_table(), and maybe_optimized_builtin().