57 : rep (new typename
Sparse<T>::
SparseRep (a.rows (), a.cols (), a.rows ())),
81 for (i =
c[_c]; i <
c[_c + 1]; i++)
91 (*current_liboctave_error_handler)
92 (
"Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled");
116 (*current_liboctave_error_handler)
117 (
"Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled");
144 for (i = i; i < u; i++)
154 change_length (c[ncols]);
166 static const int frac = 5;
167 if (nz > nzmx || nz < nzmx - nzmx/frac)
173 std::copy (r, r + min_nzmx, new_ridx);
178 T * new_data =
new T [nz];
179 std::copy (
d,
d + min_nzmx, new_data);
225 : rep (0), dimensions (dv)
229 (
"Sparse::Sparse (const dim_vector&): dimension mismatch");
236 : rep (0), dimensions (dv)
240 unsigned long long a_nel =
static_cast<unsigned long long>(a.
rows ()) *
241 static_cast<unsigned long long>(a.
cols ());
242 unsigned long long dv_nel =
static_cast<unsigned long long>(dv (0)) *
243 static_cast<unsigned long long>(dv (1));
246 (*current_liboctave_error_handler)
247 (
"Sparse::Sparse (const Sparse&, const dim_vector&): dimension mismatch");
274 xcidx (k+1) = new_nzmx;
283 : rep (0), dimensions ()
287 else if (r.
extent (nr) > nr)
293 else if (c.
extent (nc) > nc)
295 (
"sparse: column index %d out of bound %d", r.
extent (nc), nc);
302 bool a_scalar = n == 1;
311 if ((rl != 1 && rl != n) || (cl != 1 && cl != n))
312 (*current_liboctave_error_handler) (
"sparse: dimension mismatch");
317 if (rl <= 1 && cl <= 1)
319 if (n == 1 && a(0) != T ())
327 xcidx (j+1) = j >= c(0);
349 new_nz += rd[i-1] != rd[i];
417 sidx[ci[cd[i]+1]++] = rd[0];
419 sidx[ci[cd[i]+1]++] = rd[i];
425 std::sort (sidx + ci[j], sidx + ci[j+1]);
497 new_nz += rd[i-1] != rd[i];
516 if (rd[i] != rd[i-1])
530 if (rd[i] != rd[i-1])
559 typedef std::pair<octave_idx_type, octave_idx_type> idx_pair;
564 idx_pair& p = spairs[ci[cd[i]+1]++];
576 std::sort (spairs + ci[j], spairs + ci[j+1]);
611 rrd[++jj] = a(spairs[i].second);
615 rrd[jj] += a(spairs[i].second);
629 rrd[jj] = a(spairs[i].second);
640 : rep (0), dimensions (a.dims ())
644 (
"Sparse::Sparse (const Array<T>&): dimension mismatch");
664 if (a.
elem (i,j) != T ())
677 if (--rep->count == 0)
687 if (--rep->count == 0)
707 if (n > 0 && n == ra_idx.
length ())
713 retval *= dimensions(n);
719 (
"Sparse<T>::compute_index: invalid ra_idxing operation");
728 (*current_liboctave_error_handler) (
"%s (%d): range error", fcn, n);
736 (*current_liboctave_error_handler) (
"%s (%d): range error", fcn, n);
746 (*current_liboctave_error_handler)
747 (
"%s (%d, %d): range error", fcn, i, j);
755 (*current_liboctave_error_handler)
756 (
"%s (%d, %d): range error", fcn, i, j);
766 std::ostringstream buf;
778 buf <<
"): range error";
780 std::string buf_str = buf.str ();
782 (*current_liboctave_error_handler) (buf_str.c_str ());
791 std::ostringstream buf;
803 buf <<
"): range error";
805 std::string buf_str = buf.str ();
807 (*current_liboctave_error_handler) (buf_str.c_str ());
822 (*current_liboctave_warning_with_id_handler)
823 (
"Octave:reshape-smashes-dims",
824 "reshape: sparse reshape to N-d array smashes dims");
827 dims2(1) *= dims2(i);
832 if (dimensions != dims2)
834 if (dimensions.numel () == dims2.
numel ())
841 retval =
Sparse<T> (new_nr, new_nc, new_nnz);
844 retval.
xcidx (0) = 0;
850 (*current_liboctave_error_handler)
851 (
"reshape: overflow in octave_idx_type prevents reshaping array");
856 retval.
xcidx (k+1) = j;
858 retval.
xdata (j) = data (j);
859 retval.
xridx (j) = ii;
862 retval.
xcidx (k+1) = new_nnz;
866 std::string dimensions_str = dimensions.str ();
867 std::string new_dims_str = new_dims.
str ();
869 (*current_liboctave_error_handler)
870 (
"reshape: can't reshape %s array to %s array",
871 dimensions_str.c_str (), new_dims_str.c_str ());
889 if (perm_vec.
length () == 2)
891 if (perm_vec(0) == 0 && perm_vec(1) == 1)
893 else if (perm_vec(0) == 1 && perm_vec(1) == 0)
902 (*current_liboctave_error_handler)
903 (
"permutation vector contains an invalid element");
905 return trans ? this->
transpose () : *
this;
918 resize (nr, (n + nr - 1) / nr);
935 (*current_liboctave_error_handler) (
"sparse array must be 2-D");
939 resize (dv(0), dv(1));
948 (*current_liboctave_error_handler)
949 (
"can't resize to negative dimension");
953 if (r == dim1 () && c == dim2 ())
967 for (i = i; i < u; i++)
970 xdata (k) = xdata (i);
971 xridx (k++) = xridx (i);
977 rep->nrows = dimensions(0) = r;
982 std::copy (rep->c, rep->c +
std::min (c, rep->ncols) + 1, new_cidx);
987 std::fill_n (rep->c + rep->ncols + 1, c - rep->ncols,
991 rep->ncols = dimensions(1) = c;
993 rep->change_length (rep->nnz ());
1005 if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ())
1007 (*current_liboctave_error_handler) (
"range error for insert");
1014 if (c + a_cols < nc)
1015 nel += cidx (nc) - cidx (c + a_cols);
1019 if (ridx (j) < r || ridx (j) >= r + a_rows)
1028 data (i) = tmp.
data (i);
1029 ridx (i) = tmp.
ridx (i);
1032 cidx (i) = tmp.
cidx (i);
1041 if (tmp.
ridx (j) < r)
1043 data (ii) = tmp.
data (j);
1044 ridx (ii++) = tmp.
ridx (j);
1051 data (ii) = a.
data (j);
1052 ridx (ii++) = r + a.
ridx (j);
1058 if (tmp.
ridx (j) >= r + a_rows)
1060 data (ii) = tmp.
data (j);
1061 ridx (ii++) = tmp.
ridx (j);
1071 data (ii) = tmp.
data (j);
1072 ridx (ii++) = tmp.
ridx (j);
1085 if (ra_idx.
length () != 2)
1087 (*current_liboctave_error_handler) (
"range error for insert");
1091 return insert (a, ra_idx (0), ra_idx (1));
1098 assert (ndims () == 2);
1106 retval.
xcidx (ridx (i) + 1)++;
1112 retval.
xcidx (i) = nz;
1121 retval.
xridx (q) = j;
1122 retval.
xdata (q) = data (k);
1124 assert (nnz () == retval.
xcidx (nr));
1141 for (l = 0; l < nr; l++)
1147 return std::lower_bound (ridx, ridx + nr, ri) - ridx;
1156 assert (ndims () == 2);
1166 if (idx.
extent (nel) > nel)
1183 *
this =
Sparse<T> (nr - (ub - lb), 1, nz_new);
1184 std::copy (tmp.
data (), tmp.
data () + li, data ());
1185 std::copy (tmp.
ridx (), tmp.
ridx () + li, xridx ());
1186 std::copy (tmp.
data () + ui, tmp.
data () + nz, xdata () + li);
1202 for (; j < sl && sj[j] < r; j++) ;
1203 if (j == sl || sj[j] > r)
1205 data_new[nz_new] = tmp.
data (i);
1206 ridx_new[nz_new++] = r - j;
1211 std::copy (ridx_new, ridx_new + nz_new, ridx ());
1212 std::copy (data_new, data_new + nz_new, xdata ());
1226 *
this =
Sparse<T> (1, nc - (ub - lb), new_nz);
1227 std::copy (tmp.
data (), tmp.
data () + lbi, data ());
1228 std::copy (tmp.
data () + ubi, tmp.
data () + nz , xdata () + lbi);
1229 std::fill_n (ridx (), new_nz, static_cast<octave_idx_type> (0));
1230 std::copy (tmp.
cidx () + 1, tmp.
cidx () + 1 + lb, cidx () + 1);
1237 else if (idx.
length (nel) != 0)
1244 delete_elements (idx);
1254 assert (ndims () == 2);
1264 if (idx_j.
extent (nc) > nc)
1268 if (lb == 0 && ub == nc)
1285 *
this =
Sparse<T> (nr, nc - (ub - lb), new_nz);
1286 std::copy (tmp.
data (), tmp.
data () + lbi, data ());
1287 std::copy (tmp.
ridx (), tmp.
ridx () + lbi, ridx ());
1288 std::copy (tmp.
data () + ubi, tmp.
data () + nz, xdata () + lbi);
1289 std::copy (tmp.
ridx () + ubi, tmp.
ridx () + nz, xridx () + lbi);
1290 std::copy (tmp.
cidx () + 1, tmp.
cidx () + 1 + lb, cidx () + 1);
1292 tmp.
cidx () + ub + 1, ubi - lbi);
1296 *
this = index (idx_i, idx_j.
complement (nc));
1302 if (idx_i.
extent (nr) > nr)
1306 if (lb == 0 && ub == nr)
1322 tmpl.
nnz () + tmpu.
nnz ());
1328 xdata (k) = tmpl.
data (i);
1329 xridx (k++) = tmpl.
ridx (i);
1334 xdata (k) = tmpu.
data (i);
1335 xridx (k++) = tmpu.
ridx (i) + lb;
1360 bool empty_assignment
1363 if (! empty_assignment)
1364 (*current_liboctave_error_handler)
1365 (
"a null assignment can only have one non-colon index");
1379 (*current_liboctave_error_handler)
1380 (
"invalid dimension in delete_elements");
1391 assert (ndims () == 2);
1414 retval.
xdata (j) = data (j);
1415 retval.
xridx (j) = ridx (j) + i * nr;
1419 retval.
xcidx (0) = 0;
1420 retval.
xcidx (1) = nz;
1423 else if (idx.
extent (nel) > nel)
1431 retval = tmp.
index (idx);
1436 else if (nr == 1 && nc == 1)
1443 retval =
Sparse<T> (idx_dims(0), idx_dims(1), nz ? data (0) : T ());
1454 if (i < nz && ridx (i) == idx(0))
1455 retval =
Sparse (1, 1, data (i));
1467 retval =
Sparse<T> (ub - lb, 1, nz_new);
1468 std::copy (data () + li, data () + li + nz_new, retval.
data ());
1470 retval.
xcidx (1) = nz_new;
1479 retval.
ridx (j) = nr - ridx (nz - j - 1) - 1;
1481 std::copy (cidx (), cidx () + 2, retval.
cidx ());
1482 std::reverse_copy (data (), data () + nz, retval.
data ());
1487 tmp = tmp.
index (idx);
1510 lidx(i) =
lblookup (ridx (), nz, idxa(i));
1520 if (l < nz && ridx (l) == idxa(i, j))
1538 retval.
data (k) = data (l);
1539 retval.
xridx (k++) = i;
1555 retval =
Sparse<T> (1, ub - lb, new_nz);
1556 std::copy (data () + lbi, data () + lbi + new_nz, retval.
data ());
1564 retval =
Sparse<T> (array_value ().index (idx));
1580 if (idx_dims(0) == 1 && idx_dims(1) != 1)
1591 bool resize_ok)
const
1595 assert (ndims () == 2);
1613 tmp.
resize (ext_i, ext_j);
1614 retval = tmp.
index (idx_i, idx_j);
1616 else if (idx_i.
extent (nr) > nr)
1621 else if (nr == 1 && nc == 1)
1627 retval =
Sparse<T> (array_value ().index (idx_i, idx_j));
1641 retval =
Sparse<T> (nr, ub - lb, new_nz);
1642 std::copy (data () + lbi, data () + lbi + new_nz, retval.
data ());
1643 std::copy (ridx () + lbi, ridx () + lbi + new_nz, retval.
ridx ());
1653 retval.
xcidx (j+1) = retval.
xcidx (j) + (cidx (jj+1) - cidx (jj));
1665 std::copy (data () + ljj, data () + ljj + nzj, retval.
data () + lj);
1666 std::copy (ridx () + ljj, ridx () + ljj + nzj, retval.
ridx () + lj);
1673 retval = index (idx_i);
1693 if (i < nzj && ridx (i+lj) == ii)
1708 if (retval.
xcidx (j+1) > i)
1710 retval.
xridx (i) = 0;
1711 retval.
xdata (i) = data (ij[j]);
1729 li[j] = lij =
lblookup (ridx () + lj, nzj, lb) + lj;
1730 ui[j] = uij =
lblookup (ridx () + lj, nzj, ub) + lj;
1731 retval.
xcidx (j+1) = retval.
xcidx (j) + ui[j] - li[j];
1742 retval.
xdata (k) = data (i);
1743 retval.
xridx (k++) = ridx (i) - lb;
1755 retval.
xcidx (j+1) = retval.
xcidx (j) + (cidx (jj+1) - cidx (jj));
1775 retval.
xdata (li + i) = data (uj - i);
1776 retval.
xridx (li + i) = nr - 1 - ridx (uj - i);
1799 scb[rri[li + i] = iinv[ridx (lj + i)]] = data (lj + i);
1804 std::sort (rri + li, rri + li + nzj);
1808 retval.
xdata (li + i) = scb[rri[li + i]];
1838 assert (ndims () == 2);
1848 if (idx.
length (n) == rhl)
1866 *
this = rhs.
reshape (dimensions);
1868 else if (nc == 1 && rhs.
cols () == 1)
1882 if (new_nz >= nz && new_nz <= capacity ())
1889 std::copy_backward (data () + ui, data () + nz,
1890 data () + nz + rnz);
1891 std::copy_backward (ridx () + ui, ridx () + nz,
1892 ridx () + nz + rnz);
1896 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
1907 std::copy (tmp.
data (), tmp.
data () + li, data ());
1908 std::copy (tmp.
ridx (), tmp.
ridx () + li, ridx ());
1911 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
1915 std::copy (tmp.
data () + ui, tmp.
data () + nz,
1916 data () + li + rnz);
1917 std::copy (tmp.
ridx () + ui, tmp.
ridx () + nz,
1918 ridx () + li + rnz);
1932 else if (rhs.
nnz () == 0)
1940 if (li != nz && ri[li] == iidx)
1944 maybe_compress (
true);
1969 *
this = reshape (save_dims);
1975 if (rhs.
nnz () != 0)
1991 assert (ndims () == 2);
2003 bool orig_zero_by_zero = (nr == 0 && nc == 0);
2005 if (orig_zero_by_zero || (idx_i.
length (nr) == n && idx_j.
length (nc) == m))
2010 if (orig_zero_by_zero)
2039 if (nrx != nr || ncx != nc)
2047 if (n == 0 || m == 0)
2065 if (new_nz >= nz && new_nz <= capacity ())
2072 std::copy (data () + ui, data () + nz,
2073 data () + li + rnz);
2074 std::copy (ridx () + ui, ridx () + nz,
2075 ridx () + li + rnz);
2080 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
2081 std::copy (rhs.
ridx (), rhs.
ridx () + rnz, ridx () + li);
2085 assert (nnz () == new_nz);
2095 std::copy (tmp.
data (), tmp.
data () + li, data ());
2096 std::copy (tmp.
ridx (), tmp.
ridx () + li, ridx ());
2097 std::copy (tmp.
cidx () + 1, tmp.
cidx () + 1 + lb, cidx () + 1);
2100 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
2101 std::copy (rhs.
ridx (), rhs.
ridx () + rnz, ridx () + li);
2106 std::copy (tmp.
data () + ui, tmp.
data () + nz,
2107 data () + li + rnz);
2108 std::copy (tmp.
ridx () + ui, tmp.
ridx () + nz,
2109 ridx () + li + rnz);
2111 tmp.
cidx () + ub + 1, new_nz - nz);
2113 assert (nnz () == new_nz);
2119 assign (idx_i, idx_j.
sorted (),
2134 xcidx (i+1) = tmp.
cidx (i+1) - tmp.
cidx (i);
2140 xcidx (j+1) = rhs.
cidx (i+1) - rhs.
cidx (i);
2145 xcidx (i+1) += xcidx (i);
2147 change_capacity (nnz ());
2159 std::copy (rhs.
data () + k, rhs.
data () + k + u - l,
2161 std::copy (rhs.
ridx () + k, rhs.
ridx () + k + u - l,
2168 std::copy (tmp.
data () + k, tmp.
data () + k + u - l,
2170 std::copy (tmp.
ridx () + k, tmp.
ridx () + k + u - l,
2180 assign (idx_i, rhs);
2207 else if (m == 1 && n == 1)
2211 if (rhs.
nnz () != 0)
2214 assign (idx_i, idx_j,
Sparse<T> (n, m));
2247 if (m.
length () < 1 || dim > 1)
2278 for (i = 0; i < ns; i++)
2279 if (sparse_ascending_compare<T> (static_cast<T> (0), v[i]))
2284 for (i = 0; i < ns; i++)
2285 if (sparse_descending_compare<T> (static_cast<T> (0), v[i]))
2291 mridx[k] = k - ns + nr;
2313 if (m.
length () < 1 || dim > 1)
2329 indexed_sort.
set_compare (sparse_ascending_compare<T>);
2331 indexed_sort.
set_compare (sparse_descending_compare<T>);
2350 sidx (offset + k) = k;
2357 indexed_sort.
sort (v, vi, ns);
2362 for (i = 0; i < ns; i++)
2363 if (sparse_ascending_compare<T> (static_cast<T> (0), v[i]))
2368 for (i = 0; i < ns; i++)
2369 if (sparse_descending_compare<T> (static_cast<T> (0), v[i]))
2377 if (ii < ns && mridx[ii] == k)
2380 sidx (offset + jj++) = k;
2385 sidx (k + offset) = vi[k];
2391 sidx (k - ns + nr + offset) = vi[k];
2392 mridx[k] = k - ns + nr;
2417 if (nnr == 0 || nnc == 0)
2419 else if (nnr != 1 && nnc != 1)
2426 if (nnr > 0 && nnc > 0)
2435 if (
elem (i, i+k) != 0.)
2441 if (
elem (i-k, i) != 0.)
2447 if (
elem (i, i) != 0.)
2460 T tmp =
elem (i, i+k);
2472 T tmp =
elem (i-k, i);
2484 T tmp =
elem (i, i);
2504 else if (nnr != 0 && nnc != 0)
2535 d.
xdata (i) = data (i);
2536 d.
xridx (i) = j + roff;
2538 d.
xcidx (j + coff + 1) = cidx (j+1);
2564 d.
xdata (ii) = data (ii);
2565 d.
xridx (ii++) = ir + roff;
2570 d.
xcidx (i + coff + 1) = ii;
2589 if (dim == -1 || dim == -2)
2595 (*current_liboctave_error_handler)
2596 (
"cat: invalid dimension");
2600 if (dim == 0 || dim == 1)
2603 return sparse_list[0];
2607 if (! (dv.*concat_rule) (sparse_list[i].
dims (), dim))
2608 (*current_liboctave_error_handler)
2609 (
"cat: dimension mismatch");
2610 total_nz += sparse_list[i].
nnz ();
2615 (
"cat: invalid dimension for sparse concatenation");
2649 rcum += spi.
rows ();
2652 retval.
xcidx (j+1) = l;
2665 if (sparse_list[i].is_empty ())
2694 retval(j) = data (i++);
2701 retval(ridx (i), j) = data (i);
2905 os << prefix <<
"rep address: " << rep <<
"\n"
2906 << prefix <<
"rep->nzmx: " << rep->nzmx <<
"\n"
2907 << prefix <<
"rep->nrows: " << rep->nrows <<
"\n"
2908 << prefix <<
"rep->ncols: " << rep->ncols <<
"\n"
2909 << prefix <<
"rep->data: " <<
static_cast<void *
> (rep->d) <<
"\n"
2910 << prefix <<
"rep->ridx: " << static_cast<void *> (rep->r) <<
"\n"
2911 << prefix <<
"rep->cidx: " <<
static_cast<void *
> (rep->c) <<
"\n"
2912 << prefix <<
"rep->count: " << rep->count <<
"\n";
2915 #define INSTANTIATE_SPARSE(T, API) \
2916 template class API Sparse<T>;
Array< T > as_matrix(void) const
Return the array as a matrix.
T & elem(octave_idx_type _r, octave_idx_type _c)
octave_idx_type * xridx(void)
void mx_inline_add2(size_t n, R *r, const X *x)
octave_idx_type cols(void) const
octave_idx_type length(octave_idx_type n=0) const
std::string str(char sep= 'x') const
octave_idx_type rows(void) const
void change_length(octave_idx_type nz)
octave_idx_type numel(void) const
const octave_base_value const Array< octave_idx_type > & ra_idx
Sparse< T > & operator=(const Sparse< T > &a)
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value)
dim_vector dims(void) const
octave_idx_type rows(void) const
static const idx_vector colon
octave_idx_type numel(void) const
Number of elements in the array.
void set_compare(compare_fcn_type comp)
void resize(int n, int fill_value=0)
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
octave_idx_type * xcidx(void)
Sparse< T > index(const idx_vector &i, bool resize_ok=false) const
Sparse< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
bool sparse_indices_ok(octave_idx_type *r, octave_idx_type *c, octave_idx_type nrows, octave_idx_type ncols, octave_idx_type nnz)
static Sparse< T > cat(int dim, octave_idx_type n, const Sparse< T > *sparse_list)
Sparse< T > & insert(const Sparse< T > &a, octave_idx_type r, octave_idx_type c)
octave_idx_type * cidx(void)
T & elem(octave_idx_type n)
octave_idx_type columns(void) const
bool indices_ok(void) const
void gripe_assignment_dimension_mismatch(void)
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 const double const double double * d
T range_error(const char *fcn, octave_idx_type n) const
idx_vector inverse_permutation(octave_idx_type n) const
octave_idx_type nnz(void) const
bool sparse_ascending_compare(typename ref_param< T >::type a, typename ref_param< T >::type b)
bool concat(const dim_vector &dvb, int dim)
This corresponds to cat().
void assign(const idx_vector &i, const Sparse< T > &rhs)
void maybe_compress(bool remove_zeros)
Sparse< T >::SparseRep * rep
dim_vector orig_dimensions(void) const
T celem(octave_idx_type _r, octave_idx_type _c) const
liboctave_error_handler current_liboctave_error_handler
octave_idx_type safe_numel(void) const
void copy_data(octave_idx_type *data) const
void mx_inline_sub(size_t n, R *r, const X *x, const Y *y)
idx_vector complement(octave_idx_type n) const
void change_capacity(octave_idx_type nz)
bool sparse_descending_compare(typename ref_param< T >::type a, typename ref_param< T >::type b)
const Array< octave_idx_type > & col_perm_vec(void) const
static void gripe_index_out_of_range(void)
Sparse< T > sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Sparse< T > reshape(const dim_vector &new_dims) const
Sparse< T > maybe_compress(bool remove_zeros=false)
void resize(octave_idx_type r, octave_idx_type c)
Array< T > transpose(void) const
const T * data(void) const
void gripe_invalid_resize(void)
bool is_vector(void) const
dim_vector redim(int n) const
bool is_cont_range(octave_idx_type n, octave_idx_type &l, octave_idx_type &u) const
bool is_permutation(octave_idx_type n) const
if_then_else< is_class_type< T >::no, T, T const & >::result type
void delete_elements(const idx_vector &i)
Array< octave_idx_type > as_array(void) const
bool is_colon_equiv(octave_idx_type n) const
charNDArray max(char d, const charNDArray &m)
octave_idx_type length(void) const
Number of elements in the array.
octave_idx_type extent(octave_idx_type n) const
bool is_range(void) const
void sort(T *data, octave_idx_type nel)
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
octave_idx_type * ridx(void)
bool is_empty(void) const
void gripe_invalid_assignment_size(void)
void resize1(octave_idx_type n)
octave_idx_type compute_index(const Array< octave_idx_type > &ra_idx) const
bool is_scalar(void) 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)
void assign(const idx_vector &i, const Array< T > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
void mx_inline_add(size_t n, R *r, const X *x, const Y *y)
void gripe_del_index_out_of_range(bool is1d, octave_idx_type idx, octave_idx_type ext)
const T * fortran_vec(void) const
octave_idx_type cols(void) const
const octave_idx_type * raw(void)
octave_idx_type increment(void) const
Sparse< T > diag(octave_idx_type k=0) const
void print_info(std::ostream &os, const std::string &prefix) const
Sparse< T > transpose(void) const
static octave_idx_type lblookup(const octave_idx_type *ridx, octave_idx_type nr, octave_idx_type ri)
idx_vector sorted(bool uniq=false) const
octave_idx_type length(void) const
Array< T > index(const idx_vector &i) const
Indexing without resizing.
bool is_colon(void) const
charNDArray min(char d, const charNDArray &m)
Array< T > array_value(void) const