Ejemplo n.º 1
0
R_init_Matrix(DllInfo *dll)
{
    R_registerRoutines(dll, NULL, CallEntries, NULL, ExtEntries);
    R_useDynamicSymbols(dll, FALSE);

/* These are callable from other packages' C code: */

#define RREGDEF(name)  R_RegisterCCallable("Matrix", #name, (DL_FUNC) name)

    RREGDEF(Csparse_diagU2N);

    RREGDEF(as_cholmod_dense);
    RREGDEF(as_cholmod_factor);
    RREGDEF(as_cholmod_sparse);
    RREGDEF(as_cholmod_triplet);
    RREGDEF(chm_factor_to_SEXP);
    RREGDEF(chm_factor_ldetL2);
    RREGDEF(chm_factor_update);
    RREGDEF(chm_sparse_to_SEXP);
    RREGDEF(chm_triplet_to_SEXP);

    RREGDEF(cholmod_aat);
    RREGDEF(cholmod_add);
    RREGDEF(cholmod_allocate_dense);
    RREGDEF(cholmod_allocate_sparse);
    RREGDEF(cholmod_allocate_triplet);
    RREGDEF(cholmod_analyze);
    RREGDEF(cholmod_analyze_p);
    RREGDEF(cholmod_band_inplace);
    RREGDEF(cholmod_change_factor);
    RREGDEF(cholmod_copy);
    RREGDEF(cholmod_copy_dense);
    RREGDEF(cholmod_copy_factor);
    RREGDEF(cholmod_copy_sparse);
    RREGDEF(cholmod_dense_to_sparse);
    RREGDEF(cholmod_factor_to_sparse);
    RREGDEF(cholmod_factorize);
    RREGDEF(cholmod_factorize_p);
    RREGDEF(cholmod_finish);
    RREGDEF(cholmod_free_dense);
    RREGDEF(cholmod_free_factor);
    RREGDEF(cholmod_free_sparse);
    RREGDEF(cholmod_free_triplet);
    RREGDEF(cholmod_nnz);
    RREGDEF(cholmod_scale);
    RREGDEF(cholmod_sdmult);
    RREGDEF(cholmod_solve);
    RREGDEF(cholmod_sort);
    RREGDEF(cholmod_sparse_to_dense);
    RREGDEF(cholmod_sparse_to_triplet);
    RREGDEF(cholmod_speye);
    RREGDEF(cholmod_spsolve);
    RREGDEF(cholmod_ssmult);
    RREGDEF(cholmod_start);
    RREGDEF(cholmod_submatrix);
    RREGDEF(cholmod_transpose);
    RREGDEF(cholmod_triplet_to_sparse);
    RREGDEF(cholmod_vertcat);
    RREGDEF(cholmod_updown);

    RREGDEF(dpoMatrix_chol);
    RREGDEF(numeric_as_chm_dense);

    R_cholmod_start(&c);
//    R_cholmod_l_start(&cl);

    Matrix_DimNamesSym = install("Dimnames");
    Matrix_DimSym = install("Dim");
    Matrix_diagSym = install("diag");
    Matrix_factorSym = install("factors");
    Matrix_iSym = install("i");
    Matrix_jSym = install("j");
    Matrix_lengthSym = install("length");
    Matrix_pSym = install("p");
    Matrix_permSym = install("perm");
    Matrix_uploSym = install("uplo");
    Matrix_xSym = install("x");

    Matrix_NS = R_FindNamespace(mkString("Matrix"));
    if(Matrix_NS == R_UnboundValue)
	error(_("missing 'Matrix' namespace: should never happen"));

#ifdef DEBUG_Matrix
    if(isEnvironment(Matrix_NS))
	Rprintf("Matrix_NS: %s\n",
		CHAR(asChar(eval(lang2(install("format"),Matrix_NS),
				 R_GlobalEnv))));
    else
#else
    if(!isEnvironment(Matrix_NS))
#endif
	error(_("Matrix namespace not determined correctly"));
}
Ejemplo n.º 2
0
Archivo: init.c Proyecto: rforge/matrix
R_init_Matrix(DllInfo *dll)
{
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);

    R_RegisterCCallable("Matrix", "as_cholmod_dense", (DL_FUNC)as_cholmod_dense);
    R_RegisterCCallable("Matrix", "as_cholmod_factor", (DL_FUNC)as_cholmod_factor);
    R_RegisterCCallable("Matrix", "as_cholmod_sparse", (DL_FUNC)as_cholmod_sparse);
    R_RegisterCCallable("Matrix", "chm_factor_to_SEXP", (DL_FUNC)chm_factor_to_SEXP);
    R_RegisterCCallable("Matrix", "chm_sparse_to_SEXP", (DL_FUNC)chm_sparse_to_SEXP);

    R_RegisterCCallable("Matrix", "cholmod_aat", (DL_FUNC)cholmod_aat);
    R_RegisterCCallable("Matrix", "cholmod_add", (DL_FUNC)cholmod_add);
    R_RegisterCCallable("Matrix", "cholmod_allocate_dense", (DL_FUNC)cholmod_allocate_dense);
    R_RegisterCCallable("Matrix", "cholmod_allocate_sparse", (DL_FUNC)cholmod_allocate_sparse);
    R_RegisterCCallable("Matrix", "cholmod_allocate_triplet", (DL_FUNC)cholmod_allocate_triplet);
    R_RegisterCCallable("Matrix", "cholmod_analyze", (DL_FUNC)cholmod_analyze);
    R_RegisterCCallable("Matrix", "cholmod_analyze_p", (DL_FUNC)cholmod_analyze_p);
    R_RegisterCCallable("Matrix", "cholmod_change_factor", (DL_FUNC)cholmod_change_factor);
    R_RegisterCCallable("Matrix", "cholmod_copy", (DL_FUNC)cholmod_copy);
    R_RegisterCCallable("Matrix", "cholmod_copy_dense", (DL_FUNC)cholmod_copy_dense);
    R_RegisterCCallable("Matrix", "cholmod_copy_factor", (DL_FUNC)cholmod_copy_factor);
    R_RegisterCCallable("Matrix", "cholmod_copy_sparse", (DL_FUNC)cholmod_copy_sparse);
    R_RegisterCCallable("Matrix", "cholmod_dense_to_sparse", (DL_FUNC)cholmod_dense_to_sparse);
    R_RegisterCCallable("Matrix", "cholmod_factor_to_sparse", (DL_FUNC)cholmod_factor_to_sparse);
    R_RegisterCCallable("Matrix", "cholmod_factorize", (DL_FUNC)cholmod_factorize);
    R_RegisterCCallable("Matrix", "cholmod_factorize_p", (DL_FUNC)cholmod_factorize_p);
    R_RegisterCCallable("Matrix", "cholmod_finish", (DL_FUNC)cholmod_finish);
    R_RegisterCCallable("Matrix", "cholmod_free_dense", (DL_FUNC)cholmod_free_dense);
    R_RegisterCCallable("Matrix", "cholmod_free_factor", (DL_FUNC)cholmod_free_factor);
    R_RegisterCCallable("Matrix", "cholmod_free_sparse", (DL_FUNC)cholmod_free_sparse);
    R_RegisterCCallable("Matrix", "cholmod_free_triplet", (DL_FUNC)cholmod_free_triplet);
    R_RegisterCCallable("Matrix", "cholmod_nnz", (DL_FUNC)cholmod_nnz);
    R_RegisterCCallable("Matrix", "cholmod_scale", (DL_FUNC)cholmod_scale);
    R_RegisterCCallable("Matrix", "cholmod_sdmult", (DL_FUNC)cholmod_sdmult);
    R_RegisterCCallable("Matrix", "cholmod_solve", (DL_FUNC)cholmod_solve);
    R_RegisterCCallable("Matrix", "cholmod_sort", (DL_FUNC)cholmod_sort);
    R_RegisterCCallable("Matrix", "cholmod_sparse_to_dense", (DL_FUNC)cholmod_sparse_to_dense);
    R_RegisterCCallable("Matrix", "cholmod_sparse_to_triplet", (DL_FUNC)cholmod_sparse_to_triplet);
    R_RegisterCCallable("Matrix", "cholmod_speye", (DL_FUNC)cholmod_speye);
    R_RegisterCCallable("Matrix", "cholmod_spsolve", (DL_FUNC)cholmod_spsolve);
    R_RegisterCCallable("Matrix", "cholmod_ssmult", (DL_FUNC)cholmod_ssmult);
    R_RegisterCCallable("Matrix", "cholmod_start", (DL_FUNC)cholmod_start);
    R_RegisterCCallable("Matrix", "cholmod_submatrix", (DL_FUNC)cholmod_submatrix);
    R_RegisterCCallable("Matrix", "cholmod_transpose", (DL_FUNC)cholmod_transpose);
    R_RegisterCCallable("Matrix", "cholmod_triplet_to_sparse", (DL_FUNC)cholmod_triplet_to_sparse);
    R_RegisterCCallable("Matrix", "cholmod_vertcat", (DL_FUNC)cholmod_vertcat);

    R_RegisterCCallable("Matrix", "dpoMatrix_chol", (DL_FUNC)dpoMatrix_chol);
    R_RegisterCCallable("Matrix", "numeric_as_chm_dense", (DL_FUNC)numeric_as_chm_dense);

    R_cholmod_start(&c);

    Matrix_DimNamesSym = install("Dimnames");
    Matrix_DimSym = install("Dim");
    Matrix_diagSym = install("diag");
    Matrix_factorSym = install("factors");
    Matrix_iSym = install("i");
    Matrix_jSym = install("j");
    Matrix_lengthSym = install("length");
    Matrix_pSym = install("p");
    Matrix_permSym = install("perm");
    Matrix_uploSym = install("uplo");
    Matrix_xSym = install("x");
}