46#define QD_MAX 20000000
65 Quad(
char *grid_type,
char *fs_type,
int ndim,
int param,
double alpha=0.0,
double betta=1.0);
1D Array class for any type T
2D Array class for any type T
Stores data of any type T in a 1D array.
Definition Array1D.h:61
Stores data of any type T in a 2D array.
Definition Array2D.h:60
int XSize() const
Returns size in the x-direction.
Definition Array2D.h:99
Generates quadrature rules.
Definition quad.h:54
Array1D< string > grid_types_
Vector of grid types: 'CC','CCO','NC','NCO','LU', 'HG', 'JB', 'LG', 'SW', 'pdf', or 'GP3'.
Definition quad.h:248
void create1DRule_JB(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Jacobi-Beta.
Definition quad.cpp:607
string grid_type_
Grid type: 'CC','CCO','NC','NCO','LU', 'HG', 'JB', 'LG', 'SW', 'pdf', or 'GP3'.
Definition quad.h:246
void create1DRule(string gridtype, Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Compute 1D rules.
Definition quad.cpp:353
void nextLevel()
Compute the indices of the next-level points.
Definition quad.cpp:862
void SetRule(Array2D< double > &q, Array1D< double > &w, Array2D< int > &ind)
Set the rule externally (quadrature points, weights and indices) Dummy function for backward compatib...
Definition quad.h:105
Array2D< int > npts_1_all
Definition quad.h:194
Array1D< int > param_
Definition quad.h:191
int ndim_
The dimensionality.
Definition quad.h:183
Array1D< double > alphas_
The first parameter of the rule, if any.
Definition quad.h:166
void SetQdpts(Array2D< double > &q)
Externally set quadrature points.
Definition quad.h:119
void AddTwoRules(QuadRule *rule1, QuadRule *rule2, QuadRule *rule_sum)
Add two rules.
Definition quad.cpp:324
void create1DRule_NC(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Newton-Cotes (i.e. equispaced, includes the endpoints)
Definition quad.cpp:451
double alpha_
The first parameter of the rule, if any.
Definition quad.h:162
void MultiplyManyRules(int nrules, QuadRule *rules, QuadRule *rule_prod)
Multiply many rules (full tensor product)
Definition quad.cpp:253
void SetBeta(double betta)
Set the parameter beta.
Definition quad.h:90
~Quad()
Destructor.
Definition quad.h:82
void create1DRule_pdf(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Custom rule given the recursive coefficients of the corresponding orthogonal polynomials.
Definition quad.cpp:676
Array1D< double > bb_
the right endpoints of the domain
Definition quad.h:155
int maxlevel_
The level for sparse rules, or the number of grid points per dim for full product rules.
Definition quad.h:190
int GetNQ()
Get the number of quadrature points.
Definition quad.h:139
int quadverbose_
Verbosity level.
Definition quad.h:159
void GetDomain(Array1D< double > &aa, Array1D< double > &bb) const
Get the domain endpoints (for compact support domains)
Definition quad.h:97
void MultiplyManyRules_(int nrules, QuadRule *rules, QuadRule *rule_prod)
Definition quad.cpp:282
void GetQdpts(Array2D< double > &q)
Externally set the indices.
Definition quad.h:126
void SetLevel(int param)
Get the indices.
Definition quad.h:133
Quad(const Quad &)
Dummy copy constructor, which should not be used as it is currently not well defined.
Definition quad.h:150
void MultiplyTwoRules(QuadRule *rule1, QuadRule *rule2, QuadRule *rule_prod)
Multiply two rules (full tensor product)
Definition quad.cpp:209
void create1DRule_LU(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Legendre-Uniform.
Definition quad.cpp:398
void create1DRule_LG(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr)
Gamma-Laguerre.
Definition quad.cpp:628
int nlevel_
The current level, working variable for hierarchical construction.
Definition quad.h:186
void create1DRule_SW(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr)
Stieltjes-Wigert.
Definition quad.cpp:645
void compressRule(QuadRule *rule)
Compress the rule, i.e. merge repeating points.
Definition quad.cpp:985
Array2D< QuadRule > qr_all
Definition quad.h:195
void GetRule(Array2D< double > &q, Array1D< double > &w)
Get the quadrature rule.
Definition quad.cpp:199
void SetAlpha(double alpha)
Set the parameter alpha.
Definition quad.h:88
int growth_rule_
Growth rule: exponential(0) or linear(1)
Definition quad.h:241
Array2D< int > npts_all
Working arrays.
Definition quad.h:194
Array1D< double > aa_
The left endpoints of the domain.
Definition quad.h:153
void create1DRule_NCO(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Newton-Cotes open (i.e. excludes the endpoints)
Definition quad.cpp:484
void init()
Initialization function.
Definition quad.cpp:103
Array2D< QuadRule > qr_1_all
Definition quad.h:195
void SetRule()
Set the rule externally (quadrature points, weights, indices, and the level)
Definition quad.cpp:762
QuadRule rule_
The quadrature rule structure.
Definition quad.h:180
void create1DRule_GP3(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Gauss-Patterson starting with Legendre-Uniform 3.
Definition quad.cpp:711
void SetVerbosity(int verbosity)
Set the verbosity level.
Definition quad.h:143
string fs_type_
Sparseness type (full or sparse)
Definition quad.h:251
void SetDomain(Array1D< double > &aa, Array1D< double > &bb)
Set the domain endpoints (for compact support domains)
Definition quad.cpp:163
void create1DRule_HG(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr)
Gauss-Hermite.
Definition quad.cpp:423
void create1DRule_CCO(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Clenshaw-Curtis open (i.e. excludes the endpoints)
Definition quad.cpp:562
Array1D< double > betas_
The second parameter of the rule, if any.
Definition quad.h:168
void getMultiIndexLevel(Array2D< int > &multiIndexLevel, int level, int ndim)
Auxilliary function: get the level of the multi-index.
Definition quad.cpp:948
void GetRule(Array2D< double > &q, Array1D< double > &w, Array2D< int > &ind)
Get the quadrature rule with indexing Dummy function for backward compatibility.
Definition quad.h:116
void GetDomain(Array1D< double > &aa) const
Get the domain endpoint (for semi-infinite domains)
Definition quad.h:99
double beta_
The second parameter of the rule, if any.
Definition quad.h:164
void GetWghts(Array1D< double > &w)
Get the weights.
Definition quad.h:128
Quad()
Constructor: empty.
Definition quad.h:80
void create1DRule_CC(Array1D< double > &qdpts, Array1D< double > &wghts, int ngr, double a, double b)
Clenshaw-Curtis (includes the endpoints)
Definition quad.cpp:509
Array1D< int > growth_rules_
Growth rules: exponential(0) or linear(1)
Definition quad.h:243
void SetWghts(Array1D< double > &w)
Externally set the weights.
Definition quad.h:121
void SubtractTwoRules(QuadRule *rule1, QuadRule *rule2, QuadRule *rule_sum)
Subtract two rules.
Definition quad.cpp:312
Rule structure that stores quadrature points, weights and indices.
Definition quad.h:172
Array2D< double > qdpts
Quadrature points.
Definition quad.h:174
Array1D< double > wghts
Quadrature weights.
Definition quad.h:176