CUQIpy 1.0.0.post0.dev200__tar.gz → 1.0.0.post0.dev215__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.
Potentially problematic release.
This version of CUQIpy might be problematic. Click here for more details.
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/CUQIpy.egg-info/PKG-INFO +1 -1
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/PKG-INFO +1 -1
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/_version.py +3 -3
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_gaussian.py +12 -4
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/utilities/__init__.py +1 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/utilities/_utilities.py +15 -1
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_distribution.py +20 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/CUQIpy.egg-info/SOURCES.txt +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/CUQIpy.egg-info/dependency_links.txt +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/CUQIpy.egg-info/requires.txt +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/CUQIpy.egg-info/top_level.txt +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/LICENSE +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/README.md +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/_messages.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/array/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/array/_array.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/config.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/_data.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/astronaut.npz +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/camera.npz +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/cat.npz +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/cookie.png +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/data/satellite.mat +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/density/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/density/_density.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/diagnostics.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_beta.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_cauchy.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_cmrf.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_custom.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_distribution.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_gamma.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_gmrf.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_inverse_gamma.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_joint_distribution.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_laplace.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_lmrf.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_lognormal.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_normal.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_posterior.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_uniform.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_cwmh.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_hmc.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_langevin_algorithm.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_laplace_approximation.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_mh.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_pcn.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_rto.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/experimental/mcmc/_sampler.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/geometry/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/geometry/_geometry.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/implicitprior/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/implicitprior/_regularizedGMRF.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/implicitprior/_regularizedGaussian.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/likelihood/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/likelihood/_likelihood.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/model/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/model/_model.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/operator/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/operator/_operator.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/pde/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/pde/_pde.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/problem/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/problem/_problem.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_conjugate.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_conjugate_approx.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_cwmh.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_gibbs.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_hmc.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_langevin_algorithm.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_laplace_approximation.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_mh.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_pcn.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_rto.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_sampler.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/samples/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/samples/_samples.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/solver/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/solver/_solver.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/testproblem/__init__.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/testproblem/_testproblem.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/utilities/_get_python_variable_name.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/pyproject.toml +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/requirements.txt +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/setup.cfg +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/setup.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_MRFs.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_abstract_distribution_density.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_bayesian_inversion.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_density.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_distributions_shape.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_geometry.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_implicit_priors.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_joint_distribution.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_likelihood.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_model.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_pde.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_posterior.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_problem.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_sampler.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_samples.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_solver.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_testproblem.py +0 -0
- {cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.0.0.post0.
|
|
3
|
+
Version: 1.0.0.post0.dev215
|
|
4
4
|
Summary: Computational Uncertainty Quantification for Inverse problems in Python
|
|
5
5
|
Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>, Chao Zhang <chaz@dtu.dk>
|
|
6
6
|
License: Apache License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.0.0.post0.
|
|
3
|
+
Version: 1.0.0.post0.dev215
|
|
4
4
|
Summary: Computational Uncertainty Quantification for Inverse problems in Python
|
|
5
5
|
Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>, Chao Zhang <chaz@dtu.dk>
|
|
6
6
|
License: Apache License
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-
|
|
11
|
+
"date": "2024-05-16T11:29:50+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.0.0.post0.
|
|
14
|
+
"full-revisionid": "b713d6478d33977b12342e4bcb29968a95ee5973",
|
|
15
|
+
"version": "1.0.0.post0.dev215"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -9,7 +9,7 @@ import scipy.linalg as splinalg
|
|
|
9
9
|
|
|
10
10
|
from cuqi import config
|
|
11
11
|
from cuqi.geometry import _get_identity_geometries
|
|
12
|
-
from cuqi.utilities import force_ndarray, sparse_cholesky
|
|
12
|
+
from cuqi.utilities import force_ndarray, sparse_cholesky, check_if_conditional_from_attr
|
|
13
13
|
from cuqi.distribution import Distribution
|
|
14
14
|
|
|
15
15
|
# We potentially allow the use of sksparse.cholmod for sparse Cholesky
|
|
@@ -191,7 +191,7 @@ class Gaussian(Distribution):
|
|
|
191
191
|
value = force_ndarray(value)
|
|
192
192
|
self._sqrtcov = value
|
|
193
193
|
self._cov = None # Reset covariance (in case it was computed before)
|
|
194
|
-
if (value is not None) and (not callable(value)):
|
|
194
|
+
if (value is not None) and (not callable(value)):
|
|
195
195
|
if self.dim > config.MIN_DIM_SPARSE:
|
|
196
196
|
sparse_flag = True # do sparse computations
|
|
197
197
|
else:
|
|
@@ -214,7 +214,7 @@ class Gaussian(Distribution):
|
|
|
214
214
|
value = force_ndarray(value)
|
|
215
215
|
self._sqrtprec = value
|
|
216
216
|
self._cov = None # Reset covariance (in case it was computed before)
|
|
217
|
-
if
|
|
217
|
+
if not check_if_conditional_from_attr(value):
|
|
218
218
|
if self.dim > config.MIN_DIM_SPARSE:
|
|
219
219
|
sparse_flag = True # do sparse computations
|
|
220
220
|
else:
|
|
@@ -631,7 +631,7 @@ def get_sqrtprec_from_sqrtprec(dim, sqrtprec, sparse_flag):
|
|
|
631
631
|
dim : int
|
|
632
632
|
Dimension of the sqrtprec matrix.
|
|
633
633
|
|
|
634
|
-
sqrtprec : 1-d or 2-d ndarray or sparse matrix
|
|
634
|
+
sqrtprec : 1-d or 2-d ndarray or sparse matrix or scipy.sparse.linalg.LinearOperator
|
|
635
635
|
Square root of precision matrix. If 1-dimensional, then assumed to be a diagonal matrix.
|
|
636
636
|
|
|
637
637
|
sparse_flag: bool
|
|
@@ -666,6 +666,14 @@ def get_sqrtprec_from_sqrtprec(dim, sqrtprec, sparse_flag):
|
|
|
666
666
|
logdet = np.sum(-np.log(sqrtprec.data**2))
|
|
667
667
|
rank = dim
|
|
668
668
|
|
|
669
|
+
# sqrtprec is LinearOperator
|
|
670
|
+
elif isinstance(sqrtprec, spa.linalg.LinearOperator):
|
|
671
|
+
if hasattr(sqrtprec, 'logdet'):
|
|
672
|
+
logdet = sqrtprec.logdet
|
|
673
|
+
else:
|
|
674
|
+
logdet = None
|
|
675
|
+
rank = dim
|
|
676
|
+
|
|
669
677
|
# sqrtprec diagonal
|
|
670
678
|
elif np.count_nonzero(sqrtprec-np.diag(sqrtprec.diagonal())) == 0:
|
|
671
679
|
stdinv = sqrtprec.diagonal()
|
|
@@ -64,13 +64,27 @@ def get_indirect_variables(dist):
|
|
|
64
64
|
attributes = []
|
|
65
65
|
for attribute in dist.get_mutable_variables():
|
|
66
66
|
value = getattr(dist, attribute)
|
|
67
|
-
if
|
|
67
|
+
if check_if_conditional_from_attr(value):
|
|
68
68
|
keys = get_non_default_args(value)
|
|
69
69
|
for key in keys:
|
|
70
70
|
if key not in attributes: #Ensure we did not already find this key
|
|
71
71
|
attributes.append(key)
|
|
72
72
|
return attributes
|
|
73
73
|
|
|
74
|
+
def check_if_conditional_from_attr(value):
|
|
75
|
+
"""
|
|
76
|
+
Check if a distribution is conditional from a given attribute.
|
|
77
|
+
So far, we assume that a distribution is conditional if
|
|
78
|
+
- the given attribute is a callable function and
|
|
79
|
+
- the given attribute is not a LinearOperator.
|
|
80
|
+
"""
|
|
81
|
+
if isinstance(value, spslinalg.LinearOperator):
|
|
82
|
+
return False
|
|
83
|
+
elif callable(value):
|
|
84
|
+
return True
|
|
85
|
+
else:
|
|
86
|
+
return False
|
|
87
|
+
|
|
74
88
|
def get_writeable_attributes(dist):
|
|
75
89
|
""" Get writeable attributes of object instance. """
|
|
76
90
|
attributes = []
|
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
|
4
4
|
import scipy as sp
|
|
5
5
|
import scipy.stats as scipy_stats
|
|
6
6
|
import scipy.sparse as sps
|
|
7
|
+
import numpy.linalg as nplinalg
|
|
7
8
|
|
|
8
9
|
from pytest import approx
|
|
9
10
|
import pytest
|
|
@@ -738,3 +739,22 @@ def test_Gaussian_from_sparse_sqrtprec():
|
|
|
738
739
|
|
|
739
740
|
assert y_from_dense.logpdf(np.ones(N)) == y_from_sparse.logpdf(np.ones(N))
|
|
740
741
|
|
|
742
|
+
def test_Gaussian_from_linear_operator_sqrtprec():
|
|
743
|
+
""" Test Gaussian distribution from LinearOperator sqrtprec is equal to dense sqrtprec """
|
|
744
|
+
N = 10; M = 5
|
|
745
|
+
|
|
746
|
+
sqrtprec = sp.sparse.spdiags(np.random.randn(N), 0, N, N)
|
|
747
|
+
prec = sqrtprec.todense()@sqrtprec.todense().T
|
|
748
|
+
|
|
749
|
+
def matvec(x):
|
|
750
|
+
return sqrtprec @ x
|
|
751
|
+
def rmatvec(x):
|
|
752
|
+
return sqrtprec.T @ x
|
|
753
|
+
|
|
754
|
+
sqrtprec_operator = sp.sparse.linalg.LinearOperator((N, N), matvec=matvec, rmatvec=rmatvec)
|
|
755
|
+
sqrtprec_operator.logdet = -np.log(nplinalg.det(prec))
|
|
756
|
+
|
|
757
|
+
y_from_sparse = cuqi.distribution.Gaussian(mean = np.zeros(N), sqrtprec = sqrtprec_operator)
|
|
758
|
+
y_from_dense = cuqi.distribution.Gaussian(mean = np.zeros(N), sqrtprec = sqrtprec.todense())
|
|
759
|
+
|
|
760
|
+
assert np.allclose(y_from_dense.logpdf(np.ones(N)), y_from_sparse.logpdf(np.ones(N)))
|
|
File without changes
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/CUQIpy.egg-info/dependency_links.txt
RENAMED
|
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
|
|
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
|
|
File without changes
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/distribution/_joint_distribution.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/implicitprior/_regularizedGMRF.py
RENAMED
|
File without changes
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/implicitprior/_regularizedGaussian.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/sampler/_laplace_approximation.py
RENAMED
|
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
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/cuqi/utilities/_get_python_variable_name.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.0.0.post0.dev200 → cuqipy-1.0.0.post0.dev215}/tests/test_abstract_distribution_density.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|