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");
86 (*current_liboctave_error_handler)
87 (
"internal error: invalid character converted to idx_vector; must be ':'");
105 (*current_liboctave_error_handler)
106 (
"internal error: idx_colon_rep::sort_idx");
119 len (_step ?
std::
max ((_limit - _start) / _step,
152 double b = r.
base ();
153 double inc = r.
inc ();
165 return start + i*step;
183 if (step < 0 && len > 0)
203 os <<
start <<
':' << step <<
':' <<
start + len*step;
211 static_cast<double> (step), len);
228 if (i <= 0 && ! conv_error)
242 if (static_cast<double> (i) !=
x)
251 return convert_index (static_cast<double> (x), conv_error, ext);
254 template <
typename T>
264 template <
typename T>
315 template <
typename T>
317 :
data (0), len (nda.
numel ()), ext (0), aowner (0), orig_dims (nda.
dims ())
373 :
data (0), len (b ? 1 : 0), ext (0), aowner (0), orig_dims (len, len)
386 :
data (0), len (nnz), ext (0), aowner (0), orig_dims ()
415 :
data (0), len (bnda.
nnz ()), ext (0), aowner (0), orig_dims ()
434 d[k++] = j * nr + bnda.
ridx (
i);
453 if (n < 0 || n >= len)
469 std::unique_ptr<idx_vector_rep> new_rep (
476 new_rep->
data = new_data;
478 std::copy (
data,
data + len, new_data);
481 lsort.
sort (new_data, len);
487 new_rep->
len = new_len;
505 new_rep->
len = new_len;
512 new_rep->
data = new_data;
526 new_rep->
data = new_data;
535 return new_rep.release ();
542 std::unique_ptr<idx_vector_rep> new_rep (
548 idx.
clear (orig_dims);
554 new_rep->
data = new_data;
555 std::copy (
data,
data + len, new_data);
559 lsort.
sort (new_data, idx_data, len);
569 idx.
clear (orig_dims);
573 new_rep->
data = new_data;
591 return new_rep.release ();
600 os <<
data[ii] <<
',' <<
' ';
637 :
data (0), len (b ? 1 : 0), ext (0), lsti (-1), lste (-1),
638 aowner (0), orig_dims (len, len)
642 bool *
d =
new bool [1];
651 :
data (0), len (nnz), ext (bnda.
numel ()), lsti (-1), lste (-1),
652 aowner (0), orig_dims ()
659 while (
ext > 0 && ! bnda(
ext-1))
686 while (!
data[++lste]) ;
693 if (
data[++lste]) --n;
701 if (n < 0 || n >= len)
713 os <<
data[ii] <<
',' <<
' ';
772 if (nnz <= bnda.
numel () / factor)
782 bool reduced =
false;
884 if ((l*t == n && tj == 1) || (t == 0 && tj == 0))
1052 (*current_liboctave_error_handler) (
"colon not allowed");
1062 for (i = start, j = start + len; i < j; i++) *data++ = i;
1063 else if (step == -1)
1064 for (i = start, j = start - len; i > j; i--) *data++ = i;
1066 for (i = 0, j = start; i < len; i++, j += step) *data++ = j;
1081 std::copy (rdata, rdata + len, data);
1107 (*current_liboctave_error_handler)
1108 (
"internal error: out of range complement index requested");
1119 ndata[
i] = ! data[
i];
1166 assert (n ==
length (n));
1213 ext = len > 0 ? idata[len - 1] + 1 : 0;
1281 if (! resize_ok &&
extent (z_len) > z_len)
1283 (*current_liboctave_error_handler)
1284 (
"invalid matrix index = %d",
extent (z_len));
1311 #define INSTANTIATE_SCALAR_VECTOR_REP_CONST(T) \
1312 template OCTAVE_API idx_vector::idx_scalar_rep::idx_scalar_rep (T); \
1313 template OCTAVE_API idx_vector::idx_vector_rep::idx_vector_rep (const Array<T>&);
octave_idx_type elem(octave_idx_type n) const
virtual Array< octave_idx_type > as_array(void)
idx_base_rep * sort_uniq_clone(bool uniq=false)
octave_idx_type checkelem(octave_idx_type i) const
octave_idx_type cols(void) const
octave_idx_type extent(octave_idx_type n) const
idx_base_rep * sort_idx(Array< octave_idx_type > &)
octave_idx_type length(octave_idx_type n=0) const
octave_idx_type checkelem(octave_idx_type i) const
static void err_index_out_of_range(void)
octave_idx_type rows(void) const
idx_base_rep * sort_idx(Array< octave_idx_type > &)
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value)
dim_vector dims(void) const
nd group nd example oindent but is performed more efficiently If only and it is a scalar
bool is_vector(void) const
static const idx_vector colon
octave_idx_type numel(void) const
Number of elements in the array.
Array< octave_idx_type > as_array(void)
static idx_vector_rep * err_rep(void)
void set_compare(compare_fcn_type comp)
octave_idx_type checkelem(octave_idx_type i) const
octave_idx_type max(void) const
dim_vector orig_dimensions(void) const
octave_idx_type xelem(octave_idx_type n) const
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
octave_idx_type get_step(void) const
octave_idx_type fill(const T &val, octave_idx_type n, T *dest) const
octave_idx_type get_start(void) const
octave_idx_type * cidx(void)
Range unconvert(void) const
Array< bool > unconvert(void) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
std::ostream & print(std::ostream &os) const
Array< octave_idx_type > as_array(void)
idx_vector inverse_permutation(octave_idx_type n) 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 const F77_DBLE F77_DBLE * d
octave_idx_type convert_index(octave_idx_type i, bool &conv_error, octave_idx_type &ext)
idx_base_rep * sort_idx(Array< octave_idx_type > &)
octave_idx_type length(octave_idx_type) const
virtual bool is_colon_equiv(octave_idx_type) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
dim_vector orig_dimensions(void) const
std::ostream & print(std::ostream &os) const
void copy_data(octave_idx_type *data) const
idx_vector unmask(void) const
Array< double > unconvert(void) const
idx_vector complement(octave_idx_type n) const
idx_base_rep * sort_uniq_clone(bool uniq=false)
std::ostream & print(std::ostream &os) const
then the function must return scalars which will be concatenated into the return array(s).If code
octave_idx_type length(octave_idx_type) const
const FloatComplex * data(void) const
bool is_vector(void) const
octave_idx_type checkelem(octave_idx_type i) const
static idx_vector_rep * nil_rep(void)
virtual idx_class_type idx_class(void) const
octave_idx_type ones_count(void) const
octave_idx_type extent(octave_idx_type n) const
Array< octave_idx_type > as_array(void)
bool is_cont_range(octave_idx_type n, octave_idx_type &l, octave_idx_type &u) const
#define INSTANTIATE_SCALAR_VECTOR_REP_CONST(T)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
bool is_permutation(octave_idx_type n) const
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
double unconvert(void) const
OCTAVE_NORETURN idx_base_rep * sort_idx(Array< octave_idx_type > &)
bool all_zero(void) const
octave_idx_type nnz(void) const
Count nonzero elements.
Array< octave_idx_type > as_array(void) const
T & xelem(octave_idx_type n)
bool is_colon_equiv(octave_idx_type n) 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
idx_class_type idx_class(void) const
octave_idx_type extent(octave_idx_type n) const
T::size_type numel(const T &str)
void sort(T *data, octave_idx_type nel)
octave_idx_type * ridx(void)
=val(i)}if ode{val(i)}occurs in table i
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by nd tex zero divided by nd ifnottex and any operation involving another NaN value(5+NaN).Note that NaN always compares not equal to NaN(NaN!
bool all_elements_are_ints(void) const
octave_idx_type xelem(octave_idx_type i) const
octave_idx_type ndims(void) const
Number of dimensions.
Array< octave_idx_type > find(octave_idx_type n=-1, bool backward=false) const
Find indices of (at most n) nonzero elements.
idx_base_rep * sort_idx(Array< octave_idx_type > &)
const octave_idx_type * data
std::ostream & print(std::ostream &os) const
bool maybe_reduce(octave_idx_type n, const idx_vector &j, octave_idx_type nj)
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
octave_idx_type get_data(void) const
void unconvert(idx_class_type &iclass, double &scalar, Range &range, Array< double > &array, Array< bool > &mask) const
OCTAVE_EXPORT octave_value_list error nd deftypefn *const octave_scalar_map err
octave_idx_type freeze(octave_idx_type z_len, const char *tag, bool resize_ok=false)
std::ostream & print(std::ostream &os) const
const T * fortran_vec(void) const
const octave_idx_type * get_data(void) const
const bool * get_data(void) const
Vector representing the dimensions (size) of an Array.
const octave_idx_type * raw(void)
octave_idx_type increment(void) const
virtual octave_idx_type length(octave_idx_type n) const =0
idx_vector sorted(bool uniq=false) const
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
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
bool is_colon(void) const
octave_idx_type checkelem(octave_idx_type i) const
Array< octave_idx_type > as_array(void)
static OCTAVE_NORETURN void err_invalid_range(void)