PARCEL SYCL v1.2 / API Reference User Guide API Reference Search Download 日本語

8 Items Common to All Solvers

This chapter gives the items common to the C++ solver classes (precision template arguments, settings and exceptions, names of the constants). The symbols and terms are given in “Symbols and Terms” in Common Items.

8.1 Class Template Arguments (Arithmetic Precision)

All solver classes specify the arithmetic precision of each operation through the following template arguments. When omitted, each defaults to parcel_double.

Argument Description Default
Tspmv Arithmetic precision of the sparse matrix-vector product (SpMV) parcel_double
Tprecon Arithmetic precision of the preconditioner parcel_double
Taxpy Arithmetic precision of vector operations (axpy (y←αx+yy \leftarrow \alpha x + y), etc.) parcel_double
Tdot Arithmetic precision of reductions (inner products and norms) parcel_double
template< class Tspmv = parcel_double, class Tprecon = parcel_double,
          class Taxpy = parcel_double, class Tdot   = parcel_double >
class pcg;      // likewise for pbicgstab, pgmres, pcagmres, power, inverse_power, ks_arnoldi

All seven solver classes have these four arguments.

8.2 Template Arguments of solver() (Data Precision)

The template arguments of the solver() function specify the precision in which each piece of data is stored. Solver-specific arguments are given in the entry for each class. Arguments that can be deduced from the actual arguments can be omitted, and those that cannot be deduced default to parcel_double. Therefore, to use double precision throughout, you can write parcel::krylov::pcg<> s; s.solver(A, x, b); (for the eigenvalue solvers, s.solver(A, ev, evec)). To specify them explicitly, give them in order from the first.

Argument Description Default
Tmat Data precision of the coefficient matrix (must match the type of parcel::matrix<Tmat>) deduced from the argument
Tvecx / Tvecb Data precision of the solution vector / right-hand side vector (linear solvers) deduced from the argument
Teigen_val / Teigen_vec Data precision of the eigenvalues / eigenvectors (eigenvalue solvers) deduced from the argument
Tvec Data precision of the vectors internal to the solver (not present in ks_arnoldi) parcel_double
Tprecon_mat Data precision of the preconditioner matrix parcel_double (ks_arnoldi: Teigen_vec)
Tprecon_vec Data precision of the preconditioner vectors parcel_double (ks_arnoldi: Teigen_vec)

8.3 Handling of Settings and Exceptions

Function Accepted values
set_tolerance(), set_linsolve_tolerance() Finite positive value (0 or less, NaN, and Inf are rejected)
set_max_iteration(), set_linsolve_max_iteration(), set_linsolve_restart(), ks_arnoldi::set_ks_max_restart() 1 or greater
set_precon_algo(), set_linsolve_precon_algo() PRECON_NONE, PRECON_POINTJACOBI, PRECON_BLOCKJACOBI, PRECON_JACOBI
set_jacobi(), set_linsolve_jacobi() 1 or greater
set_blockjacobi(), set_linsolve_blockjacobi() 1 or greater (not exceeding the number of locally owned rows is not checked)
set_linsolve_algo() LINSOLVE_PGMRES, LINSOLVE_PCG
pgmres::set_restart() 1 or greater
pgmres::set_qr_algo() QR_CGS, QR_MGS
pcagmres::set_restart() ss and tt both 1 or greater
pcagmres::set_qr_algo() QR_CGS, QR_MGS, QR_CHOLESKYQR, QR_CAGMRES_CHOLESKYQR
pcagmres::set_explicit_q() CAGMRES_Q_AUTO, CAGMRES_Q_EXPLICIT, CAGMRES_Q_IMPLICIT
ks_arnoldi::set_ks_subspace() 1≤nev≤kkeep<m1 \leq nev \leq k_{keep} < m
ks_arnoldi::set_qr_algo() QR_CGS, QR_MGS

8.4 Constants

The constants passed to the setting functions and the convergence state constants are in the following namespaces. All have the type const PARCEL_INT. Their meanings are given in the common constants and Convergence Status.

Namespace Constants (values) Used with
parcel:: PRECON_NONE (0), PRECON_POINTJACOBI (1), PRECON_BLOCKJACOBI (2), PRECON_JACOBI (4) set_precon_algo(), set_linsolve_precon_algo()
parcel::qr:: QR_CGS (0), QR_MGS (1), QR_CHOLESKYQR (2), QR_CAGMRES_CHOLESKYQR (202) pgmres::set_qr_algo(), pcagmres::set_qr_algo(), ks_arnoldi::set_qr_algo()
parcel::krylov:: LINSOLVE_PGMRES (0), LINSOLVE_PCG (1) set_linsolve_algo()
parcel::krylov:: CAGMRES_Q_AUTO (0), CAGMRES_Q_EXPLICIT (1), CAGMRES_Q_IMPLICIT (2) set_explicit_q()
parcel::krylov:: CONVERGED_RTOL (1), ITERATING (0), DIVERGED_ITS (-1), DIVERGED_NANORINF (-2), DIVERGED_BREAKDOWN (-3) get_converged_reason(), converged_reason_name()