pygeoinf 1.1.9__py3-none-any.whl → 1.2.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.
- pygeoinf/linear_optimisation.py +9 -9
- pygeoinf/linear_solvers.py +37 -6
- {pygeoinf-1.1.9.dist-info → pygeoinf-1.2.0.dist-info}/METADATA +1 -1
- {pygeoinf-1.1.9.dist-info → pygeoinf-1.2.0.dist-info}/RECORD +6 -6
- {pygeoinf-1.1.9.dist-info → pygeoinf-1.2.0.dist-info}/LICENSE +0 -0
- {pygeoinf-1.1.9.dist-info → pygeoinf-1.2.0.dist-info}/WHEEL +0 -0
pygeoinf/linear_optimisation.py
CHANGED
|
@@ -51,7 +51,7 @@ class LinearLeastSquaresInversion(Inversion):
|
|
|
51
51
|
if self.forward_problem.data_error_measure_set:
|
|
52
52
|
self.assert_inverse_data_covariance()
|
|
53
53
|
|
|
54
|
-
def normal_operator(self, damping: float) ->
|
|
54
|
+
def normal_operator(self, damping: float) -> LinearOperator:
|
|
55
55
|
"""
|
|
56
56
|
Returns the Tikhonov-regularized normal operator.
|
|
57
57
|
|
|
@@ -88,8 +88,8 @@ class LinearLeastSquaresInversion(Inversion):
|
|
|
88
88
|
solver: "LinearSolver",
|
|
89
89
|
/,
|
|
90
90
|
*,
|
|
91
|
-
preconditioner: Optional[
|
|
92
|
-
) -> Union[Operator,
|
|
91
|
+
preconditioner: Optional[LinearOperator] = None,
|
|
92
|
+
) -> Union[Operator, LinearOperator]:
|
|
93
93
|
"""
|
|
94
94
|
Returns an operator that maps data to the least-squares solution.
|
|
95
95
|
|
|
@@ -121,7 +121,7 @@ class LinearLeastSquaresInversion(Inversion):
|
|
|
121
121
|
)
|
|
122
122
|
|
|
123
123
|
# This mapping is affine, not linear, if the error measure has a non-zero mean.
|
|
124
|
-
def mapping(data:
|
|
124
|
+
def mapping(data: Vector) -> Vector:
|
|
125
125
|
shifted_data = self.forward_problem.data_space.subtract(
|
|
126
126
|
data, self.forward_problem.data_error_measure.expectation
|
|
127
127
|
)
|
|
@@ -162,13 +162,13 @@ class LinearMinimumNormInversion(Inversion):
|
|
|
162
162
|
solver: "LinearSolver",
|
|
163
163
|
/,
|
|
164
164
|
*,
|
|
165
|
-
preconditioner: Optional[
|
|
165
|
+
preconditioner: Optional[LinearOperator] = None,
|
|
166
166
|
significance_level: float = 0.95,
|
|
167
167
|
minimum_damping: float = 0.0,
|
|
168
168
|
maxiter: int = 100,
|
|
169
169
|
rtol: float = 1.0e-6,
|
|
170
170
|
atol: float = 0.0,
|
|
171
|
-
) -> Union[Operator,
|
|
171
|
+
) -> Union[Operator, LinearOperator]:
|
|
172
172
|
"""
|
|
173
173
|
Returns an operator that maps data to the minimum-norm solution.
|
|
174
174
|
|
|
@@ -196,8 +196,8 @@ class LinearMinimumNormInversion(Inversion):
|
|
|
196
196
|
lsq_inversion = LinearLeastSquaresInversion(self.forward_problem)
|
|
197
197
|
|
|
198
198
|
def get_model_for_damping(
|
|
199
|
-
damping: float, data:
|
|
200
|
-
) -> tuple[
|
|
199
|
+
damping: float, data: Vector, model0: Optional[Vector] = None
|
|
200
|
+
) -> tuple[Vector, float]:
|
|
201
201
|
"""Computes the LS model and its chi-squared for a given damping."""
|
|
202
202
|
op = lsq_inversion.least_squares_operator(
|
|
203
203
|
damping, solver, preconditioner=preconditioner
|
|
@@ -206,7 +206,7 @@ class LinearMinimumNormInversion(Inversion):
|
|
|
206
206
|
chi_squared = self.forward_problem.chi_squared(model, data)
|
|
207
207
|
return model, chi_squared
|
|
208
208
|
|
|
209
|
-
def mapping(data:
|
|
209
|
+
def mapping(data: Vector) -> Vector:
|
|
210
210
|
"""The non-linear mapping from data to the minimum-norm model."""
|
|
211
211
|
model = self.model_space.zero
|
|
212
212
|
chi_squared = self.forward_problem.chi_squared(model, data)
|
pygeoinf/linear_solvers.py
CHANGED
|
@@ -48,6 +48,19 @@ class DirectLinearSolver(LinearSolver):
|
|
|
48
48
|
factorization.
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
|
+
def __init__(
|
|
52
|
+
self, /, *, galerkin: bool = False, parallel: bool = False, n_jobs: int = -1
|
|
53
|
+
):
|
|
54
|
+
"""
|
|
55
|
+
Args:
|
|
56
|
+
galerkin (bool): If True, the Galerkin matrix representation is used.
|
|
57
|
+
parallel (bool): If True, parallel computation is used.
|
|
58
|
+
n_jobs (int): Number of parallel jobs.
|
|
59
|
+
"""
|
|
60
|
+
self._galerkin: bool = galerkin
|
|
61
|
+
self._parallel: bool = parallel
|
|
62
|
+
self._n_jobs: int = n_jobs
|
|
63
|
+
|
|
51
64
|
|
|
52
65
|
class LUSolver(DirectLinearSolver):
|
|
53
66
|
"""
|
|
@@ -55,12 +68,16 @@ class LUSolver(DirectLinearSolver):
|
|
|
55
68
|
dense matrix representation.
|
|
56
69
|
"""
|
|
57
70
|
|
|
58
|
-
def __init__(
|
|
71
|
+
def __init__(
|
|
72
|
+
self, /, *, galerkin: bool = False, parallel: bool = False, n_jobs: int = -1
|
|
73
|
+
) -> None:
|
|
59
74
|
"""
|
|
60
75
|
Args:
|
|
61
76
|
galerkin (bool): If True, the Galerkin matrix representation is used.
|
|
77
|
+
parallel (bool): If True, parallel computation is used.
|
|
78
|
+
n_jobs (int): Number of parallel jobs.
|
|
62
79
|
"""
|
|
63
|
-
|
|
80
|
+
super().__init__(galerkin=galerkin, parallel=parallel, n_jobs=n_jobs)
|
|
64
81
|
|
|
65
82
|
def __call__(self, operator: LinearOperator) -> LinearOperator:
|
|
66
83
|
"""
|
|
@@ -74,7 +91,12 @@ class LUSolver(DirectLinearSolver):
|
|
|
74
91
|
"""
|
|
75
92
|
assert operator.is_square
|
|
76
93
|
|
|
77
|
-
matrix = operator.matrix(
|
|
94
|
+
matrix = operator.matrix(
|
|
95
|
+
dense=True,
|
|
96
|
+
galerkin=self._galerkin,
|
|
97
|
+
parallel=self._parallel,
|
|
98
|
+
n_jobs=self._n_jobs,
|
|
99
|
+
)
|
|
78
100
|
factor = lu_factor(matrix, overwrite_a=True)
|
|
79
101
|
|
|
80
102
|
def matvec(cy: np.ndarray) -> np.ndarray:
|
|
@@ -102,12 +124,16 @@ class CholeskySolver(DirectLinearSolver):
|
|
|
102
124
|
representation is positive-definite.
|
|
103
125
|
"""
|
|
104
126
|
|
|
105
|
-
def __init__(
|
|
127
|
+
def __init__(
|
|
128
|
+
self, /, *, galerkin: bool = False, parallel: bool = False, n_jobs: int = -1
|
|
129
|
+
) -> None:
|
|
106
130
|
"""
|
|
107
131
|
Args:
|
|
108
132
|
galerkin (bool): If True, the Galerkin matrix representation is used.
|
|
133
|
+
parallel (bool): If True, parallel computation is used.
|
|
134
|
+
n_jobs (int): Number of parallel jobs.
|
|
109
135
|
"""
|
|
110
|
-
|
|
136
|
+
super().__init__(galerkin=galerkin, parallel=parallel, n_jobs=n_jobs)
|
|
111
137
|
|
|
112
138
|
def __call__(self, operator: LinearOperator) -> LinearOperator:
|
|
113
139
|
"""
|
|
@@ -121,7 +147,12 @@ class CholeskySolver(DirectLinearSolver):
|
|
|
121
147
|
"""
|
|
122
148
|
assert operator.is_automorphism
|
|
123
149
|
|
|
124
|
-
matrix = operator.matrix(
|
|
150
|
+
matrix = operator.matrix(
|
|
151
|
+
dense=True,
|
|
152
|
+
galerkin=self._galerkin,
|
|
153
|
+
parallel=self._parallel,
|
|
154
|
+
n_jobs=self._n_jobs,
|
|
155
|
+
)
|
|
125
156
|
factor = cho_factor(matrix, overwrite_a=False)
|
|
126
157
|
|
|
127
158
|
def matvec(cy: np.ndarray) -> np.ndarray:
|
|
@@ -6,8 +6,8 @@ pygeoinf/hilbert_space.py,sha256=90aaUPUBCqsEuXroOwCmvbRFhi1vf6F9bS4pU3DCseI,233
|
|
|
6
6
|
pygeoinf/inversion.py,sha256=p9k_iDVgJGLM1cGlT-0rgRwqdYVdsYC_euTXZk3kuOc,3199
|
|
7
7
|
pygeoinf/linear_bayesian.py,sha256=aIOzTZbjJtdtwHKh5e01iS8iMiyr8XuwGx91udS3VK4,9624
|
|
8
8
|
pygeoinf/linear_forms.py,sha256=Uizipi67i1Sd6m0TzsrJd99Xreo_6V8Db0gMy76fG6g,5953
|
|
9
|
-
pygeoinf/linear_optimisation.py,sha256=
|
|
10
|
-
pygeoinf/linear_solvers.py,sha256=
|
|
9
|
+
pygeoinf/linear_optimisation.py,sha256=zWUMQpuLlEXtA3yJ55sT8809THbU_oQlLUwjroAbZbU,11067
|
|
10
|
+
pygeoinf/linear_solvers.py,sha256=USeUPa0zZ7gXk5OnvEw1LzCxCZoQIKhdwZZn-KNU7jA,13371
|
|
11
11
|
pygeoinf/operators.py,sha256=_t_UqYBIk4rWdRe98hre39sPaoRRbNejOtcvabtf0x8,38010
|
|
12
12
|
pygeoinf/parallel.py,sha256=E148IAKiXojWe6sq3iYtHl1XGAW8w6xaYbI7LOM9oKc,2269
|
|
13
13
|
pygeoinf/random_matrix.py,sha256=Q9jgQVpMOy8jR3s057DzHeKrKLdvwRktF-n_oVZ0xbs,8231
|
|
@@ -15,7 +15,7 @@ pygeoinf/symmetric_space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
15
15
|
pygeoinf/symmetric_space/circle.py,sha256=eUZPIDwg19RTCK3-bvbARg1g9RQcnV462MTlDaI-l5Y,17716
|
|
16
16
|
pygeoinf/symmetric_space/sphere.py,sha256=yjmES34jWLi4-EhU_RDILYn1y7_YrvgrTyT2qL2mLVg,21534
|
|
17
17
|
pygeoinf/symmetric_space/symmetric_space.py,sha256=lEAshbb55qL0iX84H423Pt35Af89Iy2pfB18JCPheX8,17970
|
|
18
|
-
pygeoinf-1.
|
|
19
|
-
pygeoinf-1.
|
|
20
|
-
pygeoinf-1.
|
|
21
|
-
pygeoinf-1.
|
|
18
|
+
pygeoinf-1.2.0.dist-info/LICENSE,sha256=GrTQnKJemVi69FSbHprq60KN0OJGsOSR-joQoTq-oD8,1501
|
|
19
|
+
pygeoinf-1.2.0.dist-info/METADATA,sha256=Q9Wo26AZXTTmUy7Fc8AVyhqDlEME7gDQ2udkImPATGo,15363
|
|
20
|
+
pygeoinf-1.2.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
21
|
+
pygeoinf-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|