69 (*current_liboctave_error_handler)
70 (
"Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled");
72 for (
i =
c[_c];
i <
c[_c + 1];
i++)
81 (*current_liboctave_error_handler)
82 (
"Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled");
103 template <
typename T>
114 template <
typename T>
135 change_length (
c[ncols]);
138 template <
typename T>
146 static const int frac = 5;
147 if (nz > nzmx || nz < nzmx - nzmx/frac)
153 std::copy_n (r, min_nzmx, new_ridx);
158 T *new_data =
new T [nz];
159 std::copy_n (
d, min_nzmx, new_data);
168 template <
typename T>
175 template <
typename T>
188 template <
typename T>
216 template <
typename T>
218 : rep (new typename
Sparse<T>::SparseRep (
a.rows (),
a.cols (),
a.rows ())),
234 template <
typename T>
236 : rep (nullptr), dimensions (
dv)
240 (
"Sparse::Sparse (const dim_vector&): dimension mismatch");
245 template <
typename T>
247 : rep (nullptr), dimensions (
dv)
251 unsigned long long a_nel =
static_cast<unsigned long long>(
a.rows ()) *
252 static_cast<unsigned long long>(
a.cols ());
253 unsigned long long dv_nel =
static_cast<unsigned long long>(
dv(0)) *
254 static_cast<unsigned long long>(
dv(1));
257 (*current_liboctave_error_handler)
258 (
"Sparse::Sparse (const Sparse&, const dim_vector&): dimension mismatch");
287 template <
typename T>
292 : rep (nullptr), dimensions ()
296 else if (r.
extent (nr) > nr)
302 else if (
c.extent (nc) > nc)
304 (
"sparse: column index %d out of bound %d", r.
extent (nc), nc);
311 bool a_scalar = n == 1;
320 if ((rl != 1 && rl != n) || (cl != 1 && cl != n))
321 (*current_liboctave_error_handler) (
"sparse: dimension mismatch");
326 if (rl <= 1 && cl <= 1)
328 if (n == 1 &&
a(0) != T ())
333 std::fill_n (
xcidx () +
c(0) + 1, nc -
c(0), 1);
355 new_nz += rd[
i-1] != rd[
i];
359 std::fill_n (
xcidx () +
c(0) + 1, nc -
c(0), new_nz);
424 sidx[ci[cd[
i]+1]++] = rd[0];
426 sidx[ci[cd[
i]+1]++] = rd[
i];
432 std::sort (sidx + ci[j], sidx + ci[j+1]);
504 new_nz += rd[
i-1] != rd[
i];
508 std::fill_n (
xcidx () +
c(0) + 1, nc -
c(0), new_nz);
524 if (rd[
i] != rd[
i-1])
538 if (rd[
i] != rd[
i-1])
567 typedef std::pair<octave_idx_type, octave_idx_type> idx_pair;
572 idx_pair&
p = spairs[ci[cd[
i]+1]++];
584 std::sort (spairs + ci[j], spairs + ci[j+1]);
619 rrd[++jj] =
a(spairs[
i].second);
623 rrd[jj] +=
a(spairs[
i].second);
637 rrd[jj] =
a(spairs[
i].second);
652 template <
typename T>
654 : rep (nullptr), dimensions (
a.
dims ())
658 (
"Sparse::Sparse (const Array<T>&): dimension mismatch");
677 if (
a.elem (
i,j) != T ())
686 template <
typename T>
689 if (--rep->count == 0)
693 template <
typename T>
699 if (--rep->count == 0)
705 dimensions =
a.dimensions;
711 template <
typename T>
719 (
"Sparse<T>::compute_index: invalid ra_idxing operation");
734 template <
typename T>
738 (*current_liboctave_error_handler) (
"%s (%d): range error",
fcn, n);
741 template <
typename T>
745 (*current_liboctave_error_handler) (
"%s (%d): range error",
fcn, n);
748 template <
typename T>
753 (*current_liboctave_error_handler) (
"%s (%d, %d): range error",
fcn,
i, j);
756 template <
typename T>
760 (*current_liboctave_error_handler) (
"%s (%d, %d): range error",
fcn,
i, j);
763 template <
typename T>
768 std::ostringstream buf;
780 buf <<
"): range error";
784 (*current_liboctave_error_handler) (buf_str.c_str ());
787 template <
typename T>
791 std::ostringstream buf;
803 buf <<
"): range error";
807 (*current_liboctave_error_handler) (buf_str.c_str ());
810 template <
typename T>
817 if (dims2.
ndims () > 2)
819 (*current_liboctave_warning_with_id_handler)
820 (
"Octave:reshape-smashes-dims",
821 "reshape: sparse reshape to N-D array smashes dims");
824 dims2(1) *= dims2(
i);
829 if (dimensions != dims2)
831 if (dimensions.numel () == dims2.
numel ())
849 if (i_old_rm >= new_nr)
851 i_old_qu += i_old_rm / new_nr;
852 i_old_rm = i_old_rm % new_nr;
857 ii = (i_old_rm + ridx (j)) % new_nr;
858 jj = i_old_qu + (i_old_rm + ridx (j)) / new_nr;
866 retval.xdata (j) = data (j);
878 (*current_liboctave_error_handler)
879 (
"reshape: can't reshape %s array to %s array",
880 dimensions_str.c_str (), new_dims_str.c_str ());
889 template <
typename T>
898 if (perm_vec.
numel () == 2)
900 if (perm_vec(0) == 0 && perm_vec(1) == 1)
902 else if (perm_vec(0) == 1 && perm_vec(1) == 0)
911 (*current_liboctave_error_handler)
912 (
"permutation vector contains an invalid element");
914 return trans ? this->
transpose () : *
this;
917 template <
typename T>
927 resize (nr, (n + nr - 1) / nr);
936 template <
typename T>
943 (*current_liboctave_error_handler) (
"sparse array must be 2-D");
945 resize (
dv(0),
dv(1));
948 template <
typename T>
953 (*current_liboctave_error_handler) (
"can't resize to negative dimension");
955 if (r == dim1 () &&
c == dim2 ())
972 xdata (
k) = xdata (
i);
973 xridx (
k++) = xridx (
i);
979 rep->nrows = dimensions(0) = r;
984 std::copy_n (rep->c,
std::min (
c, rep->ncols) + 1, new_cidx);
989 std::fill_n (rep->c + rep->ncols + 1,
c - rep->ncols,
993 rep->ncols = dimensions(1) =
c;
995 rep->change_length (rep->nnz ());
998 template <
typename T>
1007 if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ())
1008 (*current_liboctave_error_handler) (
"range error for insert");
1013 if (
c + a_cols < nc)
1014 nel += cidx (nc) - cidx (
c + a_cols);
1018 if (ridx (j) < r || ridx (j) >= r + a_rows)
1027 data (
i) =
tmp.data (
i);
1028 ridx (
i) =
tmp.ridx (
i);
1031 cidx (
i) =
tmp.cidx (
i);
1040 if (
tmp.ridx (j) < r)
1042 data (ii) =
tmp.data (j);
1043 ridx (ii++) =
tmp.ridx (j);
1050 data (ii) =
a.data (j);
1051 ridx (ii++) = r +
a.ridx (j);
1057 if (
tmp.ridx (j) >= r + a_rows)
1059 data (ii) =
tmp.data (j);
1060 ridx (ii++) =
tmp.ridx (j);
1070 data (ii) =
tmp.data (j);
1071 ridx (ii++) =
tmp.ridx (j);
1079 template <
typename T>
1090 template <
typename T>
1094 assert (ndims () == 2);
1102 retval.xcidx (ridx (
i) + 1)++;
1120 assert (nnz () ==
retval.xcidx (nr));
1137 for (l = 0; l < nr; l++)
1143 return std::lower_bound (ridx, ridx + nr, ri) - ridx;
1146 template <
typename T>
1152 assert (ndims () == 2);
1162 if (idx.
extent (nel) > nel)
1180 *
this =
Sparse<T> (nr - (ub - lb), 1, nz_new);
1181 std::copy_n (
tmp.data (), li, data ());
1182 std::copy_n (
tmp.ridx (), li, xridx ());
1183 std::copy (
tmp.data () + ui,
tmp.data () + nz, xdata () + li);
1199 for (; j < sl && sj[j] < r; j++) ;
1200 if (j == sl || sj[j] > r)
1202 data_new[nz_new] =
tmp.data (
i);
1203 ridx_new[nz_new++] = r - j;
1208 std::copy_n (ridx_new, nz_new, ridx ());
1209 std::copy_n (data_new, nz_new, xdata ());
1223 *
this =
Sparse<T> (1, nc - (ub - lb), new_nz);
1224 std::copy_n (
tmp.data (), lbi, data ());
1225 std::copy (
tmp.data () + ubi,
tmp.data () + nz , xdata () + lbi);
1226 std::fill_n (ridx (), new_nz, static_cast<octave_idx_type> (0));
1227 std::copy_n (
tmp.cidx () + 1, lb, cidx () + 1);
1234 else if (idx.
length (nel) != 0)
1241 delete_elements (idx);
1247 template <
typename T>
1251 assert (ndims () == 2);
1261 if (idx_j.
extent (nc) > nc)
1265 if (lb == 0 && ub == nc)
1282 *
this =
Sparse<T> (nr, nc - (ub - lb), new_nz);
1283 std::copy_n (
tmp.data (), lbi, data ());
1284 std::copy_n (
tmp.ridx (), lbi, ridx ());
1285 std::copy (
tmp.data () + ubi,
tmp.data () + nz, xdata () + lbi);
1286 std::copy (
tmp.ridx () + ubi,
tmp.ridx () + nz, xridx () + lbi);
1287 std::copy_n (
tmp.cidx () + 1, lb, cidx () + 1);
1289 tmp.cidx () + ub + 1, ubi - lbi);
1293 *
this = index (idx_i, idx_j.
complement (nc));
1299 if (idx_i.
extent (nr) > nr)
1303 if (lb == 0 && ub == nr)
1319 tmpl.
nnz () + tmpu.
nnz ());
1325 xdata (
k) = tmpl.
data (
i);
1326 xridx (
k++) = tmpl.
ridx (
i);
1331 xdata (
k) = tmpu.
data (
i);
1332 xridx (
k++) = tmpu.
ridx (
i) + lb;
1344 tmp.delete_elements (idx_j, idx_i);
1345 *
this =
tmp.transpose ();
1357 bool empty_assignment
1360 if (! empty_assignment)
1361 (*current_liboctave_error_handler)
1362 (
"a null assignment can only have one non-colon index");
1366 template <
typename T>
1378 template <
typename T>
1384 assert (ndims () == 2);
1407 retval.xdata (j) = data (j);
1408 retval.xridx (j) = ridx (j) +
i * nr;
1416 else if (idx.
extent (nel) > nel)
1427 else if (nr == 1 && nc == 1)
1433 retval = (
Sparse<T> (idx_dims(0), idx_dims(1), nz ? data (0) : T ()));
1444 if (
i < nz && ridx (
i) == idx(0))
1458 std::copy_n (data () + li, nz_new,
retval.data ());
1460 retval.xcidx (1) = nz_new;
1469 retval.ridx (j) = nr - ridx (nz - j - 1) - 1;
1471 std::copy_n (cidx (), 2,
retval.cidx ());
1472 std::reverse_copy (data (), data () + nz,
retval.data ());
1510 if (l < nz && ridx (l) == idxa(
i, j))
1546 std::copy_n (data () + lbi, new_nz,
retval.data ());
1570 if (idx_dims(0) == 1 && idx_dims(1) != 1)
1578 template <
typename T>
1581 bool resize_ok)
const 1585 assert (ndims () == 2);
1603 tmp.resize (ext_i, ext_j);
1606 else if (idx_i.
extent (nr) > nr)
1611 else if (nr == 1 && nc == 1)
1632 std::copy_n (data () + lbi, new_nz,
retval.data ());
1633 std::copy_n (ridx () + lbi, new_nz,
retval.ridx ());
1643 retval.xcidx (j+1) =
retval.xcidx (j) + (cidx (jj+1) - cidx (jj));
1655 std::copy_n (data () + ljj, nzj,
retval.data () + lj);
1656 std::copy_n (ridx () + ljj, nzj,
retval.ridx () + lj);
1683 if (
i < nzj && ridx (
i+lj) == ii)
1701 retval.xdata (
i) = data (ij[j]);
1719 li[j] = lij =
lblookup (ridx () + lj, nzj, lb) + lj;
1720 ui[j] = uij =
lblookup (ridx () + lj, nzj, ub) + lj;
1733 retval.xridx (
k++) = ridx (
i) - lb;
1745 retval.xcidx (j+1) =
retval.xcidx (j) + (cidx (jj+1) - cidx (jj));
1765 retval.xdata (li +
i) = data (uj -
i);
1766 retval.xridx (li +
i) = nr - 1 - ridx (uj -
i);
1789 scb[rri[li +
i] = iinv[ridx (lj +
i)]] = data (lj +
i);
1794 std::sort (rri + li, rri + li + nzj);
1798 retval.xdata (li +
i) = scb[rri[li +
i]];
1822 template <
typename T>
1828 assert (ndims () == 2);
1838 if (idx.
length (n) == rhl)
1856 *
this = rhs.
reshape (dimensions);
1858 else if (nc == 1 && rhs.
cols () == 1)
1872 if (new_nz >= nz && new_nz <= nzmax ())
1879 std::copy_backward (data () + ui, data () + nz,
1880 data () + nz + rnz);
1881 std::copy_backward (ridx () + ui, ridx () + nz,
1882 ridx () + nz + rnz);
1886 std::copy_n (rhs.
data (), rnz, data () + li);
1897 std::copy_n (
tmp.data (), li, data ());
1898 std::copy_n (
tmp.ridx (), li, ridx ());
1901 std::copy_n (rhs.
data (), rnz, data () + li);
1905 std::copy (
tmp.data () + ui,
tmp.data () + nz,
1906 data () + li + rnz);
1907 std::copy (
tmp.ridx () + ui,
tmp.ridx () + nz,
1908 ridx () + li + rnz);
1922 else if (rhs.
nnz () == 0)
1930 if (li != nz && ri[li] == iidx)
1934 maybe_compress (
true);
1959 *
this = reshape (save_dims);
1965 if (rhs.
nnz () != 0)
1974 template <
typename T>
1981 assert (ndims () == 2);
1993 bool orig_zero_by_zero = (nr == 0 && nc == 0);
1995 if (orig_zero_by_zero || (idx_i.
length (nr) == n && idx_j.
length (nc) == m))
2000 if (orig_zero_by_zero)
2029 if (nrx != nr || ncx != nc)
2037 if (n == 0 || m == 0)
2055 if (new_nz >= nz && new_nz <= nzmax ())
2062 std::copy_backward (data () + ui, data () + nz,
2064 std::copy_backward (ridx () + ui, ridx () + nz,
2070 std::copy_n (rhs.
data (), rnz, data () + li);
2071 std::copy_n (rhs.
ridx (), rnz, ridx () + li);
2075 assert (nnz () == new_nz);
2085 std::copy_n (
tmp.data (), li, data ());
2086 std::copy_n (
tmp.ridx (), li, ridx ());
2087 std::copy_n (
tmp.cidx () + 1, lb, cidx () + 1);
2090 std::copy_n (rhs.
data (), rnz, data () + li);
2091 std::copy_n (rhs.
ridx (), rnz, ridx () + li);
2096 std::copy (
tmp.data () + ui,
tmp.data () + nz,
2097 data () + li + rnz);
2098 std::copy (
tmp.ridx () + ui,
tmp.ridx () + nz,
2099 ridx () + li + rnz);
2101 tmp.cidx () + ub + 1, new_nz - nz);
2103 assert (nnz () == new_nz);
2109 assign (idx_i, idx_j.
sorted (),
2124 xcidx (
i+1) =
tmp.cidx (
i+1) -
tmp.cidx (
i);
2135 xcidx (
i+1) += xcidx (
i);
2137 change_capacity (nnz ());
2149 std::copy_n (rhs.
data () +
k,
u - l, xdata () + l);
2150 std::copy_n (rhs.
ridx () +
k,
u - l, xridx () + l);
2156 std::copy_n (
tmp.data () +
k,
u - l, xdata () + l);
2157 std::copy_n (
tmp.ridx () +
k,
u - l, xridx () + l);
2166 assign (idx_i, rhs);
2193 else if (m == 1 && n == 1)
2197 if (rhs.
nnz () != 0)
2200 assign (idx_i, idx_j,
Sparse<T> (n, m));
2202 else if (idx_i.
length (nr) == m && idx_j.
length (nc) == n
2203 && (n == 1 || m == 1))
2205 assign (idx_i, idx_j, rhs.
transpose ());
2213 template <
typename T>
2221 template <
typename T>
2229 template <
typename T>
2238 if (m.
numel () < 1 || dim > 1)
2256 (
"Sparse<T>::sort: invalid MODE");
2270 for (
i = 0;
i < ns;
i++)
2271 if (sparse_ascending_compare<T> (static_cast<T> (0), v[
i]))
2276 for (
i = 0;
i < ns;
i++)
2277 if (sparse_descending_compare<T> (static_cast<T> (0), v[
i]))
2283 mridx[
k] =
k - ns + nr;
2295 template <
typename T>
2305 if (m.
numel () < 1 || dim > 1)
2321 indexed_sort.
set_compare (sparse_ascending_compare<T>);
2323 indexed_sort.
set_compare (sparse_descending_compare<T>);
2326 (
"Sparse<T>::sort: invalid MODE");
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)
2528 d.xdata (
i) = data (
i);
2529 d.xridx (
i) = j + roff;
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 ();
2655 if (sparse_list[
i].isempty ())
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&)); T & elem(octave_idx_type _r, octave_idx_type _c)
octave_idx_type rows(void) const
std::string str(char sep='x') const
void mx_inline_add2(size_t n, R *r, const X *x)
OCTAVE_NORETURN T range_error(const char *fcn, octave_idx_type n) const
Sparse< T > permute(const Array< octave_idx_type > &vec, bool inv=false) const
void resize(octave_idx_type r, octave_idx_type c)
dim_vector orig_dimensions(void) const
void change_length(octave_idx_type nz)
const octave_base_value const Array< octave_idx_type > & ra_idx
#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
Sparse< T > index(const idx_vector &i, bool resize_ok=false) const
identity matrix If supplied two scalar respectively For allows like xample val
void delete_elements(const idx_vector &i)
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_idx_type columns(void) const
void set_compare(compare_fcn_type comp)
octave_idx_type * cidx(void)
void resize(int n, int fill_value=0)
const T * fortran_vec(void) const
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)
Sparse< T > sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
void err_index_out_of_range(int nd, int dim, octave_idx_type idx, octave_idx_type ext)
Sparse< T > diag(octave_idx_type k=0) const
idx_vector inverse_permutation(octave_idx_type n) const
Sparse< T > transpose(void) const
Sparse< T >::SparseRep * rep
bool sparse_indices_ok(octave_idx_type *r, octave_idx_type *c, octave_idx_type nrows, octave_idx_type ncols, octave_idx_type nnz)
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
virtual octave_idx_type numel(const octave_value_list &)
Array< T > as_matrix(void) const
Return the array as a matrix.
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
octave_idx_type cols(void) const
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 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().
octave_idx_type compute_index(const Array< octave_idx_type > &ra_idx) const
void err_del_index_out_of_range(bool is1d, octave_idx_type idx, octave_idx_type ext)
bool is_permutation(octave_idx_type n) const
void maybe_compress(bool remove_zeros)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
Compressed Column Sparse(rows=3, cols=4, nnz=2 [17%])(1
std::istream & read_sparse_matrix(std::istream &is, Sparse< T > &a, T(*read_fcn)(std::istream &))
octave_idx_type numel(void) const
static Sparse< T >::SparseRep * nil_rep(void)
void change_capacity(octave_idx_type nz)
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
void mx_inline_sub(size_t n, R *r, const X *x, const Y *y)
bool is_range(void) const
bool sparse_descending_compare(typename ref_param< T >::type a, typename ref_param< T >::type b)
bool is_colon(void) const
void copy_data(octave_idx_type *data) 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
octave_idx_type increment(void) const
idx_vector sorted(bool uniq=false) const
octave_idx_type * ridx(void)
octave_idx_type * xridx(void)
bool isvector(void) const
Array< T > transpose(void) const
Sparse< T > & operator=(const Sparse< T > &a)
Array< T > array_value(void) 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
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
if_then_else< is_class_type< T >::no, T, T const & >::result type
void err_invalid_resize(void)
bool any_element_is_nan(void) const
octave_idx_type cols(void) const
T celem(octave_idx_type _r, octave_idx_type _c) const
charNDArray max(char d, const charNDArray &m)
void resize1(octave_idx_type n)
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<T> type or any later type derived from ...
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.
Sparse< T > & insert(const Sparse< T > &a, octave_idx_type r, octave_idx_type c)
Sparse< T > reshape(const dim_vector &new_dims) 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)
Sparse< T > maybe_compress(bool remove_zeros=false)
void assign(const idx_vector &i, const Array< T > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
dim_vector dims(void) const
void mx_inline_add(size_t n, R *r, const X *x, const Y *y)
idx_vector complement(octave_idx_type n) const
octave_idx_type ndims(void) const
Number of dimensions.
octave_idx_type * xcidx(void)
Array< octave_idx_type > as_array(void) const
void assign(const idx_vector &i, const Sparse< T > &rhs)
octave_idx_type numel(void) const
Number of elements in the array.
write the output to stdout if nargout is
bool indices_ok(void) const
Vector representing the dimensions (size) of an Array.
bool is_scalar(void) const
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
static octave_idx_type lblookup(const octave_idx_type *ridx, octave_idx_type nr, octave_idx_type ri)
octave_idx_type rows(void) const
static Sparse< T > cat(int dim, octave_idx_type n, const Sparse< T > *sparse_list)
charNDArray min(char d, const charNDArray &m)
void print_info(std::ostream &os, const std::string &prefix) const