forked from asmaxwell/NSDI-Pulse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiroot.cpp
37 lines (27 loc) · 799 Bytes
/
multiroot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* multiroot.cpp
*
* Created on: 15 Dec 2023
* Author: andy
*/
#include "multiroot.h"
multiroot::multiroot() {
}
multiroot::~multiroot() {
}
int multiroot::solver(const gsl_vector * x, void *params, gsl_vector * f){
double x0 = gsl_vector_get (x, 0);
double x1 = gsl_vector_get (x, 1);
double x2 = gsl_vector_get (x, 2);
double x3 = gsl_vector_get (x, 3);
speEqns* SPEs = ((struct rparams *) params)->SPEs;
const vec4& pf = ((struct rparams *) params)->pf;
dcmplx ti = std::complex(x0,x1), tr = std::complex(x2,x3);
const dcmplx y0 = SPEs->SPE_ti(ti, tr, pf);
const dcmplx y1 = SPEs->SPE_tr(ti, tr, pf);
gsl_vector_set (f, 0, y0.real());
gsl_vector_set (f, 1, y0.imag());
gsl_vector_set (f, 2, y1.real());
gsl_vector_set (f, 3, y1.imag());
return GSL_SUCCESS;
}