Skip to content

Commit

Permalink
MAINT: fix a bunch of minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Holger Kohr committed Apr 5, 2017
1 parent 7c5a951 commit d51234c
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 283 deletions.
122 changes: 63 additions & 59 deletions doc/source/refs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,98 +3,102 @@
References
==========

.. [BB1988] Barzilai, J, and Borwein, J M. *Two-point step size
gradient methods*. IMA Journal of Numerical Analysis, 8 (1988),
pp 141--148.
.. [BB1988] Barzilai, J, and Borwein, J M.
*Two-point step size gradient methods*.
IMA Journal of Numerical Analysis, 8 (1988), pp 141--148.
.. [BC2011] Bauschke, H H, and Combettes, P L. *Convex analysis and
monotone operator theory in Hilbert spaces*. Springer, 2011.
.. [BC2011] Bauschke, H H, and Combettes, P L.
*Convex analysis and monotone operator theory in Hilbert spaces*.
Springer, 2011.
.. [BC2015] Bot, R I, and Csetnek, E R. *On the convergence rate of
a forward-backward type primal-dual splitting algorithm for convex
optimization problems*. Optimization, 64.1 (2015), pp 5--23.
.. [BC2015] Bot, R I, and Csetnek, E R.
*On the convergence rate of a forward-backward type primal-dual splitting algorithm for convex optimization problems*.
Optimization, 64.1 (2015), pp 5--23.
.. [BH2013] Bot, R I, and Hendrich, C. *A Douglas-Rachford type
primal-dual method for solving inclusions with mixtures of
composite and parallel-sum type monotone operators*. SIAM Journal
on Optimization, 23.4 (2013), pp 2541--2565.
.. [BH2013] Bot, R I, and Hendrich, C.
*A Douglas-Rachford type primal-dual method for solving inclusions with mixtures of composite and parallel-sum type monotone operators*.
SIAM Journal on Optimization, 23.4 (2013), pp 2541--2565.
.. [Bro1965] Broyden, C G. *A class of methods for solving nonlinear
simultaneous equations*. Mathematics of computation, 33 (1965),
pp 577--593.
.. [Bro1965] Broyden, C G.
*A class of methods for solving nonlinear simultaneous equations*.
Mathematics of computation, 33 (1965), pp 577--593.
.. [BV2004] Boyd, S, and Vandenberghe, L. *Convex optimization*.
.. [BV2004] Boyd, S, and Vandenberghe, L.
*Convex optimization*.
Cambridge university press, 2004.
.. [Che+2015] Cheng, A, Henderson, R, Mastronarde, D, Ludtke, S J,
Schoenmakers, R H M, Short, J, Marabini, R, Dallakyan, S, Agard, D,
and Winn, M. *MRC2014: Extensions to the MRC format header for electron
cryo-microscopy and tomography*. Journal of Structural Biology,
129 (2015), pp 146--150.
.. [Che+2015] Cheng, A, Henderson, R, Mastronarde, D, Ludtke, S J, Schoenmakers, R H M, Short, J, Marabini, R, Dallakyan, S, Agard, D, and Winn, M.
*MRC2014: Extensions to the MRC format header for electron cryo-microscopy and tomography*.
Journal of Structural Biology, 129 (2015), pp 146--150.
.. [CP2011a] Chambolle, A and Pock, T. *A First-Order
Primal-Dual Algorithm for Convex Problems with Applications to
Imaging*. Journal of Mathematical Imaging and Vision, 40 (2011),
pp 120-145.
.. [CP2011a] Chambolle, A and Pock, T.
*A First-Order Primal-Dual Algorithm for Convex Problems with Applications to Imaging*.
Journal of Mathematical Imaging and Vision, 40 (2011), pp 120-145.
.. [CP2011b] Chambolle, A and Pock, T. *Diagonal
preconditioning for first order primal-dual algorithms in convex
optimization*. 2011 IEEE International Conference on Computer Vision
(ICCV), 2011, pp 1762-1769.
.. [CP2011b] Chambolle, A and Pock, T.
*Diagonal preconditioning for first order primal-dual algorithms in convex optimization*.
2011 IEEE International Conference on Computer Vision (ICCV), 2011, pp 1762-1769.
.. [CP2011c] Combettes, P L, and Pesquet, J-C. *Proximal splitting
methods in signal processing.* In: Bauschke, H H, Burachik, R S,
Combettes, P L, Elser, V, Luke, D R, and Wolkowicz, H. Fixed-point
algorithms for inverse problems in science and engineering, Springer,
2011.
.. [CP2011c] Combettes, P L, and Pesquet, J-C.
*Proximal splitting methods in signal processing.*
In: Bauschke, H H, Burachik, R S, Combettes, P L, Elser, V, Luke, D R, and Wolkowicz, H.
Fixed-point algorithms for inverse problems in science and engineering, Springer, 2011.
.. [GNS2009] Griva, I, Nash, S G, and Sofer, A. *Linear and nonlinear
optimization*. Siam, 2009.
.. [GNS2009] Griva, I, Nash, S G, and Sofer, A.
*Linear and nonlinear optimization*.
Siam, 2009.
.. [Hei+2016] Heide, F et al. *ProxImaL: Efficient Image Optimization using
Proximal Algorithms*. ACM Transactions on Graphics (TOG), 2016.
.. [Hac2012] Hackbusch, W.
*Tensor Spaces and Numerical Tensor Calculus*. Springer, 2012.
.. [KP2015] Komodakis, N, and Pesquet, J-C. *Playing with Duality: An overview
of recent primal-dual approaches for solving large-scale optimization
problems*. IEEE Signal Processing Magazine, 32.6 (2015), pp 31--54.
.. [Hei+2016] Heide, F et al.
*ProxImaL: Efficient Image Optimization using Proximal Algorithms*.
ACM Transactions on Graphics (TOG), 2016.
.. [Kva1991] Kvaalen, E. *A faster Broyden method*. BIT Numerical
Mathematics 31 (1991), pp 369--372.
.. [KP2015] Komodakis, N, and Pesquet, J-C.
*Playing with Duality: An overview of recent primal-dual approaches for solving large-scale optimization problems*.
IEEE Signal Processing Magazine, 32.6 (2015), pp 31--54.
.. [Lue1969] Luenberger, D G. *Optimization by vector space methods*. Wiley,
1969.
.. [Kva1991] Kvaalen, E.
*A faster Broyden method*.
BIT Numerical Mathematics 31 (1991), pp 369--372.
.. [Okt2015] Oktem, O. *Mathematics of electron tomography*. In:
Scherzer, O. Handbook of Mathematical Methods in Imaging.
.. [Lue1969] Luenberger, D G.
*Optimization by vector space methods*.
Wiley, 1969.
.. [Okt2015] Oktem, O. *Mathematics of electron tomography*.
In: Scherzer, O. Handbook of Mathematical Methods in Imaging.
Springer, 2015, pp 937--1031.
.. [PB2014] Parikh, N, and Boyd, S. *Proximal Algorithms*.
.. [PB2014] Parikh, N, and Boyd, S.
*Proximal Algorithms*.
Foundations and Trends in Optimization, 1 (2014), pp 127-239.
.. [Pre+2007] Press, W H, Teukolsky, S A, Vetterling, W T, and Flannery, B P.
*Numerical Recipes in C - The Art of Scientific Computing* (Volume 3).
Cambridge University Press, 2007.
.. [Ray1997] Raydan, M. *The Barzilai and Borwein method for the
large scale unconstrained minimization problem*. SIAM J. Optim.,
7 (1997), pp 26--33.
.. [Ray1997] Raydan, M.
*The Barzilai and Borwein method for the large scale unconstrained minimization problem*.
SIAM J. Optim., 7 (1997), pp 26--33.
.. [Roc1970] Rockafellar, R. T. *Convex analysis*. Princeton
University Press, 1970.
.. [Roc1970] Rockafellar, R. T.
*Convex analysis*.
Princeton University Press, 1970.
.. [Sid+2012] Sidky, E Y, Jorgensen, J H, and Pan, X.
*Convex optimization problem prototyping for image reconstruction in
computed tomography with the Chambolle-Pock algorithm*. Physics in
Medicine and Biology, 57 (2012), pp 3065-3091.
*Convex optimization problem prototyping for image reconstruction in computed tomography with the Chambolle-Pock algorithm*.
Physics in Medicine and Biology, 57 (2012), pp 3065-3091.
.. [SW1971] Stein, E, and Weiss, G.
*Introduction to Fourier Analysis on Euclidean Spaces*.
Princeton University Press, 1971.
.. [Val2014] Valkonen, T.
*A primal-dual hybrid gradient method for non-linear operators with
applications to MRI*. Inverse Problems, 30 (2014).
*A primal-dual hybrid gradient method for non-linear operators with applications to MRI*.
Inverse Problems, 30 (2014).
.. [Du+2016] J. Duran, M. Moeller, C. Sbert, and D. Cremers.
*Collaborative Total Variation: A General Framework for Vectorial TV Models*
*Collaborative Total Variation: A General Framework for Vectorial TV Models*.
SIAM Journal of Imaging Sciences 9(1): 116--151, 2016.
2 changes: 1 addition & 1 deletion odl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from .set import *
__all__ += set.__all__

