13 if (XLENGTH(i0) > INT_MAX)
14 Rf_error(
_(
"number of triplets to be aggregated exceeds %s"),
19 int *pi0 = INTEGER(i0), *pi1 = NULL,
20 *pj0 = INTEGER(j0), *pj1 = NULL,
21 *pdim =
DIM(from), m = pdim[0], n = pdim[1],
22 nnz = (int) XLENGTH(i0), nnz_ = nnz, *iwork = NULL;
23 size_t liwork = (size_t) ((int_fast64_t) n + 1 + n + m + nnz),
29 c##TYPE *px0 = NULL, *px1 = NULL, *work = NULL; \
31 SEXP x0 = PROTECT(GET_SLOT(from, Matrix_xSym)); \
33 Matrix_Calloc(work, lwork, c##TYPE); \
35 c##tspaggr(pj1, pi1, px1, pj0, pi0, px0, n, m, &nnz, iwork, work); \
37 PROTECT(to = newObject(class)); \
38 PROTECT(i1 = Rf_allocVector(INTSXP, nnz)), \
39 PROTECT(j1 = Rf_allocVector(INTSXP, nnz)); \
42 SET_SLOT(to, Matrix_iSym, i1); \
43 SET_SLOT(to, Matrix_jSym, j1); \
45 SEXP x1 = PROTECT(Rf_allocVector(c##TYPESXP, nnz)); \
47 SET_SLOT(to, Matrix_xSym, x1); \
49 c##tspaggr(pj1, pi1, px1, pj0, pi0, px0, n, m, &nnz, iwork, work); \
56 Matrix_Free(work, lwork); \
74 if (
class[1] !=
'g' &&
UPLO(from) !=
'U')
76 if (
class[1] ==
's' &&
class[0] ==
'z' &&
TRANS(from) !=
'C')
78 if (
class[1] ==
't' &&
DIAG(from) !=
'N')
#define SWITCH5(c, template)
#define Matrix_Calloc(p, n, t)
#define SET_DIMNAMES(x, mode, value)
const char * Matrix_class(SEXP, const char **, int, const char *)
#define Matrix_Free(p, n)
#define DIMNAMES(x, mode)
#define GET_SLOT(x, name)
#define COPY_SLOT(dest, src, name)
const char * valid_sparse[]
SEXP R_sparse_aggregate(SEXP s_from)
SEXP sparse_aggregate(SEXP from, const char *class)