CUQIpy 1.3.0.post0.dev86__tar.gz → 1.3.0.post0.dev237__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.

Files changed (128) hide show
  1. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/PKG-INFO +1 -1
  2. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/PKG-INFO +1 -1
  3. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/_version.py +3 -3
  4. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/geometry/_productgeometry.py +3 -3
  5. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_rto.py +23 -15
  6. cuqipy-1.3.0.post0.dev237/cuqi/model/_model.py +1500 -0
  7. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/pde/_pde.py +14 -10
  8. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/solver/_solver.py +6 -2
  9. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/testproblem/_testproblem.py +2 -3
  10. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_distribution.py +1 -1
  11. cuqipy-1.3.0.post0.dev237/tests/test_model.py +1941 -0
  12. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_solver.py +12 -4
  13. cuqipy-1.3.0.post0.dev86/cuqi/model/_model.py +0 -796
  14. cuqipy-1.3.0.post0.dev86/tests/test_model.py +0 -516
  15. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/SOURCES.txt +0 -0
  16. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/dependency_links.txt +0 -0
  17. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/requires.txt +0 -0
  18. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/top_level.txt +0 -0
  19. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/LICENSE +0 -0
  20. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/README.md +0 -0
  21. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/__init__.py +0 -0
  22. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/_messages.py +0 -0
  23. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/array/__init__.py +0 -0
  24. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/array/_array.py +0 -0
  25. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/config.py +0 -0
  26. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/__init__.py +0 -0
  27. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/_data.py +0 -0
  28. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/astronaut.npz +0 -0
  29. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/camera.npz +0 -0
  30. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/cat.npz +0 -0
  31. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/cookie.png +0 -0
  32. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/satellite.mat +0 -0
  33. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/density/__init__.py +0 -0
  34. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/density/_density.py +0 -0
  35. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/diagnostics.py +0 -0
  36. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/__init__.py +0 -0
  37. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_beta.py +0 -0
  38. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_cauchy.py +0 -0
  39. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_cmrf.py +0 -0
  40. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_custom.py +0 -0
  41. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_distribution.py +0 -0
  42. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_gamma.py +0 -0
  43. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_gaussian.py +0 -0
  44. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_gmrf.py +0 -0
  45. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_inverse_gamma.py +0 -0
  46. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_joint_distribution.py +0 -0
  47. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_laplace.py +0 -0
  48. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_lmrf.py +0 -0
  49. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_lognormal.py +0 -0
  50. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_modifiedhalfnormal.py +0 -0
  51. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_normal.py +0 -0
  52. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_posterior.py +0 -0
  53. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_smoothed_laplace.py +0 -0
  54. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_truncated_normal.py +0 -0
  55. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_uniform.py +0 -0
  56. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/__init__.py +0 -0
  57. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/__init__.py +0 -0
  58. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/_ast.py +0 -0
  59. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/_orderedset.py +0 -0
  60. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/_randomvariable.py +0 -0
  61. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/geometry/__init__.py +0 -0
  62. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/__init__.py +0 -0
  63. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_conjugate.py +0 -0
  64. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_conjugate_approx.py +0 -0
  65. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_cwmh.py +0 -0
  66. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_direct.py +0 -0
  67. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_gibbs.py +0 -0
  68. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_hmc.py +0 -0
  69. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_langevin_algorithm.py +0 -0
  70. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_laplace_approximation.py +0 -0
  71. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_mh.py +0 -0
  72. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_pcn.py +0 -0
  73. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_sampler.py +0 -0
  74. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_utilities.py +0 -0
  75. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/geometry/__init__.py +0 -0
  76. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/geometry/_geometry.py +0 -0
  77. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/__init__.py +0 -0
  78. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_regularizedGMRF.py +0 -0
  79. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_regularizedGaussian.py +0 -0
  80. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_regularizedUnboundedUniform.py +0 -0
  81. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_restorator.py +0 -0
  82. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/likelihood/__init__.py +0 -0
  83. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/likelihood/_likelihood.py +0 -0
  84. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/model/__init__.py +0 -0
  85. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/operator/__init__.py +0 -0
  86. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/operator/_operator.py +0 -0
  87. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/pde/__init__.py +0 -0
  88. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/problem/__init__.py +0 -0
  89. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/problem/_problem.py +0 -0
  90. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/__init__.py +0 -0
  91. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_conjugate.py +0 -0
  92. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_conjugate_approx.py +0 -0
  93. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_cwmh.py +0 -0
  94. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_gibbs.py +0 -0
  95. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_hmc.py +0 -0
  96. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_langevin_algorithm.py +0 -0
  97. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_laplace_approximation.py +0 -0
  98. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_mh.py +0 -0
  99. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_pcn.py +0 -0
  100. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_rto.py +0 -0
  101. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_sampler.py +0 -0
  102. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/samples/__init__.py +0 -0
  103. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/samples/_samples.py +0 -0
  104. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/solver/__init__.py +0 -0
  105. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/testproblem/__init__.py +0 -0
  106. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/utilities/__init__.py +0 -0
  107. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/utilities/_get_python_variable_name.py +0 -0
  108. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/utilities/_utilities.py +0 -0
  109. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/pyproject.toml +0 -0
  110. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/requirements.txt +0 -0
  111. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/setup.cfg +0 -0
  112. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/setup.py +0 -0
  113. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_MRFs.py +0 -0
  114. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_abstract_distribution_density.py +0 -0
  115. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_bayesian_inversion.py +0 -0
  116. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_density.py +0 -0
  117. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_distributions_shape.py +0 -0
  118. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_geometry.py +0 -0
  119. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_implicit_priors.py +0 -0
  120. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_joint_distribution.py +0 -0
  121. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_likelihood.py +0 -0
  122. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_pde.py +0 -0
  123. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_posterior.py +0 -0
  124. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_problem.py +0 -0
  125. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_sampler.py +0 -0
  126. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_samples.py +0 -0
  127. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_testproblem.py +0 -0
  128. {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CUQIpy
3
- Version: 1.3.0.post0.dev86
3
+ Version: 1.3.0.post0.dev237
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.4
2
2
  Name: CUQIpy
3
- Version: 1.3.0.post0.dev86
3
+ Version: 1.3.0.post0.dev237
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": "2025-04-10T10:50:04+0200",
11
+ "date": "2025-05-15T09:06:20+0300",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "fe056d15f6ff918511cf7ee579dc8e7689c1dbc4",
15
- "version": "1.3.0.post0.dev86"
14
+ "full-revisionid": "b9a5dd37abfe2ee51d5594630de54dd3469bfeca",
15
+ "version": "1.3.0.post0.dev237"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -172,10 +172,10 @@ class _ProductGeometry(Geometry):
172
172
  return tuple(funvecs)
173
173
 
174
174
 
175
- def __repr__(self) -> str:
175
+ def __repr__(self, pad="") -> str:
176
176
  """Representation of the product geometry."""
177
177
  string = "{}(".format(self.__class__.__name__) + "\n"
178
178
  for g in self.geometries:
179
- string += "\t{}\n".format(g.__repr__())
180
- string += ")"
179
+ string += pad + " {}\n".format(g.__repr__())
180
+ string += pad + ")"
181
181
  return string
@@ -3,7 +3,7 @@ from scipy.linalg.interpolative import estimate_spectral_norm
3
3
  from scipy.sparse.linalg import LinearOperator as scipyLinearOperator
4
4
  import numpy as np
5
5
  import cuqi
6
- from cuqi.solver import CGLS, FISTA, ADMM, ScipyLinearLSQ
6
+ from cuqi.solver import CGLS, FISTA, ADMM, ScipyLinearLSQ, ScipyMinimizer
7
7
  from cuqi.experimental.mcmc import Sampler
8
8
 
9
9
 
@@ -167,6 +167,7 @@ class RegularizedLinearRTO(LinearRTO):
167
167
  ADMM: [2] Boyd et al. "Distributed optimization and statistical learning via the alternating direction method of multipliers."Foundations and Trends® in Machine learning, 2011.
168
168
  Used when prior.proximal is a list of penalty terms.
169
169
  ScipyLinearLSQ: Wrapper for Scipy's lsq_linear for the Trust Region Reflective algorithm. Optionally used when the constraint is either "nonnegativity" or "box".
170
+ ScipyMinimizer: Wrapper for Scipy's minimize. Optionally used when the constraint is either "nonnegativity" or "box".
170
171
 
171
172
  Parameters
172
173
  ------------
@@ -177,7 +178,7 @@ class RegularizedLinearRTO(LinearRTO):
177
178
  Initial point for the sampler. *Optional*.
178
179
 
179
180
  maxit : int
180
- Maximum number of iterations of the FISTA/ADMM/ScipyLinearLSQ solver. *Optional*.
181
+ Maximum number of iterations of the FISTA/ADMM/ScipyLinearLSQ/ScipyMinimizer solver. *Optional*.
181
182
 
182
183
  inner_max_it : int
183
184
  Maximum number of iterations of the CGLS solver used within the ADMM solver. *Optional*.
@@ -191,7 +192,7 @@ class RegularizedLinearRTO(LinearRTO):
191
192
  See [2] or `cuqi.solver.ADMM`
192
193
 
193
194
  abstol : float
194
- Absolute tolerance of the FISTA/ScipyLinearLSQ solver. *Optional*.
195
+ Absolute tolerance of the FISTA/ScipyLinearLSQ/ScipyMinimizer solver. *Optional*.
195
196
 
196
197
  inner_abstol : float
197
198
  Tolerance parameter for ScipyLinearLSQ's inner solve of the unbounded least-squares problem. *Optional*.
@@ -200,7 +201,7 @@ class RegularizedLinearRTO(LinearRTO):
200
201
  If True, FISTA is used as solver, otherwise ISTA is used. *Optional*.
201
202
 
202
203
  solver : string
203
- If set to "ScipyLinearLSQ", solver is set to cuqi.solver.ScipyLinearLSQ, otherwise FISTA/ISTA or ADMM is used. Note "ScipyLinearLSQ" can only be used with `RegularizedGaussian` of `box` or `nonnegativity` constraint. *Optional*.
204
+ Options are "FISTA" (default for a single constraint or regularization), "ADMM" (default and the only option for multiple constraints or regularizations), "ScipyLinearLSQ" and "ScipyMinimizer". Note "ScipyLinearLSQ" and "ScipyMinimizer" can only be used with `RegularizedGaussian` of a single `box` or `nonnegativity` constraint. *Optional*.
204
205
 
205
206
  callback : callable, optional
206
207
  A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
@@ -234,11 +235,11 @@ class RegularizedLinearRTO(LinearRTO):
234
235
 
235
236
  @solver.setter
236
237
  def solver(self, value):
237
- if value == "ScipyLinearLSQ":
238
+ if value == "ScipyLinearLSQ" or value == "ScipyMinimizer":
238
239
  if (self.target.prior.preset["constraint"] == "nonnegativity" or self.target.prior.preset["constraint"] == "box"):
239
240
  self._solver = value
240
241
  else:
241
- raise ValueError("ScipyLinearLSQ only supports RegularizedGaussian with box or nonnegativity constraint.")
242
+ raise ValueError("ScipyLinearLSQ and ScipyMinimizer only support RegularizedGaussian with box or nonnegativity constraint.")
242
243
  else:
243
244
  self._solver = value
244
245
 
@@ -281,15 +282,22 @@ class RegularizedLinearRTO(LinearRTO):
281
282
  sim = ADMM(self.M, y, self.proximal,
282
283
  self.current_point, self.penalty_parameter, maxit = self.maxit, inner_max_it = self.inner_max_it, adaptive = self.adaptive)
283
284
  elif self.solver == "ScipyLinearLSQ":
284
- A_op = sp.sparse.linalg.LinearOperator((sum([llh.dim for llh in self.likelihoods])+self.target.prior.dim, self.target.prior.dim),
285
- matvec=lambda x: self.M(x, 1),
286
- rmatvec=lambda x: self.M(x, 2)
287
- )
288
- sim = ScipyLinearLSQ(A_op, y, self.target.prior._box_bounds,
289
- max_iter = self.maxit,
290
- lsmr_maxiter = self.inner_max_it,
291
- tol = self.abstol,
292
- lsmr_tol = self.inner_abstol)
285
+ A_op = sp.sparse.linalg.LinearOperator((sum([llh.distribution.dim for llh in self.likelihoods])+self.target.prior.dim, self.target.prior.dim),
286
+ matvec=lambda x: self.M(x, 1),
287
+ rmatvec=lambda x: self.M(x, 2)
288
+ )
289
+ sim = ScipyLinearLSQ(A_op, y, self.target.prior._box_bounds,
290
+ max_iter = self.maxit,
291
+ lsmr_maxiter = self.inner_max_it,
292
+ tol = self.abstol,
293
+ lsmr_tol = self.inner_abstol)
294
+ elif self.solver == "ScipyMinimizer":
295
+ # Adapt bounds format, as scipy.minimize requires a bounds format
296
+ # different than that in scipy.lsq_linear.
297
+ bounds = [(self.target.prior._box_bounds[0][i], self.target.prior._box_bounds[1][i]) for i in range(self.target.prior.dim)]
298
+ # Note that the objective function is defined as 0.5*||Mx-y||^2,
299
+ # and the corresponding gradient (gradfunc) is given by M^T(Mx-y).
300
+ sim = ScipyMinimizer(lambda x: 0.5*np.sum((self.M(x, 1)-y)**2), self.current_point, gradfunc=lambda x: self.M(self.M(x, 1) - y, 2), bounds=bounds, tol=self.abstol, options={"maxiter": self.maxit})
293
301
  else:
294
302
  raise ValueError("Choice of solver not supported.")
295
303