44 template <
typename DMT,
typename MT>
47 const std::list<octave_value_list>& idx)
54 retval = do_index_op (idx.front ());
61 error (
"%s cannot be indexed with %c",
nm.c_str (),
type[0]);
72 template <
typename DMT,
typename MT>
96 template <
typename DMT,
typename MT>
103 if (idx.
length () == 2 && ! resize_ok)
134 e.set_pos_if_unset (2,
k+1);
144 template <
typename DMT,
typename MT>
147 const std::list<octave_value_list>& idx,
156 if (
type.length () != 1)
159 error (
"in indexed assignment of %s, last lhs index must be ()",
172 if (jdx.
length () == 1 && jdx(0).is_scalar_type ())
174 typename DMT::element_type
val;
186 && chk_valid_scalar (rhs,
val))
198 e.set_pos_if_unset (2,
k+1);
202 else if (jdx.
length () == 2
203 && jdx(0).is_scalar_type () && jdx(1).is_scalar_type ())
205 typename DMT::element_type
val;
214 && chk_valid_scalar (rhs,
val))
226 e.set_pos_if_unset (2,
k+1);
242 error (
"%s cannot be indexed with %c",
nm.c_str (),
type[0]);
258 template <
typename DMT,
typename MT>
266 rm.resize (
dv(0),
dv(1));
275 template <
typename DMT,
typename MT>
287 return to_dense ().is_true ();
293 {
return x.real (); }
299 template <
typename DMT,
typename MT>
303 typedef typename DMT::element_type el_type;
307 "complex matrix",
"real scalar");
313 type_name (),
"real scalar");
318 template <
typename DMT,
typename MT>
322 typedef typename DMT::element_type el_type;
326 "complex matrix",
"real scalar");
328 if (! (
numel () > 0))
332 type_name (),
"real scalar");
337 template <
typename DMT,
typename MT>
341 if (rows () == 0 || columns () == 0)
345 type_name (),
"complex scalar");
350 template <
typename DMT,
typename MT>
358 if (rows () == 0 || columns () == 0)
362 type_name (),
"complex scalar");
369 template <
typename DMT,
typename MT>
373 return Matrix (diag_matrix_value ());
376 template <
typename DMT,
typename MT>
383 template <
typename DMT,
typename MT>
390 template <
typename DMT,
typename MT>
397 template <
typename DMT,
typename MT>
401 return NDArray (matrix_value ());
404 template <
typename DMT,
typename MT>
411 template <
typename DMT,
typename MT>
418 template <
typename DMT,
typename MT>
425 template <
typename DMT,
typename MT>
429 return to_dense ().bool_array_value (warn);
432 template <
typename DMT,
typename MT>
436 return to_dense ().char_array_value (warn);
439 template <
typename DMT,
typename MT>
446 template <
typename DMT,
typename MT>
453 template <
typename DMT,
typename MT>
457 return to_dense ().index_vector (require_integers);
460 template <
typename DMT,
typename MT>
468 template <
typename DMT,
typename MT>
476 template <
typename DMT,
typename MT>
482 std::ostringstream buf;
487 template <
typename DMT,
typename MT>
491 os <<
"# rows: " <<
matrix.rows () <<
"\n" 492 <<
"# columns: " <<
matrix.columns () <<
"\n";
499 template <
typename DMT,
typename MT>
508 error (
"load: failed to extract number of rows and columns");
515 error (
"load: failed to load diagonal matrix constant");
520 typedef typename DMT::element_type el_type;
530 template <
typename DMT,
typename MT>
533 bool pr_as_read_syntax)
const 536 current_print_indent_level ());
539 template <
typename DMT,
typename MT>
543 return to_dense ().as_mxArray ();
546 template <
typename DMT,
typename MT>
555 template <
typename DMT,
typename MT>
559 print_raw (
os, pr_as_read_syntax);
562 template <
typename DMT,
typename MT>
569 return to_dense ().write (
os, block_size, output_type, skip,
flt_fmt);
572 template <
typename DMT,
typename MT>
583 template <
typename DMT,
typename MT>
589 else if (
matrix.ndims () == 2)
606 std::ostringstream buf;
609 size_t pos =
tmp.find_first_not_of (
' ');
610 if (pos != std::string::npos)
611 os <<
tmp.substr (pos);
612 else if (!
tmp.empty ())
615 if (++elts >= max_elts)
622 if (
i < nr - 1 && elts < max_elts)
635 template <
typename DMT,
typename MT>
652 template <
typename DMT,
typename MT>
656 if (! dense_cache.is_defined ())
657 dense_cache = MT (
matrix);
Matrix matrix_value(bool=false) const
int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
void print(std::ostream &os, bool pr_as_read_syntax=false)
Template for N-dimensional array classes with like-type math operators.
characters Given a string matrix
mxArray * as_mxArray(void) const
identity matrix If supplied two scalar respectively For allows like xample val
bool load_ascii(std::istream &is)
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
FloatMatrix float_matrix_value(bool=false) const
void error(const char *fmt,...)
void short_disp(std::ostream &os) const
charNDArray char_array_value(bool=false) const
octave::mach_info::float_format flt_fmt
bool is_defined(void) const
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
idx_vector index_vector(bool=false) const
octave_value to_dense(void) const
Template for two dimensional diagonal array with math operators.
bool any_zero(void) const
octave_value resize(const dim_vector &dv, bool fill=false) const
float float_value(bool=false) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
boolNDArray bool_array_value(bool warn=false) 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_raw(std::ostream &os, bool pr_as_read_syntax=false) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
octave_value diag(octave_idx_type k=0) const
double double_value(bool=false) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
float_display_format get_edit_display_format(void) const
octave_idx_type length(octave_idx_type n=0) const
#define panic_impossible()
bool is_true(const std::string &s)
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
float lo_ieee_float_nan_value(void)
FloatComplexNDArray float_complex_array_value(bool=false) const
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
N Dimensional Array with copy-on-write semantics.
Array< idx_vector > ind2sub(const dim_vector &dv, const idx_vector &idx)
bool all_ones(void) const
T::size_type numel(const T &str)
void err_invalid_conversion(const std::string &from, const std::string &to)
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
SparseMatrix sparse_matrix_value(bool=false) const
ComplexNDArray complex_array_value(bool=false) const
bool is_colon_equiv(octave_idx_type n) const
octave_value fast_elem_extract(octave_idx_type n) const
void print_info(std::ostream &os, const std::string &prefix) const
FloatNDArray float_array_value(bool=false) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave_idx_type length(void) const
bool print_as_scalar(void) const
NDArray array_value(bool=false) const
bool save_ascii(std::ostream &os)
void warn_array_as_logical(const dim_vector &dv)
std::complex< float > FloatComplex
Complex complex_value(bool=false) const
octave_idx_type ndims(void) const
Number of dimensions.
std::complex< double > Complex
ComplexMatrix complex_matrix_value(bool=false) const
FloatComplex float_complex_value(bool=false) const
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
bool is_scalar(void) const
octave_value resize(const dim_vector &dv, bool fill=false) 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())
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)