26 #if defined (HAVE_CONFIG_H)
46 const std::list<octave_value_list>& idx)
60 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
83 idx0 = idx(0).index_vector ();
85 idx1 = idx(1).index_vector ();
87 catch (octave::index_exception& ie)
90 ie.set_pos_if_unset (2, k+1);
107 if (idx0.is_colon ())
left =
false;
108 if (idx1.is_colon ()) right =
false;
128 if (nidx == 2 && ! resize_ok && idx0.is_scalar () && idx1.is_scalar ())
205 #define FORWARD_MATRIX_VALUE(TYPE, PREFIX) \
207 octave_perm_matrix::PREFIX ## _value (bool frc_str_conv) const \
209 return to_dense ().PREFIX ## _value (frc_str_conv); \
327 std::ostringstream buf;
336 os <<
"# orient: c\n";
355 error (
"load: failed to extract size & orientation");
357 bool colp = orient ==
'c';
361 error (
"load: failed to load permutation matrix constant");
379 os.write (
reinterpret_cast<char *
> (&sz), 4);
380 os.write (
reinterpret_cast<char *
> (&colp), 1);
382 os.write (
reinterpret_cast<const char *
> (col_perm.
data ()),
394 if (! (is.read (
reinterpret_cast<char *
> (&sz), 4)
395 && is.read (
reinterpret_cast<char *
> (&colp), 1)))
400 if (! is.read (
reinterpret_cast<char *
> (
m.fortran_vec ()),
m.byte_size ()))
405 int nel =
m.numel ();
406 for (
int i = 0; i < nel; i++)
430 bool pr_as_read_syntax)
const
462 return to_dense ().
write (os, block_size, output_type, skip, flt_fmt);
467 const std::string& prefix)
const
482 "permutation matrix",
"double");
524 std::ostringstream buf;
527 std::string tmp = buf.str ();
528 std::size_t pos = tmp.find_first_not_of (
' ');
529 if (pos != std::string::npos)
530 os << tmp.substr (pos);
531 else if (! tmp.empty ())
534 if (++elts >= max_elts)
541 if (i < nr - 1 && elts < max_elts)
void swap_bytes< 2 >(void *ptr)
void swap_bytes< 8 >(void *ptr)
void swap_bytes< 4 >(void *ptr)
OCTARRAY_OVERRIDABLE_FUNC_API std::size_t byte_size(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
const Array< octave_idx_type > & col_perm_vec(void) const
octave_idx_type cols(void) const
octave_idx_type columns(void) const
octave_idx_type elem(octave_idx_type i, octave_idx_type j) const
void print_info(std::ostream &os, const std::string &prefix) const
octave_idx_type rows(void) const
octave_idx_type checkelem(octave_idx_type i, octave_idx_type j) const
octave_idx_type numel(void) const
Vector representing the dimensions (size) of an Array.
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
bool all_ones(void) const
bool any_zero(void) const
octave_idx_type columns(void) const
octave::refcount< octave_idx_type > count
int current_print_indent_level(void) const
OCTINTERP_API void newline(std::ostream &os) const
virtual octave_idx_type numel(void) const
octave_idx_type rows(void) const
friend class octave_value
static int static_type_id(void)
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_value convert_to_str_internal(bool pad, bool force, char type) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
octave_base_value * try_narrowing_conversion(void)
octave_value as_int16(void) const
octave_value as_int8(void) const
octave_value as_int64(void) const
int8NDArray int8_array_value(void) const
SparseMatrix sparse_matrix_value(bool=false) const
virtual octave_value to_dense(void) const
octave_value as_uint32(void) const
dim_vector dims(void) const
void print(std::ostream &os, bool pr_as_read_syntax=false)
int64NDArray int64_array_value(void) const
void print_info(std::ostream &os, const std::string &prefix) const
bool save_binary(std::ostream &os, bool save_as_floats)
double double_value(bool=false) const
int16NDArray int16_array_value(void) const
octave_value as_uint64(void) const
octave_value as_double(void) const
FloatNDArray float_array_value(bool=false) const
int32NDArray int32_array_value(void) const
octave_value as_single(void) const
float_display_format get_edit_display_format(void) const
SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
bool load_ascii(std::istream &is)
uint8NDArray uint8_array_value(void) const
std::string type_name(void) const
bool print_as_scalar(void) const
type_conv_info numeric_conversion_function(void) const
float float_value(bool=false) const
FloatComplex float_complex_value(bool=false) const
Complex complex_value(bool=false) const
octave_value fast_elem_extract(octave_idx_type n) const
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
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
octave::idx_vector index_vector(bool require_integers=false) const
bool save_ascii(std::ostream &os)
uint64NDArray uint64_array_value(void) const
Matrix matrix_value(bool=false) const
uint32NDArray uint32_array_value(void) const
octave_value as_uint8(void) const
octave_value as_uint16(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value m_dense_cache
octave_value as_int32(void) const
mxArray * as_mxArray(bool interleaved) const
uint16NDArray uint16_array_value(void) const
void short_disp(std::ostream &os) const
octave_idx_type length(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_value index_op(const octave_value_list &idx, bool resize_ok=false)
OCTINTERP_API 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
bool is_defined(void) const
OCTINTERP_API octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
mxArray * as_mxArray(bool interleaved=false) const
void error(const char *fmt,...)
#define panic_impossible()
void warn_array_as_logical(const dim_vector &dv)
void err_invalid_conversion(const std::string &from, const std::string &to)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave::idx_vector idx_vector
float lo_ieee_float_nan_value(void)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
class OCTAVE_API SparseMatrix
class OCTAVE_API PermMatrix
class OCTAVE_API SparseComplexMatrix
class OCTAVE_API SparseBoolMatrix
std::complex< double > Complex
std::complex< float > FloatComplex
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
#define FORWARD_MATRIX_VALUE(TYPE, PREFIX)
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)