HiRep 0.1
Loading...
Searching...
No Matches
linear_solvers.h
1/***************************************************************************\
2* Copyright (c) 2008, Claudio Pica *
3* All rights reserved. *
4\***************************************************************************/
5
6#ifndef LINEAR_SOLVERS_H
7#define LINEAR_SOLVERS_H
8
9#include "hr_complex.h"
10#include "spinor_field.h"
11#include "Core/gpu.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef void (*spinor_operator)(spinor_field *out, spinor_field *in);
18typedef void (*spinor_operator_flt)(spinor_field_flt *out, spinor_field_flt *in);
19typedef void (*spinor_operator_m)(spinor_field *out, spinor_field *in, double m);
20
21typedef struct mshift_par {
22 int n; /* number of shifts */
23 double *shift;
24 double err2; /* relative error of the solutions */
25 int max_iter; /* maximum number of iterations: 0 => infinity */
26 void *add_par; /* additional parameters for specific inverters */
28
29// We might want to add a "trial" spinor to the argument list
30typedef int (*inverter_ptr)(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
31void SAP_prec(int nu, inverter_ptr inv, mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
32
33/*
34 * performs the multi-shifted CG inversion:
35 * out[i] = (M-(par->shift[i]))^-1 in
36 * returns the number of cg iterations done.
37 */
38int cg_mshift(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
39int cg_mshift_def(mshift_par *par, spinor_operator M, spinor_operator P, spinor_operator_m Pinv, spinor_field *in,
40 spinor_field *out);
41int cg_mshift_flt(mshift_par *par, spinor_operator M, spinor_operator_flt F, spinor_field *in, spinor_field *out);
42
43typedef struct g5QMR_fltacc_par {
44 double err2; /* maximum error on the solutions */
45 int max_iter; /* maximum number of iterations: 0 => infinity */
46 double err2_flt; /* maximum error on the solutions */
47 int max_iter_flt; /* maximum number of iterations: 0 => infinity */
49
50int g5QMR_mshift(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
51int g5QMR_mshift_trunc(mshift_par *par, int trunc_iter, spinor_operator M, spinor_field *in, spinor_field *out_trunc,
52 spinor_field *out);
53int g5QMR_fltacc(g5QMR_fltacc_par *par, spinor_operator M, spinor_operator_flt M_flt, spinor_field *in, spinor_field *out);
54
55typedef struct MINRES_par {
56 double err2; /* maximum error on the solutions */
57 int max_iter; /* maximum number of iterations: 0 => infinity */
59
60int BiCGstab(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
61int HBiCGstab(MINRES_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
62int HBiCGstab_flt(MINRES_par *par, spinor_operator_flt M, spinor_field_flt *in, spinor_field_flt *out);
63
64/*
65int BiCGstab_mshift(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
66int HBiCGstab_mshift(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
67*/
68
69int MINRES_mshift(mshift_par *par, spinor_operator M, spinor_field *in, spinor_field *out);
70
71int MINRES(MINRES_par *par, spinor_operator M, spinor_field *in, spinor_field *out, spinor_field *trial);
72int MINRES_flt(MINRES_par *par, spinor_operator_flt M, spinor_field_flt *in, spinor_field_flt *out, spinor_field_flt *trial);
73
74int eva(int nev, int nevt, int init, int kmax, int imax, double ubnd, double omega1, double omega2, spinor_operator Op,
75 spinor_field *ev, double d[], int *status);
76int eva_tuned(int nev, int nevt, int init, int kmax, int imax, double lbnd, double ubnd, double omega1, double omega2,
77 spinor_operator Op, spinor_field *ev, double d[], int *status);
78
79visible void jacobi1(int n, double a[], double d[], double v[]);
80visible void jacobi2(int n, hr_complex a[], double d[], hr_complex v[]);
81
82#ifdef __cplusplus
83}
84#endif
85#endif
Basic gpu imports and structs. Include this in files that define GPU logic.
Type definitions and macros for complex numbers.
The elementary site structures defined in suN.h are used in this file to define field structures that...
Definition linear_solvers.h:55
Definition linear_solvers.h:43
Definition linear_solvers.h:21
Spinor field array containing single precision SU(N_f) spinors in chosen fermion representation.
Definition spinor_field.h:207
Spinor field array containing SU(N_f) spinors in chosen fermion representation.
Definition spinor_field.h:189