pygeoinf 1.2.6__tar.gz → 1.2.8__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.
Files changed (29) hide show
  1. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/PKG-INFO +8 -15
  2. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/README.md +7 -14
  3. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/__init__.py +6 -1
  4. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/gaussian_measure.py +25 -36
  5. pygeoinf-1.2.8/pygeoinf/linear_operators.py +1823 -0
  6. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/linear_solvers.py +39 -7
  7. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/random_matrix.py +114 -0
  8. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pyproject.toml +3 -14
  9. pygeoinf-1.2.6/pygeoinf/linear_operators.py +0 -999
  10. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/LICENSE +0 -0
  11. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/backus_gilbert.py +0 -0
  12. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/checks/hilbert_space.py +0 -0
  13. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/checks/linear_operators.py +0 -0
  14. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/checks/nonlinear_operators.py +0 -0
  15. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/direct_sum.py +0 -0
  16. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/forward_problem.py +0 -0
  17. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/hilbert_space.py +0 -0
  18. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/inversion.py +0 -0
  19. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/linear_bayesian.py +0 -0
  20. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/linear_forms.py +0 -0
  21. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/linear_optimisation.py +0 -0
  22. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/nonlinear_forms.py +0 -0
  23. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/nonlinear_operators.py +0 -0
  24. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/nonlinear_optimisation.py +0 -0
  25. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/parallel.py +0 -0
  26. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/symmetric_space/__init__.py +0 -0
  27. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/symmetric_space/circle.py +0 -0
  28. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/symmetric_space/sphere.py +0 -0
  29. {pygeoinf-1.2.6 → pygeoinf-1.2.8}/pygeoinf/symmetric_space/symmetric_space.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pygeoinf
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: A package for solving geophysical inference and inverse problems
5
5
  License: BSD-3-Clause
6
6
  Author: David Al-Attar and Dan Heathcote
@@ -64,22 +64,15 @@ git clone https://github.com/da380/pygeoinf.git
64
64
  cd pygeoinf
65
65
  poetry install
66
66
  ```
67
-
68
- You can install the optional dependencies for running tests, building documentation, or running the tutorials by using the --with flag.
67
+ You can install all optional dependencies for development—including tools for running the test suite,
68
+ building the documentation, and running the Jupyter tutorialsby using the ```--with``` flag and specifying the ```dev``` group.
69
69
 
70
70
  ```bash
71
- # To install dependencies for running the test suite
72
- poetry install --with tests
73
-
74
- # To install dependencies for building the documentation
75
- poetry install --with docs
71
+ # Install all development dependencies (for tests, docs, and tutorials)
72
+ poetry install --with dev
73
+ ```
76
74
 
77
- # To install dependencies for running the Jupyter tutorials
78
- poetry install --with tutorials
79
75
 
80
- # You can also combine them
81
- poetry install --with tests,docs,tutorials
82
- ```
83
76
 
84
77
  ## Documentation
85
78
 
@@ -245,9 +238,9 @@ The output of the above script will look similar to the following figure:
245
238
 
246
239
  ## Future Plans
247
240
 
248
- `pygeoinf` is under active development. Future work will focus on expanding the library's capabilities to address a broader range of geophysical problems. Key areas for development include:
241
+ `pygeoinf` is under active development. Current work is focused on expanding the library's capabilities to address a broader range of geophysical problems. Key areas for development include:
249
242
 
