26 #if ! defined (octave_ov_range_h)
27 #define octave_ov_range_h 1
29 #include "octave-config.h"
35 #include <type_traits>
60 : m_numel (
numel), m_base (base), m_increment(incr) { }
70 return m_base +
static_cast<int> (i) * m_increment;
71 return m_base + (m_numel - 1) * m_increment;
78 return m_base +
static_cast<int> (i) * m_increment;
79 return m_base + (m_numel - 1) * m_increment;
108 error (
"invalid range");
113 m_idx_cache (
r.m_idx_cache
120 set_idx_cache (cache);
142 OCTINTERP_API type_conv_info numeric_conversion_function ()
const;
154 const std::list<octave_value_list>& idx);
157 const std::list<octave_value_list>& idx,
int)
158 {
return subsref (type, idx); }
172 OCTINTERP_API
bool could_be_trivial_range ();
188 resize (
const dim_vector& dv,
bool fill =
false)
const;
190 std::size_t
byte_size ()
const {
return 3 *
sizeof (T); }
194 return raw_array_value ().
reshape (new_dims);
199 return raw_array_value ().
permute (vec, inv);
257 typename ov_mx_type::object_type
m (raw_array_value ());
267 typename ov_mx_type::object_type
m (raw_array_value ());
276 return m_range.
diag (k);
284 typename ov_mx_type::object_type
m (raw_array_value ());
286 return m.diag (nr, nc);
292 return tmp.
sort (dim, mode);
299 return tmp.
sort (sidx, dim, mode);
304 return m_range.issorted (mode);
319 OCTINTERP_API
double double_value (
bool =
false)
const;
321 OCTINTERP_API
float float_value (
bool =
false)
const;
325 return double_value (frc_str_conv);
330 return float_value (frc_str_conv);
335 return raw_array_value ();
340 return raw_array_value ();
345 return raw_array_value ();
350 return raw_array_value ();
353 OCTINTERP_API
charNDArray char_array_value (
bool =
false)
const;
361 return raw_array_value ();
366 return raw_array_value ();
371 return raw_array_value ();
376 return raw_array_value ();
381 return raw_array_value ();
386 return raw_array_value ();
391 return raw_array_value ();
396 return raw_array_value ();
409 OCTINTERP_API
Complex complex_value (
bool =
false)
const;
411 OCTINTERP_API
FloatComplex float_complex_value (
bool =
false)
const;
413 OCTINTERP_API
boolNDArray bool_array_value (
bool warn =
false)
const;
417 return raw_array_value ();
422 return raw_array_value ();
427 return raw_array_value ();
432 return raw_array_value ();
435 OCTINTERP_API octave::range<double> range_value ()
const;
440 convert_to_str_internal (
bool pad,
bool force,
char type)
const;
455 OCTINTERP_API
void print (std::ostream& os,
bool pr_as_read_syntax =
false);
458 print_raw (std::ostream& os,
bool pr_as_read_syntax =
false)
const;
461 print_name_tag (std::ostream& os,
const std::string& name)
const;
463 OCTINTERP_API
void short_disp (std::ostream& os)
const;
467 OCTINTERP_API std::string
471 OCTINTERP_API
bool save_ascii (std::ostream& os);
473 OCTINTERP_API
bool load_ascii (std::istream& is);
475 OCTINTERP_API
bool save_binary (std::ostream& os,
bool save_as_floats);
478 load_binary (std::istream& is,
bool swap,
484 OCTINTERP_API
bool load_hdf5 (
octave_hdf5_id loc_id,
const char *name);
486 int write (octave::stream& os,
int block_size,
493 return os.write (matrix_value (), block_size, output_type, skip, flt_fmt);
496 OCTINTERP_API
mxArray * as_mxArray (
bool interleaved)
const;
501 return tmp.
map (umap);
519 delete m_idx_cache; m_idx_cache =
nullptr;
536 OCTINTERP_API octave::range<double>
Array< T, Alloc > sort(int dim=0, sortmode mode=ASCENDING) const
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
virtual octave_idx_type numel() const
octave_trivial_range(const octave_trivial_range &)=default
bool is_trivial_range() const
double vm_extract_forloop_double(octave_idx_type i)
octave_trivial_range(octave_idx_type numel, int base, int incr)
octave_value vm_extract_forloop_value(octave_idx_type i)
octave_value permute(const Array< int > &vec, bool inv=false) const
octave_value reshape(const dim_vector &dv) const
octave_idx_type nnz() const
octave_value map(octave_base_value::unary_mapper_t umap) const
octave_value diag(octave_idx_type k=0) const
ComplexMatrix complex_matrix_value(bool=false) const
double scalar_value(bool frc_str_conv=false) const
octave::idx_vector set_idx_cache(const octave::idx_vector &idx) const
octave_value map(unary_mapper_t umap) const
bool is_uint8_type() const
ov_range(const ov_range< T > &r)
octave_base_value * clone() const
float float_scalar_value(bool frc_str_conv=false) const
octave_idx_type numel() const
int32NDArray int32_array_value() const
bool is_uint16_type() const
bool is_int64_type() const
bool is_double_type() const
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
octave_value diag(octave_idx_type k=0) const
ov_range(const octave::range< T > &r)
builtin_type_t builtin_type() const
static octave_hdf5_id hdf5_save_type
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
SparseMatrix sparse_matrix_value(bool=false) const
FloatNDArray float_array_value(bool=false) const
sortmode issorted(sortmode mode=UNSORTED) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
uint8NDArray uint8_array_value() const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
NDArray array_value(bool=false) const
bool is_int8_type() const
octave_value full_value() const
octave_value all(int dim=0) const
Array< T > raw_array_value() const
bool vm_need_storable_call() const
std::size_t byte_size() const
octave_idx_type nnz() const
bool is_int16_type() const
bool is_uint32_type() const
octave_value squeeze() const
octave::range< T > m_range
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int)
octave_value any(int dim=0) const
int8NDArray int8_array_value() const
bool is_single_type() const
ComplexNDArray complex_array_value(bool=false) const
octave_value diag(octave_idx_type nr, octave_idx_type nc) const
octave::idx_vector * m_idx_cache
FloatMatrix float_matrix_value(bool=false) const
octave_base_value * empty_clone() const
octave::range< double > range_value() const
ov_range(const octave::range< T > &r, const octave::idx_vector &cache)
Matrix matrix_value(bool=false) const
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
int16NDArray int16_array_value() const
Array< octave_idx_type > sort_rows_idx(sortmode) const
void clear_cached_info() const
bool is_uint64_type() const
octave_value reshape(const dim_vector &new_dims) const
uint16NDArray uint16_array_value() 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
octave_value permute(const Array< int > &vec, bool inv=false) const
FloatComplexNDArray float_complex_array_value(bool=false) const
bool is_int32_type() const
octave_value sort(Array< octave_idx_type > &sidx, octave_idx_type dim=0, sortmode mode=ASCENDING) const
uint32NDArray uint32_array_value() const
uint64NDArray uint64_array_value() const
octave::idx_vector index_vector(bool require_integers=false) const
int64NDArray int64_array_value() const
void() error(const char *fmt,...)
octave::idx_vector idx_vector
std::complex< double > Complex
std::complex< float > FloatComplex
T::size_type numel(const T &str)
bool btyp_isnumeric(builtin_type_t btyp)
bool btyp_isinteger(builtin_type_t btyp)
#define DECLARE_TEMPLATE_OV_TYPEID_SPECIALIZATIONS(cls, type)
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
bool btyp_isfloat(builtin_type_t btyp)
ov_range< double > octave_double_range
octave_double_range octave_range