41 template <
typename MT>
44 const std::list<octave_value_list>& idx)
51 retval = do_index_op (idx.front ());
58 error (
"%s cannot be indexed with %c",
nm.c_str (),
type[0]);
69 template <
typename MT>
72 const std::list<octave_value_list>& idx,
81 if (
type.length () == 1)
91 error (
"invalid assignment expression");
100 error (
"in indexed assignment of %s, last lhs index must be ()",
112 error (
"%s cannot be indexed with %c",
nm.c_str (),
type[0]);
128 template <
typename MT>
138 const MT& cmatrix =
matrix;
159 if (! resize_ok &&
i.is_scalar ())
160 retval = cmatrix.checkelem (
i(0));
174 if (! resize_ok &&
i.is_scalar () && j.
is_scalar ())
175 retval = cmatrix.checkelem (
i(0), j(0));
184 bool scalar_opt = n_idx == nd && ! resize_ok;
187 for (
k = 0;
k < n_idx;
k++)
189 idx_vec(
k) = idx(
k).index_vector ();
191 scalar_opt = (scalar_opt && idx_vec(
k).is_scalar ());
205 e.set_pos_if_unset (n_idx,
k+1);
212 template <
typename MT>
255 for (
k = 0;
k < n_idx;
k++)
256 idx_vec(
k) = idx(
k).index_vector ();
258 matrix.assign (idx_vec, rhs);
269 clear_cached_info ();
272 template <
typename MT>
281 template <
typename MT>
284 typename MT::element_type rhs)
311 if (
i.is_scalar () &&
i(0) <
matrix.numel ())
326 if (
i.is_scalar () && j.
is_scalar () && nd == 2
337 bool scalar_opt = n_idx == nd;
340 for (
k = 0;
k < n_idx;
k++)
342 idx_vec(
k) = idx(
k).index_vector ();
344 scalar_opt = (scalar_opt && idx_vec(
k).is_scalar ()
345 && idx_vec(
k)(0) <
dv(
k));
356 j += idx_vec(
i)(0) * n;
362 matrix.assign (idx_vec, mrhs);
373 clear_cached_info ();
376 template <
typename MT>
390 clear_cached_info ();
393 template <
typename MT>
406 template <
typename MT>
418 if (t1.any_element_is_nan ())
432 template <
typename MT>
441 template <
typename MT>
445 print_raw (
os, pr_as_read_syntax);
449 template <
typename MT>
457 template <
typename MT>
463 else if (
matrix.ndims () == 2)
480 std::ostringstream buf;
483 size_t pos =
tmp.find_first_not_of (
' ');
484 if (pos != std::string::npos)
485 os <<
tmp.substr (pos);
486 else if (!
tmp.empty ())
489 if (++elts >= max_elts)
496 if (
i < nr - 1 && elts < max_elts)
509 template <
typename MT>
516 template <
typename MT>
522 std::ostringstream buf;
527 template <
typename MT>
537 template <
typename MT>
545 typedef typename MT::element_type ET;
551 void *here =
reinterpret_cast<void *
> (&
matrix(n));
553 return x.get_rep ().fast_elem_insert_self (here, btyp);
bool fast_elem_insert(octave_idx_type n, const octave_value &x)
const octave_base_value const Array< octave_idx_type > & ra_idx
characters Given a string matrix
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
bool print_as_scalar(void) const
void assign(const octave_value_list &idx, const MT &rhs)
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
void delete_elements(const octave_value_list &idx)
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
void error(const char *fmt,...)
boolNDArray all(int dim=-1) const
octave_value fast_elem_extract(octave_idx_type n) const
void err_nan_to_logical_conversion(void)
bool any_zero(void) const
octave_value resize(const dim_vector &dv, bool fill=false) const
float_display_format get_edit_display_format(void) const
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
void print(std::ostream &os, bool pr_as_read_syntax=false)
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
#define panic_impossible()
Array< octave_idx_type > conv_to_int_array(const Array< idx_vector > &a)
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value resize(const dim_vector &dv, bool fill=false) const
N Dimensional Array with copy-on-write semantics.
bool all_ones(void) const
float_display_format make_format(const double &d)
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
MatrixType matrix_type(void) const
octave_idx_type length(void) const
void warn_array_as_logical(const dim_vector &dv)
void short_disp(std::ostream &os) const
Vector representing the dimensions (size) of an Array.
bool is_scalar(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
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 * x
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
void print_info(std::ostream &os, const std::string &prefix) const