43 const std::list<octave_value_list>& idx)
50 retval = do_index_op (idx.front ());
56 std::string nm = type_name ();
57 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
71 const std::list<octave_value_list>& idx,
80 if (type.length () == 1)
81 retval = numeric_assign (type, idx, rhs);
93 retval = tmp.
subsasgn (type, idx, rhs);
96 error (
"invalid assignment expression");
100 std::string nm = type_name ();
101 error (
"in indexed assignment of %s, last lhs index must be ()",
114 retval = tmp.
subsasgn (type, idx, rhs);
118 std::string nm = type_name ();
119 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
140 int nd = matrix.ndims ();
141 const MT& cmatrix = matrix;
157 retval = cmatrix.checkelem (i(0));
159 retval = MT (matrix.index (i, resize_ok));
176 retval = cmatrix.checkelem (i(0), j(0));
178 retval = MT (matrix.index (i, j, resize_ok));
187 bool scalar_opt = n_idx == nd && ! resize_ok;
192 idx_vec(i) = idx(i).index_vector ();
197 scalar_opt = (scalar_opt && idx_vec(i).is_scalar ());
205 retval = MT (matrix.index (idx_vec, resize_ok));
231 matrix.assign (i, rhs);
244 matrix.assign (i, j, rhs);
255 idx_vec(i) = idx(i).index_vector ();
262 matrix.assign (idx_vec, rhs);
268 clear_cached_info ();
283 typename MT::element_type rhs)
287 int nd = matrix.ndims ();
304 if (i.
is_scalar () && i(0) < matrix.numel ())
307 matrix.assign (i, mrhs);
324 && i(0) < matrix.rows () && j(0) < matrix.columns ())
325 matrix(i(0), j(0)) = rhs;
327 matrix.assign (i, j, mrhs);
336 bool scalar_opt = n_idx == nd;
341 idx_vec(i) = idx(i).index_vector ();
346 scalar_opt = (scalar_opt && idx_vec(i).is_scalar ()
347 && idx_vec(i)(0) < dv(i));
360 j += idx_vec(i)(0) * k;
366 matrix.assign (idx_vec, mrhs);
373 clear_cached_info ();
385 ra_idx(i) = idx(i).index_vector ();
387 matrix.delete_elements (ra_idx);
390 clear_cached_info ();
399 retval.resize (dv, 0);
411 int nel = dv.
numel ();
417 if (t1.any_element_is_nan ())
443 print_raw (os, pr_as_read_syntax);
450 const std::string& prefix)
const
452 matrix.print_info (os, prefix);
459 if (matrix.is_empty ())
461 else if (matrix.ndims () == 2)
478 std::ostringstream buf;
480 std::string tmp = buf.str ();
481 size_t pos = tmp.find_first_not_of (
" ");
482 if (pos != std::string::npos)
483 os << tmp.substr (pos);
484 else if (! tmp.empty ())
487 if (++elts >= max_elts)
494 if (i < nr - 1 && elts < max_elts)
511 if (n < matrix.numel ())
522 if (n < matrix.numel ())
525 typedef typename MT::element_type ET;
531 void *here =
reinterpret_cast<void *
> (&matrix(n));
boolNDArray all(int dim=-1) const
void short_disp(std::ostream &os) const
bool fast_elem_insert(octave_idx_type n, const octave_value &x)
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void assign(const octave_value_list &idx, const MT &rhs)
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_idx_type length(void) const
void delete_elements(const octave_value_list &idx)
void error(const char *fmt,...)
bool all_ones(void) const
virtual bool fast_elem_insert_self(void *where, builtin_type_t btyp) const
MatrixType matrix_type(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void print(std::ostream &os, bool pr_as_read_syntax=false)
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
void gripe_nan_to_logical_conversion(void)
octave_value resize(const dim_vector &dv, bool fill=false) const
#define panic_impossible()
dim_vector redim(int n) const
Array< octave_idx_type > conv_to_int_array(const Array< idx_vector > &a)
bool any_zero(void) const
Handles the reference counting for all the derived classes.
const octave_base_value & get_rep(void) const
void octave_print_internal(std::ostream &, char, bool)
bool is_scalar(void) const
bool print_as_scalar(void) const
octave_value fast_elem_extract(octave_idx_type n) const
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
F77_RET_T const double * x
void print_info(std::ostream &os, const std::string &prefix) const