26 #if defined (HAVE_CONFIG_H)
43 static const char *error_id_nonconformant_args
44 =
"Octave:nonconformant-args";
46 static const char *error_id_index_out_of_bounds
47 =
"Octave:index-out-of-bounds";
49 static const char *error_id_invalid_index =
"Octave:invalid-index";
51 static const char *warning_id_nearly_singular_matrix
52 =
"Octave:nearly-singular-matrix";
54 static const char *warning_id_singular_matrix =
"Octave:singular-matrix";
59 (*current_liboctave_error_handler)
60 (
"invalid conversion from NaN to logical");
66 (*current_liboctave_error_handler)
67 (
"invalid conversion from NaN to character");
74 const char *err_id = error_id_nonconformant_args;
76 (*current_liboctave_error_with_id_handler)
77 (err_id,
"%s: nonconformant arguments (op1 len: %" OCTAVE_IDX_TYPE_FORMAT
78 ", op2 len: % " OCTAVE_IDX_TYPE_FORMAT
")",
79 op, op1_len, op2_len);
87 const char *err_id = error_id_nonconformant_args;
89 (*current_liboctave_error_with_id_handler)
90 (err_id,
"%s: nonconformant arguments "
91 "(op1 is %" OCTAVE_IDX_TYPE_FORMAT
"x%" OCTAVE_IDX_TYPE_FORMAT
", "
92 "op2 is %" OCTAVE_IDX_TYPE_FORMAT
"x%" OCTAVE_IDX_TYPE_FORMAT
")",
93 op, op1_nr, op1_nc, op2_nr, op2_nc);
100 const char *err_id = error_id_nonconformant_args;
102 std::string op1_dims_str = op1_dims.
str ();
103 std::string op2_dims_str = op2_dims.
str ();
105 (*current_liboctave_error_with_id_handler)
106 (err_id,
"%s: nonconformant arguments (op1 is %s, op2 is %s)",
107 op, op1_dims_str.c_str (), op2_dims_str.c_str ());
114 const char *err_id = error_id_index_out_of_bounds;
116 (*current_liboctave_error_with_id_handler)
117 (err_id,
"A(%s) = []: index out of bounds: value %" OCTAVE_IDX_TYPE_FORMAT
118 " out of bound %" OCTAVE_IDX_TYPE_FORMAT,
119 is1d ?
"I" :
"..,I,..", idx, ext);
129 std::ostringstream buf;
136 bool show_parens =
m_dim > 0;
148 buf <<
"(...[x" <<
m_dim - 1 <<
"]...";
164 buf <<
"...[x" <<
m_nd -
m_dim <<
"]...)";
182 OCTAVE_DEFAULT_COPY_MOVE (invalid_index)
186 static std::string exp
187 = std::to_string (std::numeric_limits<octave_idx_type>::digits);
189 set_message (expression ()
190 +
": subscripts must be either integers 1 to (2^" + exp
191 +
")-1 or logicals");
195 const char *
err_id ()
const
197 return error_id_invalid_index;
202 invalid_index *retval =
new invalid_index {*
this};
203 retval->set_identifier (retval->err_id ());
214 invalid_index e (idx, nd, dim);
228 const std::string& var)
230 std::ostringstream buf;
237 if (
n + 1 != nearest && (buf.str ().find (
'.') == std::string::npos))
238 buf << std::showpos << (
n + 1 - nearest);
259 OCTAVE_DEFAULT_COPY_MOVE (out_of_range)
263 set_message (expression () +
": out of bound "
264 + std::to_string (m_extent)
265 +
" (dimensions are " + m_size.str (
'x') +
")");
269 const char *
err_id ()
const
271 return error_id_index_out_of_bounds;
276 out_of_range *retval =
new out_of_range {*
this};
277 retval->set_identifier (retval->err_id ());
295 throw out_of_range (std::to_string (idx), nd, dim, ext, dv);
301 (*current_liboctave_error_with_id_handler)
302 (
"Octave:invalid-resize",
303 "Invalid resizing operation or ambiguous assignment to an out-of-bounds array element");
311 (*current_liboctave_warning_with_id_handler)
312 (warning_id_singular_matrix,
313 "matrix singular to machine precision");
317 (*current_liboctave_warning_with_id_handler)
318 (warning_id_nearly_singular_matrix,
319 "matrix singular to machine precision, rcond = %g", rcond);
323 OCTAVE_END_NAMESPACE(
octave)
Vector representing the dimensions (size) of an Array.
std::string str(char sep='x') const
std::string expression() const
virtual const char * err_id() const =0
virtual index_exception * dup()=0
virtual void update_message()
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void err_invalid_resize()
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
void err_nan_to_logical_conversion()
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
void err_index_out_of_range(int nd, int dim, octave_idx_type idx, octave_idx_type ext, const dim_vector &dv)
void err_nan_to_character_conversion()
void err_del_index_out_of_range(bool is1d, octave_idx_type idx, octave_idx_type ext)
void warn_singular_matrix(double rcond)
std::complex< T > floor(const std::complex< T > &x)