51 : dimensions (
dv), rep (
a.rep),
52 slice_data (
a.slice_data), slice_len (
a.slice_len)
59 (*current_liboctave_error_handler)
60 (
"reshape: can't reshape %s array to %s array",
61 dimensions_str.c_str (), new_dims_str.c_str ());
78 slice_data = rep->data;
81 std::fill_n (slice_data, slice_len,
val);
88 if (--rep->count == 0)
93 slice_data = rep->data;
103 if (--rep->count == 0)
107 slice_data = rep->data;
108 slice_len = rep->len;
114 template <
typename T>
122 bool dims_changed =
false;
128 for (
int i = 0;
i < ndims ();
i++)
130 if (dimensions(
i) == 1)
133 new_dimensions(
k++) = dimensions(
i);
148 new_dimensions.
resize (2);
150 new_dimensions(0) =
tmp;
151 new_dimensions(1) = 1;
167 template <
typename T>
174 template <
typename T>
182 template <
typename T>
189 template <
typename T>
202 template <
typename T>
209 template <
typename T>
216 template <
typename T>
223 template <
typename T>
236 template <
typename T>
243 template <
typename T>
251 template <
typename T>
258 template <
typename T>
267 template <
typename T>
278 template <
typename T>
306 assert (
n == perm.
numel ());
311 for (
int i = 1;
i <
n+1;
i++) cdim[
i] = cdim[
i-1] *
dv(
i-1);
314 for (
int k = 0;
k <
n;
k++)
322 for (
int k = 1;
k <
n;
k++)
348 template <
typename T>
359 if (lr == m && lc == m)
361 const T *ss = src + kc * nr + kr;
364 blk[j*m+
i] = ss[j*nr +
i];
365 T *dd = dest + kr * nc + kc;
368 dd[j*nc+
i] = blk[
i*m+j];
372 const T *ss = src + kc * nr + kr;
375 blk[j*m+
i] = ss[j*nr +
i];
376 T *dd = dest + kr * nc + kc;
379 dd[j*nc+
i] = blk[
i*m+j];
389 template <
typename T>
398 std::copy_n (src, len, dest);
424 template <
typename T>
428 template <
typename T>
438 int perm_vec_len = perm_vec_arg.
numel ();
440 if (perm_vec_len <
dv.
ndims ())
442 (
"%s: invalid permutation vector", inv ?
"ipermute" :
"permute");
452 bool identity =
true;
455 for (
int i = 0;
i < perm_vec_len;
i++)
458 if (perm_elt >= perm_vec_len || perm_elt < 0)
459 (*current_liboctave_error_handler)
460 (
"%s: permutation vector contains an invalid element",
461 inv ?
"ipermute" :
"permute");
463 if (checked[perm_elt])
464 (*current_liboctave_error_handler)
465 (
"%s: permutation vector cannot contain identical elements",
466 inv ?
"ipermute" :
"permute");
469 checked[perm_elt] =
true;
470 identity = identity && perm_elt ==
i;
479 for (
int i = 0;
i < perm_vec_len;
i++)
480 perm_vec(perm_vec_arg(
i)) =
i;
483 for (
int i = 0;
i < perm_vec_len;
i++)
484 dv_new(
i) =
dv(perm_vec(
i));
525 for (
int i = 1;
i <
n;
i++)
555 template <
typename T>
556 T *
do_index (
const T *src, T *dest,
int lev)
const 572 template <
typename T>
573 const T *
do_assign (
const T *src, T *dest,
int lev)
const 589 template <
typename T>
605 template <
typename T>
608 template <
typename T>
611 template <
typename T>
635 int l = ndv.
ndims ();
636 assert (odv.
ndims () == l);
639 for (;
i < l-1 && ndv(
i) == odv(
i);
i++) ld *= ndv(
i);
648 for (
int j = 0; j <
n; j++)
651 sext[j] = sld *= odv(
i+j);
652 dext[j] = dld *= ndv(
i+j);
668 template <
typename T>
673 std::copy_n (src,
cext[0], dest);
681 for (
k = 0;
k <
cext[lev];
k++)
684 std::fill_n (dest +
k * dd,
dext[lev] -
k * dd, rfv);
690 template <
typename T>
695 template <
typename T>
727 if (
i.extent (n) != n)
733 if (n != 1 && is_nd_vector () && idx_len != 1
745 if (idx_len != 0 &&
i.is_cont_range (n, l,
u))
755 i.index (data (), n,
retval.fortran_vec ());
762 template <
typename T>
779 if (
i.extent (r) != r)
809 const T *src = data ();
810 T *dest =
retval.fortran_vec ();
813 dest +=
i.index (src + r * j.
xelem (
k), r, dest);
820 template <
typename T>
824 int ial = ia.
numel ();
831 retval = index (ia(0), ia(1));
838 bool all_colons =
true;
839 for (
int i = 0;
i < ial;
i++)
841 if (ia(
i).extent (
dv(
i)) !=
dv(
i))
845 all_colons = all_colons && ia(
i).is_colon ();
884 template <
typename T>
888 static T
zero = T ();
895 template <
typename T>
899 if (n < 0 || ndims () != 2)
910 bool invalid =
false;
911 if (rows () == 0 || rows () == 1)
913 else if (columns () == 1)
922 if (n == nx - 1 && n > 0)
926 slice_data[slice_len-1] = T ();
930 else if (n == nx + 1 && nx > 0)
934 && slice_data + slice_len < rep->data + rep->len)
936 slice_data[slice_len++] = rfv;
944 T *dest =
tmp.fortran_vec ();
946 std::copy_n (data (), nx, dest);
955 T *dest =
tmp.fortran_vec ();
959 std::copy_n (data (), n0, dest);
960 std::fill_n (dest + n0, n1, rfv);
966 template <
typename T>
970 if (r < 0 ||
c < 0 || ndims () != 2)
975 if (r != rx ||
c != cx)
978 T *dest =
tmp.fortran_vec ();
984 const T *src = data ();
987 std::copy_n (src, r * c0, dest);
994 std::copy_n (src, r0, dest);
997 std::fill_n (dest, r1, rfv);
1002 std::fill_n (dest, r * c1, rfv);
1008 template <
typename T>
1014 resize2 (
dv(0),
dv(1), rfv);
1015 else if (dimensions !=
dv)
1017 if (dimensions.ndims () > dvl ||
dv.
any_neg ())
1030 template <
typename T>
1044 tmp.resize1 (nx, rfv);
1047 if (
tmp.numel () != nx)
1051 return tmp.index (
i);
1054 template <
typename T>
1057 bool resize_ok,
const T& rfv)
const 1067 if (r != rx ||
c != cx)
1072 tmp.resize2 (rx, cx, rfv);
1075 if (
tmp.rows () != rx ||
tmp.columns () != cx)
1079 return tmp.index (
i, j);
1082 template <
typename T>
1085 bool resize_ok,
const T& rfv)
const 1090 int ial = ia.
numel ();
1093 for (
int i = 0;
i < ial;
i++)
1094 dvx(
i) = ia(
i).extent (
dv(
i));
1097 bool all_scalars =
true;
1098 for (
int i = 0;
i < ial;
i++)
1099 all_scalars = all_scalars && ia(
i).is_scalar ();
1103 tmp.resize (dvx, rfv);
1105 if (
tmp.dimensions != dvx)
1110 return tmp.index (ia);
1113 template <
typename T>
1120 if (rhl != 1 &&
i.length (n) != rhl)
1124 bool colon =
i.is_colon_equiv (nx);
1129 if (dimensions.zero_by_zero () && colon)
1148 *
this = rhs.
reshape (dimensions);
1153 i.fill (rhs(0), n, fortran_vec ());
1155 i.assign (rhs.
data (), n, fortran_vec ());
1160 template <
typename T>
1165 bool initial_dims_all_zero = dimensions.all_zero ();
1179 if (initial_dims_all_zero)
1183 rdv(0) =
i.extent (
dv(0));
1187 bool isfill = rhs.
numel () == 1;
1191 bool match = (isfill
1192 || (rhdv.
ndims () == 2 && il == rhdv(0) && jl == rhdv(1)));
1193 match = match || (il == 1 && jl == rhdv(0) && rhdv(1) == 1);
1197 bool all_colons = (
i.is_colon_equiv (rdv(0))
1222 *
this = rhs.
reshape (dimensions);
1232 const T *src = rhs.
data ();
1233 T *dest = fortran_vec ();
1239 ii.
fill (*src, n, dest);
1241 ii.
assign (src, n, dest);
1248 i.fill (*src, r, dest + r * j.
xelem (
k));
1253 src +=
i.assign (src, r, dest + r * j.
xelem (
k));
1259 else if ((il != 0 && jl != 0) || (rhdv(0) != 0 && rhdv(1) != 0))
1264 template <
typename T>
1269 int ial = ia.
numel ();
1273 assign (ia(0), rhs, rfv);
1275 assign (ia(0), ia(1), rhs, rfv);
1278 bool initial_dims_all_zero = dimensions.all_zero ();
1292 if (initial_dims_all_zero)
1297 for (
int i = 0;
i < ial;
i++)
1298 rdv(
i) = ia(
i).extent (
dv(
i));
1303 bool all_colons =
true;
1304 bool isfill = rhs.
numel () == 1;
1308 int rhdvl = rhdv.
ndims ();
1309 for (
int i = 0;
i < ial;
i++)
1311 all_colons = all_colons && ia(
i).is_colon_equiv (rdv(
i));
1313 if (l == 1)
continue;
1314 match = match && j < rhdvl && l == rhdv(j++);
1317 match = match && (j == rhdvl || rhdv(j) == 1);
1318 match = match || isfill;
1346 *
this = rhs.
reshape (dimensions);
1357 rh.
fill (rhs(0), fortran_vec ());
1365 bool lhsempty, rhsempty;
1366 lhsempty = rhsempty =
false;
1367 for (
int i = 0;
i < ial;
i++)
1370 lhsempty = lhsempty || (l == 0);
1371 rhsempty = rhsempty || (rhdv(j++) == 0);
1373 if (! lhsempty || ! rhsempty)
1387 template <
typename T>
1396 else if (
i.length (n) != 0)
1398 if (
i.extent (n) != n)
1402 bool col_vec = ndims () == 2 && columns () == 1 && rows () != 1;
1403 if (
i.is_scalar () &&
i(0) == n-1 && dimensions.isvector ())
1408 else if (
i.is_cont_range (n, l,
u))
1413 const T *src = data ();
1414 T *dest =
tmp.fortran_vec ();
1415 std::copy_n (src, l, dest);
1416 std::copy (src +
u, src + n, dest + l);
1422 *
this = index (
i.complement (n));
1427 template <
typename T>
1431 if (dim < 0 || dim >= ndims ())
1432 (*current_liboctave_error_handler) (
"invalid dimension in delete_elements");
1439 else if (
i.length (n) != 0)
1441 if (
i.extent (n) != n)
1446 if (
i.is_cont_range (n, l,
u))
1454 for (
int k = 0;
k < dim;
k++) dl *= dimensions(
k);
1455 for (
int k = dim + 1;
k < ndims ();
k++) du *= dimensions(
k);
1459 const T *src = data ();
1460 T *dest =
tmp.fortran_vec ();
1461 l *= dl;
u *= dl; n *= dl;
1464 std::copy_n (src, l, dest);
1466 std::copy (src +
u, src + n, dest);
1477 ia (dim) =
i.complement (n);
1483 template <
typename T>
1487 int ial = ia.
numel ();
1490 delete_elements (ia(0));
1494 for (
k = 0;
k < ial;
k++)
1496 if (! ia(
k).is_colon ())
1512 delete_elements (dim, ia(dim));
1527 bool empty_assignment =
false;
1529 int num_non_colon_indices = 0;
1533 for (
int i = 0;
i < ial;
i++)
1537 if (ia(
i).
length (dim_len) == 0)
1539 empty_assignment =
true;
1543 if (! ia(
i).is_colon_equiv (dim_len))
1545 num_non_colon_indices++;
1547 if (num_non_colon_indices == 2)
1552 if (! empty_assignment)
1553 (*current_liboctave_error_handler)
1554 (
"a null assignment can only have one non-colon index");
1560 template <
typename T>
1566 if (ndims () == 2 &&
a.ndims () == 2)
1573 for (
int k = 2;
k <
a.ndims ();
k++)
1581 template <
typename T>
1596 template <
typename T>
1600 assert (ndims () == 2);
1605 if (nr >= 8 && nc >= 8)
1615 else if (nr > 1 && nc > 1)
1621 result.xelem (j,
i) = xelem (
i, j);
1632 template <
typename T>
1639 template <
typename T>
1643 assert (ndims () == 2);
1651 if (nr >= 8 && nc >= 8)
1660 for (jj = 0; jj < (nc - 8 + 1); jj += 8)
1663 for (ii = 0; ii < (nr - 8 + 1); ii += 8)
1667 j < jj + 8; j++, idxj += nr)
1669 buf[
k++] = xelem (
i + idxj);
1737 template <
typename T>
1747 template <
typename T>
1754 template <
typename T>
1759 (*current_liboctave_error_handler) (
"sort: invalid dimension");
1775 for (
int i = 0;
i < dim;
i++)
1778 T *v = m.fortran_vec ();
1779 const T *ov = data ();
1799 if (sort_isnan<T> (
tmp))
1811 std::reverse (v + ku, v + ns);
1813 std::rotate (v, v + ku, v + ns);
1829 while (offset >= stride)
1835 offset += offset2 * stride * ns;
1843 T
tmp = ov[
i*stride + offset];
1844 if (sort_isnan<T> (
tmp))
1851 lsort.
sort (buf, kl);
1856 std::reverse (buf + ku, buf + ns);
1858 std::rotate (buf, buf + ku, buf + ns);
1863 v[
i*stride + offset] = buf[
i];
1870 template <
typename T>
1875 if (dim < 0 || dim >= ndims ())
1876 (*current_liboctave_error_handler) (
"sort: invalid dimension");
1892 for (
int i = 0;
i < dim;
i++)
1895 T *v = m.fortran_vec ();
1896 const T *ov = data ();
1919 if (sort_isnan<T> (
tmp))
1934 lsort.
sort (v, vi, kl);
1939 std::reverse (v + ku, v + ns);
1940 std::reverse (vi + ku, vi + ns);
1943 std::rotate (v, v + ku, v + ns);
1944 std::rotate (vi, vi + ku, vi + ns);
1963 while (offset >= stride)
1969 offset += offset2 * stride * ns;
1977 T
tmp = ov[
i*stride + offset];
1978 if (sort_isnan<T> (
tmp))
1993 lsort.
sort (buf, bufi, kl);
1998 std::reverse (buf + ku, buf + ns);
1999 std::reverse (bufi + ku, bufi + ns);
2002 std::rotate (buf, buf + ku, buf + ns);
2003 std::rotate (bufi, bufi + ku, bufi + ns);
2009 v[
i*stride + offset] = buf[
i];
2011 vi[
i*stride + offset] = bufi[
i];
2018 template <
typename T>
2031 template <
typename T>
2045 compare_fcn_type compare
2048 if (compare (
elem (n-1),
elem (0)))
2066 template <
typename T>
2084 template <
typename T>
2093 if (r <= 1 ||
c == 0)
2099 compare_fcn_type compare
2103 for (
i = 0;
i < cols ();
i++)
2106 T
u =
elem (rows () - 1,
i);
2117 else if (compare (
u, l))
2145 template <
typename T>
2166 template <
typename T>
2188 static const double ratio = 1.0;
2194 vmode =
values.issorted ();
2203 idx.fortran_vec (), vmode !=
mode);
2205 lsort.
lookup (data (), n,
values.data (), nval, idx.fortran_vec ());
2210 template <
typename T>
2214 const T *src = data ();
2217 const T
zero = T ();
2225 template <
typename T>
2230 const T *src = data ();
2232 const T
zero = T ();
2233 if (n < 0 || n >= nel)
2239 cnt += src[
i] !=
zero;
2244 if (src[
i] !=
zero) *dest++ =
i;
2259 for (; l >= 0 && src[l] ==
zero; l--) ;
2268 std::reverse (rdata, rdata +
k);
2277 for (; l != nel && src[l] ==
zero; l++) ;
2298 || (rows () == 0 &&
dims ().numel (1) == 0))
2300 else if (rows () == 1 && ndims () == 2)
2306 template <
typename T>
2311 (*current_liboctave_error_handler) (
"nth_element: invalid dimension");
2357 if (n(1) - n(0) == 1)
2362 else if (n(1) - n(0) == -1)
2378 (*current_liboctave_error_handler)
2379 (
"nth_element: n must be a scalar or a contiguous range");
2383 if (lo < 0 || up > ns)
2384 (*current_liboctave_error_handler) (
"nth_element: invalid element index");
2389 for (
int i = 0;
i < dim;
i++)
2393 const T *ov = data ();
2412 if (sort_isnan<T> (
tmp))
2427 T
tmp = ov[offset +
i*stride];
2428 if (sort_isnan<T> (
tmp))
2434 if (offset == stride-1)
2448 std::rotate (buf, buf + ku, buf + ns);
2462 v[offset + stride *
i] = buf[lo +
i];
2463 if (offset == stride-1)
2471 #define NO_INSTANTIATE_ARRAY_SORT(T) \ 2472 template <> Array<T> \ 2473 Array<T>::sort (int, sortmode) const \ 2477 template <> Array<T> \ 2478 Array<T>::sort (Array<octave_idx_type> &sidx, int, sortmode) const \ 2480 sidx = Array<octave_idx_type> (); \ 2483 template <> sortmode \ 2484 Array<T>::issorted (sortmode) const \ 2488 Array<T>::compare_fcn_type \ 2489 safe_comparator (sortmode, const Array<T>&, bool) \ 2493 template <> Array<octave_idx_type> \ 2494 Array<T>::sort_rows_idx (sortmode) const \ 2496 return Array<octave_idx_type> (); \ 2498 template <> sortmode \ 2499 Array<T>::is_sorted_rows (sortmode) const \ 2503 template <> octave_idx_type \ 2504 Array<T>::lookup (T const &, sortmode) const \ 2508 template <> Array<octave_idx_type> \ 2509 Array<T>::lookup (const Array<T>&, sortmode) const \ 2511 return Array<octave_idx_type> (); \ 2513 template <> octave_idx_type \ 2514 Array<T>::nnz (void) const \ 2518 template <> Array<octave_idx_type> \ 2519 Array<T>::find (octave_idx_type, bool) const \ 2521 return Array<octave_idx_type> (); \ 2523 template <> Array<T> \ 2524 Array<T>::nth_element (const idx_vector&, int) const { \ 2525 return Array<T> (); \ 2528 template <
typename T>
2537 (*current_liboctave_error_handler) (
"Matrix must be 2-dimensional");
2542 if (nnr == 0 && nnc == 0)
2544 else if (nnr != 1 && nnc != 1)
2552 if (nnr > 0 && nnc > 0)
2599 d.xelem (
i+roff,
i+coff) =
elem (0,
i);
2607 d.xelem (
i+roff,
i+coff) =
elem (
i, 0);
2614 template <
typename T>
2618 if (ndims () != 2 || (rows () != 1 && cols () != 1))
2619 (*current_liboctave_error_handler) (
"cat: invalid dimension");
2629 template <
typename T>
2636 if (dim == -1 || dim == -2)
2642 (*current_liboctave_error_handler) (
"cat: invalid dimension");
2645 return array_list[0];
2672 if (n > 2 && dim > 1)
2692 if (! (
dv.*concat_rule) (array_list[
i].
dims (), dim))
2693 (*current_liboctave_error_handler) (
"cat: dimension mismatch");
2712 if (array_list[
i].isempty ())
2718 if (dim < array_list[
i].ndims ())
2719 u = l + array_list[
i].
dims ()(dim);
2733 template <
typename T>
2737 os << prefix <<
"rep address: " << rep <<
'\n' 2738 << prefix <<
"rep->len: " << rep->len <<
'\n' 2739 << prefix <<
"rep->data: " <<
static_cast<void *
> (rep->data) <<
'\n' 2740 << prefix <<
"rep->count: " << rep->count <<
'\n' 2741 << prefix <<
"slice_data: " << static_cast<void *> (slice_data) <<
'\n' 2742 << prefix <<
"slice_len: " << slice_len <<
'\n';
2750 template <
typename T>
2760 template <
typename T>
2768 #define INSTANTIATE_ARRAY(T, API) \ 2769 template <> void Array<T>::instantiation_guard () { } \ 2770 template class API Array<T> 2774 template <
typename T>
2776 operator << (std::ostream& os, const Array<T>&
a)
2780 int n_dims = a_dims.
ndims ();
2782 os << n_dims <<
"-dimensional array";
2785 os <<
" (" << a_dims.
str () <<
')';
2798 for (
int i = 2;
i < n_dims;
i++)
2842 for (
int i = 0;
i < m;
i++)
2846 for (
int j = 2; j < n_dims - 1; j++)
2849 os <<
ra_idx(n_dims - 1) + 1 <<
") = \n";
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
std::string str(char sep='x') const
void resize_fill(const T *src, T *dest, const T &rfv) const
idx_class_type idx_class(void) const
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).
Array(void)
Empty ctor (0 by 0).
void sort_rows(const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols)
ref_param< T >::type crefT
octave_idx_type dim1(void) const
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_idx_type lookup(const T *data, octave_idx_type nel, const T &value)
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value)
const T * data(void) const
octave_idx_type extent(octave_idx_type n) const
static const idx_vector colon
identity matrix If supplied two scalar respectively For allows like xample val
void delete_elements(const idx_vector &i)
Deleting elements.
dim_vector zero_dims_inquire(const Array< idx_vector > &ia, const dim_vector &rhdv)
bool zero_by_zero(void) const
octave_idx_type safe_numel(void) const
The following function will throw a std::bad_alloc () exception if the requested size is larger than ...
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol zero divided by zero($0/0$)
virtual T resize_fill_value(void) const
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
octave_idx_type xelem(octave_idx_type n) const
void set_compare(compare_fcn_type comp)
T * do_permute(const T *src, T *dest, int lev) const
dim_vector make_nd_vector(octave_idx_type n) const
Array< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
void resize(int n, int fill_value=0)
const T * fortran_vec(void) const
Array< T >::compare_fcn_type safe_comparator(sortmode mode, const Array< T > &, bool)
octave_idx_type compute_index(octave_idx_type i, octave_idx_type j) const
void err_index_out_of_range(int nd, int dim, octave_idx_type idx, octave_idx_type ext)
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
void resize2(octave_idx_type nr, octave_idx_type nc, const T &rfv)
Resizing (with fill).
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
rec_index_helper & operator=(const rec_index_helper &)=delete
const T * do_assign(const T *src, T *dest, int lev) const
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
T & elem(octave_idx_type n)
~rec_permute_helper(void)
rec_permute_helper(const dim_vector &dv, const Array< octave_idx_type > &perm)
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
The real representation of all arrays.
virtual octave_idx_type numel(const octave_value_list &)
Complex log2(const Complex &x)
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
cell array If invoked with two or more scalar integer or a vector of integer values
Array< T > & insert(const Array< T > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
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...
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
bool concat(const dim_vector &dvb, int dim)
This corresponds to cat().
static void instantiation_guard()
void err_del_index_out_of_range(bool is1d, octave_idx_type idx, octave_idx_type ext)
Array< T > sort(int dim=0, sortmode mode=ASCENDING) const
void permute(const T *src, T *dest) const
static T no_op_fcn(const T &x)
octave_idx_type nnz(void) const
Count nonzero elements.
octave_idx_type assign(const T *src, octave_idx_type n, T *dest) const
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Array< T > index(const idx_vector &i) const
Indexing without resizing.
void do_resize_fill(const T *src, T *dest, const T &rfv, int lev) const
octave_idx_type lookup(const T &value, sortmode mode=UNSORTED) const
Do a binary lookup in a sorted array.
sortmode issorted(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
bool issorted(const T *data, octave_idx_type nel)
void index(const T *src, T *dest) const
octave_idx_type numel(const octave_value_list &idx)
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
bool sort_isnan(typename ref_param< T >::type)
bool is_colon(void) const
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().
void resize1(octave_idx_type n, const T &rfv)
Resizing (with fill).
void chop_all_singletons(void)
static T * blk_trans(const T *src, T *dest, octave_idx_type nr, octave_idx_type nc)
octave_idx_type dim2(void) const
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
bool is_cont_range(octave_idx_type &l, octave_idx_type &u) const
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
octave_idx_type length(octave_idx_type n=0) const
void assign(const T *src, T *dest) const
octave_idx_type increment(void) const
Array< T > transpose(void) const
static bool descending_compare(typename ref_param< T >::type, typename ref_param< T >::type)
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
static dim_vector alloc(int n)
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
bool is_sorted_rows(const T *data, octave_idx_type rows, octave_idx_type cols)
rec_index_helper(const dim_vector &dv, const Array< idx_vector > &ia)
With real return the complex result
Array< T > page(octave_idx_type k) const
Extract page: A(:,:,k+1).
if_then_else< is_class_type< T >::no, T, T const & >::result type
T * do_index(const T *src, T *dest, int lev) const
void err_invalid_resize(void)
rec_resize_helper & operator=(const rec_resize_helper &)=delete
N Dimensional Array with copy-on-write semantics.
charNDArray max(char d, const charNDArray &m)
Array< T > column(octave_idx_type k) const
Extract column: A(:,k+1).
T::size_type numel(const T &str)
void sort(T *data, octave_idx_type nel)
void print_info(std::ostream &os, const std::string &prefix) const
bool is_colon_equiv(octave_idx_type n) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
T & checkelem(octave_idx_type n)
octave_idx_type index(const T *src, octave_idx_type n, T *dest) const
rec_permute_helper & operator=(const rec_permute_helper &)=delete
void lookup_sorted(const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, bool rev=false)
Array< T > diag(octave_idx_type k=0) const
Get the kth super or subdiagonal.
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...
void fill(const T &val, T *dest) const
rec_resize_helper(const dim_vector &ndv, const dim_vector &odv)
octave::refcount< int > count
octave_idx_type fill(const T &val, octave_idx_type n, T *dest) const
bool hvcat(const dim_vector &dvb, int dim)
This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1).
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
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)
static Array< T >::ArrayRep * nil_rep(void)
void assign(const idx_vector &i, const Array< T > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
octave_idx_type ndims(void) const
Number of dimensions.
void nth_element(T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up=-1)
octave_idx_type numel(void) const
Number of elements in the array.
void do_fill(const T &val, T *dest, int lev) const
bool is_nd_vector(void) const
Vector representing the dimensions (size) of an Array.
bool is_scalar(void) const
void chop_trailing_singletons(void)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
nd group nd example For each display the value
octave_idx_type length(void) const
Number of elements in the array.
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
charNDArray min(char d, const charNDArray &m)
Array< T >::ArrayRep * rep
Array< T > hermitian(T(*fcn)(const T &)=nullptr) const