Skip to content

Commit b0efd1b

Browse files
committed
Change parameter name and order
1 parent 39c4524 commit b0efd1b

File tree

6 files changed

+26
-21
lines changed

6 files changed

+26
-21
lines changed

.github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
make -j"$(nproc)"
2424
./vpmr -h
2525
echo "exp(-t^2/2)" > k
26-
./vpmr -nc 5 -n 20 -d 100 -q 400 -e 1e-9 -k k -w -s
26+
./vpmr -c 5 -n 20 -d 100 -q 400 -e 1e-9 -k k -w -s
2727
for SRC in `find . | egrep '\.o'`; do gcov -n $SRC > /dev/null; done
2828
python3 -c "import _pyvpmr;print(_pyvpmr.vpmr())"
2929
- name: Python

.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
branches: [ master ]
55
pull_request:
66
branches: [ master ]
7+
env:
8+
VPMR_VERSION: ""
79
jobs:
810
debian:
911
runs-on: ubuntu-22.04

.gitignore

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
*vpmr*.so
2-
*.egg-info
1+
__pycache__
32
.cache
43
.idea/
4+
.venv
55
.vscode/
6+
*.egg-info
7+
*vpmr*.so
68
build/
79
cmake-build-*/
8-
wheelhouse
9-
__pycache__
10+
venv
11+
wheelhouse

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ Usage: vpmr [options]
160160
Options:
161161
162162
-n <int> number of terms (default: 10)
163+
-c <int> maximum exponent (default: 4)
163164
-d <int> number of precision bits (default: 512)
164165
-q <int> quadrature order (default: 500)
165166
-m <float> precision multiplier (default, minimum: 1.5)
166-
-nc <int> controls the maximum exponent (default: 4)
167167
-e <float> tolerance (default: 1E-8)
168168
-k <string> file name of kernel function (default: exp(-t^2/4))
169169
-s print singular values
@@ -188,9 +188,9 @@ The output is:
188188

189189
```text
190190
Using the following parameters:
191-
nc = 4.
192-
n = 30.
191+
terms = 30.
193192
order = 500.
193+
exponent = 4.
194194
precision = 336.
195195
tolerance = 1.0000e-08.
196196
kernel = exp(-t*t/4).

src/VPMR.cpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ int print_helper() {
284284
std::cout << "Usage: vpmr [options]\n\n";
285285
std::cout << "Options:\n\n";
286286
std::cout << " -n <int> number of terms (default: 10)\n";
287+
std::cout << " -c <int> maximum exponent (default: 4)\n";
287288
std::cout << " -d <int> number of precision bits (default: 512)\n";
288289
std::cout << " -q <int> quadrature order (default: 500)\n";
289290
std::cout << " -m <float> precision multiplier (default: 1.5)\n";
290-
std::cout << " -nc <int> controls the maximum exponent (default: 4)\n";
291291
std::cout << " -e <float> tolerance (default: 1E-8)\n";
292292
std::cout << " -k <string> file name of kernel function (default: exp(-t^2/4))\n";
293293
std::cout << " -s print singular values\n";
@@ -307,7 +307,7 @@ int main(const int argc, const char** argv) {
307307

308308
bool has_digit = false;
309309
for(auto I = 1; I < argc; ++I) {
310-
if(const auto token = std::string(argv[I]); token == "-nc")
310+
if(const auto token = std::string(argv[I]); token == "-c")
311311
NC = std::max(1, std::stoi(argv[++I]));
312312
else if(token == "-n")
313313
N = std::max(1, std::stoi(argv[++I]));
@@ -376,12 +376,13 @@ int main(const int argc, const char** argv) {
376376
std::cout << std::scientific << std::setprecision(4);
377377

378378
std::cout << "Using the following parameters:\n";
379-
std::cout << " nc = " << NC << ".\n";
380-
std::cout << " n = " << N << ".\n";
381-
std::cout << " order = " << QUAD_ORDER << ".\n";
382-
std::cout << " precision = " << DIGIT << ".\n";
383-
std::cout << " tolerance = " << (2 * TOL).toDouble() << ".\n";
384-
std::cout << " kernel = " << KERNEL << ".\n\n";
379+
std::cout << " terms = " << N << ".\n";
380+
std::cout << " exponent = " << NC << ".\n";
381+
std::cout << " precision = " << DIGIT << ".\n";
382+
std::cout << " order = " << QUAD_ORDER << ".\n";
383+
std::cout << " multiplier = " << SCALE << ".\n";
384+
std::cout << " tolerance = " << (2 * TOL).toDouble() << ".\n";
385+
std::cout << " kernel = " << KERNEL << ".\n\n";
385386

386387
try {
387388
// run VPMR algorithm
@@ -410,12 +411,12 @@ int main(const int argc, const char** argv) {
410411
#include <pybind11/stl.h>
411412

412413
std::tuple<std::vector<std::complex<double>>, std::vector<std::complex<double>>> vpmr_wrapper(
413-
const int n, const int d, const int q, const double m, const int nc, const double e, const std::string& k) {
414+
const int n, const int d, const int q, const double m, const int c, const double e, const std::string& k) {
414415
N = std::max(1, n);
415416
DIGIT = std::max(1, d);
416417
QUAD_ORDER = std::max(1, q);
417418
SCALE = std::max(1.5, m);
418-
NC = std::max(1, nc);
419+
NC = std::max(1, c);
419420
TOL = mpreal(e);
420421
if(!k.empty()) KERNEL = k;
421422

@@ -462,13 +463,13 @@ PYBIND11_MODULE(_pyvpmr, m) {
462463

463464
m.def(
464465
"vpmr", &vpmr_wrapper, pybind11::call_guard<pybind11::gil_scoped_release>(),
465-
pybind11::kw_only(), pybind11::arg("n") = 10, pybind11::arg("d") = 0, pybind11::arg("q") = 500, pybind11::arg("m") = 1.5, pybind11::arg("nc") = 4, pybind11::arg("e") = 1E-8, pybind11::arg("k") = "",
466+
pybind11::kw_only(), pybind11::arg("n") = 10, pybind11::arg("d") = 0, pybind11::arg("q") = 500, pybind11::arg("m") = 1.5, pybind11::arg("c") = 4, pybind11::arg("e") = 1E-8, pybind11::arg("k") = "",
466467
"The VPMR Algorithm.\n\n"
467468
":param n: number of terms (default: 10)\n"
469+
":param c: maximum exponent (default: 4)\n"
468470
":param d: number of precision bits (default: 512)\n"
469471
":param q: quadrature order (default: 500)\n"
470472
":param m: precision multiplier (default: 1.5)\n"
471-
":param nc: maximum exponent (default: 4)\n"
472473
":param e: tolerance (default: 1E-8)\n"
473474
":param k: kernel function (default: exp(-t^2/4))\n"
474475
":return: M, S\n");

test/example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ def kernel(x):
2323

2424

2525
if __name__ == '__main__':
26-
m, s = vpmr(n=60, k='exp(-t^2/4)*t^3', e=1e-12, nc=10)
26+
m, s = vpmr(n=60, k="exp(-t^2/4)*t^3", e=1e-12, c=10)
2727
print(to_global_damping(m, s))
2828
plot(m, s, kernel)

0 commit comments

Comments
 (0)