# operator must come before space because npy_ntuples imports Operator
# operator must come before space because fspace imports Operator
from .operator import *
__all__ += operator.__all__

Expand Down
16 changes: 8 additions & 8 deletions odl/discr/discr_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, map_type, fspace, partition, dspace, linear=False):
if self.domain.field is None:
raise TypeError('`fspace.field` cannot be `None` for '
'`linear=True`')
if not is_numerc_dtype(dspace.dtype):
if not is_numeric_dtype(dspace.dtype):
raise TypeError('`dspace.dtype` must be a numeric data type '
'for `linear=True`, got {}'
''.format(dtype_repr(dspace)))
Expand Down Expand Up @@ -377,9 +377,10 @@ def __init__(self, fspace, partition, dspace, variant='left'):
assumed to be sorted in ascending order in each dimension
for efficiency reasons.
- Nearest neighbor interpolation is the only scheme which works
with data of non-scalar type since it does not involve any
arithmetic operations on the values.
- The distinction between 'left' and 'right' variants is currently
with data of non-numeric data type since it does not involve any
arithmetic operations on the values, in contrast to other
interpolation methods.
- The distinction between left and right variants is currently
made by changing ``<=`` to ``<`` at one place. This difference
may not be noticable in some situations due to rounding errors.
"""
Expand Down Expand Up @@ -407,7 +408,7 @@ def nearest(arg, out=None):
input_type = 'array'

interpolator = _NearestInterpolator(
self.grid.coord_vectors, x.asarray(), variant=self.variant,
self.grid.coord_vectors, x, variant=self.variant,
input_type=input_type)

return interpolator(arg, out=out)
Expand Down Expand Up @@ -463,7 +464,7 @@ def linear(arg, out=None):
input_type = 'array'

interpolator = _LinearInterpolator(
self.grid.coord_vectors, x.asarray(), input_type=input_type)
self.grid.coord_vectors, x, input_type=input_type)

return interpolator(arg, out=out)

Expand Down Expand Up @@ -584,8 +585,7 @@ def per_axis_interp(arg, out=None):
input_type = 'array'

interpolator = _PerAxisInterpolator(
self.grid.coord_vectors,
x.asarray(),
self.grid.coord_vectors, x,
schemes=self.schemes, nn_variants=self.nn_variants,
input_type=input_type)

Expand Down
15 changes: 6 additions & 9 deletions odl/discr/discretization.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, uspace, dspace, sampling=None, interpol=None):
'the undiscretized space {}'
''.format(interpol.range, uspace))

TensorSpace.__init__(self, dspace.shape, dspace.dtype, dspace.order)
super().__init__(dspace.shape, dspace.dtype, dspace.order)
self.__uspace = uspace
self.__dspace = dspace
self.__sampling = sampling
Expand Down Expand Up @@ -237,7 +237,7 @@ def one(self):
@property
def weighting(self):
"""This space's weighting scheme."""
return getattr(self.dspace, 'weighting', None)
return self.dspace.weighting

