pygeoinf 1.1.5__tar.gz → 1.1.7__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.
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/PKG-INFO +1 -1
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/hilbert_space.py +44 -15
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/linear_solvers.py +6 -1
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/operators.py +0 -2
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/symmetric_space/sphere.py +20 -2
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pyproject.toml +1 -1
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/LICENSE +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/README.md +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/__init__.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/direct_sum.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/forward_problem.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/gaussian_measure.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/inversion.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/linear_bayesian.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/linear_forms.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/linear_optimisation.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/random_matrix.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/symmetric_space/__init__.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/symmetric_space/circle.py +0 -0
- {pygeoinf-1.1.5 → pygeoinf-1.1.7}/pygeoinf/symmetric_space/symmetric_space.py +0 -0
|
@@ -118,6 +118,16 @@ class HilbertSpace(ABC):
|
|
|
118
118
|
The corresponding vector in the space.
|
|
119
119
|
"""
|
|
120
120
|
|
|
121
|
+
@abstractmethod
|
|
122
|
+
def __eq__(self, other: object) -> bool:
|
|
123
|
+
"""
|
|
124
|
+
Defines equality between two HilbertSpace instances.
|
|
125
|
+
|
|
126
|
+
This is an abstract method, requiring all concrete subclasses to
|
|
127
|
+
implement a meaningful comparison. This ensures that equality is
|
|
128
|
+
defined by mathematical equivalence rather than object identity.
|
|
129
|
+
"""
|
|
130
|
+
|
|
121
131
|
# ------------------------------------------------------------------- #
|
|
122
132
|
# Default implementations that can be overridden #
|
|
123
133
|
# ------------------------------------------------------------------- #
|
|
@@ -209,25 +219,12 @@ class HilbertSpace(ABC):
|
|
|
209
219
|
"""
|
|
210
220
|
return self.from_components(np.random.randn(self.dim))
|
|
211
221
|
|
|
212
|
-
def __eq__(self, other: object) -> bool:
|
|
213
|
-
"""
|
|
214
|
-
Defines equality between Hilbert spaces.
|
|
215
|
-
|
|
216
|
-
For dual spaces, equality is determined by the equality of their
|
|
217
|
-
underlying primal spaces. For non-dual spaces, this is not implemented,
|
|
218
|
-
requiring concrete subclasses to define a meaningful comparison.
|
|
219
|
-
"""
|
|
220
|
-
if isinstance(self, DualHilbertSpace):
|
|
221
|
-
return (
|
|
222
|
-
isinstance(other, DualHilbertSpace)
|
|
223
|
-
and self.underlying_space == other.underlying_space
|
|
224
|
-
)
|
|
225
|
-
return NotImplemented
|
|
226
|
-
|
|
227
222
|
# ------------------------------------------------------------------- #
|
|
228
223
|
# Final (Non-Overridable) Methods #
|
|
229
224
|
# ------------------------------------------------------------------- #
|
|
230
225
|
|
|
226
|
+
|
|
227
|
+
|
|
231
228
|
@final
|
|
232
229
|
@property
|
|
233
230
|
def coordinate_inclusion(self) -> LinearOperator:
|
|
@@ -498,6 +495,17 @@ class DualHilbertSpace(HilbertSpace):
|
|
|
498
495
|
|
|
499
496
|
return LinearForm(self._underlying_space, components=c)
|
|
500
497
|
|
|
498
|
+
def __eq__(self, other: object) -> bool:
|
|
499
|
+
"""
|
|
500
|
+
Checks for equality with another dual space.
|
|
501
|
+
|
|
502
|
+
Two dual spaces are considered equal if and only if their underlying
|
|
503
|
+
primal spaces are equal.
|
|
504
|
+
"""
|
|
505
|
+
if not isinstance(other, DualHilbertSpace):
|
|
506
|
+
return NotImplemented
|
|
507
|
+
return self.underlying_space == other.underlying_space
|
|
508
|
+
|
|
501
509
|
@final
|
|
502
510
|
def duality_product(self, xp: LinearForm, x: Vector) -> float:
|
|
503
511
|
"""
|
|
@@ -572,6 +580,11 @@ class EuclideanSpace(HilbertSpace):
|
|
|
572
580
|
"""Maps a `LinearForm` back to a vector via its components."""
|
|
573
581
|
return self.dual.to_components(xp)
|
|
574
582
|
|
|
583
|
+
def __eq__(self, other: object):
|
|
584
|
+
if not isinstance(other, EuclideanSpace):
|
|
585
|
+
return NotImplemented
|
|
586
|
+
return self.dim == other.dim
|
|
587
|
+
|
|
575
588
|
|
|
576
589
|
class MassWeightedHilbertSpace(HilbertSpace):
|
|
577
590
|
"""
|
|
@@ -651,6 +664,22 @@ class MassWeightedHilbertSpace(HilbertSpace):
|
|
|
651
664
|
x = self.underlying_space.from_dual(xp)
|
|
652
665
|
return self._inverse_mass_operator(x)
|
|
653
666
|
|
|
667
|
+
def __eq__(self, other: object) -> bool:
|
|
668
|
+
"""
|
|
669
|
+
Checks for equality with another MassWeightedHilbertSpace.
|
|
670
|
+
|
|
671
|
+
Two mass-weighted spaces are considered equal if they share an equal
|
|
672
|
+
underlying space and their mass operators are also equal.
|
|
673
|
+
"""
|
|
674
|
+
if not isinstance(other, MassWeightedHilbertSpace):
|
|
675
|
+
return NotImplemented
|
|
676
|
+
|
|
677
|
+
return (
|
|
678
|
+
self.underlying_space == other.underlying_space
|
|
679
|
+
and (self.mass_operator == other.mass_operator)
|
|
680
|
+
and (self.inverse_mass_operator == other.inverse_mass_operator)
|
|
681
|
+
)
|
|
682
|
+
|
|
654
683
|
|
|
655
684
|
class MassWeightedHilbertModule(MassWeightedHilbertSpace, HilbertModule):
|
|
656
685
|
"""
|
|
@@ -172,7 +172,12 @@ class IterativeLinearSolver(LinearSolver):
|
|
|
172
172
|
"""
|
|
173
173
|
Solves the adjoint linear system A*y = x for y.
|
|
174
174
|
"""
|
|
175
|
-
|
|
175
|
+
adjoint_preconditioner = (
|
|
176
|
+
None
|
|
177
|
+
if preconditioner is None
|
|
178
|
+
else preconditioner.adjoint
|
|
179
|
+
)
|
|
180
|
+
return self.solve_linear_system(operator.adjoint, adjoint_preconditioner, x, y0)
|
|
176
181
|
|
|
177
182
|
def __call__(
|
|
178
183
|
self,
|
|
@@ -458,8 +458,14 @@ class Lebesgue(SphereHelper, HilbertModule, AbstractInvariantLebesgueSpace):
|
|
|
458
458
|
return LinearOperator.self_adjoint(self, mapping)
|
|
459
459
|
|
|
460
460
|
def __str__(self) -> str:
|
|
461
|
-
"""Returns
|
|
462
|
-
return
|
|
461
|
+
"""Returns a human-readable string summary of the space."""
|
|
462
|
+
return (
|
|
463
|
+
f"Lebesgue space on sphere:\n"
|
|
464
|
+
f"lmax={self.lmax}\n"
|
|
465
|
+
f"radius={self.radius}\n"
|
|
466
|
+
f"grid={self.grid}\n"
|
|
467
|
+
f"extend={self.extend}"
|
|
468
|
+
)
|
|
463
469
|
|
|
464
470
|
|
|
465
471
|
class Sobolev(SphereHelper, MassWeightedHilbertModule, AbstractInvariantSobolevSpace):
|
|
@@ -610,3 +616,15 @@ class Sobolev(SphereHelper, MassWeightedHilbertModule, AbstractInvariantSobolevS
|
|
|
610
616
|
|
|
611
617
|
c = self._coefficient_to_component(ulm)
|
|
612
618
|
return self.dual.from_components(c)
|
|
619
|
+
|
|
620
|
+
def __str__(self) -> str:
|
|
621
|
+
"""Returns a human-readable string summary of the space."""
|
|
622
|
+
return (
|
|
623
|
+
f"Lebesgue space on sphere:\n"
|
|
624
|
+
f"lmax={self.lmax}\n"
|
|
625
|
+
f"order={self.order}\n"
|
|
626
|
+
f"scale={self.scale}\n"
|
|
627
|
+
f"radius={self.radius}\n"
|
|
628
|
+
f"grid={self.grid}\n"
|
|
629
|
+
f"extend={self.extend}"
|
|
630
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|