LandauGinzburg
Loading...
Searching...
No Matches
field_nicolai.hpp
Go to the documentation of this file.
1
8#ifndef FIELD_NICOLAI_INCLUDED
9#define FIELD_NICOLAI_INCLUDED
10
11#include "field_potential.hpp"
12
13#include <iomanip>
14#include <fstream>
15#include <time.h> // For test_nr_method //
16#include <limits.h> // For test_nr_method //
17
18using std::vector; // For class NicolaiSol //
19
27extern const double SOL_ID_MAXVAL;
34extern const double MAX_NRERR;
42extern const double NR_INTERRUPTION;
48
55 AlgebraA ,
56 AlgebraD ,
57 AlgebraE ,
58 Custom
59};
60
61
68class Nicolai:public Field {
69protected:
71 int in;
72
73public:
76 explicit Nicolai() {};
86 explicit Nicolai(const int n1, const int n2, const int n3) :
87 Field(n1, n2, Distribution::Gauss_L) {in = n3;};
90 virtual ~Nicolai() {};
91
96 virtual bool operator==(const Nicolai &f) {return (Li==f.Li) && (num_f == f.num_f);};
101 virtual bool operator!=(const Nicolai &f) {return !(*this==f);};
102
110 VectorXd nr_nvec() const;
111
120 VectorXcd nrerr_nvec() const;
121
134 void nic_output(const VectorXi k, const VectorXd lambda,
135 const int num_nrsol,
136 const VectorXi signs, const int dmp,
137 const double max_err,
138 const SuperPotentialType spt) const;
139
144 void show() const;
145};
146
147
148
160class Scalar:public Field {
162 VectorXi k;
163 VectorXd lambda;
164
165 double sol_id_maxval = SOL_ID_MAXVAL;
166
172 Potential superpotential_typealgebraA() const;
178 Potential superpotential_typealgebraD() const;
184 Potential superpotential_typealgebraE() const;
190 Potential superpotential_typecustom() const;
191
197 PotentialNR superpotential_nr_typealgebraA() const;
203 PotentialNR superpotential_nr_typealgebraD() const;
209 PotentialNR superpotential_nr_typealgebraE() const;
215 PotentialNR superpotential_nr_typecustom() const;
216
217public:
220 explicit Scalar() {};
232 explicit Scalar(const int n1, const int n2,
233 const VectorXi n3, const VectorXd n4,
234 const SuperPotentialType t
237 k = n3; lambda = n4; spt_type = t;
238 };
249 explicit Scalar(const VectorXcd &v,
250 const VectorXi n3, const VectorXd n4,
251 const int num_field = 1,
252 const SuperPotentialType t
254 Field(v, num_field) { k = n3; lambda = n4; spt_type = t;};
260 explicit Scalar(const Scalar &f, const VectorXcd &v) :
261 Field(v, f.num_f) {
262 spt_type = f.spt_type;
263 k = f.k; lambda = f.lambda; spt_type = f.spt_type;
264 };
270 explicit Scalar(const Scalar &f, const VectorXd &v) :
271 Field(v, f.num_f) {
272 spt_type = f.spt_type;
273 k = f.k; lambda = f.lambda; spt_type = f.spt_type;
274 };
275
279
285 bool operator==(const Scalar &f) {
286 return (Li==f.Li) && (num_f == f.num_f)
287 && (k==f.k) && (lambda==f.lambda) && (spt_type==f.spt_type);
288 };
294 bool operator!=(const Scalar &f) { return !(*this==f); };
295
304 bool is_identical(const Scalar &f) const;
305
313 VectorXcd nrerr_svec() const;
314
327
335 Scalar nr_loop (const Nicolai &nic);
336
343 VectorXcd nr_error_vec (const Nicolai &nic) const;
350 double nr_error (const Nicolai &nic) const {
351 VectorXcd er = nr_error_vec(nic);
352 return er.norm();
353 };
354
364 void scl_output(const int in, const int num_sol, const int i,
365 const int sign, const double err) const;
366
371 void show() const;
372};
373
374
375
382class NicolaiSol:public Nicolai {
383 vector<Scalar> fs;
384 vector<double> errs;
385
386 double nr_interruption = NR_INTERRUPTION;
387
388public:
391 explicit NicolaiSol() {};
399 explicit NicolaiSol(const int n1, const int n2, const int n3) :
400 Nicolai(n1, n2, n3) {};
404
410 bool operator==(const NicolaiSol &f) {
411 MatrixXcd err_vec = (field-f.field) / field.norm();
412 double err = err_vec.norm();
413 if (err < 1.0e-15)
414 return (Li==f.Li) && (num_f == f.num_f);
415 else return false;
416 };
422 bool operator!=(const NicolaiSol &f) {return !(*this==f);};
423
428 NicolaiSol &add_sol(const Scalar &f, const double &err);
433 NicolaiSol &add_sol(const NicolaiSol &sol);
434
437 int num_sol() const {return fs.size();};
440 double max_err() const {return *max_element(errs.begin(), errs.end());};
441
453 double nr_method (const VectorXi k, const VectorXd lambda,
454 const int num_nrsol, const int LOOP,
455 const SuperPotentialType t
457
468 void test_nr_method (const VectorXi k, const VectorXd lambda,
469 const int LOOP, const int TRIAL,
470 const SuperPotentialType t
472
477 int sign_det(const int n) const {
478 return fs[n].superpotential().sign_det();
479 };
480
485 void phi_output(const int in, const VectorXi signs) const;
486
491 void show() const;
492};
493
498extern int SuperPotentialType_StdNumSol (const VectorXi k, const SuperPotentialType t);
499
500#endif
Generate normal distributions; Compute convolutions.
MatrixXcd field
Superfields.
int Li
Physical box size, N_0=N_1.
int num_f
Number of superfields.
Nicolai map; Compute Vector for NR method.
Nicolai(const int n1, const int n2, const int n3)
Set Li, num_f, in; Configuration is generated by random device with deviation Li/SQRT2.
Nicolai()
Constructor of Nicolai.
int in
ID number for the Nicolai map.
VectorXcd nrerr_nvec() const
Compute Vector for NR error estimate (complex type)
VectorXd nr_nvec() const
Compute Vector for NR method (Real type)
void nic_output(const VectorXi k, const VectorXd lambda, const int num_nrsol, const VectorXi signs, const int dmp, const double max_err, const SuperPotentialType spt) const
Output to file.
virtual bool operator==(const Nicolai &f)
Is identical (Li, num_f) ?
void show() const
Output Li, in, field.
virtual ~Nicolai()
Destructor of Nicolai.
virtual bool operator!=(const Nicolai &f)
Not identical (Li, num_f) ?
Execute the Newton–Raphson method; Combine solutions; Obtain sign det for each Scalar.
int num_sol() const
Number of solutions.
void phi_output(const int in, const VectorXi signs) const
Output to file.
NicolaiSol(const int n1, const int n2, const int n3)
Set members of the class Nicolai:
bool operator!=(const NicolaiSol &f)
Not identical (Li, num_f, field) ?
NicolaiSol & add_sol(const Scalar &f, const double &err)
Add a new solution; Ignore identical one.
void test_nr_method(const VectorXi k, const VectorXd lambda, const int LOOP, const int TRIAL, const SuperPotentialType t=SuperPotentialType::AlgebraA)
Observe the numerical convergence of NR method for each system.
int sign_det(const int n) const
Sign determinant (Jacobian)
bool operator==(const NicolaiSol &f)
Is identical (Li, num_f, field) ?
double max_err() const
Maximum error of NR method.
NicolaiSol()
Constructor of NicolaiSol.
double nr_method(const VectorXi k, const VectorXd lambda, const int num_nrsol, const int LOOP, const SuperPotentialType t=SuperPotentialType::AlgebraA)
Newton–Raphson method.
~NicolaiSol()
Destructor of NicolaiSol.
void show() const
Output Scalars.
Compute Jacobian and its sign determinant.
Compute Matrix and Vector for NR method.
An solution of Nicolai map; Update to a new solution with NR method; Compute some types of superpoten...
Scalar nr_loop(const Nicolai &nic)
An iteration of NR method; Compute LU decompositon; Overwrite own members.
~Scalar()
Destructor of Scalar.
Scalar()
Constructor of Scalar.
bool operator!=(const Scalar &f)
Not identical (Li, num_f, k, lambda, spt_type) ?
void show() const
Output Li, k, lambda, field.
PotentialNR superpotential_nr() const
Compute superpotential (class PotentialNR)
VectorXcd nr_error_vec(const Nicolai &nic) const
Compute error of NR method for each momentum.
Scalar(const Scalar &f, const VectorXd &v)
Set parameters identical to Scalar f; Configuration is given by VectorXd.
Scalar(const Scalar &f, const VectorXcd &v)
Set parameters identical to Scalar f; Configuration is given by VectorXcd.
bool operator==(const Scalar &f)
Is identical (Li, num_f, k, lambda, spt_type) ?
double nr_error(const Nicolai &nic) const
Compute error of NR method.
Scalar(const int n1, const int n2, const VectorXi n3, const VectorXd n4, const SuperPotentialType t=SuperPotentialType::AlgebraA)
Set Li, num_f, k, lambda, spt_type, and field configuration generated by Mersenne twistor with unit d...
Potential superpotential() const
Compute superpotential (class Potential)
bool is_identical(const Scalar &f) const
Identify two solutions.
Scalar(const VectorXcd &v, const VectorXi n3, const VectorXd n4, const int num_field=1, const SuperPotentialType t=SuperPotentialType::AlgebraA)
Generate from VectorXcd; Set num_f, k, lambda, and spt_type.
void scl_output(const int in, const int num_sol, const int i, const int sign, const double err) const
Output to file.
VectorXcd nrerr_svec() const
Compute Vector for NR error (complex type)
Distribution
Types of normal distributions.
const double SOL_ID_MAXVAL
Identification of scalar solutions.
const double NR_INTERRUPTION
Interruption of NR iteration.
SuperPotentialType
Types of superpotentials.
const double MAX_NRERR
Max error of NR iteration.
const int SuperPotentialTypeCustom_StdNumSol
Standard number of solutions for SuperPotentialType::Custom.
Definition field_spt.cpp:14
int SuperPotentialType_StdNumSol(const VectorXi k, const SuperPotentialType t)
Standard number of solutions for each SuperPotentialType.
Definition of the class Potential.