@property
def is_weighted(self):
Expand Down Expand Up @@ -296,10 +296,7 @@ class DiscretizedSpaceElement(Tensor):

def __init__(self, space, tensor):
"""Initialize a new instance."""
assert isinstance(space, DiscretizedSpace)
assert tensor in space.dspace

Tensor.__init__(self, space)
super().__init__(space)
self.__tensor = tensor

@property
Expand Down Expand Up @@ -447,9 +444,9 @@ def interpolation(self):

def __ipow__(self, p):
"""Implement ``self **= p``."""
# Falls back to `LinearSpaceElement.__ipow__` if `self.tensor`
# has no own `__ipow__`. The fallback only works for integer `p`.
# TODO: do we even need this??
# The concrete `tensor` can specialize `__ipow__` for non-integer
# `p` so we want to use it here. Otherwise we get the default
# `LinearSpaceElement.__ipow__` which only works for integer `p`.
self.tensor.__ipow__(p)
return self

Expand Down
3 changes: 2 additions & 1 deletion odl/operator/default_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
from copy import copy

from odl.operator.operator import Operator
from odl.set import LinearSpace, Field, RealNumbers
from odl.set.space import LinearSpaceElement
from odl.space import ProductSpace
from odl.set import LinearSpace, LinearSpaceElement, Field, RealNumbers


