Skip to content

Commit

Permalink
update test to use original LinearOperatorLowRankUpdate class
Browse files Browse the repository at this point in the history
  • Loading branch information
gschnabel committed Jun 30, 2024
1 parent ffaedab commit 15b6001
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/test_tf_uq_custom_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
)
from gmapy.mappings.tf.restricted_map import RestrictedMap
from gmapy.mappings.helperfuns.numeric_jacobian import numeric_jacobian
from gmapy.tf_uq.custom_linear_operators import MyLinearOperatorLowRankUpdate
# from gmapy.tf_uq.custom_linear_operators import MyLinearOperatorLowRankUpdate


class TestTfUQCustomDistributions(unittest.TestCase):
Expand Down Expand Up @@ -201,8 +201,11 @@ def create_Smat(self, exptable):

def create_like_cov_fun(self, expcov_linop, Smat):
def like_cov_fun(u):
covop = MyLinearOperatorLowRankUpdate(
expcov_linop, Smat, u
covop = tf.linalg.LinearOperatorLowRankUpdate(
expcov_linop, Smat, u,
is_self_adjoint=expcov_linop.is_self_adjoint,
is_positive_definite=expcov_linop.is_positive_definite,
is_diag_update_positive=True
)
return covop
return like_cov_fun
Expand All @@ -222,10 +225,14 @@ def test_hessian_of_likelihood_with_covpars(self):
tf.linalg.LinearOperatorLowerTriangular(p) for p in expchol_list
]
expcov_linop_list = [
tf.linalg.LinearOperatorComposition([p, p.adjoint()])
tf.linalg.LinearOperatorComposition(
[p, p.adjoint()], is_self_adjoint=True, is_positive_definite=True
)
for p in expchol_linop_list
]
expcov_linop = tf.linalg.LinearOperatorBlockDiag(expcov_linop_list)
expcov_linop = tf.linalg.LinearOperatorBlockDiag(
expcov_linop_list, is_self_adjoint=True, is_positive_definite=True
)
Smat = self.create_Smat(self._exptable)
like_cov_fun = self.create_like_cov_fun(expcov_linop, Smat)
num_params = len(priorvals)
Expand Down

0 comments on commit 15b6001

Please sign in to comment.