Exemplo n.º 1
0
extern "C" magma_int_t
magma_c_precond(
    magma_c_sparse_matrix A, 
    magma_c_vector b, 
    magma_c_vector *x, 
    magma_c_preconditioner *precond,
    magma_queue_t queue )
{
    // set up precond parameters as solver parameters   
    magma_c_solver_par psolver_par;
    psolver_par.epsilon = precond->epsilon;
    psolver_par.maxiter = precond->maxiter;
    psolver_par.restart = precond->restart;
    psolver_par.verbose = 0;

    switch( precond->solver ) {
        case  Magma_CG:
                magma_ccg_res( A, b, x, &psolver_par, queue );break;
        case  Magma_BICGSTAB:
                magma_cbicgstab( A, b, x, &psolver_par, queue );break;
        case  Magma_GMRES: 
                magma_cgmres( A, b, x, &psolver_par, queue );break;
        case  Magma_JACOBI: 
                magma_cjacobi( A, b, x, &psolver_par, queue );break;
        case  Magma_BAITER: 
                magma_cbaiter( A, b, x, &psolver_par, queue );break;
    }
    return MAGMA_SUCCESS;
}
Exemplo n.º 2
0
extern "C" magma_int_t
magma_c_precond(
    magma_c_matrix A,
    magma_c_matrix b,
    magma_c_matrix *x,
    magma_c_preconditioner *precond,
    magma_queue_t queue )
{
    magma_int_t info = 0;
    
    // set up precond parameters as solver parameters
    magma_c_solver_par psolver_par;
    psolver_par.rtol = precond->rtol;
    psolver_par.maxiter = precond->maxiter;
    psolver_par.restart = precond->restart;
    psolver_par.verbose = 0;
    magma_c_preconditioner pprecond;
    pprecond.solver = Magma_NONE;
    pprecond.maxiter = 3;

    switch( precond->solver ) {
        case  Magma_CG:
                CHECK( magma_ccg_res( A, b, x, &psolver_par, queue )); break;
        case  Magma_BICGSTAB:
                CHECK( magma_cbicgstab( A, b, x, &psolver_par, queue )); break;
        case  Magma_GMRES:
                CHECK( magma_cfgmres( A, b, x, &psolver_par, &pprecond, queue )); break;
        case  Magma_JACOBI:
                CHECK( magma_cjacobi( A, b, x, &psolver_par, queue )); break;
        case  Magma_BAITER:
                CHECK( magma_cbaiter( A, b, x, &psolver_par, &pprecond, queue )); break;
        case  Magma_IDR:
                CHECK( magma_cidr( A, b, x, &psolver_par, queue )); break;
        case  Magma_CGS:
                CHECK( magma_ccgs( A, b, x, &psolver_par, queue )); break;
        case  Magma_QMR:
                CHECK( magma_cqmr( A, b, x, &psolver_par, queue )); break;
        case  Magma_TFQMR:
                CHECK( magma_ctfqmr( A, b, x, &psolver_par, queue )); break;
        case  Magma_BAITERO:
                CHECK( magma_cbaiter_overlap( A, b, x, &psolver_par, &pprecond, queue )); break;
        default:
                CHECK( magma_ccg_res( A, b, x, &psolver_par, queue )); break;
    }
cleanup:
    return info;
}