flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
lattice_numerical_constraint.cpp
Go to the documentation of this file.
2
3namespace flexiblesusy {
4
5using namespace std;
6
7
9(RGFlow<Lattice> *flow, size_t theory, size_t site)
10{
11 ForeignConstraint::init(flow, theory, site);
12 depends_on.resize(row.size());
13 for (auto i: nonzeros) depends_on[i] = true;
14 vector<size_t>().swap(nonzeros); // forces deallocation
15}
16
18{
19 set_x();
20 Real BC0 = c(&x[0]);
21 for (j = 0; j < row.size(); j++) {
22 Real dc;
23 Real xj = x[j];
24 if (depends_on[j]) {
25 Real abserr;
26 gsl_deriv_central(&F_gsl, xj, deriv_epsilon*u(j), &dc, &abserr);
27 x[j] = xj;
28 }
29 else dc = 0;
30 BC0 -= xj * (row[j] = dc);
31 }
32 rhs = -BC0;
33 copy_row(0);
34}
35
36double NumericalConstraint::c_wrap(double xj, void *params)
37{
38 auto self = static_cast<NumericalConstraint *>(params);
39 self->x[self->j] = xj;
40 return self->c(&self->x[0]);
41}
42
43void NumericalMatching::init(RGFlow<Lattice> *flow, size_t lower_theory)
44{
45 ForeignMatching::init(flow, lower_theory);
46 depends_on.resize(row.size());
47 for (auto i: nonzerosL) depends_on[i ] = true;
48 for (auto i: nonzerosH) depends_on[i+w.size()] = true;
49 vector<size_t>().swap(nonzerosL); // forces deallocation
50 vector<size_t>().swap(nonzerosH); // forces deallocation
51}
52
54{
55 set_w_x();
56 Real MC0 = c(&w[0], &x[0]);
57 for (j = 0; j < depends_on.size(); j++) {
58 Real dc;
59 Real wxj = wx(j);
60 if (depends_on[j]) {
61 Real uj = j < w.size() ? u(0,j) : u(1,j-w.size());
62 Real abserr;
63 gsl_deriv_central(&F_gsl, wxj, deriv_epsilon*uj, &dc, &abserr);
64 wx(j) = wxj;
65 }
66 else dc = 0;
67 MC0 -= wxj * (row[j] = dc);
68 }
69 rhs = -MC0;
70 copy_row(0);
71}
72
73double NumericalMatching::c_wrap(double wxj, void *params)
74{
75 auto self = static_cast<NumericalMatching *>(params);
76 self->wx(self->j) = wxj;
77 return self->c(&self->w[0], &self->x[0]);
78}
79
80} // namespace flexiblesusy
void init(RGFlow< Lattice > *flow, size_t theory, size_t site)
void init(RGFlow< Lattice > *flow, size_t lower_theory)
Real u(size_t To, size_t i) const
static double c_wrap(double xj, void *params)
virtual Real c(const Real *x) const =0
void init(RGFlow< Lattice > *flow, size_t theory, size_t site)
static double c_wrap(double wxj, void *params)
void init(RGFlow< Lattice > *flow, size_t lower_theory)
virtual Real c(const Real *w, const Real *x) const =0
double Real
Definition: mathdefs.hpp:12