41 const std::list<octave_value_list>& idx)
48 retval = do_index_op (idx.front ());
54 std::string nm = type_name ();
55 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
69 const std::list<octave_value_list>& idx,
78 if (type.length () == 1)
79 retval = numeric_assign (type, idx, rhs);
91 retval = tmp.
subsasgn (type, idx, rhs);
94 error (
"invalid assignment expression");
98 std::string nm = type_name ();
99 error (
"in indexed assignment of %s, last lhs index must be ()",
112 retval = tmp.
subsasgn (type, idx, rhs);
116 std::string nm = type_name ();
117 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
138 int nd = matrix.ndims ();
139 const MT& cmatrix = matrix;
155 retval = cmatrix.checkelem (i(0));
157 retval = MT (matrix.index (i, resize_ok));
174 retval = cmatrix.checkelem (i(0), j(0));
176 retval = MT (matrix.index (i, j, resize_ok));
185 bool scalar_opt = n_idx == nd && ! resize_ok;
190 idx_vec(i) = idx(i).index_vector ();
195 scalar_opt = (scalar_opt && idx_vec(i).is_scalar ());
203 retval = MT (matrix.index (idx_vec, resize_ok));
229 matrix.assign (i, rhs);
242 matrix.assign (i, j, rhs);
253 idx_vec(i) = idx(i).index_vector ();
260 matrix.assign (idx_vec, rhs);
266 clear_cached_info ();
281 typename MT::element_type rhs)
285 int nd = matrix.ndims ();
302 if (i.
is_scalar () && i(0) < matrix.numel ())
305 matrix.assign (i, mrhs);
322 && i(0) < matrix.rows () && j(0) < matrix.columns ())
323 matrix(i(0), j(0)) = rhs;
325 matrix.assign (i, j, mrhs);
334 bool scalar_opt = n_idx == nd;
339 idx_vec(i) = idx(i).index_vector ();
344 scalar_opt = (scalar_opt && idx_vec(i).is_scalar ()
345 && idx_vec(i)(0) < dv(i));
357 j += idx_vec(i)(0) * k;
363 matrix.assign (idx_vec, mrhs);
370 clear_cached_info ();
382 ra_idx(i) = idx(i).index_vector ();
384 matrix.delete_elements (ra_idx);
387 clear_cached_info ();
396 retval.resize (dv, 0);
408 int nel = dv.
numel ();
414 if (t1.any_element_is_nan ())
440 print_raw (os, pr_as_read_syntax);
447 const std::string& prefix)
const
449 matrix.print_info (os, prefix);
456 if (matrix.is_empty ())
458 else if (matrix.ndims () == 2)
475 std::ostringstream buf;
477 std::string tmp = buf.str ();
478 size_t pos = tmp.find_first_not_of (
" ");
479 os << tmp.substr (pos);
481 if (++elts >= max_elts)
488 if (i < nr - 1 && elts < max_elts)
505 if (n < matrix.numel ())
516 if (n < matrix.numel ())
519 typedef typename MT::element_type ET;
525 void *here =
reinterpret_cast<void *
> (&matrix(n));