65 : rep (new typename
Sparse<T>::
SparseRep (a.rows (), a.cols (), a.rows ())),
88 (*current_liboctave_error_handler)
89 (
"Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled");
91 for (i =
c[_c]; i <
c[_c + 1]; i++)
100 (*current_liboctave_error_handler)
101 (
"Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled");
122 template <
typename T>
133 template <
typename T>
154 change_length (
c[ncols]);
157 template <
typename T>
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);
188 template <
typename T>
195 template <
typename T>
208 template <
typename T>
236 template <
typename T>
238 : rep (0), dimensions (dv)
240 if (dv.
ndims () != 2)
242 (
"Sparse::Sparse (const dim_vector&): dimension mismatch");
247 template <
typename T>
249 : rep (0), dimensions (dv)
253 unsigned long long a_nel =
static_cast<unsigned long long>(a.
rows ()) *
254 static_cast<unsigned long long>(a.
cols ());
255 unsigned long long dv_nel =
static_cast<unsigned long long>(
dv(0)) *
256 static_cast<unsigned long long>(
dv(1));
259 (*current_liboctave_error_handler)
260 (
"Sparse::Sparse (const Sparse&, const dim_vector&): dimension mismatch");
289 template <
typename T>
294 : rep (0), dimensions ()
298 else if (r.
extent (nr) > nr)
304 else if (c.
extent (nc) > nc)
306 (
"sparse: column index %d out of bound %d", r.
extent (nc), nc);
313 bool a_scalar = n == 1;
322 if ((rl != 1 && rl != n) || (cl != 1 && cl != n))
323 (*current_liboctave_error_handler) (
"sparse: dimension mismatch");
328 if (rl <= 1 && cl <= 1)
330 if (n == 1 &&
a(0) != T ())
360 new_nz += rd[
i-1] != rd[
i];
428 sidx[ci[cd[
i]+1]++] = rd[0];
430 sidx[ci[cd[
i]+1]++] = rd[
i];
436 std::sort (sidx + ci[j], sidx + ci[j+1]);
508 new_nz += rd[
i-1] != rd[
i];
527 if (rd[
i] != rd[
i-1])
541 if (rd[
i] != rd[
i-1])
570 typedef std::pair<octave_idx_type, octave_idx_type> idx_pair;
575 idx_pair&
p = spairs[ci[cd[
i]+1]++];
587 std::sort (spairs + ci[j], spairs + ci[j+1]);
649 template <
typename T>
651 : rep (0), dimensions (a.
dims ())
655 (
"Sparse::Sparse (const Array<T>&): dimension mismatch");
674 if (a.
elem (
i,j) != T ())
683 template <
typename T>
686 if (--rep->count == 0)
690 template <
typename T>
696 if (--rep->count == 0)
708 template <
typename T>
714 if (n <= 0 || n != ra_idx.
numel ())
716 (
"Sparse<T>::compute_index: invalid ra_idxing operation");
724 retval *= dimensions(n);
731 template <
typename T>
735 (*current_liboctave_error_handler) (
"%s (%d): range error",
fcn, n);
738 template <
typename T>
742 (*current_liboctave_error_handler) (
"%s (%d): range error",
fcn, n);
745 template <
typename T>
750 (*current_liboctave_error_handler) (
"%s (%d, %d): range error",
fcn,
i, j);
753 template <
typename T>
757 (*current_liboctave_error_handler) (
"%s (%d, %d): range error",
fcn,
i, j);
760 template <
typename T>
765 std::ostringstream buf;
777 buf <<
"): range error";
781 (*current_liboctave_error_handler) (buf_str.c_str ());
784 template <
typename T>
788 std::ostringstream buf;
800 buf <<
"): range error";
804 (*current_liboctave_error_handler) (buf_str.c_str ());
807 template <
typename T>
814 if (dims2.
ndims () > 2)
816 (*current_liboctave_warning_with_id_handler)
817 (
"Octave:reshape-smashes-dims",
818 "reshape: sparse reshape to N-D array smashes dims");
821 dims2(1) *= dims2(
i);
826 if (dimensions != dims2)
828 if (dimensions.numel () == dims2.
numel ())
835 retval =
Sparse<T> (new_nr, new_nc, new_nnz);
838 retval.
xcidx (0) = 0;
846 if (i_old_rm >= new_nr)
848 i_old_qu += i_old_rm / new_nr;
849 i_old_rm = i_old_rm % new_nr;
854 ii = (i_old_rm + ridx (j)) % new_nr;
855 jj = i_old_qu + (i_old_rm + ridx (j)) / new_nr;
864 retval.
xdata (j) = data (j);
865 retval.
xridx (j) = ii;
869 retval.
xcidx (
k+1) = new_nnz;
876 (*current_liboctave_error_handler)
877 (
"reshape: can't reshape %s array to %s array",
878 dimensions_str.c_str (), new_dims_str.c_str ());
887 template <
typename T>
896 if (perm_vec.
numel () == 2)
898 if (perm_vec(0) == 0 && perm_vec(1) == 1)
900 else if (perm_vec(0) == 1 && perm_vec(1) == 0)
909 (*current_liboctave_error_handler)
910 (
"permutation vector contains an invalid element");
912 return trans ? this->
transpose () : *
this;
915 template <
typename T>
925 resize (nr, (n + nr - 1) / nr);
934 template <
typename T>
941 (*current_liboctave_error_handler) (
"sparse array must be 2-D");
943 resize (
dv(0),
dv(1));
946 template <
typename T>
951 (*current_liboctave_error_handler) (
"can't resize to negative dimension");
953 if (r == dim1 () && c == dim2 ())
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 ());
996 template <
typename T>
1005 if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ())
1006 (*current_liboctave_error_handler) (
"range error for insert");
1011 if (c + a_cols < nc)
1012 nel += cidx (nc) - cidx (c + a_cols);
1016 if (ridx (j) < r || ridx (j) >= r + a_rows)
1038 if (tmp.
ridx (j) < r)
1040 data (ii) = tmp.
data (j);
1041 ridx (ii++) = tmp.
ridx (j);
1048 data (ii) = a.
data (j);
1049 ridx (ii++) = r + a.
ridx (j);
1055 if (tmp.
ridx (j) >= r + a_rows)
1057 data (ii) = tmp.
data (j);
1058 ridx (ii++) = tmp.
ridx (j);
1068 data (ii) = tmp.
data (j);
1069 ridx (ii++) = tmp.
ridx (j);
1077 template <
typename T>
1082 if (ra_idx.
numel () != 2)
1088 template <
typename T>
1092 assert (ndims () == 2);
1100 retval.
xcidx (ridx (
i) + 1)++;
1115 retval.
xridx (q) = j;
1116 retval.
xdata (q) = data (
k);
1118 assert (nnz () == retval.
xcidx (nr));
1135 for (l = 0; l < nr; l++)
1141 return std::lower_bound (ridx, ridx + nr, ri) - ridx;
1144 template <
typename T>
1150 assert (ndims () == 2);
1160 if (idx.
extent (nel) > nel)
1178 *
this =
Sparse<T> (nr - (ub - lb), 1, nz_new);
1179 std::copy (tmp.
data (), tmp.
data () + li, data ());
1180 std::copy (tmp.
ridx (), tmp.
ridx () + li, xridx ());
1181 std::copy (tmp.
data () + ui, tmp.
data () + nz, xdata () + li);
1197 for (; j < sl && sj[j] < r; j++) ;
1198 if (j == sl || sj[j] > r)
1200 data_new[nz_new] = tmp.
data (
i);
1201 ridx_new[nz_new++] = r - j;
1206 std::copy (ridx_new, ridx_new + nz_new, ridx ());
1207 std::copy (data_new, data_new + nz_new, xdata ());
1221 *
this =
Sparse<T> (1, nc - (ub - lb), new_nz);
1222 std::copy (tmp.
data (), tmp.
data () + lbi, data ());
1223 std::copy (tmp.
data () + ubi, tmp.
data () + nz , xdata () + lbi);
1224 std::fill_n (ridx (), new_nz, static_cast<octave_idx_type> (0));
1225 std::copy (tmp.
cidx () + 1, tmp.
cidx () + 1 + lb, cidx () + 1);
1232 else if (idx.
length (nel) != 0)
1239 delete_elements (idx);
1245 template <
typename T>
1249 assert (ndims () == 2);
1259 if (idx_j.
extent (nc) > nc)
1263 if (lb == 0 && ub == nc)
1280 *
this =
Sparse<T> (nr, nc - (ub - lb), new_nz);
1281 std::copy (tmp.
data (), tmp.
data () + lbi, data ());
1282 std::copy (tmp.
ridx (), tmp.
ridx () + lbi, ridx ());
1283 std::copy (tmp.
data () + ubi, tmp.
data () + nz, xdata () + lbi);
1284 std::copy (tmp.
ridx () + ubi, tmp.
ridx () + nz, xridx () + lbi);
1285 std::copy (tmp.
cidx () + 1, tmp.
cidx () + 1 + lb, cidx () + 1);
1287 tmp.
cidx () + ub + 1, ubi - lbi);
1291 *
this = index (idx_i, idx_j.
complement (nc));
1297 if (idx_i.
extent (nr) > nr)
1301 if (lb == 0 && ub == nr)
1317 tmpl.
nnz () + tmpu.
nnz ());
1323 xdata (
k) = tmpl.
data (
i);
1324 xridx (
k++) = tmpl.
ridx (
i);
1329 xdata (
k) = tmpu.
data (
i);
1330 xridx (
k++) = tmpu.
ridx (
i) + lb;
1355 bool empty_assignment
1358 if (! empty_assignment)
1359 (*current_liboctave_error_handler)
1360 (
"a null assignment can only have one non-colon index");
1364 template <
typename T>
1376 template <
typename T>
1382 assert (ndims () == 2);
1405 retval.
xdata (j) = data (j);
1406 retval.
xridx (j) = ridx (j) +
i * nr;
1410 retval.
xcidx (0) = 0;
1411 retval.
xcidx (1) = nz;
1414 else if (idx.
extent (nel) > nel)
1423 retval = tmp.
index (idx);
1425 else if (nr == 1 && nc == 1)
1431 retval =
Sparse<T> (idx_dims(0), idx_dims(1), nz ? data (0) : T ());
1442 if (i < nz && ridx (i) == idx(0))
1443 retval =
Sparse (1, 1, data (i));
1455 retval =
Sparse<T> (ub - lb, 1, nz_new);
1456 std::copy (data () + li, data () + li + nz_new, retval.
data ());
1458 retval.
xcidx (1) = nz_new;
1467 retval.
ridx (j) = nr - ridx (nz - j - 1) - 1;
1469 std::copy (cidx (), cidx () + 2, retval.
cidx ());
1470 std::reverse_copy (data (), data () + nz, retval.
data ());
1475 tmp = tmp.
index (idx);
1508 if (l < nz && ridx (l) == idxa(
i, j))
1526 retval.
data (k) = data (l);
1543 retval =
Sparse<T> (1, ub - lb, new_nz);
1544 std::copy (data () + lbi, data () + lbi + new_nz, retval.
data ());
1552 retval =
Sparse<T> (array_value ().index (idx));
1568 if (idx_dims(0) == 1 && idx_dims(1) != 1)
1576 template <
typename T>
1579 bool resize_ok)
const
1583 assert (ndims () == 2);
1601 tmp.
resize (ext_i, ext_j);
1602 retval = tmp.
index (idx_i, idx_j);
1604 else if (idx_i.
extent (nr) > nr)
1609 else if (nr == 1 && nc == 1)
1615 retval =
Sparse<T> (array_value ().index (idx_i, idx_j));
1629 retval =
Sparse<T> (nr, ub - lb, new_nz);
1630 std::copy (data () + lbi, data () + lbi + new_nz, retval.
data ());
1631 std::copy (ridx () + lbi, ridx () + lbi + new_nz, retval.
ridx ());
1641 retval.
xcidx (j+1) = retval.
xcidx (j) + (cidx (jj+1) - cidx (jj));
1653 std::copy (data () + ljj, data () + ljj + nzj, retval.
data () + lj);
1654 std::copy (ridx () + ljj, ridx () + ljj + nzj, retval.
ridx () + lj);
1661 retval = index (idx_i);
1681 if (i < nzj && ridx (i+lj) == ii)
1696 if (retval.
xcidx (j+1) >
i)
1698 retval.
xridx (i) = 0;
1699 retval.
xdata (i) = data (ij[j]);
1717 li[j] = lij =
lblookup (ridx () + lj, nzj, lb) + lj;
1718 ui[j] = uij =
lblookup (ridx () + lj, nzj, ub) + lj;
1719 retval.
xcidx (j+1) = retval.
xcidx (j) + ui[j] - li[j];
1731 retval.
xridx (
k++) = ridx (
i) - lb;
1743 retval.
xcidx (j+1) = retval.
xcidx (j) + (cidx (jj+1) - cidx (jj));
1763 retval.
xdata (li +
i) = data (uj -
i);
1764 retval.
xridx (li +
i) = nr - 1 - ridx (uj -
i);
1787 scb[rri[li +
i] = iinv[ridx (lj +
i)]] = data (lj +
i);
1792 std::sort (rri + li, rri + li + nzj);
1796 retval.
xdata (li +
i) = scb[rri[li +
i]];
1820 template <
typename T>
1826 assert (ndims () == 2);
1836 if (idx.
length (n) == rhl)
1854 *
this = rhs.
reshape (dimensions);
1856 else if (nc == 1 && rhs.
cols () == 1)
1870 if (new_nz >= nz && new_nz <= nzmax ())
1877 std::copy_backward (data () + ui, data () + nz,
1878 data () + nz + rnz);
1879 std::copy_backward (ridx () + ui, ridx () + nz,
1880 ridx () + nz + rnz);
1884 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
1895 std::copy (tmp.
data (), tmp.
data () + li, data ());
1896 std::copy (tmp.
ridx (), tmp.
ridx () + li, ridx ());
1899 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
1903 std::copy (tmp.
data () + ui, tmp.
data () + nz,
1904 data () + li + rnz);
1905 std::copy (tmp.
ridx () + ui, tmp.
ridx () + nz,
1906 ridx () + li + rnz);
1920 else if (rhs.
nnz () == 0)
1928 if (li != nz && ri[li] == iidx)
1932 maybe_compress (
true);
1957 *
this = reshape (save_dims);
1963 if (rhs.
nnz () != 0)
1972 template <
typename T>
1979 assert (ndims () == 2);
1991 bool orig_zero_by_zero = (nr == 0 && nc == 0);
1993 if (orig_zero_by_zero || (idx_i.
length (nr) == n && idx_j.
length (nc) ==
m))
1998 if (orig_zero_by_zero)
2027 if (nrx != nr || ncx != nc)
2035 if (n == 0 || m == 0)
2053 if (new_nz >= nz && new_nz <= nzmax ())
2060 std::copy_backward (data () + ui, data () + nz,
2062 std::copy_backward (ridx () + ui, ridx () + nz,
2068 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
2069 std::copy (rhs.
ridx (), rhs.
ridx () + rnz, ridx () + li);
2073 assert (nnz () == new_nz);
2083 std::copy (tmp.
data (), tmp.
data () + li, data ());
2084 std::copy (tmp.
ridx (), tmp.
ridx () + li, ridx ());
2085 std::copy (tmp.
cidx () + 1, tmp.
cidx () + 1 + lb, cidx () + 1);
2088 std::copy (rhs.
data (), rhs.
data () + rnz, data () + li);
2089 std::copy (rhs.
ridx (), rhs.
ridx () + rnz, ridx () + li);
2094 std::copy (tmp.
data () + ui, tmp.
data () + nz,
2095 data () + li + rnz);
2096 std::copy (tmp.
ridx () + ui, tmp.
ridx () + nz,
2097 ridx () + li + rnz);
2099 tmp.
cidx () + ub + 1, new_nz - nz);
2101 assert (nnz () == new_nz);
2107 assign (idx_i, idx_j.
sorted (),
2133 xcidx (
i+1) += xcidx (
i);
2135 change_capacity (nnz ());
2147 std::copy (rhs.
data () +
k, rhs.
data () + k + u - l,
2149 std::copy (rhs.
ridx () +
k, rhs.
ridx () + k + u - l,
2156 std::copy (tmp.
data () +
k, tmp.
data () + k + u - l,
2158 std::copy (tmp.
ridx () +
k, tmp.
ridx () + k + u - l,
2168 assign (idx_i, rhs);
2195 else if (m == 1 && n == 1)
2199 if (rhs.
nnz () != 0)
2202 assign (idx_i, idx_j,
Sparse<T> (n, m));
2204 else if (idx_i.
length (nr) == m && idx_j.
length (nc) == n
2205 && (n == 1 || m == 1))
2207 assign (idx_i, idx_j, rhs.
transpose ());
2215 template <
typename T>
2223 template <
typename T>
2231 template <
typename T>
2240 if (m.
numel () < 1 || dim > 1)
2271 for (i = 0; i < ns; i++)
2272 if (sparse_ascending_compare<T> (static_cast<T> (0), v[i]))
2277 for (i = 0; i < ns; i++)
2278 if (sparse_descending_compare<T> (static_cast<T> (0), v[i]))
2284 mridx[
k] =
k - ns + nr;
2296 template <
typename T>
2306 if (m.
numel () < 1 || dim > 1)
2322 indexed_sort.
set_compare (sparse_ascending_compare<T>);
2324 indexed_sort.
set_compare (sparse_descending_compare<T>);
2343 sidx (offset +
k) =
k;
2350 indexed_sort.
sort (v, vi, ns);
2355 for (i = 0; i < ns; i++)
2356 if (sparse_ascending_compare<T> (static_cast<T> (0), v[i]))
2361 for (i = 0; i < ns; i++)
2362 if (sparse_descending_compare<T> (static_cast<T> (0), v[i]))
2370 if (ii < ns && mridx[ii] ==
k)
2373 sidx (offset + jj++) =
k;
2378 sidx (
k + offset) = vi[
k];
2384 sidx (
k - ns + nr + offset) = vi[
k];
2385 mridx[
k] =
k - ns + nr;
2402 template <
typename T>
2410 if (nnr == 0 || nnc == 0)
2412 else if (nnr != 1 && nnc != 1)
2419 if (nnr > 0 && nnc > 0)
2497 else if (nnr != 0 && nnc != 0)
2531 d.
xcidx (j + coff + 1) = cidx (j+1);
2557 d.
xdata (ii) = data (ii);
2558 d.
xridx (ii++) = ir + roff;
2563 d.
xcidx (
i + coff + 1) = ii;
2575 template <
typename T>
2582 if (dim == -1 || dim == -2)
2588 (*current_liboctave_error_handler) (
"cat: invalid dimension");
2592 if (dim != 0 && dim != 1)
2593 (*current_liboctave_error_handler)
2594 (
"cat: invalid dimension for sparse concatenation");
2597 return sparse_list[0];
2601 if (! (dv.*concat_rule) (sparse_list[
i].
dims (), dim))
2602 (*current_liboctave_error_handler) (
"cat: dimension mismatch");
2604 total_nz += sparse_list[
i].
nnz ();
2639 rcum += spi.
rows ();
2642 retval.
xcidx (j+1) = l;
2655 if (sparse_list[
i].is_empty ())
2673 template <
typename T>
2697 template <
typename T>
2700 T (*read_fcn) (std::istream&))
2706 if (nr > 0 && nc > 0)
2730 (*current_liboctave_error_handler)
2731 (
"invalid sparse matrix: element %d: "
2732 "Symbols '%s' is not an integer format",
2733 i+1, err_field.c_str ());
2736 if (itmp < 0 || itmp >= nr)
2738 is.setstate (std::ios::failbit);
2740 (*current_liboctave_error_handler)
2741 (
"invalid sparse matrix: element %d: "
2742 "row index = %d out of range",
2746 if (jtmp < 0 || jtmp >= nc)
2748 is.setstate (std::ios::failbit);
2750 (*current_liboctave_error_handler)
2751 (
"invalid sparse matrix: element %d: "
2752 "column index = %d out of range",
2758 is.setstate (std::ios::failbit);
2760 (*current_liboctave_error_handler)
2761 (
"invalid sparse matrix: element %d:"
2762 "column indices must appear in ascending order (%d < %d)",
2765 else if (jtmp > jold)
2770 else if (itmp < iold)
2772 is.setstate (std::ios::failbit);
2774 (*current_liboctave_error_handler)
2775 (
"invalid sparse matrix: element %d: "
2776 "row indices must appear in ascending order in each column "
2784 tmp = read_fcn (is);
2790 a.
ridx (ii++) = itmp;
2998 template <
typename T>
3002 os << prefix <<
"rep address: " << rep <<
"\n"
3003 << prefix <<
"rep->nzmx: " << rep->nzmx <<
"\n"
3004 << prefix <<
"rep->nrows: " << rep->nrows <<
"\n"
3005 << prefix <<
"rep->ncols: " << rep->ncols <<
"\n"
3006 << prefix <<
"rep->data: " <<
static_cast<void *
> (rep->d) <<
"\n"
3007 << prefix <<
"rep->ridx: " << static_cast<void *> (rep->r) <<
"\n"
3008 << prefix <<
"rep->cidx: " <<
static_cast<void *
> (rep->c) <<
"\n"
3009 << prefix <<
"rep->count: " << rep->count <<
"\n";
3012 #define INSTANTIATE_SPARSE(T, API) \
3013 template class API Sparse<T>; \
3014 template std::istream& \
3015 read_sparse_matrix<T> (std::istream& is, Sparse<T>& a, \
3016 T (*read_fcn) (std::istream&));
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_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 calculate Y_a and Y _d item Given calculate Y nd enumerate In either initial values for the given components are and initial guesses for the unknown components must also be provided as input Set this option to to solve the first or to solve the second(the default is 0, so you must provide a set of initial conditions that are consistent).If this option is set to a nonzero value
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.
identity matrix If supplied two scalar respectively For allows like xample val
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)
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)
void err_index_out_of_range(int nd, int dim, octave_idx_type idx, octave_idx_type ext)
static Sparse< T >::SparseRep * nil_rep(void)
Sparse< T > index(const idx_vector &i, bool resize_ok=false) const
bool any_element_is_nan(void) 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
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.
OCTAVE_NORETURN T range_error(const char *fcn, octave_idx_type n) const
idx_vector inverse_permutation(octave_idx_type n) const
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
octave_idx_type nnz(void) const
Actual number of nonzero terms.
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
octave_idx_type nzmax(void) const
Amount of storage for nonzero elements.
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 err_del_index_out_of_range(bool is1d, octave_idx_type idx, octave_idx_type ext)
void maybe_compress(bool remove_zeros)
Sparse< T >::SparseRep * rep
dim_vector orig_dimensions(void) const
std::istream & read_sparse_matrix(std::istream &is, Sparse< T > &a, T(*read_fcn)(std::istream &))
T celem(octave_idx_type _r, octave_idx_type _c) const
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
nd deftypefn *octave_map m
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
bool is_vector(void) const
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
dim_vector redim(int n) const
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
bool is_permutation(octave_idx_type n) const
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
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
void err_invalid_resize(void)
bool is_colon_equiv(octave_idx_type n) const
charNDArray max(char d, const charNDArray &m)
octave_idx_type extent(octave_idx_type n) const
bool is_range(void) const
T::size_type numel(const T &str)
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
Compressed Column Sparse(rows=3, cols=4, nnz=2[17%])(1
void resize1(octave_idx_type n)
=val(i)}if ode{val(i)}occurs in table i
octave_idx_type compute_index(const Array< octave_idx_type > &ra_idx) 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))<
bool is_scalar(void) 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)
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)
const T * fortran_vec(void) const
octave_idx_type cols(void) const
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
const octave_idx_type * raw(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
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
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