sparse-ir 0.97.0__py3-none-any.whl → 1.1.0__py3-none-any.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.
- sparse_ir/__init__.py +2 -2
- sparse_ir/sampling.py +81 -13
- {sparse_ir-0.97.0.dist-info → sparse_ir-1.1.0.dist-info}/METADATA +6 -5
- {sparse_ir-0.97.0.dist-info → sparse_ir-1.1.0.dist-info}/RECORD +7 -7
- {sparse_ir-0.97.0.dist-info → sparse_ir-1.1.0.dist-info}/WHEEL +1 -1
- {sparse_ir-0.97.0.dist-info → sparse_ir-1.1.0.dist-info}/LICENSE.txt +0 -0
- {sparse_ir-0.97.0.dist-info → sparse_ir-1.1.0.dist-info}/top_level.txt +0 -0
sparse_ir/__init__.py
CHANGED
@@ -10,9 +10,9 @@ intermediate representation of correlation functions. It provides:
|
|
10
10
|
- basis functions and singular values are accurate to full precision
|
11
11
|
- routines for sparse sampling
|
12
12
|
"""
|
13
|
-
__copyright__ = "2020-
|
13
|
+
__copyright__ = "2020-2024 Markus Wallerberger, Hiroshi Shinaoka, and others"
|
14
14
|
__license__ = "MIT"
|
15
|
-
__version__ = "
|
15
|
+
__version__ = "1.1.0"
|
16
16
|
|
17
17
|
from .kernel import RegularizedBoseKernel, LogisticKernel
|
18
18
|
from .sve import compute as compute_sve, SVEResult
|
sparse_ir/sampling.py
CHANGED
@@ -20,13 +20,70 @@ class AbstractSampling:
|
|
20
20
|
|________________| fit |___________________|
|
21
21
|
|
22
22
|
"""
|
23
|
-
def evaluate(self, al, axis=None):
|
24
|
-
"""Evaluate the basis coefficients at
|
23
|
+
def evaluate(self, al, axis=None, *, points=None):
|
24
|
+
"""Evaluate the basis coefficients at sampling points.
|
25
|
+
|
26
|
+
Arguments:
|
27
|
+
al (array):
|
28
|
+
Array where the `l`-th item along `axis` corresponds to the
|
29
|
+
`l`-th basis coefficient
|
30
|
+
axis (integer):
|
31
|
+
Axis or dimension of `al` along which to evaluate the function.
|
32
|
+
Defaults to the last, i.e., rightmost axis.
|
33
|
+
points (vector):
|
34
|
+
Points on which the results should be evaluated. Defaults
|
35
|
+
to the sampling points for which the sampling objects was
|
36
|
+
created.
|
37
|
+
|
38
|
+
Return:
|
39
|
+
Array where the `n`-th item along `axis` corresponds to the
|
40
|
+
value on the `n`-th sampling point (or value on `point[n]`, if
|
41
|
+
given.)
|
42
|
+
|
43
|
+
Note:
|
44
|
+
If `points` is given, a new sampling is created at each invocation,
|
45
|
+
which can result in a performance hit. Consider caching sampling
|
46
|
+
objects or simply using the `.u()` and `.uhat()` methods of the
|
47
|
+
underlying basis.
|
48
|
+
"""
|
49
|
+
if points is not None:
|
50
|
+
return self._for_sampling_points(points).evaluate(al, axis)
|
51
|
+
|
25
52
|
return self.matrix.matmul(al, axis)
|
26
53
|
|
27
|
-
def fit(self, ax, axis=None):
|
28
|
-
"""Fit basis coefficients from the
|
29
|
-
|
54
|
+
def fit(self, ax, axis=None, *, points=None):
|
55
|
+
"""Fit the basis coefficients from the sampling points.
|
56
|
+
|
57
|
+
Arguments:
|
58
|
+
ax (array):
|
59
|
+
Array where the `n`-th item along `axis` corresponds to the
|
60
|
+
value on the `n`-th sampling point (or value on `point[n]`, if
|
61
|
+
given.)
|
62
|
+
axis (integer):
|
63
|
+
Axis or dimension of `ax` along which to fit the function.
|
64
|
+
Defaults to the last, i.e., rightmost axis.
|
65
|
+
points (vector):
|
66
|
+
Points on which the `ax` is given. Defaults to the sampling
|
67
|
+
points for which the sampling objects was created.
|
68
|
+
|
69
|
+
Return:
|
70
|
+
Array where the `l`-th item along `axis` corresponds to the
|
71
|
+
`l`-th basis coefficient
|
72
|
+
|
73
|
+
Note:
|
74
|
+
If `points` is given, a new sampling is created at each invocation,
|
75
|
+
which can result in a performance hit. Consider caching sampling
|
76
|
+
objects.
|
77
|
+
"""
|
78
|
+
if points is not None:
|
79
|
+
return self._for_sampling_points(points).fit(ax, axis)
|
80
|
+
|
81
|
+
matrix = self.matrix
|
82
|
+
if self.basis.is_well_conditioned and not (matrix.cond <= 1e8):
|
83
|
+
warn(f"Sampling matrix is poorly conditioned "
|
84
|
+
f"(kappa = {matrix.cond:.2g})", ConditioningWarning)
|
85
|
+
|
86
|
+
return matrix.lstsq(ax, axis)
|
30
87
|
|
31
88
|
@property
|
32
89
|
def cond(self):
|
@@ -48,6 +105,9 @@ class AbstractSampling:
|
|
48
105
|
"""Basis instance"""
|
49
106
|
raise NotImplementedError()
|
50
107
|
|
108
|
+
def _for_sampling_points(self, x):
|
109
|
+
raise RuntimeError("Changing sampling points is not possible")
|
110
|
+
|
51
111
|
|
52
112
|
class TauSampling(AbstractSampling):
|
53
113
|
"""Sparse sampling in imaginary time.
|
@@ -68,10 +128,6 @@ class TauSampling(AbstractSampling):
|
|
68
128
|
self._sampling_points = sampling_points
|
69
129
|
self._matrix = DecomposedMatrix(matrix)
|
70
130
|
|
71
|
-
if basis.is_well_conditioned and self._matrix.cond > 1e8:
|
72
|
-
warn(f"Sampling matrix is poorly conditioned "
|
73
|
-
f"(kappa = {self._matrix.cond:.2g})", ConditioningWarning)
|
74
|
-
|
75
131
|
@property
|
76
132
|
def basis(self): return self._basis
|
77
133
|
|
@@ -86,6 +142,10 @@ class TauSampling(AbstractSampling):
|
|
86
142
|
"""Sampling points in (reduced) imaginary time"""
|
87
143
|
return self._sampling_points
|
88
144
|
|
145
|
+
def _for_sampling_points(self, x):
|
146
|
+
x = np.asarray(x)
|
147
|
+
return TauSampling(self._basis, x)
|
148
|
+
|
89
149
|
|
90
150
|
class MatsubaraSampling(AbstractSampling):
|
91
151
|
"""Sparse sampling in Matsubara frequencies.
|
@@ -125,10 +185,6 @@ class MatsubaraSampling(AbstractSampling):
|
|
125
185
|
else:
|
126
186
|
self._matrix = DecomposedMatrix(matrix)
|
127
187
|
|
128
|
-
if basis.is_well_conditioned and self._matrix.cond > 1e8:
|
129
|
-
warn(f"Sampling matrix is poorly conditioned "
|
130
|
-
f"(kappa = {self._matrix.cond:.2g})", ConditioningWarning)
|
131
|
-
|
132
188
|
@property
|
133
189
|
def basis(self): return self._basis
|
134
190
|
|
@@ -148,6 +204,11 @@ class MatsubaraSampling(AbstractSampling):
|
|
148
204
|
"""Sampling points as (reduced) Matsubara frequencies"""
|
149
205
|
return self._sampling_points
|
150
206
|
|
207
|
+
def _for_sampling_points(self, x):
|
208
|
+
x = np.asarray(x)
|
209
|
+
return MatsubaraSampling(self._basis, x,
|
210
|
+
positive_only=self._positive_only)
|
211
|
+
|
151
212
|
|
152
213
|
class DecomposedMatrix:
|
153
214
|
"""Matrix in SVD decomposed form for fast and accurate fitting.
|
@@ -314,6 +375,13 @@ class SplitDecomposedMatrix:
|
|
314
375
|
|
315
376
|
|
316
377
|
class ConditioningWarning(RuntimeWarning):
|
378
|
+
"""Warns about a poorly conditioned problem.
|
379
|
+
|
380
|
+
This warning is issued if the library detects a poorly conditioned fitting
|
381
|
+
problem. This essentially means there is a high degree of ambiguity in how
|
382
|
+
to choose the solution. One must therefore expect to lose significant
|
383
|
+
precision in the parameter values.
|
384
|
+
"""
|
317
385
|
pass
|
318
386
|
|
319
387
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sparse-ir
|
3
|
-
Version:
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: intermediate representation (IR) basis for electronic propagator
|
5
5
|
Home-page: https://github.com/SpM-lab/sparse-ir
|
6
6
|
Author: ['Markus Wallerberger', 'Hiroshi Shinaoka', 'Kazuyoshi Yoshimi', 'Junya Otsuki', 'Chikano Naoya']
|
7
7
|
Author-email: markus.wallerberger@tuwien.ac.at
|
8
8
|
License: UNKNOWN
|
9
|
-
Keywords: irbasis
|
9
|
+
Keywords: irbasis many-body propagator svd
|
10
10
|
Platform: UNKNOWN
|
11
|
-
Classifier: Development Status ::
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
12
12
|
Classifier: Intended Audience :: Developers
|
13
13
|
Classifier: Intended Audience :: Science/Research
|
14
14
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
@@ -16,6 +16,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
17
17
|
Requires-Python: >=3
|
18
18
|
Description-Content-Type: text/x-rst
|
19
|
+
License-File: LICENSE.txt
|
19
20
|
Requires-Dist: numpy
|
20
21
|
Requires-Dist: scipy
|
21
22
|
Requires-Dist: setuptools
|
@@ -143,7 +144,7 @@ useful in your research, please consider citing the following papers:
|
|
143
144
|
|
144
145
|
- Hiroshi Shinaoka et al., `Phys. Rev. B 96, 035147`_ (2017)
|
145
146
|
- Jia Li et al., `Phys. Rev. B 101, 035144`_ (2020)
|
146
|
-
- Markus Wallerberger et al., `
|
147
|
+
- Markus Wallerberger et al., `SoftwareX 21, 101266`_ (2023)
|
147
148
|
|
148
149
|
If you are discussing sparse sampling in your research specifically, please
|
149
150
|
also consider citing an independently discovered, closely related approach, the
|
@@ -152,7 +153,7 @@ MINIMAX isometry method (Merzuk Kaltak and Georg Kresse,
|
|
152
153
|
|
153
154
|
.. _Phys. Rev. B 96, 035147: https://doi.org/10.1103/PhysRevB.96.035147
|
154
155
|
.. _Phys. Rev. B 101, 035144: https://doi.org/10.1103/PhysRevB.101.035144
|
155
|
-
..
|
156
|
+
.. _SoftwareX 21, 101266: https://doi.org/10.1016/j.softx.2022.101266
|
156
157
|
.. _Phys. Rev. B 101, 205145: https://doi.org/10.1103/PhysRevB.101.205145
|
157
158
|
|
158
159
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
sparse_ir/__init__.py,sha256=
|
1
|
+
sparse_ir/__init__.py,sha256=BzVg_maIuofnQArELnsb3Gdi4LnHa7OPt7prTjdbnnM,816
|
2
2
|
sparse_ir/_gauss.py,sha256=9Ou38SfucUjY83o8Tz62s-gXfWDC8QEHBjiUzcbWaY4,9621
|
3
3
|
sparse_ir/_roots.py,sha256=ARpyYhhI5gR1AT1zDgezVgCxnHEaJwGF38jEv6ebarA,4351
|
4
4
|
sparse_ir/_util.py,sha256=93s7tGcXxz3mwHsBQmAh-6EQ26xLbUeFHVtlnzQxRps,3004
|
@@ -10,11 +10,11 @@ sparse_ir/basis_set.py,sha256=zLD51j9X3iuXfX2nzmn5yRRn7S_GOOyCRFqb05OMDXI,2869
|
|
10
10
|
sparse_ir/dlr.py,sha256=X6orDjvsOAsFrZsCh8vfedu0_SmTvIpSQmGabfI9pi8,5361
|
11
11
|
sparse_ir/kernel.py,sha256=2HO77HTOK2WJKizDgr1nmmyhd1mGYT2WvKrFwLiMhjM,18487
|
12
12
|
sparse_ir/poly.py,sha256=XbNjgFaofE9zSvPPPYmsDVLLea2k8CSEopfxx-e48ko,18359
|
13
|
-
sparse_ir/sampling.py,sha256=
|
13
|
+
sparse_ir/sampling.py,sha256=AR6ONMwKjQXVvmulwCNk93J-1OmNS8fYutXCLdfReCA,13801
|
14
14
|
sparse_ir/svd.py,sha256=iQwpBCFSPJeKqhAIlufzz9Ybpm1dq382Km3TU-UvNuc,3375
|
15
15
|
sparse_ir/sve.py,sha256=pVUKg_cLphx-lRCfrDJXrpkow97vjIgvvSrxA7lhzzg,15179
|
16
|
-
sparse_ir-
|
17
|
-
sparse_ir-
|
18
|
-
sparse_ir-
|
19
|
-
sparse_ir-
|
20
|
-
sparse_ir-
|
16
|
+
sparse_ir-1.1.0.dist-info/LICENSE.txt,sha256=3tGlA0QNYsfjETaQqJO0Ixne5PQ16PNVJiDcGsgHER0,1079
|
17
|
+
sparse_ir-1.1.0.dist-info/METADATA,sha256=MIFpjO8gtK_A2NzU6g4SNYhZ-OKdUaNZqTpSD3V_VIU,6458
|
18
|
+
sparse_ir-1.1.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
19
|
+
sparse_ir-1.1.0.dist-info/top_level.txt,sha256=UsscWAzJg7fKo9qmIwW8jnG7CAfhFzWYBOTXVySzuA0,10
|
20
|
+
sparse_ir-1.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|