Skip to content

Commit

Permalink
[publish] Improve precision bit estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
TLCFEM committed May 15, 2024
1 parent 3287a90 commit 82d5d9b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Options:
-n <int> number of terms (default: 10)
-d <int> number of precision bits (default: 512)
-q <int> quadrature order (default: 500)
-m <int> precision multiplier (default: 1.5)
-m <float> precision multiplier (default, minimum: 1.5)
-nc <int> controls the maximum exponent (default: 4)
-e <float> tolerance (default: 1E-8)
-k <string> file name of kernel function (default: exp(-t^2/4))
Expand All @@ -164,6 +164,11 @@ Options:
-h print this help message
```

The minimum required precision can be estimated by the parameter $$n$$.
The algorithm involves the computation of $$C^{4n}_{2n}$$ and $$2^{4n}$$.
The number of precision bits shall be at least $$\log_2(C^{4n}_{2n})+4n$$.
In the implementation, this number will be further multiplied by the parameter $$m$$.

#### Example

The default kernel is `exp(-t^2/4)`. One can run the application with the following command:
Expand Down
20 changes: 10 additions & 10 deletions src/VPMR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,17 @@ int main(const int argc, const char** argv) {
bool has_digit = false;
for(auto I = 1; I < argc; ++I) {
if(const auto token = std::string(argv[I]); token == "-nc")
NC = std::stoi(argv[++I]);
NC = std::max(1, std::stoi(argv[++I]));
else if(token == "-n")
N = std::stoi(argv[++I]);
N = std::max(1, std::stoi(argv[++I]));
else if(token == "-d") {
DIGIT = std::stoi(argv[++I]);
DIGIT = std::max(1, std::stoi(argv[++I]));
has_digit = true;
}
else if(token == "-q")
QUAD_ORDER = std::stoi(argv[++I]);
QUAD_ORDER = std::max(1, std::stoi(argv[++I]));
else if(token == "-m")
SCALE = std::stod(argv[++I]);
SCALE = std::max(1.5, std::stod(argv[++I]));
else if(token == "-e")
TOL = mpreal(argv[++I]);
else if(token == "-w")
Expand Down Expand Up @@ -411,11 +411,11 @@ int main(const int argc, const char** argv) {

std::tuple<std::vector<std::complex<double>>, std::vector<std::complex<double>>> vpmr_wrapper(
const int n, const int d, const int q, const double m, const int nc, const double e, const std::string& k) {
N = n;
DIGIT = d;
QUAD_ORDER = q;
SCALE = m;
NC = nc;
N = std::max(1, n);
DIGIT = std::max(1, d);
QUAD_ORDER = std::max(1, q);
SCALE = std::max(1.5, m);
NC = std::max(1, nc);
TOL = mpreal(e);
if(!k.empty()) KERNEL = k;

Expand Down

0 comments on commit 82d5d9b

Please sign in to comment.