contrib/sparse/sparse-solver.c
/**
 * sparse_solver_new:
 *
 * Returns: A #SparseSolver, or %NULL if the solver is not available.
 */
A #SparseSolver, or %NULL if the solver is not available.
A #SparseSolver or %NULL if the solver is not available .
SparseSolver *
sparse_solver_new (SparseSolverMethod method)
{
    SparseSolver *ret = malloc (sizeof (SparseSolver));
    memset (&ret->statistics, 0, sizeof (SparseSolverStatistics));
    ret->verbose = 0;
    #define PREPARE_SOLVER(solver_uc,solver)  \
    case SPARSE_SOLVER_METHOD_##solver_uc:     \
        ret->init  = sparse_##solver##_init;  \
        ret->clear = sparse_##solver##_clear; \
        ret->solve = sparse_##solver##_solve; \
        break;
    switch (method)
    {
            PREPARE_SOLVER(LAPACK,lapack)
#if HAVE_SUPERLU
            PREPARE_SOLVER(SUPERLU,superlu)
#endif
#if HAVE_SUPERLU_MT
            PREPARE_SOLVER(SUPERLU_MT,superlu_mt)
#endif
#if HAVE_UMFPACK
            PREPARE_SOLVER(UMFPACK,umfpack)
#endif
#if HAVE_MKL_DSS
            PREPARE_SOLVER(MKL_DSS,mkl_dss)
#endif
#if HAVE_MKL_CLUSTER
            PREPARE_SOLVER(MKL_CLUSTER,mkl_cluster)
#endif
#if HAVE_CUSOLVER
            PREPARE_SOLVER(CUSOLVER,cusolver)
#endif
#if HAVE_PARDISO
            PREPARE_SOLVER(PARDISO,pardiso)
#endif
        default:
            return NULL;
    }
    ret->init (ret);
    return ret;
}
SparseSolver * sparse_solver_new ( SparseSolverMethod method ) { SparseSolver * ret = malloc ( sizeof ( SparseSolver ) ) ; memset ( & ret -> statistics , 0 , sizeof ( SparseSolverStatistics ) ) ; ret -> verbose = 0 ; #define PREPARE_SOLVER ( solver_uc , solver )   \
    case SPARSE_SOLVER_METHOD_##solver_uc:     \
        ret->init  = sparse_##solver##_init;  \
        ret->clear = sparse_##solver##_clear; \
        ret->solve = sparse_##solver##_solve; \
        break; switch ( method ) { PREPARE_SOLVER ( LAPACK , lapack ) #if HAVE_SUPERLU PREPARE_SOLVER ( SUPERLU , superlu ) #endif #if HAVE_SUPERLU_MT PREPARE_SOLVER ( SUPERLU_MT , superlu_mt ) #endif #if HAVE_UMFPACK PREPARE_SOLVER ( UMFPACK , umfpack ) #endif #if HAVE_MKL_DSS PREPARE_SOLVER ( MKL_DSS , mkl_dss ) #endif #if HAVE_MKL_CLUSTER PREPARE_SOLVER ( MKL_CLUSTER , mkl_cluster ) #endif #if HAVE_CUSOLVER PREPARE_SOLVER ( CUSOLVER , cusolver ) #endif #if HAVE_PARDISO PREPARE_SOLVER ( PARDISO , pardiso ) #endif default : return NULL ; } ret -> init ( ret ) ; return ret ; }
sparse_solver_new:
 Returns: A #SparseSolver, or %NULL if the solver is not available.
sparse_solver_new : Returns : A #SparseSolver or %NULL if the solver is not available .