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>
85 retval =
matrix.build_diag_matrix ();
88 retval =
matrix.array_value ().diag (k);
92 retval =
matrix.extract_diag (k);
96 template <
typename DMT,
typename MT>
103 if (idx.
length () == 2 && ! resize_ok)
114 retval =
matrix.checkelem (idx0(0), idx1(0));
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))
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))
232 retval = numeric_assign (type, idx, rhs);
242 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
247 retval = tmp.
subsasgn (type, idx, rhs);
258 template <
typename DMT,
typename MT>
263 if (dv.
ndims () == 2)
266 rm.resize (
dv(0),
dv(1));
270 retval = to_dense ().
resize (dv, fill);
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>
472 os <<
"# rows: " <<
matrix.rows () <<
"\n"
473 <<
"# columns: " <<
matrix.columns () <<
"\n";
475 os <<
matrix.extract_diag ();
480 template <
typename DMT,
typename MT>
489 error (
"load: failed to extract number of rows and columns");
496 error (
"load: failed to load diagonal matrix constant");
501 typedef typename DMT::element_type el_type;
511 template <
typename DMT,
typename MT>
514 bool pr_as_read_syntax)
const
517 current_print_indent_level ());
520 template <
typename DMT,
typename MT>
524 return to_dense ().as_mxArray ();
527 template <
typename DMT,
typename MT>
536 template <
typename DMT,
typename MT>
540 print_raw (os, pr_as_read_syntax);
543 template <
typename DMT,
typename MT>
550 return to_dense ().write (os, block_size, output_type, skip, flt_fmt);
553 template <
typename DMT,
typename MT>
558 matrix.print_info (os, prefix);
561 template <
typename DMT,
typename MT>
578 template <
typename DMT,
typename MT>
582 if (! dense_cache.is_defined ())
583 dense_cache = MT (
matrix);
void print(std::ostream &os, bool pr_as_read_syntax=false)
bool is_true(const std::string &s)
octave_value to_dense(void) const
octave_idx_type length(octave_idx_type n=0) const
float float_value(bool=false) const
NDArray array_value(bool=false) const
double double_value(bool=false) const
mxArray * as_mxArray(void) const
idx_vector index_vector(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
identity matrix If supplied two scalar respectively For allows like xample val
bool load_ascii(std::istream &is)
octave_value resize(const dim_vector &dv, bool fill=false) const
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
octave_idx_type length(void) const
bool is_defined(void) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the then the first element defines the pivoting tolerance for the unsymmetric the values defined such that for full matrix
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
void error(const char *fmt,...)
charNDArray char_array_value(bool=false) const
SparseMatrix sparse_matrix_value(bool=false) const
octave::mach_info::float_format flt_fmt
octave_value resize(const dim_vector &dv, bool fill=false) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Template for N-dimensional array classes with like-type math operators.
bool all_ones(void) const
FloatComplex float_complex_value(bool=false) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
bool print_as_scalar(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
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)
nd deftypefn *octave_map m
#define panic_impossible()
Template for two dimensional diagonal array with math operators.
ComplexMatrix complex_matrix_value(bool=false) const
bool any_zero(void) const
Complex complex_value(bool=false) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
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)
void print_info(std::ostream &os, const std::string &prefix) const
bool is_colon_equiv(octave_idx_type n) const
N Dimensional Array with copy-on-write semantics.
Array< idx_vector > ind2sub(const dim_vector &dv, const idx_vector &idx)
FloatComplexNDArray float_complex_array_value(bool=false) const
T::size_type numel(const T &str)
void err_invalid_conversion(const std::string &from, const std::string &to)
FloatMatrix float_matrix_value(bool=false) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Matrix matrix_value(bool=false) const
ComplexNDArray complex_array_value(bool=false) const
FloatNDArray float_array_value(bool=false) const
void octave_print_internal(std::ostream &, char, bool)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
bool is_scalar(void) const
octave_value fast_elem_extract(octave_idx_type n) const
boolNDArray bool_array_value(bool warn=false) const
octave_idx_type ndims(void) const
Number of dimensions.
bool save_ascii(std::ostream &os)
void warn_array_as_logical(const dim_vector &dv)
std::complex< float > FloatComplex
FloatComplexMatrix float_complex_matrix_value(bool=false) const
std::complex< double > Complex
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
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)
octave_value diag(octave_idx_type k=0) const
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
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())
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)