GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-base.cc File Reference
#include <iostream>
#include <limits>
#include "lo-ieee.h"
#include "lo-mappers.h"
#include "call-stack.h"
#include "defun.h"
#include "errwarn.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "mxarray.h"
#include "oct-hdf5.h"
#include "oct-lvalue.h"
#include "oct-map.h"
#include "oct-stream.h"
#include "ops.h"
#include "ov-base.h"
#include "ov-cell.h"
#include "ov-ch-mat.h"
#include "ov-classdef.h"
#include "ov-complex.h"
#include "ov-cx-mat.h"
#include "ov-fcn-handle.h"
#include "ov-range.h"
#include "ov-re-mat.h"
#include "ov-scalar.h"
#include "ov-str-mat.h"
#include "ovl.h"
#include "parse.h"
#include "pr-flt-fmt.h"
#include "pr-output.h"
#include "utils.h"
#include "variables.h"
Include dependency graph for ov-base.cc:

Go to the source code of this file.

Macros

#define INT_CONV_METHOD(T, F)
 

Functions

builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y)
 Determine the resulting type for a possible mixed-type operation. More...
 
bool called_from_builtin (void)
 
static OCTAVE_NORETURN void err_assign_conversion_failed (const std::string &tn1, const std::string &tn2)
 
static OCTAVE_NORETURN void err_indexed_assignment (const std::string &tn1, const std::string &tn2)
 
static OCTAVE_NORETURN void err_no_conversion (const std::string &on, const std::string &tn1, const std::string &tn2)
 
OCTAVE_EXPORT octave_value_list Fsparse_auto_mutate (const octave_value_list &args, int nargout) the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function. nd deftypefn */)
 
void install_base_type_conversions (octave::type_info &ti)
 
octave_value make_idx_args (const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
 
static octave_base_valueoct_conv_cell_conv (const octave_base_value &)
 
static octave_base_valueoct_conv_complex_matrix_conv (const octave_base_value &)
 
static octave_base_valueoct_conv_matrix_conv (const octave_base_value &)
 
static octave_base_valueoct_conv_string_conv (const octave_base_value &)
 
static octave_value_list sanitize (const octave_value_list &ovl)
 

Variables

std::string btyp_class_name [btyp_num_types]
 
bool Vsparse_auto_mutate = false
 

Macro Definition Documentation

◆ INT_CONV_METHOD

#define INT_CONV_METHOD (   T,
  F 
)
Value:
octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
{ \
T retval = 0; \
\
double d = 0.0; \
\
try \
{ \
d = double_value (frc_str_conv); \
} \
catch (octave::execution_exception& e) \
{ \
err_wrong_type_arg (e, "octave_base_value::" #F "_value ()", type_name ()); \
} \
if (require_int && octave::math::x_nint (d) != d) \
error_with_cfn ("conversion of %g to " #T " value failed", d); \
else if (d < std::numeric_limits<T>::min ()) \
else if (d > std::numeric_limits<T>::max ()) \
else \
retval = static_cast<T> (octave::math::fix (d)); \
\
return retval; \
}
double fix(double x)
Definition: lo-mappers.h:127
i e
Definition: data.cc:2591
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 const F77_DBLE F77_DBLE * d
if(nargin< 2) print_usage()
Definition: cellfun.cc:407
octave_value retval
Definition: data.cc:6246
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
T x_nint(T x)
Definition: lo-mappers.h:284
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)
Definition: mx-inlines.cc:756

Definition at line 459 of file ov-base.cc.

Function Documentation

◆ btyp_mixed_numeric()

builtin_type_t btyp_mixed_numeric ( builtin_type_t  x,
builtin_type_t  y 
)

Determine the resulting type for a possible mixed-type operation.

Rules for the resulting type:

  • bool -> double
  • single + double -> single
  • real + complex -> complex
  • integer + real -> integer
  • uint + uint -> uint (the bigger one)
  • sint + sint -> sint (the bigger one)
Returns
The resulting type or "unknown type", if the resulting type cannot be determined.

Definition at line 63 of file ov-base.cc.

References btyp_bool, btyp_double, btyp_float, btyp_float_complex, btyp_int64, btyp_int8, btyp_uint64, btyp_uint8, btyp_unknown, retval, x, and y.

Referenced by do_minmax_body().

◆ called_from_builtin()

◆ err_assign_conversion_failed()

static OCTAVE_NORETURN void err_assign_conversion_failed ( const std::string tn1,
const std::string tn2 
)
static

Definition at line 1159 of file ov-base.cc.

References error().

Referenced by octave_base_value::numeric_assign().

◆ err_indexed_assignment()

static OCTAVE_NORETURN void err_indexed_assignment ( const std::string tn1,
const std::string tn2 
)
static

Definition at line 1151 of file ov-base.cc.

References error().

Referenced by octave_base_value::numeric_assign().

◆ err_no_conversion()

static OCTAVE_NORETURN void err_no_conversion ( const std::string on,
const std::string tn1,
const std::string tn2 
)
static

Definition at line 1167 of file ov-base.cc.

References error(), and on.

Referenced by octave_base_value::numeric_assign().

◆ Fsparse_auto_mutate()

OCTAVE_EXPORT octave_value_list Fsparse_auto_mutate ( const octave_value_list args,
int  nargout 
)

Definition at line 1527 of file ov-base.cc.

References SET_INTERNAL_VARIABLE.

◆ install_base_type_conversions()

void install_base_type_conversions ( octave::type_info ti)

Definition at line 1480 of file ov-base.cc.

References INSTALL_ASSIGNCONV_TI, and INSTALL_WIDENOP_TI.

◆ make_idx_args()

◆ oct_conv_cell_conv()

static octave_base_value* oct_conv_cell_conv ( const octave_base_value )
static

Definition at line 1381 of file ov-base.cc.

◆ oct_conv_complex_matrix_conv()

static octave_base_value* oct_conv_complex_matrix_conv ( const octave_base_value )
static

Definition at line 1369 of file ov-base.cc.

◆ oct_conv_matrix_conv()

static octave_base_value* oct_conv_matrix_conv ( const octave_base_value )
static

Definition at line 1363 of file ov-base.cc.

◆ oct_conv_string_conv()

static octave_base_value* oct_conv_string_conv ( const octave_base_value )
static

Definition at line 1375 of file ov-base.cc.

◆ sanitize()

static octave_value_list sanitize ( const octave_value_list ovl)
inlinestatic

Definition at line 1387 of file ov-base.cc.

References i, octave_value::is_magic_colon(), octave_value_list::length(), ovl(), and retval.

Referenced by make_idx_args().

Variable Documentation

◆ btyp_class_name

std::string btyp_class_name[btyp_num_types]
Initial value:
=
{
"double", "single", "double", "single",
"int8", "int16", "int32", "int64",
"uint8", "uint16", "uint32", "uint64",
"logical", "char",
"struct", "cell", "function_handle"
}

Definition at line 87 of file ov-base.cc.

Referenced by octave::get_dispatch_type(), and make_fcn_handle().

◆ Vsparse_auto_mutate