pyvpmr 231126__cp38-cp38-macosx_10_9_x86_64.whl → 240307__cp38-cp38-macosx_10_9_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _pyvpmr.cpython-38-darwin.so +0 -0
- pyvpmr/.dylibs/libtbb.12.11.dylib +0 -0
- pyvpmr/__init__.py +57 -4
- {pyvpmr-231126.dist-info → pyvpmr-240307.dist-info}/METADATA +23 -7
- pyvpmr-240307.dist-info/RECORD +10 -0
- {pyvpmr-231126.dist-info → pyvpmr-240307.dist-info}/WHEEL +1 -1
- pyvpmr/.dylibs/libtbb.12.10.dylib +0 -0
- pyvpmr-231126.dist-info/RECORD +0 -10
- {pyvpmr-231126.dist-info → pyvpmr-240307.dist-info}/LICENSE +0 -0
- {pyvpmr-231126.dist-info → pyvpmr-240307.dist-info}/top_level.txt +0 -0
_pyvpmr.cpython-38-darwin.so
CHANGED
Binary file
|
Binary file
|
pyvpmr/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C)
|
1
|
+
# Copyright (C) 2024 Theodore Chang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
@@ -30,7 +30,7 @@ def split(result: str) -> tuple | None:
|
|
30
30
|
Split the output of the vpmr program into two arrays of complex numbers.
|
31
31
|
|
32
32
|
:param result: The raw output of the vpmr program.
|
33
|
-
:return:
|
33
|
+
:return: A tuple of two arrays of complex numbers.
|
34
34
|
"""
|
35
35
|
split_r = result.strip().split('\n')
|
36
36
|
regex = re.compile(r'([+\-]\d+\.\d+e[+\-]\d+){2}j')
|
@@ -46,8 +46,8 @@ def split(result: str) -> tuple | None:
|
|
46
46
|
|
47
47
|
def plot(
|
48
48
|
m: list | np.ndarray, s: list | np.ndarray, kernel: Callable, *,
|
49
|
-
size: tuple = (6, 4),
|
50
|
-
xlim: tuple = (0, 10),
|
49
|
+
size: tuple[float, float] = (6, 4),
|
50
|
+
xlim: tuple[float, float] = (0, 10),
|
51
51
|
show: bool = True,
|
52
52
|
save_to: str = None
|
53
53
|
):
|
@@ -93,3 +93,56 @@ def plot(
|
|
93
93
|
plt.show()
|
94
94
|
if save_to:
|
95
95
|
fig.savefig(save_to)
|
96
|
+
|
97
|
+
|
98
|
+
def _process_args(*args):
|
99
|
+
if len(args) == 1:
|
100
|
+
assert 2 == len(args[0])
|
101
|
+
m, s = args[0]
|
102
|
+
elif len(args) == 2:
|
103
|
+
m, s = args
|
104
|
+
else:
|
105
|
+
raise ValueError('Wrong number of arguments.')
|
106
|
+
|
107
|
+
if len(m) == len(s):
|
108
|
+
return np.array(m), np.array(s)
|
109
|
+
|
110
|
+
raise ValueError('The length of m and s must be the same.')
|
111
|
+
|
112
|
+
|
113
|
+
def to_global_damping(*args):
|
114
|
+
"""
|
115
|
+
Generate a command to use the kernel as a global nonviscous damping model in suanPan.
|
116
|
+
:param args: The m and s values.
|
117
|
+
:return: The command.
|
118
|
+
"""
|
119
|
+
command = '# The following can be used as a global nonviscous damping with the Newmark time integration.\n'
|
120
|
+
command += '# You may need to modify the first line to change tag and integration parameters.\n'
|
121
|
+
command += 'integrator NonviscousNewmark 1 .25 .5'
|
122
|
+
|
123
|
+
for m, s in zip(*_process_args(*args)):
|
124
|
+
command += f' \\\n{m.real:+.15e} {m.imag:+.15e} {s.real:+.15e} {s.imag:+.15e}'
|
125
|
+
|
126
|
+
command += '\n'
|
127
|
+
|
128
|
+
return command
|
129
|
+
|
130
|
+
|
131
|
+
def to_elemental_damping(*args):
|
132
|
+
"""
|
133
|
+
Generate a command to use the kernel as a per-element nonviscous damping model in suanPan.
|
134
|
+
:param args: The m and s values.
|
135
|
+
:return: The command.
|
136
|
+
"""
|
137
|
+
command = '# The following can be used as a per-element based nonviscous damping.\n'
|
138
|
+
command += '# You may need to modify the first line to change tags.\n'
|
139
|
+
command += '# Use the alternative form to apply to multiplier elements.\n'
|
140
|
+
command += '# modifier ElementalNonviscousGroup {unique_modifier_tag} {associated_element_group_tag}'
|
141
|
+
command += 'modifier ElementalNonviscous {unique_modifier_tag} {associated_element_tag}'
|
142
|
+
|
143
|
+
for m, s in zip(*_process_args(*args)):
|
144
|
+
command += f' \\\n{m.real:+.15e} {m.imag:+.15e} {s.real:+.15e} {s.imag:+.15e}'
|
145
|
+
|
146
|
+
command += '\n'
|
147
|
+
|
148
|
+
return command
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyvpmr
|
3
|
-
Version:
|
3
|
+
Version: 240307
|
4
4
|
Summary: The VPMR Algorithm
|
5
5
|
Home-page: https://github.com/TLCFEM/vpmr
|
6
6
|
Author: Theodore Chang
|
@@ -32,16 +32,30 @@ A Python package is also provided.
|
|
32
32
|
Check the reference paper [10.1007/s10915-022-01999-1](https://doi.org/10.1007/s10915-022-01999-1) and
|
33
33
|
the [original](https://github.com/ZXGao97/VPMR) MATLAB implementation for more details.
|
34
34
|
|
35
|
+
In short, the algorithm tries to find a summation of exponentials to approximate a given kernel function.
|
36
|
+
In mathematical terms, it looks for a set of $m_j$ and $s_j$ such that
|
37
|
+
|
38
|
+
```math
|
39
|
+
\max_{t\in{}I}\left\|g(t)-\sum_jm_j\exp(-s_jt)\right\|<\epsilon.
|
40
|
+
```
|
41
|
+
|
42
|
+
In the above, $g(t)$ is the given kernel function and $\epsilon$ is the prescribed tolerance.
|
43
|
+
|
35
44
|
## Dependency
|
36
45
|
|
46
|
+
The following libraries are required:
|
47
|
+
|
37
48
|
1. [gmp](https://gmplib.org/) for multiple precision arithmetic
|
38
49
|
2. [mpfr](https://www.mpfr.org/) for multiple-precision floating-point computations
|
39
|
-
3. [
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
50
|
+
3. [tbb](https://github.com/oneapi-src/oneTBB) for parallel computing
|
51
|
+
|
52
|
+
The following libraries are included:
|
53
|
+
|
54
|
+
1. [mpreal](http://www.holoborodko.com/pavel/mpfr/) `mpreal` type C++ wrapper, included
|
55
|
+
2. [BigInt](https://github.com/faheel/BigInt) `BigInt` arbitrary large integer for combinatorial number, included
|
56
|
+
3. [Eigen](https://eigen.tuxfamily.org/) for matrix decomposition, included
|
57
|
+
4. [exprtk](https://github.com/ArashPartow/exprtk.git) for expression parsing, included
|
58
|
+
5. [exprtk-custom-types](https://github.com/ArashPartow/exprtk-custom-types.git) for `mpreal` support, included
|
45
59
|
|
46
60
|
## How To
|
47
61
|
|
@@ -60,6 +74,8 @@ On RPM-based Linux distributions (using `dnf`), if you are:
|
|
60
74
|
available), `sudo dnf install -y gcc-c++ tbb-devel mpfr-devel gmp-devel`
|
61
75
|
2. using the packaged binary (wheels are available), `sudo dnf install -y gmp mpfr tbb`
|
62
76
|
|
77
|
+
On DEB-based Linux distributions (using `apt`), you need to `sudo apt install -y libtbb-dev libmpfr-dev libgmp-dev`.
|
78
|
+
|
63
79
|
On macOS, you need to `brew install tbb mpfr gmp`.
|
64
80
|
|
65
81
|
Then install the package with `pip`.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
_pyvpmr.cpython-38-darwin.so,sha256=kW-o0yjyV7FCqsjG6TSoqQ9VA73XD6fBNhzG1nmFQgc,12328384
|
2
|
+
pyvpmr/__init__.py,sha256=Bi-DREXwct7QQutAWxBFY8y-nW2qto9JHaG_6pGsA-w,4829
|
3
|
+
pyvpmr/.dylibs/libtbb.12.11.dylib,sha256=L7EvWho8o4KbVikpAqItU5mZI6oZbjEJ5EZHx9Z4ZlU,395984
|
4
|
+
pyvpmr/.dylibs/libgmp.10.dylib,sha256=wmdidr8avFWum3bQ4SdfAf6p0V7fuSl3LXaQQhdGeFw,486064
|
5
|
+
pyvpmr/.dylibs/libmpfr.6.dylib,sha256=rkHO2k_E8OmFgbEEi19EsH5BsIdXkEqOdIfBtUGNUDQ,485904
|
6
|
+
pyvpmr-240307.dist-info/RECORD,,
|
7
|
+
pyvpmr-240307.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
8
|
+
pyvpmr-240307.dist-info/WHEEL,sha256=wt_0D7ETubDJ-d2If9gFyi_RXCxFIy3PzOgckP8MsJY,109
|
9
|
+
pyvpmr-240307.dist-info/top_level.txt,sha256=Eg1XIUGMpHxqPFJiuE5mRh-LSacMJfhz3QoVoApXeQY,15
|
10
|
+
pyvpmr-240307.dist-info/METADATA,sha256=BGij-YZs9a4P3EtgDzSftWge_KvV-5sDc4yhJHeasWE,8554
|
Binary file
|
pyvpmr-231126.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
_pyvpmr.cpython-38-darwin.so,sha256=u4cHfypi054tYWH7fnxGdh2Vmly0UfRYpe-LkMyHjf8,12327504
|
2
|
-
pyvpmr/__init__.py,sha256=r72K3AwbwV1LeFRKju6W96nZA38ZTE6mdf17Y25QOrM,2986
|
3
|
-
pyvpmr/.dylibs/libtbb.12.10.dylib,sha256=TGQLgN2tiRa-KGvobwrLt657chXIpFztVljxj_VXLM8,369280
|
4
|
-
pyvpmr/.dylibs/libgmp.10.dylib,sha256=wmdidr8avFWum3bQ4SdfAf6p0V7fuSl3LXaQQhdGeFw,486064
|
5
|
-
pyvpmr/.dylibs/libmpfr.6.dylib,sha256=rkHO2k_E8OmFgbEEi19EsH5BsIdXkEqOdIfBtUGNUDQ,485904
|
6
|
-
pyvpmr-231126.dist-info/RECORD,,
|
7
|
-
pyvpmr-231126.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
8
|
-
pyvpmr-231126.dist-info/WHEEL,sha256=7bITxp1IXfScHG_aHqjgl3cb1WeEQowtBiPLTHk6_e8,109
|
9
|
-
pyvpmr-231126.dist-info/top_level.txt,sha256=Eg1XIUGMpHxqPFJiuE5mRh-LSacMJfhz3QoVoApXeQY,15
|
10
|
-
pyvpmr-231126.dist-info/METADATA,sha256=_EXdG3WATY-DONBgcBaPyiJMp3OMFUZT57ud0FexcLg,8006
|
File without changes
|
File without changes
|