Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pyproximal.egg-info/
pyproximal/version.py

# Development #
.codacy
.vscode
.ipynb_checkpoints/
notebooks
Expand Down
4 changes: 2 additions & 2 deletions pyproximal/optimization/primaldual.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def PrimalDual(
Linear operator of g
x0 : :obj:`numpy.ndarray`
Initial vector
tau : :obj:`float` or :obj:`np.ndarray`
tau : :obj:`float` or :obj:`numpy.ndarray`
Stepsize of subgradient of :math:`f`. This can be constant
or function of iterations (in the latter cases provided as np.ndarray)
mu : :obj:`float` or :obj:`np.ndarray`
mu : :obj:`float` or :obj:`numpy.ndarray`
Stepsize of subgradient of :math:`g^*`. This can be constant
or function of iterations (in the latter cases provided as np.ndarray)
y0 : :obj:`numpy.ndarray`
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/optimization/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def Segment(

Parameters
----------
y : :obj:`np.ndarray`
y : :obj:`numpy.ndarray`
Image to segment (must have 2 or more dimensions)
cl : :obj:`numpy.ndarray`
Classes
Expand Down
4 changes: 2 additions & 2 deletions pyproximal/optimization/sr3.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ def _lsqr(
Data
iter_lim: :obj:`int`
Maximum number of iterations
z_old: :obj:`np.ndarray`
z_old: :obj:`numpy.ndarray`
The previous outer iteration
x0: :obj:`numpy.ndarray`
initial guess
kappa: :obj:`float`
The regularization parameter for the inner iteration
eps: :obj:`float`
The regularization parameter for the outer iteration
Reg: :obj:`np.ndarray`
Reg: :obj:`numpy.ndarray`
The regularization operator L

Returns
Expand Down
12 changes: 6 additions & 6 deletions pyproximal/projection/Box.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class BoxProj:

Parameters
----------
lower : :obj:`float` or :obj:`np.ndarray`, optional
lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower bound
upper : :obj:`float` or :obj:`np.ndarray`, optional
upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper bound

Notes
Expand Down Expand Up @@ -56,13 +56,13 @@ class HyperPlaneBoxProj:

Parameters
----------
coeffs : :obj:`np.ndarray`
coeffs : :obj:`numpy.ndarray`
Vector of coefficients used in the definition of the hyperplane
scalar : :obj:`float`
Scalar used in the definition of the hyperplane
lower : :obj:`float` or :obj:`np.ndarray`, optional
lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower bound of Box
upper : :obj:`float` or :obj:`np.ndarray`, optional
upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper bound of Box
maxiter : :obj:`int`, optional
Maximum number of iterations used by :func:`scipy.optimize.bisect`
Expand Down Expand Up @@ -123,7 +123,7 @@ def __call__(self, x: NDArray) -> NDArray:

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Vector

"""
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/projection/Euclidean.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class EuclideanBallProj:

Parameters
----------
center : :obj:`np.ndarray` or :obj:`float`
center : :obj:`numpy.ndarray` or :obj:`float`
Center of the ball
radius : :obj:`float`
Radius
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/projection/Intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class IntersectionProj:
Size of vector to be projected
n : :obj:`int`
Number of vectors to be projected simultaneously
sigma : :obj:`np.ndarray`
sigma : :obj:`numpy.ndarray`
Matrix of distances of size :math:`k \times k`
niter : :obj:`int`, optional
Number of iterations
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/projection/Simplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __call__(self, x: NDArray) -> NDArray:

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Vector
maxiter : :obj:`int`, optional
Maximum number of iterations used by :func:`scipy.optimize.bisect`
Expand Down
4 changes: 2 additions & 2 deletions pyproximal/proximal/Box.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class Box(ProxOperator):

Parameters
----------
lower : :obj:`float` or :obj:`np.ndarray`, optional
lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower bound
upper : :obj:`float` or :obj:`np.ndarray`, optional
upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper bound

Notes
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/proximal/Euclidean.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class EuclideanBall(ProxOperator):

Parameters
----------
center : :obj:`np.ndarray` or :obj:`float`
center : :obj:`numpy.ndarray` or :obj:`float`
Center of the ball
radius : :obj:`float`
Radius
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/proximal/Intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Intersection(ProxOperator):
Size of vector to be projected
n : :obj:`int`
Number of vectors to be projected simultaneously
sigma : :obj:`np.ndarray` or :obj:`float`
sigma : :obj:`numpy.ndarray` or :obj:`float`
Matrix of distances of size :math:`k \times k` (or single value in the
case of constant matrix)
niter : :obj:`int`, optional
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/proximal/L0.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class L0(ProxOperator):

Parameters
----------
sigma : :obj:`float` or :obj:`np.ndarray` or :obj:`func`, optional
sigma : :obj:`float` or :obj:`numpy.ndarray` or :obj:`func`, optional
Multiplicative coefficient of L0 norm. This can be a constant number, a list
of values (for multidimensional inputs, acting on the second dimension) or
a function that is called passing a counter which keeps track of how many
Expand Down
4 changes: 2 additions & 2 deletions pyproximal/proximal/L1.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class L1(ProxOperator):

Parameters
----------
sigma : :obj:`float` or :obj:`np.ndarray` or :obj:`func`, optional
sigma : :obj:`float` or :obj:`numpy.ndarray` or :obj:`func`, optional
Multiplicative coefficient of L1 norm. This can be a constant number, a list
of values (for 2-dimensional inputs, acting on the second dimension) or
a function that is called passing a counter which keeps track of how many
times the ``prox`` method has been invoked before and returns a scalar (or a list of)
``sigma`` to be used.
g : :obj:`np.ndarray`, optional
g : :obj:`numpy.ndarray`, optional
Vector to be subtracted

Notes
Expand Down
4 changes: 2 additions & 2 deletions pyproximal/proximal/L2.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class L2(ProxOperator):
This can be a constant number or a function that is called passing a
counter which keeps track of how many times the ``prox`` method has
been invoked before and returns the ``niter`` to be used.
x0 : :obj:`np.ndarray`, optional
x0 : :obj:`numpy.ndarray`, optional
Initial vector
warm : :obj:`bool`, optional
Warm start (``True``) or not (``False``). Uses estimate from previous
Expand Down Expand Up @@ -316,7 +316,7 @@ class L2Convolve(ProxOperator):

Parameters
----------
h : :obj:`np.ndarray`
h : :obj:`numpy.ndarray`
Kernel of convolution operator
b : :obj:`numpy.ndarray`
Data vector
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/proximal/Nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Nonlinear(ABC, ProxOperator):

Parameters
----------
x0 : :obj:`np.ndarray`
x0 : :obj:`numpy.ndarray`
Initial vector
niter : :obj:`int`, optional
Number of iterations of iterative scheme used to compute the proximal
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/proximal/Orthogonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Orthogonal(ProxOperator):
Orthogonal operator
partial : :obj:`bool`, optional
Partial (``True``) of full (``False``) orthogonality
b : :obj:`np.ndarray`, optional
b : :obj:`numpy.ndarray`, optional
Vector
alpha : :obj:`float`, optional
Positive coefficient for partial orthogonality. It will be ignored if
Expand Down
8 changes: 4 additions & 4 deletions pyproximal/proximal/Quadratic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class Quadratic(ProxOperator):
----------
Op : :obj:`pylops.LinearOperator`, optional
Linear operator (must be square)
b : :obj:`np.ndarray`, optional
b : :obj:`numpy.ndarray`, optional
Vector
c : :obj:`float`, optional
Scalar
niter : :obj:`int`, optional
Number of iterations of iterative scheme used to compute the proximal
x0 : :obj:`np.ndarray`, optional
x0 : :obj:`numpy.ndarray`, optional
Initial vector
warm : :obj:`bool`, optional
Warm start (``True``) or not (``False``). Uses estimate from previous
Expand Down Expand Up @@ -121,12 +121,12 @@ def grad(self, x: NDArray) -> NDArray:

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Vector

Returns
-------
g : :obj:`np.ndarray`
g : :obj:`numpy.ndarray`
Gradient vector

"""
Expand Down
10 changes: 5 additions & 5 deletions pyproximal/proximal/RelaxedMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class RelaxedMumfordShah(ProxOperator):

Parameters
----------
sigma : :obj:`float` or :obj:`np.ndarray` or :obj:`func`, optional
sigma : :obj:`float` or :obj:`numpy.ndarray` or :obj:`func`, optional
Multiplicative coefficient of L2 norm that controls the smoothness of the solutuon.
This can be a constant number, a list of values (for multidimensional inputs, acting
on the second dimension) or a function that is called passing a counter which keeps
track of how many times the ``prox`` method has been invoked before and returns a
scalar (or a list of) ``sigma`` to be used.
kappa : :obj:`float` or :obj:`np.ndarray` or :obj:`func`, optional
kappa : :obj:`float` or :obj:`numpy.ndarray` or :obj:`func`, optional
Constant value in the rMS norm which essentially controls when the norm allows a jump. This can be a
constant number, a list of values (for multidimensional inputs, acting on the second dimension) or
a function that is called passing a counter which keeps track of how many
Expand All @@ -58,10 +58,10 @@ class RelaxedMumfordShah(ProxOperator):
The :math:`rMS` proximal operator is defined as [1]_:

.. math::
\text{prox}_{\tau \text{rMS}}(x) =
\text{prox}_{\tau \text{rMS}}(\mathbf{x}) =
\begin{cases}
\frac{1}{1+2\tau\alpha}x & \text{ if } & \vert x\vert \leq \sqrt{\frac{\kappa}{\alpha}(1 + 2\tau\alpha)} \\
\kappa & \text{ else }
\frac{1}{1+2\tau\alpha}x_i & \text{ if } & \vert x_i\vert \leq \sqrt{\frac{\kappa}{\alpha}(1 + 2\tau\alpha)} \\
x_i & \text{ else }
\end{cases}.

.. [1] Strekalovskiy, E., and D. Cremers, 2014, Real-time minimization of the piecewise smooth
Expand Down
4 changes: 2 additions & 2 deletions pyproximal/proximal/Sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Sum(ProxOperator):
----------
ops : :obj:`list`
A list of proximable functions :math:`f_1, \ldots, f_m`.
weights : :obj:`np.ndarray` or :obj:`list` or :obj:`None`, optional, default=None
weights : :obj:`numpy.ndarray` or :obj:`list` or :obj:`None`, optional, default=None
Weights :math:`\sum_{i=1}^m w_i = 1, \ 0 < w_i < 1`,
used when :math:`m > 2`, or :math:`m = 2` and ``use_parallel=True``.
Defaults to None, which means :math:`w_1 = \cdots = w_m = \frac{1}{m}.`
Expand Down Expand Up @@ -142,7 +142,7 @@ def __call__(self, x: NDArray) -> bool | float:

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Vector

Returns
Expand Down
10 changes: 5 additions & 5 deletions pyproximal/proximal/_Simplex_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ def simplex_jit_cuda(x, coeffs, scalar, lower, upper, maxiter, ftol, xtol, y):

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Input vector
coeffs : :obj:`np.ndarray`
coeffs : :obj:`numpy.ndarray`
Vector of coefficients used in the definition of the hyperplane
scalar : :obj:`float`
Scalar used in the definition of the hyperplane
lower : :obj:`float` or :obj:`np.ndarray`, optional
lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower bound of Box
upper : :obj:`float` or :obj:`np.ndarray`, optional
upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper bound of Box
maxiter : :obj:`int`, optional
Maximum number of iterations
ftol : :obj:`float`, optional
Function tolerance
xtol : :obj:`float`, optional
Solution absolute tolerance
y : :obj:`np.ndarray`
y : :obj:`numpy.ndarray`
Output vector

"""
Expand Down
20 changes: 10 additions & 10 deletions pyproximal/proximal/_Simplex_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ def bisect_jit(

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Input vector
coeffs : :obj:`np.ndarray`
coeffs : :obj:`numpy.ndarray`
Vector of coefficients used in the definition of the hyperplane
scalar : :obj:`float`
Scalar used in the definition of the hyperplane
lower : :obj:`float` or :obj:`np.ndarray`, optional
lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower bound of Box
upper : :obj:`float` or :obj:`np.ndarray`, optional
upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper bound of Box
bisect_lower : :obj:`float` or :obj:`np.ndarray`, optional
bisect_lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower end of bisection
bisect_upper : :obj:`float` or :obj:`np.ndarray`, optional
bisect_upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper end of bisection
maxiter : :obj:`int`, optional
Maximum number of iterations
Expand Down Expand Up @@ -91,15 +91,15 @@ def simplex_jit(

Parameters
----------
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Input vector
coeffs : :obj:`np.ndarray`
coeffs : :obj:`numpy.ndarray`
Vector of coefficients used in the definition of the hyperplane
scalar : :obj:`float`
Scalar used in the definition of the hyperplane
lower : :obj:`float` or :obj:`np.ndarray`, optional
lower : :obj:`float` or :obj:`numpy.ndarray`, optional
Lower bound of Box
upper : :obj:`float` or :obj:`np.ndarray`, optional
upper : :obj:`float` or :obj:`numpy.ndarray`, optional
Upper bound of Box
maxiter : :obj:`int`, optional
Maximum number of iterations
Expand Down
2 changes: 1 addition & 1 deletion pyproximal/utils/moreau.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def moreau(
----------
prox : :obj:`pyproximal.ProxOperator`
Proximal operator
x : :obj:`np.ndarray`
x : :obj:`numpy.ndarray`
Vector
tau : :obj:`float`
Positive scalar weight
Expand Down