60 : dimensions (dv), rep (a.rep),
61 slice_data (a.slice_data), slice_len (a.slice_len)
68 (*current_liboctave_error_handler)
69 (
"reshape: can't reshape %s array to %s array",
70 dimensions_str.c_str (), new_dims_str.c_str ());
87 slice_data = rep->data;
90 std::fill_n (slice_data, slice_len, val);
97 if (--rep->count == 0)
102 slice_data = rep->data;
103 slice_len = rep->len;
108 template <
typename T>
112 if (--rep->count == 0)
116 slice_data = rep->
data;
117 slice_len = rep->len;
123 template <
typename T>
131 bool dims_changed =
false;
137 for (
int i = 0;
i < ndims ();
i++)
139 if (dimensions(
i) == 1)
142 new_dimensions(k++) = dimensions(
i);
157 new_dimensions.
resize (2);
159 new_dimensions(0) =
tmp;
160 new_dimensions(1) = 1;
165 new_dimensions.
resize (k);
170 retval =
Array<T> (*
this, new_dimensions);
176 template <
typename T>
183 template <
typename T>
191 template <
typename T>
198 template <
typename T>
211 template <
typename T>
218 template <
typename T>
225 template <
typename T>
232 template <
typename T>
245 template <
typename T>
252 template <
typename T>
260 template <
typename T>
267 template <
typename T>
272 #if defined (OCTAVE_ENABLE_BOUNDS_CHECK)
273 if (k < 0 || k > dimensions.numel (1))
280 template <
typename T>
287 #if defined (OCTAVE_ENABLE_BOUNDS_CHECK)
288 if (k < 0 || k > dimensions.numel (2))
295 template <
typename T>
299 #if defined (OCTAVE_ENABLE_BOUNDS_CHECK)
305 if (up < lo) up = lo;
325 stride (dim + n), use_blk (
false)
327 assert (n == perm.
numel ());
332 for (
int i = 1;
i < n+1;
i++) cdim[
i] = cdim[
i-1] *
dv(
i-1);
335 for (
int k = 0;
k <
n;
k++)
339 stride[
k] = cdim[kk];
343 for (
int k = 1;
k <
n;
k++)
345 if (stride[
k] == stride[top]*dim[top])
351 stride[
top] = stride[
k];
356 use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1];
363 template <
typename T>
374 if (lr == m && lc == m)
376 const T *ss = src + kc * nr + kr;
379 blk[j*m+
i] = ss[j*nr +
i];
380 T *dd = dest + kr * nc + kc;
383 dd[j*nc+
i] = blk[
i*m+j];
387 const T *ss = src + kc * nr + kr;
390 blk[j*m+
i] = ss[j*nr +
i];
391 T *dd = dest + kr * nc + kc;
394 dd[j*nc+
i] = blk[
i*m+j];
404 template <
typename T>
413 std::copy (src, src + len, dest);
424 else if (use_blk && lev == 1)
425 dest =
blk_trans (src, dest, dim[1], dim[0]);
445 template <
typename T>
449 template <
typename T>
459 int perm_vec_len = perm_vec_arg.
numel ();
461 if (perm_vec_len < dv.
ndims ())
463 (
"%s: invalid permutation vector", inv ?
"ipermute" :
"permute");
468 dv.
resize (perm_vec_len, 1);
473 bool identity =
true;
476 for (
int i = 0;
i < perm_vec_len;
i++)
479 if (perm_elt >= perm_vec_len || perm_elt < 0)
480 (*current_liboctave_error_handler)
481 (
"%s: permutation vector contains an invalid element",
482 inv ?
"ipermute" :
"permute");
484 if (checked[perm_elt])
485 (*current_liboctave_error_handler)
486 (
"%s: permutation vector cannot contain identical elements",
487 inv ?
"ipermute" :
"permute");
490 checked[perm_elt] =
true;
491 identity = identity && perm_elt ==
i;
500 for (
int i = 0;
i < perm_vec_len;
i++)
501 perm_vec(perm_vec_arg(
i)) =
i;
504 for (
int i = 0;
i < perm_vec_len;
i++)
505 dv_new(
i) =
dv(perm_vec(
i));
546 for (
int i = 1;
i <
n;
i++)
549 if (idx[top].maybe_reduce (dim[top], ia(
i),
dv(
i)))
560 cdim[
top] = cdim[top-1] * dim[top-1];
570 template <
typename T>
574 dest += idx[0].
index (src, dim[0], dest);
580 dest =
do_index (src + d*idx[lev].xelem (
i), dest, lev-1);
587 template <
typename T>
588 const T *
do_assign (
const T *src, T *dest,
int lev)
const
591 src += idx[0].
assign (src, dim[0], dest);
597 src =
do_assign (src, dest + d*idx[lev].xelem (
i), lev-1);
604 template <
typename T>
608 idx[0].
fill (val, dim[0], dest);
614 do_fill (val, dest + d*idx[lev].xelem (
i), lev-1);
626 template <
typename T>
629 template <
typename T>
632 template <
typename T>
654 : cext (0), sext (0), dext (0), n (0)
656 int l = ndv.
ndims ();
657 assert (odv.
ndims () == l);
660 for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i);
669 for (
int j = 0; j <
n; j++)
671 cext[j] =
std::min (ndv(i+j), odv(i+j));
672 sext[j] = sld *= odv(i+j);
673 dext[j] = dld *= ndv(i+j);
683 template <
typename T>
688 std::copy (src, src+cext[0], dest);
689 std::fill_n (dest + cext[0], dext[0] - cext[0], rfv);
696 for (k = 0; k < cext[lev]; k++)
699 std::fill_n (dest + k * dd, dext[lev] - k * dd, rfv);
711 template <
typename T>
716 template <
typename T>
754 if (ndims () == 2 && n != 1 && rd.
is_vector ())
758 else if (rows () == 1)
765 retval =
Array<T> (*
this, rd, l, u);
780 template <
typename T>
827 const T* src = data ();
838 template <
typename T>
842 int ial = ia.
numel ();
847 retval = index (ia(0));
849 retval = index (ia(0), ia(1));
856 bool all_colons =
true;
857 for (
int i = 0;
i < ial;
i++)
859 if (ia(
i).extent (
dv(
i)) !=
dv(
i))
863 all_colons = all_colons && ia(
i).is_colon ();
885 retval =
Array<T> (*
this, rdv, l, u);
902 template <
typename T>
906 static T
zero = T ();
913 template <
typename T>
917 if (n < 0 || ndims () != 2)
928 bool invalid =
false;
929 if (rows () == 0 || rows () == 1)
931 else if (columns () == 1)
940 if (n == nx - 1 && n > 0)
944 slice_data[slice_len-1] = T ();
948 else if (n == nx + 1 && nx > 0)
952 && slice_data + slice_len < rep->data + rep->len)
954 slice_data[slice_len++] = rfv;
964 std::copy (data (), data () + nx, dest);
977 std::copy (data (), data () + n0, dest);
978 std::fill_n (dest + n0, n1, rfv);
984 template <
typename T>
988 if (r < 0 || c < 0 || ndims () != 2)
993 if (r != rx || c != cx)
1002 const T *src = data ();
1005 std::copy (src, src + r * c0, dest);
1012 std::copy (src, src + r0, dest);
1015 std::fill_n (dest, r1, rfv);
1020 std::fill_n (dest, r * c1, rfv);
1026 template <
typename T>
1030 int dvl = dv.
ndims ();
1032 resize2 (
dv(0),
dv(1), rfv);
1033 else if (dimensions != dv)
1035 if (dimensions.ndims () > dvl || dv.
any_neg ())
1048 template <
typename T>
1065 if (tmp.
numel () != nx)
1069 return tmp.
index (i);
1072 template <
typename T>
1075 bool resize_ok,
const T& rfv)
const
1085 if (r != rx || c != cx)
1097 return tmp.
index (i, j);
1100 template <
typename T>
1103 bool resize_ok,
const T& rfv)
const
1108 int ial = ia.
numel ();
1111 for (
int i = 0;
i < ial;
i++)
1112 dvx(
i) = ia(
i).extent (
dv(
i));
1115 bool all_scalars =
true;
1116 for (
int i = 0;
i < ial;
i++)
1117 all_scalars = all_scalars && ia(
i).is_scalar ();
1128 return tmp.
index (ia);
1131 template <
typename T>
1138 if (rhl != 1 && i.
length (n) != rhl)
1147 if (dimensions.zero_by_zero () && colon)
1166 *
this = rhs.
reshape (dimensions);
1171 i.
fill (rhs(0), n, fortran_vec ());
1178 template <
typename T>
1183 bool initial_dims_all_zero = dimensions.all_zero ();
1197 if (initial_dims_all_zero)
1205 bool isfill = rhs.
numel () == 1;
1209 bool match = (isfill
1210 || (rhdv.
ndims () == 2 && il == rhdv(0) && jl == rhdv(1)));
1211 match = match || (il == 1 && jl == rhdv(0) && rhdv(1) == 1);
1240 *
this = rhs.
reshape (dimensions);
1250 const T* src = rhs.
data ();
1251 T *dest = fortran_vec ();
1257 ii.
fill (*src, n, dest);
1259 ii.
assign (src, n, dest);
1277 else if ((il != 0 && jl != 0) || (rhdv(0) != 0 && rhdv(1) != 0))
1282 template <
typename T>
1287 int ial = ia.
numel ();
1291 assign (ia(0), rhs, rfv);
1293 assign (ia(0), ia(1), rhs, rfv);
1296 bool initial_dims_all_zero = dimensions.all_zero ();
1310 if (initial_dims_all_zero)
1315 for (
int i = 0;
i < ial;
i++)
1316 rdv(
i) = ia(
i).extent (
dv(
i));
1321 bool all_colons =
true;
1322 bool isfill = rhs.
numel () == 1;
1326 int rhdvl = rhdv.
ndims ();
1327 for (
int i = 0;
i < ial;
i++)
1329 all_colons = all_colons && ia(
i).is_colon_equiv (rdv(
i));
1331 if (l == 1)
continue;
1332 match = match && j < rhdvl && l == rhdv(j++);
1335 match = match && (j == rhdvl || rhdv(j) == 1);
1336 match = match || isfill;
1364 *
this = rhs.
reshape (dimensions);
1375 rh.
fill (rhs(0), fortran_vec ());
1383 bool lhsempty, rhsempty;
1384 lhsempty = rhsempty =
false;
1385 for (
int i = 0;
i < ial;
i++)
1388 lhsempty = lhsempty || (l == 0);
1389 rhsempty = rhsempty || (rhdv(j++) == 0);
1391 if (! lhsempty || ! rhsempty)
1405 template <
typename T>
1414 else if (i.
length (n) != 0)
1420 bool col_vec = ndims () == 2 && columns () == 1 && rows () != 1;
1421 if (i.
is_scalar () &&
i(0) == n-1 && dimensions.is_vector ())
1431 const T *src = data ();
1433 std::copy (src, src + l, dest);
1434 std::copy (src + u, src + n, dest + l);
1445 template <
typename T>
1449 if (dim < 0 || dim >= ndims ())
1450 (*current_liboctave_error_handler) (
"invalid dimension in delete_elements");
1457 else if (i.
length (n) != 0)
1472 for (
int k = 0;
k < dim;
k++) dl *= dimensions(
k);
1473 for (
int k = dim + 1;
k < ndims ();
k++) du *= dimensions(
k);
1477 const T *src = data ();
1479 l *= dl; u *= dl; n *= dl;
1482 std::copy (src, src + l, dest);
1484 std::copy (src + u, src + n, dest);
1501 template <
typename T>
1505 int ial = ia.
numel ();
1508 delete_elements (ia(0));
1512 for (k = 0; k < ial; k++)
1514 if (! ia(k).is_colon ())
1530 delete_elements (dim, ia(dim));
1545 bool empty_assignment =
false;
1547 int num_non_colon_indices = 0;
1551 for (
int i = 0;
i < ial;
i++)
1555 if (ia(
i).
length (dim_len) == 0)
1557 empty_assignment =
true;
1561 if (! ia(
i).is_colon_equiv (dim_len))
1563 num_non_colon_indices++;
1565 if (num_non_colon_indices == 2)
1570 if (! empty_assignment)
1571 (*current_liboctave_error_handler)
1572 (
"a null assignment can only have one non-colon index");
1578 template <
typename T>
1584 if (ndims () == 2 && a.
ndims () == 2)
1591 for (
int k = 2;
k < a.
ndims ();
k++)
1599 template <
typename T>
1614 template <
typename T>
1618 assert (ndims () == 2);
1623 if (nr >= 8 && nc >= 8)
1633 else if (nr > 1 && nc > 1)
1639 result.
xelem (j,
i) = xelem (
i, j);
1650 template <
typename T>
1657 template <
typename T>
1661 assert (ndims () == 2);
1669 if (nr >= 8 && nc >= 8)
1680 for (jj = 0; jj < (nc - 8 + 1); jj += 8)
1682 for (ii = 0; ii < (nr - 8 + 1); ii += 8)
1686 j < jj + 8; j++, idxj += nr)
1688 buf[
k++] = xelem (
i + idxj);
1695 result.
xelem (j + idxi) =
fcn (buf[k]);
1756 template <
typename T>
1766 template <
typename T>
1773 template <
typename T>
1778 (*current_liboctave_error_handler) (
"sort: invalid dimension");
1787 if (dim >= dv.
ndims ())
1794 for (
int i = 0;
i < dim;
i++)
1797 T *v = m.fortran_vec ();
1798 const T *ov = data ();
1818 if (sort_isnan<T> (tmp))
1830 std::reverse (v + ku, v + ns);
1832 std::rotate (v, v + ku, v + ns);
1848 while (offset >= stride)
1854 offset += offset2 * stride * ns;
1862 T
tmp = ov[
i*stride + offset];
1863 if (sort_isnan<T> (tmp))
1870 lsort.
sort (buf, kl);
1875 std::reverse (buf + ku, buf + ns);
1877 std::rotate (buf, buf + ku, buf + ns);
1882 v[
i*stride + offset] = buf[
i];
1889 template <
typename T>
1894 if (dim < 0 || dim >= ndims ())
1895 (*current_liboctave_error_handler) (
"sort: invalid dimension");
1911 for (
int i = 0;
i < dim;
i++)
1914 T *v = m.fortran_vec ();
1915 const T *ov = data ();
1938 if (sort_isnan<T> (tmp))
1953 lsort.
sort (v, vi, kl);
1958 std::reverse (v + ku, v + ns);
1959 std::reverse (vi + ku, vi + ns);
1962 std::rotate (v, v + ku, v + ns);
1963 std::rotate (vi, vi + ku, vi + ns);
1982 while (offset >= stride)
1988 offset += offset2 * stride * ns;
1996 T
tmp = ov[
i*stride + offset];
1997 if (sort_isnan<T> (tmp))
2012 lsort.
sort (buf, bufi, kl);
2017 std::reverse (buf + ku, buf + ns);
2018 std::reverse (bufi + ku, bufi + ns);
2021 std::rotate (buf, buf + ku, buf + ns);
2022 std::rotate (bufi, bufi + ku, bufi + ns);
2028 v[
i*stride + offset] = buf[
i];
2030 vi[
i*stride + offset] = bufi[
i];
2037 template <
typename T>
2050 template <
typename T>
2064 compare_fcn_type compare
2067 if (compare (
elem (n-1),
elem (0)))
2085 template <
typename T>
2103 template <
typename T>
2112 if (r <= 1 || c == 0)
2118 compare_fcn_type compare
2122 for (i = 0; i < cols (); i++)
2125 T
u =
elem (rows () - 1, i);
2136 else if (compare (u, l))
2147 if (mode ==
UNSORTED && i == cols ())
2164 template <
typename T>
2182 return lsort.
lookup (data (), n, value);
2185 template <
typename T>
2207 static const double ratio = 1.0;
2222 idx.fortran_vec (), vmode !=
mode);
2224 lsort.
lookup (data (), n, values.
data (), nval, idx.fortran_vec ());
2229 template <
typename T>
2233 const T *src = data ();
2236 const T
zero = T ();
2244 template <
typename T>
2249 const T *src = data ();
2251 const T
zero = T ();
2252 if (n < 0 || n >= nel)
2258 cnt += src[
i] != zero;
2260 retval.
clear (cnt, 1);
2263 if (src[
i] != zero) *dest++ =
i;
2270 retval.
clear (n, 1);
2278 for (; l >= 0 && src[l] ==
zero; l--) ;
2287 std::reverse (rdata, rdata + k);
2296 for (; l != nel && src[l] ==
zero; l++) ;
2317 || (rows () == 0 &&
dims ().numel (1) == 0))
2319 else if (rows () == 1 && ndims () == 2)
2325 template <
typename T>
2330 (*current_liboctave_error_handler) (
"nth_element: invalid dimension");
2333 if (dim >= dv.ndims ())
2334 dv.resize (dim+1, 1);
2341 dv.chop_trailing_singletons ();
2377 (*current_liboctave_error_handler)
2378 (
"nth_element: n must be a scalar or a contiguous range");
2382 if (lo < 0 || up > ns)
2383 (*current_liboctave_error_handler) (
"nth_element: invalid element index");
2388 for (
int i = 0;
i < dim;
i++)
2392 const T *ov = data ();
2411 if (sort_isnan<T> (tmp))
2426 T
tmp = ov[offset +
i*stride];
2427 if (sort_isnan<T> (tmp))
2433 if (offset == stride-1)
2447 std::rotate (buf, buf + ku, buf + ns);
2461 v[offset + stride *
i] = buf[lo +
i];
2462 if (offset == stride-1)
2470 #define NO_INSTANTIATE_ARRAY_SORT(T) \
2471 template <> Array<T> \
2472 Array<T>::sort (int, sortmode) const \
2476 template <> Array<T> \
2477 Array<T>::sort (Array<octave_idx_type> &sidx, int, sortmode) const \
2479 sidx = Array<octave_idx_type> (); \
2482 template <> sortmode \
2483 Array<T>::is_sorted (sortmode) const \
2487 Array<T>::compare_fcn_type \
2488 safe_comparator (sortmode, const Array<T>&, bool) \
2492 template <> Array<octave_idx_type> \
2493 Array<T>::sort_rows_idx (sortmode) const \
2495 return Array<octave_idx_type> (); \
2497 template <> sortmode \
2498 Array<T>::is_sorted_rows (sortmode) const \
2502 template <> octave_idx_type \
2503 Array<T>::lookup (T const &, sortmode) const \
2507 template <> Array<octave_idx_type> \
2508 Array<T>::lookup (const Array<T>&, sortmode) const \
2510 return Array<octave_idx_type> (); \
2512 template <> octave_idx_type \
2513 Array<T>::nnz (void) const \
2517 template <> Array<octave_idx_type> \
2518 Array<T>::find (octave_idx_type, bool) const \
2520 return Array<octave_idx_type> (); \
2522 template <> Array<T> \
2523 Array<T>::nth_element (const idx_vector&, int) const { \
2524 return Array<T> (); \
2527 template <
typename T>
2536 (*current_liboctave_error_handler) (
"Matrix must be 2-dimensional");
2541 if (nnr == 0 && nnc == 0)
2543 else if (nnr != 1 && nnc != 1)
2551 if (nnr > 0 && nnc > 0)
2613 template <
typename T>
2617 if (ndims () != 2 || (rows () != 1 && cols () != 1))
2618 (*current_liboctave_error_handler) (
"cat: invalid dimension");
2623 retval.xelem (
i,
i) = xelem (
i);
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");
2696 if (retval.is_empty ())
2711 if (array_list[
i].is_empty ())
2717 if (dim < array_list[
i].ndims ())
2718 u = l + array_list[
i].
dims ()(dim);
2724 retval.assign (idxa, array_list[
i]);
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>
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>
2775 operator << (std::ostream& os, const Array<T>&
a)
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++)
2817 os <<
" " <<
a.elem (ra_idx);
2829 os <<
" " <<
a.elem (ra_idx);
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";
2857 os <<
" " <<
a.elem (ra_idx);
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
bool is_cont_range(octave_idx_type &l, octave_idx_type &u) const
bool is_empty(void) const
octave_idx_type length(octave_idx_type n=0) const
void resize_fill(const T *src, T *dest, const T &rfv) const
std::string str(char sep= 'x') const
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
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)
Array< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
bool is_vector(void) const
void permute(const T *src, T *dest) const
static const idx_vector colon
octave_idx_type assign(const T *src, octave_idx_type n, T *dest) const
octave_idx_type numel(void) const
Number of elements in the array.
static octave_idx_type nn
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)
void assign(const T *src, T *dest) const
octave_idx_type compute_index(octave_idx_type i, octave_idx_type j) const
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
void set_compare(compare_fcn_type comp)
octave_idx_type dim2(void) const
void do_fill(const T &val, T *dest, int lev) const
void resize(int n, int fill_value=0)
rec_permute_helper & operator=(const rec_permute_helper &)
Array< T >::compare_fcn_type safe_comparator(sortmode mode, const Array< T > &, bool)
octave_idx_type xelem(octave_idx_type n) const
void err_index_out_of_range(int nd, int dim, octave_idx_type idx, octave_idx_type ext)
T * do_permute(const T *src, T *dest, int lev) const
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
Array< T > diag(octave_idx_type k=0) const
Get the kth super or subdiagonal.
void resize2(octave_idx_type nr, octave_idx_type nc, const T &rfv)
Resizing (with fill).
Array< T > page(octave_idx_type k) const
Extract page: A(:,:,k+1).
octave_idx_type fill(const T &val, octave_idx_type n, T *dest) const
T & elem(octave_idx_type n)
~rec_permute_helper(void)
rec_permute_helper(const dim_vector &dv, const Array< octave_idx_type > &perm)
The real representation of all arrays.
octave_idx_type dim1(void) const
octave_idx_type lookup(const T &value, sortmode mode=UNSORTED) const
Do a binary lookup in a sorted array.
octave_idx_type rows(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
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
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.
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)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
static T no_op_fcn(const T &x)
dim_vector orig_dimensions(void) const
virtual T resize_fill_value(void) const
octave_idx_type safe_numel(void) const
Array< T > sort(int dim=0, sortmode mode=ASCENDING) const
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
idx_vector complement(octave_idx_type n) const
bool sort_isnan(typename ref_param< T >::type)
octave_idx_type index(const T *src, octave_idx_type n, T *dest) const
nd deftypefn *octave_map m
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().
rec_resize_helper & operator=(const rec_resize_helper &)
void resize1(octave_idx_type n, const T &rfv)
void chop_all_singletons(void)
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).
static T * blk_trans(const T *src, T *dest, octave_idx_type nr, octave_idx_type nc)
void print_info(std::ostream &os, const std::string &prefix) const
Array< T > transpose(void) const
const T * data(void) const
void resize(const dim_vector &dv, const T &rfv)
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
Array< T > column(octave_idx_type k) const
Extract column: A(:,k+1).
dim_vector redim(int n) const
void fill(const T &val, T *dest) const
static bool descending_compare(typename ref_param< T >::type, typename ref_param< T >::type)
bool is_cont_range(octave_idx_type n, octave_idx_type &l, octave_idx_type &u) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
const T * do_assign(const T *src, T *dest, int lev) 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
static dim_vector alloc(int n)
octave_idx_type nnz(void) const
Count nonzero elements.
bool is_sorted_rows(const T *data, octave_idx_type rows, octave_idx_type cols)
bool is_sorted(const T *data, octave_idx_type nel)
rec_index_helper(const dim_vector &dv, const Array< idx_vector > &ia)
With real return the complex result
if_then_else< is_class_type< T >::no, T, T const & >::result type
void err_invalid_resize(void)
T & xelem(octave_idx_type n)
bool is_colon_equiv(octave_idx_type n) const
sortmode is_sorted(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
N Dimensional Array with copy-on-write semantics.
charNDArray max(char d, const charNDArray &m)
idx_class_type idx_class(void) const
octave_idx_type length(void) const
Number of elements in the array.
octave_idx_type extent(octave_idx_type n) const
T::size_type numel(const T &str)
void sort(T *data, octave_idx_type nel)
T & checkelem(octave_idx_type n)
octave_refcount< int > count
=val(i)}if ode{val(i)}occurs in table i
bool zero_by_zero(void) const
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
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 > hermitian(T(*fcn)(const T &)=0) const
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!
rec_index_helper & operator=(const rec_index_helper &)
bool is_scalar(void) const
rec_resize_helper(const dim_vector &ndv, const dim_vector &odv)
void index(const T *src, T *dest) const
octave_idx_type ndims(void) const
Number of dimensions.
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)
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
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).
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 nth_element(T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up=-1)
const T * fortran_vec(void) const
Vector representing the dimensions (size) of an Array.
void do_resize_fill(const T *src, T *dest, const T &rfv, int lev) 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
octave_idx_type increment(void) const
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
octave_idx_type columns(void) const
Array< T > index(const idx_vector &i) const
Indexing without resizing.
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
charNDArray min(char d, const charNDArray &m)
Array< T >::ArrayRep * rep
T * do_index(const T *src, T *dest, int lev) const