pygeoinf 1.1.4__py3-none-any.whl → 1.1.6__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/hilbert_space.py CHANGED
@@ -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,21 +219,6 @@ 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
  # ------------------------------------------------------------------- #
@@ -498,6 +493,17 @@ class DualHilbertSpace(HilbertSpace):
498
493
 
499
494
  return LinearForm(self._underlying_space, components=c)
500
495
 
496
+ def __eq__(self, other: object) -> bool:
497
+ """
498
+ Checks for equality with another dual space.
499
+
500
+ Two dual spaces are considered equal if and only if their underlying
501
+ primal spaces are equal.
502
+ """
503
+ if not isinstance(other, DualHilbertSpace):
504
+ return NotImplemented
505
+ return self.underlying_space == other.underlying_space
506
+
501
507
  @final
502
508
  def duality_product(self, xp: LinearForm, x: Vector) -> float:
503
509
  """
@@ -572,6 +578,11 @@ class EuclideanSpace(HilbertSpace):
572
578
  """Maps a `LinearForm` back to a vector via its components."""
573
579
  return self.dual.to_components(xp)
574
580
 
581
+ def __eq__(self, other: object):
582
+ if not isinstance(other, EuclideanSpace):
583
+ return NotImplemented
584
+ return self.dim == other.dim
585
+
575
586
 
576
587
  class MassWeightedHilbertSpace(HilbertSpace):
577
588
  """
@@ -651,6 +662,22 @@ class MassWeightedHilbertSpace(HilbertSpace):
651
662
  x = self.underlying_space.from_dual(xp)
652
663
  return self._inverse_mass_operator(x)
653
664
 
665
+ def __eq__(self, other: object) -> bool:
666
+ """
667
+ Checks for equality with another MassWeightedHilbertSpace.
668
+
669
+ Two mass-weighted spaces are considered equal if they share an equal
670
+ underlying space and their mass operators are also equal.
671
+ """
672
+ if not isinstance(other, MassWeightedHilbertSpace):
673
+ return NotImplemented
674
+
675
+ return (
676
+ self.underlying_space == other.underlying_space
677
+ and (self.mass_operator == other.mass_operator)
678
+ and (self.inverse_mass_operator == other.inverse_mass_operator)
679
+ )
680
+
654
681
 
655
682
  class MassWeightedHilbertModule(MassWeightedHilbertSpace, HilbertModule):
656
683
  """
@@ -457,6 +457,16 @@ class Lebesgue(SphereHelper, HilbertModule, AbstractInvariantLebesgueSpace):
457
457
 
458
458
  return LinearOperator.self_adjoint(self, mapping)
459
459
 
460
+ def __str__(self) -> str:
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
+ )
469
+
460
470
 
461
471
  class Sobolev(SphereHelper, MassWeightedHilbertModule, AbstractInvariantSobolevSpace):
462
472
  """
@@ -606,3 +616,15 @@ class Sobolev(SphereHelper, MassWeightedHilbertModule, AbstractInvariantSobolevS
606
616
 
607
617
  c = self._coefficient_to_component(ulm)
608
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
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pygeoinf
3
- Version: 1.1.4
3
+ Version: 1.1.6
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
@@ -2,7 +2,7 @@ pygeoinf/__init__.py,sha256=uYRwiHKi4nvzUBwQJxNdt8OZodFQ_nj5rUv2YkDXL9Q,1185
2
2
  pygeoinf/direct_sum.py,sha256=r0h-3bK6RQiOMoq086oupYaXgUM4pFIV8XNKOB2q9BE,17095
3
3
  pygeoinf/forward_problem.py,sha256=RnnVBMg8Ih7TqZylfSkQ7pdHEowEfCkTiXiKFrxBpnM,9754
4
4
  pygeoinf/gaussian_measure.py,sha256=SFnHmEjpcrUy09AfO3fXLLB_SaGwA9oc5PU630e3hNM,22826
5
- pygeoinf/hilbert_space.py,sha256=42RSYoIPf0hruyysBVoeJGmsmDtTrpaet5YMZnxwgys,22429
5
+ pygeoinf/hilbert_space.py,sha256=GIQMeU5yYDtGUv_nR9TjvJ6DJQKIVSe1JEMZy_qyLjg,23363
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
@@ -12,9 +12,9 @@ pygeoinf/operators.py,sha256=kbDfHpaWaSnd0zvoAVMBpWWiQRNfW0ImVhtzEEIH6mM,33165
12
12
  pygeoinf/random_matrix.py,sha256=_XVwXqM_c0SMpy6JU-8IboXpotug6dDDHKdSPAJpH7c,7788
13
13
  pygeoinf/symmetric_space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  pygeoinf/symmetric_space/circle.py,sha256=0EHPg2FcvWTOvCb8ualCW0uUp8RuUNfQ7oK6NHXtG1Q,17552
15
- pygeoinf/symmetric_space/sphere.py,sha256=hg9eAXdwbU9l_QssEcq86FOAQc6mBf416OKVjgsU2Ic,20540
15
+ pygeoinf/symmetric_space/sphere.py,sha256=edxLWXMqW857hYdN54X76HZyIe0lVVFdzrtCdTHM9Oc,21234
16
16
  pygeoinf/symmetric_space/symmetric_space.py,sha256=YkRjHucc2cO7IAoyJS5KMdiRBuytRpUfTUsVMHBPZYs,16146
17
- pygeoinf-1.1.4.dist-info/LICENSE,sha256=GrTQnKJemVi69FSbHprq60KN0OJGsOSR-joQoTq-oD8,1501
18
- pygeoinf-1.1.4.dist-info/METADATA,sha256=jFoUW2ZH9MrnRw-ZDJvwMJXL0R3yH5KdnLt2chnThUI,15324
19
- pygeoinf-1.1.4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
20
- pygeoinf-1.1.4.dist-info/RECORD,,
17
+ pygeoinf-1.1.6.dist-info/LICENSE,sha256=GrTQnKJemVi69FSbHprq60KN0OJGsOSR-joQoTq-oD8,1501
18
+ pygeoinf-1.1.6.dist-info/METADATA,sha256=FzoajwK5kOs47gJmHXkDrd9T1VeyPpxO9ERBFo7iJuc,15324
19
+ pygeoinf-1.1.6.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
20
+ pygeoinf-1.1.6.dist-info/RECORD,,