250
- * **Generalised Backus-Gilbert Methods**: Implementation of a generalised Backus-Gilbert framework for linear inference problems, building on the work of [Al-Attar(2021)](https://arxiv.org/abs/2104.12256). The focus will be on constructing direct estimates of specific properties of interest (i.e., linear functionals of the model) from data, without needing to first solve for the full model itself.
243
+ * **Generalised Backus-Gilbert Methods**: Implementation of a generalised Backus-Gilbert framework for linear inference problems. The focus will be on constructing direct estimates of specific properties of interest (i.e., linear functionals of the model) from data, without needing to first solve for the full model itself.
251
244
 
252
245
  * **Non-linear Optimisation**: Extension of the current optimisation framework to handle non-linear inverse problems. This will involve creating a general interface where users can provide their own non-linear forward mapping, a misfit functional, and methods for computing gradients (and optionally Hessians) for use in gradient-based optimisation algorithms.
253
246
 
@@ -43,22 +43,15 @@ git clone https://github.com/da380/pygeoinf.git
43
43
  cd pygeoinf
44
44
  poetry install
45
45
  ```
46
-
47
- You can install the optional dependencies for running tests, building documentation, or running the tutorials by using the --with flag.
46
+ You can install all optional dependencies for development—including tools for running the test suite,
47
+ building the documentation, and running the Jupyter tutorialsby using the ```--with``` flag and specifying the ```dev``` group.
48
48
 
49
49
  ```bash
50
- # To install dependencies for running the test suite
51
- poetry install --with tests
52
-
53
- # To install dependencies for building the documentation
54
- poetry install --with docs
50
+ # Install all development dependencies (for tests, docs, and tutorials)
51
+ poetry install --with dev
52
+ ```
55
53
 
56
- # To install dependencies for running the Jupyter tutorials
57
- poetry install --with tutorials
58
54
 
59
- # You can also combine them
60
- poetry install --with tests,docs,tutorials
61
- ```
62
55
 
63
56
  ## Documentation
64
57
 
@@ -224,9 +217,9 @@ The output of the above script will look similar to the following figure:
224
217
 
225
218
  ## Future Plans
226
219
 
227
- `pygeoinf` is under active development. Future work will focus on expanding the library's capabilities to address a broader range of geophysical problems. Key areas for development include:
220
+ `pygeoinf` is under active development. Current work is focused on expanding the library's capabilities to address a broader range of geophysical problems. Key areas for development include:
228
221
 
229
- * **Generalised Backus-Gilbert Methods**: Implementation of a generalised Backus-Gilbert framework for linear inference problems, building on the work of [Al-Attar(2021)](https://arxiv.org/abs/2104.12256). The focus will be on constructing direct estimates of specific properties of interest (i.e., linear functionals of the model) from data, without needing to first solve for the full model itself.
222
+ * **Generalised Backus-Gilbert Methods**: Implementation of a generalised Backus-Gilbert framework for linear inference problems. The focus will be on constructing direct estimates of specific properties of interest (i.e., linear functionals of the model) from data, without needing to first solve for the full model itself.
230
223
 
231
224
  * **Non-linear Optimisation**: Extension of the current optimisation framework to handle non-linear inverse problems. This will involve creating a general interface where users can provide their own non-linear forward mapping, a misfit functional, and methods for computing gradients (and optionally Hessians) for use in gradient-based optimisation algorithms.
232
225
 
@@ -9,6 +9,7 @@ from .random_matrix import (
9
9
  random_svd,
10
10
  random_eig,
11
11
  random_cholesky,
12
+ random_diagonal,
12
13
  )
13
14
 
14
15
  from .hilbert_space import (
@@ -34,7 +35,11 @@ from .nonlinear_operators import NonLinearOperator
34
35
 
35
36
  from .linear_operators import (
36
37
  LinearOperator,
37
- DiagonalLinearOperator,
38
+ MatrixLinearOperator,
39
+ DenseMatrixLinearOperator,
40
+ SparseMatrixLinearOperator,
41
+ DiagonalSparseMatrixLinearOperator,
42
+ NormalSumOperator,
38
43
  )
39
44
 
40
45
 
@@ -28,11 +28,11 @@ from scipy.sparse import diags
28
28
  from scipy.stats import multivariate_normal
29
29
 
30
30
 
31
- from .hilbert_space import EuclideanSpace, HilbertModule
31
+ from .hilbert_space import EuclideanSpace, HilbertModule, Vector
32
32
 
33
33
  from .linear_operators import (
34
34
  LinearOperator,
35
- DiagonalLinearOperator,
35
+ DiagonalSparseMatrixLinearOperator,
36
36
  )
37
37
 
38
38
  from .direct_sum import (
@@ -40,17 +40,6 @@ from .direct_sum import (
40
40
  )
41
41
 
42
42
 
43
- # This block only runs for type checkers, not at runtime, to prevent
44
- # circular import errors while still allowing type hints.
45
- if TYPE_CHECKING:
46
- from .hilbert_space import HilbertSpace, EuclideanSpace
47
- from .operators import LinearOperator, DiagonalLinearOperator
48
- from .direct_sum import BlockDiagonalLinearOperator
49
-
50
- # Define a generic type for vectors in a Hilbert space
51
- Vector = TypeVar("Vector")
52
-
53
-
54
43
  class GaussianMeasure:
55
44
  """
56
45
  Represents a Gaussian measure on a Hilbert space.
@@ -76,29 +65,29 @@ class GaussianMeasure:
76
65
  inverse_covariance_factor: LinearOperator = None,
77
66
  ) -> None:
78
67
  """
79
- Initializes the GaussianMeasure.
68
+ Initializes the GaussianMeasure.
80
69
 
81
70
  The measure can be defined in several ways, primarily by providing
82
- either a covariance operator or a covariance factor.
83
-
84
- Args:
85
- covariance (LinearOperator, optional): A self-adjoint and positive
86
- semi-definite linear operator on the domain.
87
- covariance_factor (LinearOperator, optional): A linear operator L
88
- such that the covariance C = L @ L*.
89
- expectation (vector, optional): The expectation (mean) of the
90
- measure. Defaults to the zero vector of the space.
91
- sample (callable, optional): A function that returns a random
92
- sample from the measure. If a `covariance_factor` is given,
93
- a default sampler is created.
94
- inverse_covariance (LinearOperator, optional): The inverse of the
95
- covariance operator (the precision operator).
96
- inverse_covariance_factor (LinearOperator, optional): A factor Li
97
- of the inverse covariance, such that C_inv = Li.T @ Li.
98
-
99
- Raises:
100
- ValueError: If neither `covariance` nor `covariance_factor`
101
- is provided.
71
+ either a covariance operator or a covariance factor.
72
+
73
+ Args:
74
+ covariance (LinearOperator, optional): A self-adjoint and positive
75
+ semi-definite linear operator on the domain.
76
+ covariance_factor (LinearOperator, optional): A linear operator L
77
+ such that the covariance C = L @ L*.
78
+ expectation (vector, optional): The expectation (mean) of the
79
+ measure. Defaults to the zero vector of the space.
80
+ sample (callable, optional): A function that returns a random
81
+ sample from the measure. If a `covariance_factor` is given,
82
+ a default sampler is created.
83
+ inverse_covariance (LinearOperator, optional): The inverse of the
84
+ covariance operator (the precision operator).
85
+ inverse_covariance_factor (LinearOperator, optional): A factor Li
86
+ of the inverse covariance, such that C_inv = Li.T @ Li.
87
+
88
+ Raises:
89
+ ValueError: If neither `covariance` nor `covariance_factor`
90
+ is provided.
102
91
  """
103
92
  if covariance is None and covariance_factor is None:
104
93
  raise ValueError(
@@ -186,8 +175,8 @@ class GaussianMeasure:
186
175
  "Standard deviation vector does not have the correct length"
187
176
  )
188
177
  euclidean = EuclideanSpace(domain.dim)
189
- covariance_factor = DiagonalLinearOperator(
190
- euclidean, domain, standard_deviations, galerkin=True
178
+ covariance_factor = DiagonalSparseMatrixLinearOperator.from_diagonal_values(
179
+ euclidean, domain, standard_deviations
191
180
  )
192
181
  return GaussianMeasure(
193
182
  covariance_factor=covariance_factor,