sparse-ir 1.1.7__tar.gz → 2.0.0a2__tar.gz
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-2.0.0a2/MANIFEST.in +4 -0
- sparse_ir-2.0.0a2/PKG-INFO +23 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/README.rst +24 -12
- sparse_ir-2.0.0a2/pyproject.toml +60 -0
- sparse_ir-2.0.0a2/src/sparse_ir/__init__.py +39 -0
- sparse_ir-2.0.0a2/src/sparse_ir/abstract.py +172 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/src/sparse_ir/augment.py +27 -17
- sparse_ir-2.0.0a2/src/sparse_ir/basis.py +240 -0
- sparse_ir-2.0.0a2/src/sparse_ir/basis_set.py +143 -0
- sparse_ir-2.0.0a2/src/sparse_ir/dlr.py +211 -0
- sparse_ir-2.0.0a2/src/sparse_ir/kernel.py +106 -0
- sparse_ir-2.0.0a2/src/sparse_ir/poly.py +270 -0
- sparse_ir-2.0.0a2/src/sparse_ir/sampling.py +310 -0
- sparse_ir-2.0.0a2/src/sparse_ir/sve.py +83 -0
- sparse_ir-2.0.0a2/src/sparse_ir.egg-info/PKG-INFO +23 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/src/sparse_ir.egg-info/SOURCES.txt +14 -16
- sparse_ir-2.0.0a2/src/sparse_ir.egg-info/requires.txt +4 -0
- sparse_ir-2.0.0a2/tests/test_advanced_features.py +247 -0
- {sparse-ir-1.1.7/test → sparse_ir-2.0.0a2/tests}/test_augment.py +6 -6
- sparse_ir-2.0.0a2/tests/test_basis.py +147 -0
- sparse_ir-2.0.0a2/tests/test_basis_set.py +26 -0
- sparse_ir-2.0.0a2/tests/test_core.py +144 -0
- {sparse-ir-1.1.7/test → sparse_ir-2.0.0a2/tests}/test_dlr.py +10 -10
- sparse_ir-2.0.0a2/tests/test_kernel.py +62 -0
- sparse_ir-2.0.0a2/tests/test_poly.py +44 -0
- sparse_ir-2.0.0a2/tests/test_sampling.py +117 -0
- sparse_ir-2.0.0a2/tests/test_sampling_advanced.py +153 -0
- sparse_ir-2.0.0a2/tests/test_sve.py +133 -0
- sparse_ir-2.0.0a2/tests/test_sve_advanced.py +114 -0
- sparse-ir-1.1.7/PKG-INFO +0 -146
- sparse-ir-1.1.7/setup.py +0 -72
- sparse-ir-1.1.7/src/sparse_ir/__init__.py +0 -21
- sparse-ir-1.1.7/src/sparse_ir/_gauss.py +0 -260
- sparse-ir-1.1.7/src/sparse_ir/_roots.py +0 -140
- sparse-ir-1.1.7/src/sparse_ir/abstract.py +0 -184
- sparse-ir-1.1.7/src/sparse_ir/adapter.py +0 -267
- sparse-ir-1.1.7/src/sparse_ir/basis.py +0 -349
- sparse-ir-1.1.7/src/sparse_ir/basis_set.py +0 -101
- sparse-ir-1.1.7/src/sparse_ir/dlr.py +0 -168
- sparse-ir-1.1.7/src/sparse_ir/kernel.py +0 -529
- sparse-ir-1.1.7/src/sparse_ir/poly.py +0 -525
- sparse-ir-1.1.7/src/sparse_ir/sampling.py +0 -421
- sparse-ir-1.1.7/src/sparse_ir/svd.py +0 -102
- sparse-ir-1.1.7/src/sparse_ir/sve.py +0 -385
- sparse-ir-1.1.7/src/sparse_ir.egg-info/PKG-INFO +0 -146
- sparse-ir-1.1.7/src/sparse_ir.egg-info/requires.txt +0 -15
- sparse-ir-1.1.7/test/test_basis_set.py +0 -27
- sparse-ir-1.1.7/test/test_compare.py +0 -132
- sparse-ir-1.1.7/test/test_gauss.py +0 -42
- sparse-ir-1.1.7/test/test_kernel.py +0 -47
- sparse-ir-1.1.7/test/test_poly.py +0 -151
- sparse-ir-1.1.7/test/test_sampling.py +0 -135
- sparse-ir-1.1.7/test/test_scipost_sample_code.py +0 -104
- sparse-ir-1.1.7/test/test_sve.py +0 -65
- sparse-ir-1.1.7/test/test_whitespace.py +0 -68
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/LICENSE.txt +0 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/setup.cfg +0 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/src/sparse_ir/_util.py +0 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/src/sparse_ir.egg-info/dependency_links.txt +0 -0
- {sparse-ir-1.1.7 → sparse_ir-2.0.0a2}/src/sparse_ir.egg-info/top_level.txt +0 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: sparse-ir
|
3
|
+
Version: 2.0.0a2
|
4
|
+
Summary: Python bindings for the libsparseir library, providing efficient sparse intermediate representation for many-body physics calculations
|
5
|
+
Author: SpM-lab
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/SpM-lab/sparse-r
|
8
|
+
Project-URL: Repository, https://github.com/SpM-lab/sparse-r
|
9
|
+
Project-URL: Bug Tracker, https://github.com/SpM-lab/sparse-r/issues
|
10
|
+
Keywords: physics,many-body,green-functions,sparse-ir
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
16
|
+
Requires-Python: >=3.10
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
License-File: LICENSE.txt
|
19
|
+
Requires-Dist: numpy
|
20
|
+
Requires-Dist: scipy
|
21
|
+
Requires-Dist: pylibsparseir<0.2.0,>=0.1.0
|
22
|
+
Requires-Dist: sphinx-rtd-theme>=3.0.2
|
23
|
+
Dynamic: license-file
|
@@ -12,25 +12,37 @@ Installation
|
|
12
12
|
------------
|
13
13
|
Install via `pip <https://pypi.org/project/sparse-ir>`_::
|
14
14
|
|
15
|
-
pip install sparse-ir
|
16
|
-
|
17
|
-
The above line is the recommended way to install `sparse-ir`. It automatically
|
18
|
-
installs the `xprec <https://github.com/tuwien-cms/xprec>`_ package, which
|
19
|
-
allows one to compute the IR basis functions with greater accuracy. If you do
|
20
|
-
not want to do this, simply remove the string ``[xprec]`` from the above command.
|
15
|
+
pip install sparse-ir
|
21
16
|
|
22
17
|
Install via `conda <https://anaconda.org/spm-lab/sparse-ir>`_::
|
23
18
|
|
24
|
-
conda install -c spm-lab sparse-ir
|
19
|
+
conda install -c spm-lab sparse-ir
|
25
20
|
|
26
|
-
|
27
|
-
`
|
21
|
+
sparse-ir requires `numpy <https://numpy.org/>`_, `scipy <https://scipy.org/>`_,
|
22
|
+
and `pylibsparseir <https://pypi.org/project/pylibsparseir>`_ (a thin Python wrapper
|
23
|
+
for the `libsparseir <https://github.com/SpM-lab/libsparseir>`_ C API).
|
28
24
|
|
29
25
|
To manually install the current development version, you can use the following::
|
30
26
|
|
31
27
|
# Only recommended for developers - no automatic updates!
|
32
28
|
git clone https://github.com/SpM-lab/sparse-ir
|
33
|
-
|
29
|
+
cd sparse-ir
|
30
|
+
uv sync
|
31
|
+
|
32
|
+
Note: `uv` is a fast Python package manager. If you don't have it installed,
|
33
|
+
you can install it with ``pip install uv`` or use ``pip install -e .`` instead.
|
34
|
+
|
35
|
+
Building documentation
|
36
|
+
----------------------
|
37
|
+
To build the documentation locally, first install the development dependencies::
|
38
|
+
|
39
|
+
uv sync --group doc
|
40
|
+
|
41
|
+
Then build the documentation::
|
42
|
+
|
43
|
+
uv run sphinx-build -M html doc _build/html
|
44
|
+
|
45
|
+
The documentation will be available in ``_build/html/html/index.html``.
|
34
46
|
|
35
47
|
Documentation and tutorial
|
36
48
|
--------------------------
|
@@ -42,12 +54,12 @@ Refer to the `API documentation`_ for more details on how to work
|
|
42
54
|
with the python library.
|
43
55
|
|
44
56
|
There is also a `Julia library`_ and (currently somewhat restricted)
|
45
|
-
`Fortran
|
57
|
+
`C library with Fortran bindings`_ available for the IR basis and sparse sampling.
|
46
58
|
|
47
59
|
.. _comprehensive tutorial: https://spm-lab.github.io/sparse-ir-tutorial
|
48
60
|
.. _API documentation: https://sparse-ir.readthedocs.io
|
49
61
|
.. _Julia library: https://github.com/SpM-lab/SparseIR.jl
|
50
|
-
..
|
62
|
+
.. _C library with Fortran bindings: https://github.com/SpM-lab/libsparseir
|
51
63
|
|
52
64
|
Getting started
|
53
65
|
---------------
|
@@ -0,0 +1,60 @@
|
|
1
|
+
[project]
|
2
|
+
name = "sparse-ir"
|
3
|
+
version = "2.0.0a2"
|
4
|
+
description = "Python bindings for the libsparseir library, providing efficient sparse intermediate representation for many-body physics calculations"
|
5
|
+
readme = "README.md"
|
6
|
+
requires-python = ">=3.10"
|
7
|
+
dependencies = [
|
8
|
+
"numpy",
|
9
|
+
"scipy",
|
10
|
+
"pylibsparseir>=0.1.0,<0.2.0",
|
11
|
+
"sphinx-rtd-theme>=3.0.2",
|
12
|
+
]
|
13
|
+
authors = [
|
14
|
+
{name = "SpM-lab"}
|
15
|
+
]
|
16
|
+
license = "MIT"
|
17
|
+
keywords = ["physics", "many-body", "green-functions", "sparse-ir"]
|
18
|
+
classifiers = [
|
19
|
+
"Development Status :: 3 - Alpha",
|
20
|
+
"Intended Audience :: Science/Research",
|
21
|
+
"Programming Language :: Python :: 3",
|
22
|
+
"Programming Language :: Python :: 3.12",
|
23
|
+
"Topic :: Scientific/Engineering :: Physics",
|
24
|
+
]
|
25
|
+
|
26
|
+
[project.urls]
|
27
|
+
Homepage = "https://github.com/SpM-lab/sparse-r"
|
28
|
+
Repository = "https://github.com/SpM-lab/sparse-r"
|
29
|
+
"Bug Tracker" = "https://github.com/SpM-lab/sparse-r/issues"
|
30
|
+
|
31
|
+
[build-system]
|
32
|
+
requires = ["setuptools", "wheel"]
|
33
|
+
build-backend = "setuptools.build_meta"
|
34
|
+
|
35
|
+
[tool.setuptools.packages.find]
|
36
|
+
where = ["src"]
|
37
|
+
|
38
|
+
[tool.setuptools.package-dir]
|
39
|
+
"" = "src"
|
40
|
+
|
41
|
+
[dependency-groups]
|
42
|
+
dev = [
|
43
|
+
"ipykernel>=6.29.5",
|
44
|
+
"jupytext>=1.17.2",
|
45
|
+
"matplotlib>=3.10.3",
|
46
|
+
"pytest>=8.4.1",
|
47
|
+
"sphinx>=8.0.0",
|
48
|
+
"sphinx-rtd-theme>=3.0.0",
|
49
|
+
]
|
50
|
+
doc = [
|
51
|
+
"sphinx>=8.0.0",
|
52
|
+
"sphinx-rtd-theme>=3.0.0",
|
53
|
+
"matplotlib>=3.10.3",
|
54
|
+
]
|
55
|
+
|
56
|
+
[tool.pytest.ini_options]
|
57
|
+
testpaths = ["tests"]
|
58
|
+
python_files = ["test_*.py", "*_tests.py"]
|
59
|
+
python_classes = ["Test*"]
|
60
|
+
python_functions = ["test_*"]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"""
|
2
|
+
SparseIR Python bindings
|
3
|
+
|
4
|
+
This package provides Python bindings for the SparseIR C library.
|
5
|
+
"""
|
6
|
+
|
7
|
+
from .abstract import AbstractBasis
|
8
|
+
from .basis import FiniteTempBasis, finite_temp_bases
|
9
|
+
from .sampling import TauSampling, MatsubaraSampling
|
10
|
+
from .kernel import LogisticKernel, RegularizedBoseKernel
|
11
|
+
from .sve import SVEResult, compute
|
12
|
+
from .basis_set import FiniteTempBasisSet
|
13
|
+
|
14
|
+
# New augmented functionality
|
15
|
+
from .augment import (
|
16
|
+
AugmentedBasis, AugmentedTauFunction, AugmentedMatsubaraFunction,
|
17
|
+
AbstractAugmentation, TauConst, TauLinear, MatsubaraConst
|
18
|
+
)
|
19
|
+
|
20
|
+
# DLR functionality
|
21
|
+
from .dlr import (
|
22
|
+
DiscreteLehmannRepresentation
|
23
|
+
)
|
24
|
+
|
25
|
+
# Export list for better documentation
|
26
|
+
__all__ = [
|
27
|
+
# Core functionality
|
28
|
+
'AbstractBasis', 'FiniteTempBasis', 'finite_temp_bases',
|
29
|
+
'TauSampling', 'MatsubaraSampling', 'FiniteTempBasisSet',
|
30
|
+
'LogisticKernel', 'RegularizedBoseKernel',
|
31
|
+
'SVEResult', 'compute',
|
32
|
+
|
33
|
+
# Augmented functionality
|
34
|
+
'AugmentedBasis', 'AugmentedTauFunction', 'AugmentedMatsubaraFunction',
|
35
|
+
'AbstractAugmentation', 'TauConst', 'TauLinear', 'MatsubaraConst',
|
36
|
+
|
37
|
+
# DLR functionality
|
38
|
+
'DiscreteLehmannRepresentation', 'TauPoles', 'MatsubaraPoles',
|
39
|
+
]
|
@@ -0,0 +1,172 @@
|
|
1
|
+
"""
|
2
|
+
Abstract base class for basis objects.
|
3
|
+
|
4
|
+
This module provides the abstract interface that all basis types should implement.
|
5
|
+
"""
|
6
|
+
|
7
|
+
from abc import ABC, abstractmethod
|
8
|
+
|
9
|
+
class AbstractKernel(ABC):
|
10
|
+
"""Abstract base class for kernels."""
|
11
|
+
pass
|
12
|
+
|
13
|
+
class AbstractBasis(ABC):
|
14
|
+
r"""Abstract base class for bases on the imaginary-time axis.
|
15
|
+
|
16
|
+
This class stores a set of basis functions. We can then expand a two-point
|
17
|
+
propagator G(τ), where τ is imaginary time:
|
18
|
+
|
19
|
+
G(τ) ≈ Σ_{l=0}^{L-1} g_l U_l(τ)
|
20
|
+
|
21
|
+
where U is now the l-th basis function, stored in u and g denote the
|
22
|
+
expansion coefficients. Similarly, the Fourier transform Ĝ(n), where n
|
23
|
+
is a reduced Matsubara frequency, can be expanded as follows:
|
24
|
+
|
25
|
+
Ĝ(n) ≈ Σ_{l=0}^{L-1} g_l Û_l(n)
|
26
|
+
|
27
|
+
where Û is the Fourier transform of the l-th basis function, stored
|
28
|
+
in uhat.
|
29
|
+
|
30
|
+
Assuming that basis is an instance of some abstract basis, g is a vector
|
31
|
+
of expansion coefficients, tau is some imaginary time and n some frequency,
|
32
|
+
we can write this in the library as follows:
|
33
|
+
|
34
|
+
G_tau = basis.u(tau).T @ gl
|
35
|
+
G_n = basis.uhat(n).T @ gl
|
36
|
+
"""
|
37
|
+
|
38
|
+
@property
|
39
|
+
@abstractmethod
|
40
|
+
def u(self):
|
41
|
+
r"""Basis functions on the imaginary time axis.
|
42
|
+
|
43
|
+
Set of IR basis functions on the imaginary time (tau) axis, where tau
|
44
|
+
is a real number between zero and beta. To get the l-th basis function
|
45
|
+
at imaginary time tau of some basis, use:
|
46
|
+
|
47
|
+
ultau = basis.u[l](tau) # l-th basis function at time tau
|
48
|
+
|
49
|
+
Note that u supports vectorization both over l and tau.
|
50
|
+
"""
|
51
|
+
raise NotImplementedError()
|
52
|
+
|
53
|
+
@property
|
54
|
+
@abstractmethod
|
55
|
+
def uhat(self):
|
56
|
+
r"""Basis functions on the reduced Matsubara frequency (wn) axis.
|
57
|
+
|
58
|
+
Set of IR basis functions reduced Matsubara frequency (wn) axis, where
|
59
|
+
wn is an integer. These are related to u by the following Fourier transform:
|
60
|
+
|
61
|
+
û(n) = ∫₀^β dτ exp(iπnτ/β) u(τ)
|
62
|
+
|
63
|
+
To get the l-th basis function at some reduced frequency wn of
|
64
|
+
some basis, use:
|
65
|
+
|
66
|
+
uln = basis.uhat[l](wn) # l-th basis function at freq wn
|
67
|
+
|
68
|
+
Note:
|
69
|
+
Instead of the value of the Matsubara frequency, these functions
|
70
|
+
expect integers corresponding to the prefactor of pi over beta.
|
71
|
+
For example, the first few positive fermionic frequencies would
|
72
|
+
be specified as [1, 3, 5, 7], and the first bosonic frequencies
|
73
|
+
are [0, 2, 4, 6]. This is also distinct to an index!
|
74
|
+
"""
|
75
|
+
raise NotImplementedError()
|
76
|
+
|
77
|
+
@property
|
78
|
+
@abstractmethod
|
79
|
+
def statistics(self):
|
80
|
+
"""Quantum statistic ("F" for fermionic, "B" for bosonic)"""
|
81
|
+
raise NotImplementedError()
|
82
|
+
|
83
|
+
def __getitem__(self, index):
|
84
|
+
"""Return basis functions/singular values for given index/indices.
|
85
|
+
|
86
|
+
This can be used to truncate the basis to the n most significant
|
87
|
+
singular values: basis[:3].
|
88
|
+
"""
|
89
|
+
raise NotImplementedError()
|
90
|
+
|
91
|
+
@property
|
92
|
+
def shape(self):
|
93
|
+
"""Shape of the basis function set"""
|
94
|
+
return (self.size,)
|
95
|
+
|
96
|
+
@property
|
97
|
+
@abstractmethod
|
98
|
+
def size(self):
|
99
|
+
"""Number of basis functions / singular values"""
|
100
|
+
raise NotImplementedError()
|
101
|
+
|
102
|
+
@property
|
103
|
+
@abstractmethod
|
104
|
+
def significance(self):
|
105
|
+
"""Significances of the basis functions
|
106
|
+
|
107
|
+
Vector of significance values, one for each basis function. Each
|
108
|
+
value is a number between 0 and 1 which is an a-priori bound on the
|
109
|
+
(relative) error made by discarding the associated coefficient.
|
110
|
+
"""
|
111
|
+
raise NotImplementedError()
|
112
|
+
|
113
|
+
@property
|
114
|
+
def accuracy(self):
|
115
|
+
"""Accuracy of the basis.
|
116
|
+
|
117
|
+
Upper bound to the relative error of representing a propagator with
|
118
|
+
the given number of basis functions (number between 0 and 1).
|
119
|
+
"""
|
120
|
+
return self.significance[-1]
|
121
|
+
|
122
|
+
@property
|
123
|
+
@abstractmethod
|
124
|
+
def lambda_(self):
|
125
|
+
"""Basis cutoff parameter, Λ = β * wmax, or None if not present"""
|
126
|
+
raise NotImplementedError()
|
127
|
+
|
128
|
+
@property
|
129
|
+
@abstractmethod
|
130
|
+
def beta(self):
|
131
|
+
"""Inverse temperature"""
|
132
|
+
raise NotImplementedError()
|
133
|
+
|
134
|
+
@property
|
135
|
+
def wmax(self):
|
136
|
+
"""Real frequency cutoff or None if not present"""
|
137
|
+
if self.lambda_ is None or self.beta is None:
|
138
|
+
return None
|
139
|
+
return self.lambda_ / self.beta
|
140
|
+
|
141
|
+
@abstractmethod
|
142
|
+
def default_tau_sampling_points(self, *, npoints=None):
|
143
|
+
"""Default sampling points on the imaginary time axis
|
144
|
+
|
145
|
+
Parameters
|
146
|
+
----------
|
147
|
+
npoints : int, optional
|
148
|
+
Minimum number of sampling points to return.
|
149
|
+
"""
|
150
|
+
raise NotImplementedError()
|
151
|
+
|
152
|
+
@abstractmethod
|
153
|
+
def default_matsubara_sampling_points(self, *, npoints=None,
|
154
|
+
positive_only=False):
|
155
|
+
"""Default sampling points on the imaginary frequency axis
|
156
|
+
|
157
|
+
Parameters
|
158
|
+
----------
|
159
|
+
npoints : int, optional
|
160
|
+
Minimum number of sampling points to return.
|
161
|
+
positive_only : bool
|
162
|
+
Only return non-negative frequencies. This is useful if the
|
163
|
+
object to be fitted is symmetric in Matsubara frequency,
|
164
|
+
ghat(w) == ghat(-w).conj(), or, equivalently, real in
|
165
|
+
imaginary time.
|
166
|
+
"""
|
167
|
+
raise NotImplementedError()
|
168
|
+
|
169
|
+
@property
|
170
|
+
def is_well_conditioned(self):
|
171
|
+
"""Returns True if the sampling is expected to be well-conditioned"""
|
172
|
+
return True
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# Copyright (C) 2020-2021 Markus Wallerberger, Hiroshi Shinaoka, and others
|
2
2
|
# SPDX-License-Identifier: MIT
|
3
|
-
import numpy as np
|
4
|
-
|
5
3
|
from . import _util
|
4
|
+
import numpy as np
|
5
|
+
from ctypes import c_int, byref
|
6
6
|
from . import abstract
|
7
7
|
from . import basis
|
8
|
-
|
8
|
+
from pylibsparseir.core import basis_get_default_tau_sampling_points_ext, basis_get_n_default_matsus_ext, basis_get_default_matsus_ext
|
9
|
+
from pylibsparseir.core import COMPUTATION_SUCCESS
|
9
10
|
|
10
11
|
class AugmentedBasis(abstract.AbstractBasis):
|
11
12
|
"""Augmented basis on the imaginary-time/frequency axis.
|
@@ -59,6 +60,10 @@ class AugmentedBasis(abstract.AbstractBasis):
|
|
59
60
|
self._uhat = AugmentedMatsubaraFunction(
|
60
61
|
self._basis.uhat, [aug.hat for aug in augmentations])
|
61
62
|
|
63
|
+
@property
|
64
|
+
def basis(self):
|
65
|
+
return self._basis
|
66
|
+
|
62
67
|
@property
|
63
68
|
def u(self):
|
64
69
|
return self._u
|
@@ -69,7 +74,7 @@ class AugmentedBasis(abstract.AbstractBasis):
|
|
69
74
|
|
70
75
|
@property
|
71
76
|
def statistics(self):
|
72
|
-
|
77
|
+
return self._basis.statistics
|
73
78
|
|
74
79
|
def __getitem__(self, index):
|
75
80
|
stop = basis._slice_to_size(index)
|
@@ -113,14 +118,19 @@ class AugmentedBasis(abstract.AbstractBasis):
|
|
113
118
|
# Return the sampling points of the underlying basis, but since we
|
114
119
|
# use the size of self, we add two further points. One then has to
|
115
120
|
# hope that these give good sampling points.
|
116
|
-
return self._basis.default_tau_sampling_points(npoints=npoints)
|
117
121
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
122
|
+
return basis_get_default_tau_sampling_points_ext(self._basis._ptr, npoints)
|
123
|
+
|
124
|
+
def default_matsubara_sampling_points(self, *, positive_only=False):
|
125
|
+
"""Get default Matsubara sampling points for augmented basis.
|
126
|
+
|
127
|
+
This method provides default sampling points for Matsubara frequencies
|
128
|
+
when using an augmented basis.
|
129
|
+
"""
|
130
|
+
n_points_returned = basis_get_n_default_matsus_ext(self._basis._ptr, self.size, positive_only)
|
131
|
+
points = np.zeros(n_points_returned, dtype=np.int64)
|
132
|
+
basis_get_default_matsus_ext(self._basis._ptr, positive_only, points)
|
133
|
+
return points
|
124
134
|
|
125
135
|
@property
|
126
136
|
def is_well_conditioned(self):
|
@@ -132,8 +142,8 @@ class AugmentedBasis(abstract.AbstractBasis):
|
|
132
142
|
|
133
143
|
class _AugmentedFunction:
|
134
144
|
def __init__(self, fbasis, faug):
|
135
|
-
if fbasis.ndim != 1:
|
136
|
-
|
145
|
+
#if fbasis.ndim != 1:
|
146
|
+
# raise ValueError("must have vector of functions as fbasis")
|
137
147
|
self._fbasis = fbasis
|
138
148
|
self._faug = faug
|
139
149
|
self._naug = len(faug)
|
@@ -236,7 +246,7 @@ class TauConst(AbstractAugmentation):
|
|
236
246
|
self._beta = beta
|
237
247
|
|
238
248
|
def __call__(self, tau):
|
239
|
-
tau = _util.check_range(tau,
|
249
|
+
tau = _util.check_range(tau, -self._beta, self._beta)
|
240
250
|
return np.broadcast_to(1 / np.sqrt(self._beta), tau.shape)
|
241
251
|
|
242
252
|
def deriv(self, n=1):
|
@@ -264,7 +274,7 @@ class TauLinear(AbstractAugmentation):
|
|
264
274
|
self._norm = np.sqrt(3/beta)
|
265
275
|
|
266
276
|
def __call__(self, tau):
|
267
|
-
tau = _util.check_range(tau,
|
277
|
+
tau = _util.check_range(tau, -self._beta, self._beta)
|
268
278
|
x = 2/self._beta * tau - 1
|
269
279
|
return self._norm * x
|
270
280
|
|
@@ -296,7 +306,7 @@ class MatsubaraConst(AbstractAugmentation):
|
|
296
306
|
self._beta = beta
|
297
307
|
|
298
308
|
def __call__(self, tau):
|
299
|
-
tau = _util.check_range(tau,
|
309
|
+
tau = _util.check_range(tau, -self._beta, self._beta)
|
300
310
|
return np.broadcast_to(np.nan, tau.shape)
|
301
311
|
|
302
312
|
def deriv(self, n=1):
|
@@ -321,4 +331,4 @@ def _check_bosonic_statistics(statistics):
|
|
321
331
|
elif statistics == 'F':
|
322
332
|
raise ValueError("term only allowed for bosonic basis")
|
323
333
|
else:
|
324
|
-
raise ValueError("invalid statistics")
|
334
|
+
raise ValueError("invalid statistics")
|