52 : dimensions (dv), rep (a.rep),
53 slice_data (a.slice_data), slice_len (a.slice_len)
60 (*current_liboctave_error_handler)
61 (
"reshape: can't reshape %s array to %s array",
62 dimensions_str.c_str (), new_dims_str.c_str ());
79 slice_data = rep->data;
82 std::fill_n (slice_data, slice_len, val);
89 if (--rep->count == 0)
94 slice_data = rep->data;
100 template <
typename T>
104 if (--rep->count == 0)
108 slice_data = rep->data;
109 slice_len = rep->len;
115 template <
typename T>
123 bool dims_changed =
false;
129 for (
int i = 0; i < ndims (); i++)
131 if (dimensions(i) == 1)
134 new_dimensions(k++) = dimensions(i);
149 new_dimensions.
resize (2);
151 new_dimensions(0) = tmp;
152 new_dimensions(1) = 1;
157 new_dimensions.
resize (k);
168 template <
typename T>
175 template <
typename T>
183 template <
typename T>
190 template <
typename T>
203 template <
typename T>
210 template <
typename T>
217 template <
typename T>
224 template <
typename T>
237 template <
typename T>
244 template <
typename T>
252 template <
typename T>
259 template <
typename T>
268 template <
typename T>
279 template <
typename T>
307 assert (
n == perm.
numel ());
312 for (
int i = 1; i <
n+1; i++) cdim[i] = cdim[i-1] * dv(i-1);
315 for (
int k = 0; k <
n; k++)
323 for (
int k = 1; k <
n; k++)
349 template <
typename T>
360 if (lr ==
m && lc ==
m)
362 const T *ss = src + kc * nr + kr;
365 blk[j*
m+i] = ss[j*nr + i];
366 T *dd = dest + kr * nc + kc;
369 dd[j*nc+i] = blk[i*
m+j];
373 const T *ss = src + kc * nr + kr;
376 blk[j*
m+i] = ss[j*nr + i];
377 T *dd = dest + kr * nc + kc;
380 dd[j*nc+i] = blk[i*
m+j];
390 template <
typename T>
399 std::copy_n (src,
len, dest);
417 dest =
do_permute (src + i * step, dest, lev-1);
425 template <
typename T>
429 template <
typename T>
439 int perm_vec_len = perm_vec_arg.
numel ();
441 if (perm_vec_len < dv.
ndims ())
442 (*current_liboctave_error_handler)
443 (
"%s: invalid permutation vector", inv ?
"ipermute" :
"permute");
448 dv.
resize (perm_vec_len, 1);
453 bool identity =
true;
456 for (
int i = 0; i < perm_vec_len; i++)
459 if (perm_elt >= perm_vec_len || perm_elt < 0)
460 (*current_liboctave_error_handler)
461 (
"%s: permutation vector contains an invalid element",
462 inv ?
"ipermute" :
"permute");
464 if (checked[perm_elt])
465 (*current_liboctave_error_handler)
466 (
"%s: permutation vector cannot contain identical elements",
467 inv ?
"ipermute" :
"permute");
470 checked[perm_elt] =
true;
471 identity = identity && perm_elt == i;
480 for (
int i = 0; i < perm_vec_len; i++)
481 perm_vec(perm_vec_arg(i)) = i;
484 for (
int i = 0; i < perm_vec_len; i++)
485 dv_new(i) = dv(perm_vec(i));
526 for (
int i = 1; i <
n; i++)
556 template <
typename T>
557 T *
do_index (
const T *src, T *dest,
int lev)
const
573 template <
typename T>
574 const T *
do_assign (
const T *src, T *dest,
int lev)
const
590 template <
typename T>
591 void do_fill (
const T& val, T *dest,
int lev)
const
606 template <
typename T>
609 template <
typename T>
612 template <
typename T>
636 int l = ndv.
ndims ();
640 for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i);
649 for (
int j = 0; j <
n; j++)
652 sext[j] = sld *= odv(i+j);
669 template <
typename T>
674 std::copy_n (src,
cext[0], dest);
682 for (k = 0; k <
cext[lev]; k++)
685 std::fill_n (dest + k * dd,
dext[lev] - k * dd, rfv);
691 template <
typename T>
696 template <
typename T>
734 if (
n != 1 && is_nd_vector () && idx_len != 1
763 template <
typename T>
810 const T *src = data ();
821 template <
typename T>
825 int ial = ia.
numel ();
832 retval = index (ia(0), ia(1));
839 bool all_colons =
true;
840 for (
int i = 0; i < ial; i++)
842 if (ia(i).extent (dv(i)) != dv(i))
846 all_colons = all_colons && ia(i).is_colon ();
859 for (
int i = 0; i < ial; i++) rdv(i) = ia(i).length (dv(i));
866 if (rh.is_cont_range (l, u))
885 template <
typename T>
889 static T zero = T ();
896 template <
typename T>
900 if (
n < 0 || ndims () != 2)
911 bool invalid =
false;
912 if (rows () == 0 || rows () == 1)
914 else if (columns () == 1)
923 if (
n == nx - 1 &&
n > 0)
927 slice_data[slice_len-1] = T ();
931 else if (
n == nx + 1 && nx > 0)
935 && slice_data + slice_len < rep->data + rep->len)
937 slice_data[slice_len++] = rfv;
947 std::copy_n (data (), nx, dest);
960 std::copy_n (data (), n0, dest);
961 std::fill_n (dest + n0, n1, rfv);
967 template <
typename T>
971 if (
r < 0 || c < 0 || ndims () != 2)
976 if (
r != rx || c != cx)
985 const T *src = data ();
988 std::copy_n (src,
r * c0, dest);
995 std::copy_n (src, r0, dest);
998 std::fill_n (dest, r1, rfv);
1003 std::fill_n (dest,
r * c1, rfv);
1009 template <
typename T>
1013 int dvl = dv.
ndims ();
1015 resize2 (dv(0), dv(1), rfv);
1016 else if (dimensions != dv)
1018 if (dimensions.ndims () > dvl || dv.
any_neg ())
1031 template <
typename T>
1048 if (tmp.
numel () != nx)
1052 return tmp.
index (i);
1055 template <
typename T>
1058 bool resize_ok,
const T& rfv)
const
1068 if (
r != rx || c != cx)
1080 return tmp.
index (i, j);
1083 template <
typename T>
1086 bool resize_ok,
const T& rfv)
const
1091 int ial = ia.
numel ();
1094 for (
int i = 0; i < ial; i++)
1095 dvx(i) = ia(i).extent (dv(i));
1098 bool all_scalars =
true;
1099 for (
int i = 0; i < ial; i++)
1100 all_scalars = all_scalars && ia(i).is_scalar ();
1111 return tmp.
index (ia);
1114 template <
typename T>
1121 if (rhl != 1 && i.
length (
n) != rhl)
1130 if (dimensions.zero_by_zero () && colon)
1149 *
this = rhs.
reshape (dimensions);
1154 i.
fill (rhs(0),
n, fortran_vec ());
1161 template <
typename T>
1166 bool initial_dims_all_zero = dimensions.all_zero ();
1180 if (initial_dims_all_zero)
1184 rdv(0) = i.
extent (dv(0));
1185 rdv(1) = j.
extent (dv(1));
1188 bool isfill = rhs.
numel () == 1;
1192 bool match = (isfill
1193 || (rhdv.
ndims () == 2 && il == rhdv(0) && jl == rhdv(1)));
1194 match = match || (il == 1 && jl == rhdv(0) && rhdv(1) == 1);
1223 *
this = rhs.
reshape (dimensions);
1233 const T *src = rhs.
data ();
1234 T *dest = fortran_vec ();
1240 ii.
fill (*src,
n, dest);
1260 else if ((il != 0 && jl != 0) || (rhdv(0) != 0 && rhdv(1) != 0))
1265 template <
typename T>
1270 int ial = ia.
numel ();
1274 assign (ia(0), rhs, rfv);
1276 assign (ia(0), ia(1), rhs, rfv);
1279 bool initial_dims_all_zero = dimensions.all_zero ();
1293 if (initial_dims_all_zero)
1298 for (
int i = 0; i < ial; i++)
1299 rdv(i) = ia(i).extent (dv(i));
1304 bool all_colons =
true;
1305 bool isfill = rhs.
numel () == 1;
1309 int rhdvl = rhdv.
ndims ();
1310 for (
int i = 0; i < ial; i++)
1312 all_colons = all_colons && ia(i).is_colon_equiv (rdv(i));
1314 if (l == 1)
continue;
1315 match = match && j < rhdvl && l == rhdv(j++);
1318 match = match && (j == rhdvl || rhdv(j) == 1);
1319 match = match || isfill;
1347 *
this = rhs.
reshape (dimensions);
1358 rh.
fill (rhs(0), fortran_vec ());
1366 bool lhsempty, rhsempty;
1367 lhsempty = rhsempty =
false;
1368 for (
int i = 0; i < ial; i++)
1371 lhsempty = lhsempty || (l == 0);
1372 rhsempty = rhsempty || (rhdv(j++) == 0);
1374 if (! lhsempty || ! rhsempty)
1388 template <
typename T>
1403 bool col_vec = ndims () == 2 && columns () == 1 && rows () != 1;
1404 if (i.
is_scalar () && i(0) ==
n-1 && dimensions.isvector ())
1414 const T *src = data ();
1416 std::copy_n (src, l, dest);
1417 std::copy (src + u, src +
n, dest + l);
1428 template <
typename T>
1432 if (dim < 0 || dim >= ndims ())
1433 (*current_liboctave_error_handler) (
"invalid dimension in delete_elements");
1455 for (
int k = 0; k < dim; k++) dl *= dimensions(k);
1456 for (
int k = dim + 1; k < ndims (); k++) du *= dimensions(k);
1460 const T *src = data ();
1462 l *= dl; u *= dl;
n *= dl;
1465 std::copy_n (src, l, dest);
1467 std::copy (src + u, src +
n, dest);
1484 template <
typename T>
1488 int ial = ia.
numel ();
1491 delete_elements (ia(0));
1495 for (k = 0; k < ial; k++)
1497 if (! ia(k).is_colon ())
1513 delete_elements (dim, ia(dim));
1528 bool empty_assignment =
false;
1530 int num_non_colon_indices = 0;
1534 for (
int i = 0; i < ial; i++)
1538 if (ia(i).length (dim_len) == 0)
1540 empty_assignment =
true;
1544 if (! ia(i).is_colon_equiv (dim_len))
1546 num_non_colon_indices++;
1548 if (num_non_colon_indices == 2)
1553 if (! empty_assignment)
1554 (*current_liboctave_error_handler)
1555 (
"a null assignment can only have one non-colon index");
1561 template <
typename T>
1567 if (ndims () == 2 && a.
ndims () == 2)
1574 for (
int k = 2; k < a.
ndims (); k++)
1582 template <
typename T>
1597 template <
typename T>
1601 assert (ndims () == 2);
1606 if (nr >= 8 && nc >= 8)
1616 else if (nr > 1 && nc > 1)
1622 result.
xelem (j, i) = xelem (i, j);
1633 template <
typename T>
1640 template <
typename T>
1644 assert (ndims () == 2);
1652 if (nr >= 8 && nc >= 8)
1661 for (jj = 0; jj < (nc - 8 + 1); jj += 8)
1664 for (ii = 0; ii < (nr - 8 + 1); ii += 8)
1668 j < jj + 8; j++, idxj += nr)
1670 buf[k++] = xelem (i + idxj);
1677 result.
xelem (j + idxi) = fcn (buf[k]);
1683 result.
xelem (j, i) = fcn (xelem (i, j));
1688 result.
xelem (j, i) = fcn (xelem (i, j));
1698 result.
xelem (j, i) = fcn (xelem (i, j));
1738 template <
typename T>
1748 template <
typename T>
1755 template <
typename T>
1760 (*current_liboctave_error_handler) (
"sort: invalid dimension");
1769 if (dim >= dv.
ndims ())
1776 for (
int i = 0; i < dim; i++)
1779 T *v =
m.fortran_vec ();
1780 const T *ov = data ();
1800 if (sort_isnan<T> (tmp))
1812 std::reverse (v + ku, v + ns);
1814 std::rotate (v, v + ku, v + ns);
1830 while (offset >= stride)
1836 offset += offset2 * stride * ns;
1844 T tmp = ov[i*stride + offset];
1845 if (sort_isnan<T> (tmp))
1852 lsort.
sort (buf, kl);
1857 std::reverse (buf + ku, buf + ns);
1859 std::rotate (buf, buf + ku, buf + ns);
1864 v[i*stride + offset] = buf[i];
1871 template <
typename T>
1876 if (dim < 0 || dim >= ndims ())
1877 (*current_liboctave_error_handler) (
"sort: invalid dimension");
1893 for (
int i = 0; i < dim; i++)
1896 T *v =
m.fortran_vec ();
1897 const T *ov = data ();
1920 if (sort_isnan<T> (tmp))
1935 lsort.
sort (v, vi, kl);
1940 std::reverse (v + ku, v + ns);
1941 std::reverse (vi + ku, vi + ns);
1944 std::rotate (v, v + ku, v + ns);
1945 std::rotate (vi, vi + ku, vi + ns);
1964 while (offset >= stride)
1970 offset += offset2 * stride * ns;
1978 T tmp = ov[i*stride + offset];
1979 if (sort_isnan<T> (tmp))
1994 lsort.
sort (buf, bufi, kl);
1999 std::reverse (buf + ku, buf + ns);
2000 std::reverse (bufi + ku, bufi + ns);
2003 std::rotate (buf, buf + ku, buf + ns);
2004 std::rotate (bufi, bufi + ku, bufi + ns);
2010 v[i*stride + offset] = buf[i];
2012 vi[i*stride + offset] = bufi[i];
2019 template <
typename T>
2032 template <
typename T>
2046 compare_fcn_type compare
2064 template <
typename T>
2082 template <
typename T>
2091 if (
r <= 1 || c == 0)
2097 compare_fcn_type compare
2101 for (i = 0; i < cols (); i++)
2104 T u =
elem (rows () - 1, i);
2115 else if (compare (u, l))
2126 if (mode ==
UNSORTED && i == cols ())
2143 template <
typename T>
2161 return lsort.
lookup (data (),
n, value);
2164 template <
typename T>
2186 static const double ratio = 1.0;
2194 if ((vmode ==
ASCENDING && sort_isnan<T> (values(nval-1)))
2195 || (vmode ==
DESCENDING && sort_isnan<T> (values(0))))
2208 template <
typename T>
2212 const T *src = data ();
2215 const T zero = T ();
2223 template <
typename T>
2228 const T *src = data ();
2230 const T zero = T ();
2231 if (n < 0 || n >= nel)
2237 cnt += src[i] != zero;
2242 if (src[i] != zero) *dest++ = i;
2257 for (; l >= 0 && src[l] == zero; l--) ;
2266 std::reverse (rdata, rdata + k);
2275 for (; l != nel && src[l] == zero; l++) ;
2296 || (rows () == 0 && dims ().
numel (1) == 0))
2298 else if (rows () == 1 && ndims () == 2)
2304 template <
typename T>
2309 (*current_liboctave_error_handler) (
"nth_element: invalid dimension");
2312 if (dim >= dv.ndims ())
2313 dv.resize (dim+1, 1);
2320 dv.chop_trailing_singletons ();
2331 switch (
n.idx_class ())
2355 if (
n(1) -
n(0) == 1)
2360 else if (
n(1) -
n(0) == -1)
2376 (*current_liboctave_error_handler)
2377 (
"nth_element: n must be a scalar or a contiguous range");
2381 if (lo < 0 || up > ns)
2382 (*current_liboctave_error_handler) (
"nth_element: invalid element index");
2387 for (
int i = 0; i < dim; i++)
2390 T *v =
m.fortran_vec ();
2391 const T *ov = data ();
2410 if (sort_isnan<T> (tmp))
2425 T tmp = ov[offset + i*stride];
2426 if (sort_isnan<T> (tmp))
2432 if (offset == stride-1)
2446 std::rotate (buf, buf + ku, buf + ns);
2460 v[offset + stride * i] = buf[lo + i];
2461 if (offset == stride-1)
2469 #define NO_INSTANTIATE_ARRAY_SORT(T) \
2470 template <> Array<T> \
2471 Array<T>::sort (int, sortmode) const \
2475 template <> Array<T> \
2476 Array<T>::sort (Array<octave_idx_type> &sidx, int, sortmode) const \
2478 sidx = Array<octave_idx_type> (); \
2481 template <> sortmode \
2482 Array<T>::issorted (sortmode) const \
2486 Array<T>::compare_fcn_type \
2487 safe_comparator (sortmode, const Array<T>&, bool) \
2491 template <> Array<octave_idx_type> \
2492 Array<T>::sort_rows_idx (sortmode) const \
2494 return Array<octave_idx_type> (); \
2496 template <> sortmode \
2497 Array<T>::is_sorted_rows (sortmode) const \
2501 template <> octave_idx_type \
2502 Array<T>::lookup (T const &, sortmode) const \
2506 template <> Array<octave_idx_type> \
2507 Array<T>::lookup (const Array<T>&, sortmode) const \
2509 return Array<octave_idx_type> (); \
2511 template <> octave_idx_type \
2512 Array<T>::nnz (void) const \
2516 template <> Array<octave_idx_type> \
2517 Array<T>::find (octave_idx_type, bool) const \
2519 return Array<octave_idx_type> (); \
2521 template <> Array<T> \
2522 Array<T>::nth_element (const idx_vector&, int) const { \
2523 return Array<T> (); \
2526 template <
typename T>
2535 (*current_liboctave_error_handler) (
"Matrix must be 2-dimensional");
2540 if (nnr == 0 && nnc == 0)
2542 else if (nnr != 1 && nnc != 1)
2550 if (nnr > 0 && nnc > 0)
2559 d.xelem (i) =
elem (i, i+k);
2564 d.xelem (i) =
elem (i-k, i);
2569 d.xelem (i) =
elem (i, i);
2597 d.xelem (i+roff, i+coff) =
elem (0, i);
2605 d.xelem (i+roff, i+coff) =
elem (i, 0);
2612 template <
typename T>
2616 if (ndims () != 2 || (rows () != 1 && cols () != 1))
2617 (*current_liboctave_error_handler) (
"cat: invalid dimension");
2628 template <
typename T>
2635 if (dim == -1 || dim == -2)
2641 (*current_liboctave_error_handler) (
"cat: invalid dimension");
2644 return array_list[0];
2671 if (
n > 2 && dim > 1)
2691 if (! (dv.*concat_rule) (array_list[i].
dims (), dim))
2692 (*current_liboctave_error_handler) (
"cat: dimension mismatch");
2711 if (array_list[i].isempty ())
2717 if (dim < array_list[i].ndims ())
2718 u = l + array_list[i].
dims ()(dim);
2732 template <
typename T>
2736 os << prefix <<
"rep address: " << rep <<
'\n'
2737 << prefix <<
"rep->len: " << rep->len <<
'\n'
2738 << prefix <<
"rep->data: " <<
static_cast<void *
> (rep->data) <<
'\n'
2739 << prefix <<
"rep->count: " << rep->count <<
'\n'
2740 << prefix <<
"slice_data: " <<
static_cast<void *
> (slice_data) <<
'\n'
2741 << prefix <<
"slice_len: " << slice_len <<
'\n';
2749 template <
typename T>
2752 bool retval = dimensions == dv;
2759 template <
typename T>
2767 #define INSTANTIATE_ARRAY(T, API) \
2768 template <> void Array<T>::instantiation_guard () { } \
2769 template class API Array<T>
2773 template <
typename T>
2779 int n_dims = a_dims.
ndims ();
2781 os << n_dims <<
"-dimensional array";
2784 os <<
" (" << a_dims.
str () <<
')';
2797 for (
int i = 2; i < n_dims; i++)
2841 for (
int i = 0; i <
m; i++)
2845 for (
int j = 2; j < n_dims - 1; j++)
2846 os <<
ra_idx(j) + 1 <<
',';
2848 os <<
ra_idx(n_dims - 1) + 1 <<
") = \n";
template class OCTAVE_API Array< octave_idx_type >
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
dim_vector zero_dims_inquire(const Array< idx_vector > &ia, const dim_vector &rhdv)
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
std::ostream & operator<<(std::ostream &os, const Array< T > &a)
Array< T >::compare_fcn_type safe_comparator(sortmode mode, const Array< T > &, bool)
bool sort_isnan(typename ref_param< T >::type)
static T no_op_fcn(const T &x)
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
The real representation of all arrays.
octave::refcount< octave_idx_type > count
N Dimensional Array with copy-on-write semantics.
static Array< T >::ArrayRep * nil_rep(void)
octave_idx_type nnz(void) const
Count nonzero elements.
Array< T >::ArrayRep * rep
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
Array< T > page(octave_idx_type k) const
Extract page: A(:,:,k+1).
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
void resize1(octave_idx_type n, const T &rfv)
Size of the specified dimension.
static void instantiation_guard()
Size of the specified dimension.
Array< T > sort(int dim=0, sortmode mode=ASCENDING) const
Size of the specified dimension.
virtual T resize_fill_value(void) const
Size of the specified dimension.
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
sortmode issorted(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
void assign(const idx_vector &i, const Array< T > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
octave_idx_type columns(void) const
T & xelem(octave_idx_type n)
Size of the specified dimension.
Array< T > nth_element(const idx_vector &n, int dim=0) const
Returns the n-th element in increasing order, using the same ordering as used for sort.
octave_idx_type numel(void) const
Number of elements in the array.
Array< octave_idx_type > find(octave_idx_type n=-1, bool backward=false) const
Find indices of (at most n) nonzero elements.
T & elem(octave_idx_type n)
Size of the specified dimension.
const T * data(void) const
Size of the specified dimension.
octave_idx_type lookup(const T &value, sortmode mode=UNSORTED) const
Do a binary lookup in a sorted array.
T & checkelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type rows(void) const
Array< T > hermitian(T(*fcn)(const T &)=nullptr) const
Size of the specified dimension.
void resize2(octave_idx_type nr, octave_idx_type nc, const T &rfv)
Resizing (with fill).
friend class Array
Size of the specified dimension.
Array< T > column(octave_idx_type k) const
Extract column: A(:,k+1).
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
ref_param< T >::type crefT
Array< T > index(const idx_vector &i) const
Indexing without resizing.
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
Size of the specified dimension.
Array< T > diag(octave_idx_type k=0) const
Get the kth super or subdiagonal.
Array< T > transpose(void) const
Size of the specified dimension.
octave_idx_type dim2(void) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
int ndims(void) const
Size of the specified dimension.
octave_idx_type compute_index(octave_idx_type i, octave_idx_type j) const
Size of the specified dimension.
void print_info(std::ostream &os, const std::string &prefix) const
Size of the specified dimension.
const T * fortran_vec(void) const
Size of the specified dimension.
static Array< T > cat(int dim, octave_idx_type n, const Array< T > *array_list)
Concatenation along a specified (0-based) dimension, equivalent to cat().
Array< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
Size of the specified dimension.
bool optimize_dimensions(const dim_vector &dv)
Returns true if this->dims () == dv, and if so, replaces this->dimensions by a shallow copy of dv.
Array< T > linear_slice(octave_idx_type lo, octave_idx_type up) const
Extract a slice from this array as a column vector: A(:)(lo+1:up).
octave_idx_type dim1(void) const
void delete_elements(const idx_vector &i)
Deleting elements.
bool isempty(void) const
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
bool concat(const dim_vector &dvb, int dim)
This corresponds to cat().
void chop_all_singletons(void)
std::string str(char sep='x') const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
bool zero_by_zero(void) const
void resize(int n, int fill_value=0)
static dim_vector alloc(int n)
bool hvcat(const dim_vector &dvb, int dim)
This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1).
void chop_trailing_singletons(void)
octave_idx_type ndims(void) const
Number of dimensions.
bool is_nd_vector(void) const
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
octave_idx_type safe_numel(void) const
The following function will throw a std::bad_alloc () exception if the requested size is larger than ...
dim_vector make_nd_vector(octave_idx_type n) const
octave_idx_type xelem(octave_idx_type n) const
bool is_colon(void) const
octave_idx_type fill(const T &val, octave_idx_type n, T *dest) const
static const idx_vector colon
bool maybe_reduce(octave_idx_type n, const idx_vector &j, octave_idx_type nj)
octave_idx_type length(octave_idx_type n=0) const
octave_idx_type index(const T *src, octave_idx_type n, T *dest) const
bool is_scalar(void) const
bool is_cont_range(octave_idx_type n, octave_idx_type &l, octave_idx_type &u) const
octave_idx_type assign(const T *src, octave_idx_type n, T *dest) const
idx_vector complement(octave_idx_type n) const
dim_vector orig_dimensions(void) const
octave_idx_type extent(octave_idx_type n) const
bool is_colon_equiv(octave_idx_type n) const
virtual octave_idx_type numel(void) const
void set_compare(compare_fcn_type comp)
void sort_rows(const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols)
static bool descending_compare(typename ref_param< T >::type, typename ref_param< T >::type)
bool issorted(const T *data, octave_idx_type nel)
octave_idx_type lookup(const T *data, octave_idx_type nel, const T &value)
void sort(T *data, octave_idx_type nel)
void nth_element(T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up=-1)
bool is_sorted_rows(const T *data, octave_idx_type rows, octave_idx_type cols)
void lookup_sorted(const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, bool rev=false)
void assign(const T *src, T *dest) const
rec_index_helper & operator=(const rec_index_helper &)=delete
rec_index_helper(const rec_index_helper &)=delete
const T * do_assign(const T *src, T *dest, int lev) const
void index(const T *src, T *dest) const
void do_fill(const T &val, T *dest, int lev) const
rec_index_helper(const dim_vector &dv, const Array< idx_vector > &ia)
T * do_index(const T *src, T *dest, int lev) const
void fill(const T &val, T *dest) const
bool is_cont_range(octave_idx_type &l, octave_idx_type &u) const
~rec_permute_helper(void)
void permute(const T *src, T *dest) const
T * do_permute(const T *src, T *dest, int lev) const
static T * blk_trans(const T *src, T *dest, octave_idx_type nr, octave_idx_type nc)
rec_permute_helper(const dim_vector &dv, const Array< octave_idx_type > &perm)
rec_permute_helper & operator=(const rec_permute_helper &)=delete
rec_permute_helper(const rec_permute_helper &)=delete
void do_resize_fill(const T *src, T *dest, const T &rfv, int lev) const
void resize_fill(const T *src, T *dest, const T &rfv) const
rec_resize_helper(const dim_vector &ndv, const dim_vector &odv)
rec_resize_helper & operator=(const rec_resize_helper &)=delete
if_then_else< is_class_type< T >::no, T, T const & >::result type
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
Complex log2(const Complex &x)
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
void err_del_index_out_of_range(bool is1d, octave_idx_type idx, octave_idx_type ext)
void err_invalid_resize(void)
void err_index_out_of_range(int nd, int dim, octave_idx_type idx, octave_idx_type ext, const dim_vector &dv)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value)
T::size_type numel(const T &str)
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value::octave_value(const Array< char > &chm, char type) return retval