25 #if defined (HAVE_CONFIG_H) 43 OCTAVE_NORETURN
static 47 (*current_liboctave_error_handler) (
"invalid range used as index");
53 (*current_liboctave_error_handler)
54 (
"internal error: idx_vector index out of range");
75 (*current_liboctave_error_handler)
76 (
"internal error: as_array not allowed for this index class");
87 (*current_liboctave_error_handler)
88 (
"internal error: invalid character converted to idx_vector; must be ':'");
106 (*current_liboctave_error_handler)
107 (
"internal error: idx_colon_rep::sort_idx");
120 len (_step ?
std::
max ((_limit - _start) / _step,
153 double b = r.
base ();
154 double inc = r.
inc ();
163 if (i < 0 || i >= len)
184 if (step < 0 && len > 0)
212 static_cast<double> (step), len);
229 if (
i <= 0 && ! conv_error)
243 if (static_cast<double> (
i) !=
x)
255 template <
typename T>
265 template <
typename T>
316 template <
typename T>
319 aowner (nullptr), orig_dims (nda.
dims ())
376 aowner (nullptr), orig_dims (len, len)
418 aowner (nullptr), orig_dims ()
435 d[
k++] = j * nr + bnda.
ridx (
i);
454 if (n < 0 || n >= len)
470 std::unique_ptr<idx_vector_rep> new_rep (
477 new_rep->
data = new_data;
479 std::copy_n (
data, len, new_data);
482 lsort.
sort (new_data, len);
488 new_rep->
len = new_len;
506 new_rep->
len = new_len;
513 new_rep->
data = new_data;
527 new_rep->
data = new_data;
536 return new_rep.release ();
543 std::unique_ptr<idx_vector_rep> new_rep (
549 idx.
clear (orig_dims);
555 new_rep->
data = new_data;
556 std::copy_n (
data, len, new_data);
560 lsort.
sort (new_data, idx_data, len);
570 idx.
clear (orig_dims);
574 new_rep->
data = new_data;
592 return new_rep.release ();
645 lsti (-1), lste (-1), aowner (nullptr), orig_dims (len, len)
649 bool *
d =
new bool [1];
659 lsti (-1), lste (-1), aowner (nullptr), orig_dims ()
666 while (
ext > 0 && ! bnda(
ext-1))
691 while (!
data[++lste]) ;
698 if (
data[++lste]) --n;
706 if (n < 0 || n >= len)
787 bool reduced =
false;
889 if ((l*
t == n && tj == 1) || (
t == 0 && tj == 0))
1044 assert (r !=
nullptr);
1057 (*current_liboctave_error_handler) (
"colon not allowed");
1068 else if (step == -1)
1071 for (
i = 0, j =
start;
i < len;
i++, j += step) *
data++ = j;
1086 std::copy_n (rdata, len,
data);
1112 (*current_liboctave_error_handler)
1113 (
"internal error: out of range complement index requested");
1125 std::fill_n (ndata + ext, n - ext,
true);
1170 assert (n ==
length (n));
1217 ext = (len > 0 ? idata[len - 1] + 1 : 0);
1285 if (! resize_ok &&
extent (z_len) > z_len)
1287 (*current_liboctave_error_handler)
1288 (
"invalid matrix index = %d",
extent (z_len));
1315 #define INSTANTIATE_SCALAR_VECTOR_REP_CONST(T) \ 1316 template OCTAVE_API idx_vector::idx_scalar_rep::idx_scalar_rep (T); \ 1317 template OCTAVE_API idx_vector::idx_vector_rep::idx_vector_rep (const Array<T>&);
const octave_idx_type * get_data(void) const
virtual Array< octave_idx_type > as_array(void)
idx_base_rep * sort_uniq_clone(bool uniq=false)
dim_vector orig_dimensions(void) const
std::ostream & print(std::ostream &os) const
idx_base_rep * sort_idx(Array< octave_idx_type > &)
Range unconvert(void) const
octave_idx_type checkelem(octave_idx_type i) const
idx_class_type idx_class(void) const
static void err_index_out_of_range(void)
std::ostream & print(std::ostream &os) const
idx_base_rep * sort_idx(Array< octave_idx_type > &)
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value)
const FloatComplex * data(void) const
nd group nd example oindent but is performed more efficiently If only and it is a scalar
octave_idx_type extent(octave_idx_type n) const
static const idx_vector colon
octave_idx_type max(void) const
bool all_elements_are_ints(void) const
Array< octave_idx_type > as_array(void)
static idx_vector_rep * err_rep(void)
idx_colon_rep(void)=default
Array< bool > unconvert(void) const
octave_idx_type xelem(octave_idx_type n) const
void set_compare(compare_fcn_type comp)
Array< double > unconvert(void) const
octave_idx_type * cidx(void)
dim_vector make_nd_vector(octave_idx_type n) const
octave_idx_type ones_count(void) const
const T * fortran_vec(void) const
double unconvert(void) const
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
std::complex< T > floor(const std::complex< T > &x)
idx_vector inverse_permutation(octave_idx_type n) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
void unconvert(idx_class_type &iclass, double &scalar, Range &range, Array< double > &array, Array< bool > &mask) const
idx_mask_rep(void)=delete
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
octave_idx_type extent(octave_idx_type n) const
octave_idx_type checkelem(octave_idx_type i) const
bool is_cont_range(octave_idx_type n, octave_idx_type &l, octave_idx_type &u) 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
idx_range_rep(void)=delete
virtual idx_class_type idx_class(void) const
Complex log2(const Complex &x)
octave_idx_type length(octave_idx_type) const
const bool * get_data(void) const
Array< octave_idx_type > as_array(void)
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 const F77_DBLE F77_DBLE * d
octave_idx_type convert_index(octave_idx_type i, bool &conv_error, octave_idx_type &ext)
octave_idx_type elem(octave_idx_type n) const
idx_base_rep * sort_idx(Array< octave_idx_type > &)
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
bool is_permutation(octave_idx_type n) const
octave_idx_type nnz(void) const
Count nonzero elements.
then the function must return scalars which will be concatenated into the return array(s). If code
virtual bool is_colon_equiv(octave_idx_type) const
octave_idx_type length(octave_idx_type) const
dim_vector orig_dimensions(void) const
idx_base_rep * sort_uniq_clone(bool uniq=false)
octave_idx_type extent(octave_idx_type n) const
bool is_colon(void) const
void copy_data(octave_idx_type *data) const
octave_idx_type checkelem(octave_idx_type i) const
static idx_vector_rep * nil_rep(void)
octave_idx_type xelem(octave_idx_type i) const
octave_idx_type length(octave_idx_type n=0) const
octave_idx_type increment(void) const
idx_vector sorted(bool uniq=false) const
octave_idx_type * ridx(void)
bool isvector(void) const
Array< octave_idx_type > as_array(void)
#define INSTANTIATE_SCALAR_VECTOR_REP_CONST(T)
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
OCTAVE_NORETURN idx_base_rep * sort_idx(Array< octave_idx_type > &)
std::ostream & print(std::ostream &os) const
octave_idx_type get_step(void) const
T & xelem(octave_idx_type n)
octave_idx_type get_start(void) const
octave_idx_type get_data(void) const
nd group nd example oindent but is performed more efficiently If only and it is a the dimension of the result is then the dimensions of the result are then the dimensions of the result are given by the elements of that vector An object can be resized to more dimensions than it has
octave_idx_type cols(void) const
T::size_type numel(const T &str)
void sort(T *data, octave_idx_type nel)
bool is_colon_equiv(octave_idx_type n) const
std::ostream & print(std::ostream &os) const
bool isvector(void) const
octave_idx_type fill(const T &val, octave_idx_type n, T *dest) const
octave_idx_type checkelem(octave_idx_type i) const
idx_scalar_rep(void)=delete
idx_base_rep * sort_idx(Array< octave_idx_type > &)
const octave_idx_type * data
idx_vector unmask(void) const
Array< octave_idx_type > find(octave_idx_type n=-1, bool backward=false) const
Find indices of (at most n) nonzero elements.
bool maybe_reduce(octave_idx_type n, const idx_vector &j, octave_idx_type nj)
std::ostream & print(std::ostream &os) const
dim_vector dims(void) const
idx_vector complement(octave_idx_type n) const
octave_idx_type ndims(void) const
Number of dimensions.
octave_idx_type freeze(octave_idx_type z_len, const char *tag, bool resize_ok=false)
OCTAVE_EXPORT octave_value_list or cell arrays Arguments are concatenated vertically The returned values are padded with blanks as needed to make each row of the string array have the same length Empty input strings are significant and will concatenated in the output For numerical each element is converted to the corresponding ASCII character A range error results if an input is outside the ASCII range(0-255). For cell arrays
Array< octave_idx_type > as_array(void) const
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
const octave_idx_type * raw(void)
octave_idx_type checkelem(octave_idx_type i) const
nd group nd example For each display the value
virtual octave_idx_type length(octave_idx_type n) const =0
octave_idx_type rows(void) const
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
Array< octave_idx_type > as_array(void)
static OCTAVE_NORETURN void err_invalid_range(void)