bartorch.linop.Gradient#
- bartorch.linop.Gradient(shape, axes)#
Finite differences along
axes, stacked on a new leading axis.BART’s
linop_grad. The codomain is(len(axes), *shape): one difference per axis, side by side, which is what a total-variation term is built on.The difference is the forward one and the boundary is circular: component
iat the last index along its axis is the first entry minus the last, not zero. So the operator has a null space – a constant maps to zero – which is the usual thing for a gradient and worth knowing before solving with one.The components come out in ascending axis order, whatever order
axesnames them in. BART stacks them by bit position, and its bits run the opposite way to C-order axes, so this reverses that with BART’s ownlinop_fliprather than leaving the caller to discover thataxes=(0, 1)puts axis 1 first.- Parameters:
shape (tuple of int) – The domain, C order.
axes (int or tuple of int) – Which axes to difference along. Order does not matter: BART takes a set of axes, and the result is ordered by axis either way.