__all__ = ('ScalingOperator', 'ZeroOperator', 'IdentityOperator',
Expand Down
3 changes: 2 additions & 1 deletion odl/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from numbers import Number, Integral
import sys

from odl.set import LinearSpace, LinearSpaceElement, Set, Field
from odl.set import LinearSpace, Set, Field
from odl.set.space import LinearSpaceElement


__all__ = ('Operator', 'OperatorComp', 'OperatorSum', 'OperatorVectorSum',
Expand Down
36 changes: 19 additions & 17 deletions odl/operator/tensor_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ class PointwiseNorm(PointwiseTensorFieldOperator):

"""Take the point-wise norm of a vector field.
This operator takes the (weighted) ``p``-norm
This operator computes the (weighted) p-norm in each point of
a vector field, thus producing a scalar-valued function.
It implements the formulas ::
``||F(x)|| = [ sum_j( w_j * |F_j(x)|^p ) ]^(1/p)``
||F(x)|| = [ sum_j( w_j * |F_j(x)|^p ) ]^(1/p)
for ``p`` finite and
for ``p`` finite and ::
``||F(x)|| = max_j( w_j * |F_j(x)| )``
||F(x)|| = max_j( w_j * |F_j(x)| )
for ``p = inf``, where ``F`` is a vector field. This implies that
the `Operator.domain` is a power space of a discretized function
Expand Down Expand Up @@ -311,9 +313,9 @@ def derivative(self, vf):
The derivative at ``F`` of the point-wise norm operator ``N``
with finite exponent ``p`` and weights ``w`` is the pointwise
inner product with the vector field
inner product with the vector field ::
``x --> N(F)(x)^(1-p) * [ F_j(x) * |F_j(x)|^(p-2) ]_j``.
x --> N(F)(x)^(1-p) * [ F_j(x) * |F_j(x)|^(p-2) ]_j
Note that this is not well-defined for ``F = 0``. If ``p < 2``,
any zero component will result in a singularity.
Expand Down Expand Up @@ -451,9 +453,9 @@ class PointwiseInner(PointwiseInnerBase):

"""Take the point-wise inner product with a given vector field.
This operator takes the (weighted) inner product
This operator takes the (weighted) inner product ::
``<F(x), G(x)> = sum_j ( w_j * F_j(x) * conj(G_j(x)) )``
<F(x), G(x)> = sum_j ( w_j * F_j(x) * conj(G_j(x)) )
for a given vector field ``G``, where ``F`` is the vector field
acting as a variable to this operator.
Expand Down Expand Up @@ -556,15 +558,15 @@ class PointwiseInnerAdjoint(PointwiseInnerBase):

"""Adjoint of the point-wise inner product operator.
The adjoint of the inner product operator is a mapping
The adjoint of the inner product operator is a mapping ::
``A^* : X --> X^d``.
A^* : X --> X^d
If the vector field space ``X^d`` is weighted by a vector ``v``,
the adjoint, applied to a function ``h`` from ``X`` is the vector
field
field ::
``x --> h(x) * (w / v) * G(x)``,
x --> h(x) * (w / v) * G(x),
where ``G`` and ``w`` are the vector field and weighting from the
inner product operator, resp., and all multiplications are understood
Expand All @@ -578,7 +580,7 @@ def __init__(self, sspace, vecfield, vfspace=None, weighting=None):
----------
sspace : `LinearSpace`
"Scalar" space on which the operator acts
vecfield : `range` `element-like`
vecfield : range `element-like`
Vector field of the point-wise inner product operator
vfspace : `ProductSpace`, optional
Space of vector fields to which the operator maps. It must
Expand Down Expand Up @@ -644,9 +646,9 @@ class PointwiseSum(PointwiseInner):

"""Take the point-wise sum of a vector field.
This operator takes the (weighted) sum
This operator takes the (weighted) sum ::
``sum(F(x)) = [ sum_j( w_j * F_j(x) ) ]``
sum(F(x)) = [ sum_j( w_j * F_j(x) ) ]
where ``F`` is a vector field. This implies that
the `Operator.domain` is a power space of a discretized function
Expand Down Expand Up @@ -715,8 +717,8 @@ def __init__(self, matrix, domain=None, range=None, axis=0):
----------
matrix : `array-like` or `scipy.sparse.base.spmatrix`
2-dimensional array representing the linear operator.
For Scipy sparse matrices only rank-1 tensor spaces are
allowed as ``domain``.
For Scipy sparse matrices only tensor spaces with
``ndim == 1`` are allowed as ``domain``.
domain : `TensorSpace`, optional
Space of elements on which the operator can act. Its
``dtype`` must be castable to ``range.dtype``.
Expand Down
Loading

0 comments on commit d51234c

Please sign in to comment.