LinearOperatorCollection.SamplingOp — Type
SamplingOp(::Type{T}; pattern, shape::Tuple=(), S = Vector{T})builds a linear operator that samples a vector at the positions given by pattern.
Two modes are supported:
- integer indices with
shape: returns the entries of a vectorized array of sizeshapeat the indices inpattern. A multidimensionalpatternholds indices into the first dimension, one column per remaining index, and is converted withvectorizePattern. A one-dimensionalpatternis used as is and not copied. - Boolean mask without
shape: multiplies the input elementwise with a copy ofpatternstored on the backend ofS.
Adapt.adapt(to, op) rebuilds the operator for the storage type to from its effective pattern. Integer indices are copied and stay host arrays; the Boolean mask is copied to the target backend.
Arguments
pattern- integer indices or Boolean maskshape::Tuple- size of the array to sample (integer indices only)S- storage type of the operator
LinearOperatorCollection.WeightingOp — Type
WeightingOp(::Type{T}; weights::Vector{T}, rep::Int=1) where Tgenerates a LinearOperator which multiplies an input vector index-wise with weights
Arguments
weights::Vector{T}- weights vectorrep::Int=1- number of sub-arrays that need to be multiplied withweights
LinearOperatorCollection.DiagOp — Type
DiagOp(ops...; scheduler = DynamicScheduler())
DiagOp(ops::Vector{...}; scheduler = DynamicScheduler())
DiagOp(ops::NTuple{N,...}; scheduler = DynamicScheduler())create a bloc-diagonal operator out of the LinearOperators or Arrays contained in ops. Provide a OhMyThreads.Scheduler to change multi-tasking behaviour of the operator. Defaults to parallel execution
LinearOperatorCollection.RowBlockOp — Type
RowBlockOp(ops, rows; scheduler = DynamicScheduler())
RowBlockOp(ops; scheduler = DynamicScheduler())
RowBlockOp(A::AbstractMatrix, nblocks; mode = :interleaved, rng = Random.default_rng(), scheduler = DynamicScheduler())create an operator out of the operators (or Arrays) in ops stacked vertically, [ops[1]; ops[2]; …], whose rows are scattered over the rows of the result: the rows of ops[k] are the rows rows[k] of the operator. All operators have the same number of columns, and rows is a partition of 1:nrow into index vectors or ranges, one per operator, of the length of that operator's number of rows. Without rows, the blocks are contiguous, in the order of ops.
Block-iterative solvers (e.g. ordered-subset methods) access the blocks with rowblocks. Applied as a whole, the operator multiplies every block and writes its result into its rows, and its adjoint sums the adjoints of the blocks applied to their rows. The products of the blocks run in parallel with scheduler (OhMyThreads.jl); the adjoint sums the blocks one after the other.
Blocks with contiguous rows (UnitRanges) work on views of the data; other rows are gathered into and scattered from a buffer per block (with index vectors on the device of the blocks, see Adapt.adapt). Reordering the data such that every block is contiguous avoids these copies.
The third form splits the rows of a matrix into nblocks blocks, as copies of the rows: :interleaved takes every nblocks-th row (k:nblocks:m), :contiguous consecutive rows, :random a random partition drawn with rng.
LinearOperatorCollection.rowblocks — Function
rowblocks(op::RowBlockOp)the blocks of op as pairs (operator, rows).
LinearOperatorCollection.GradientOp — Type
GradientOp(T::Type; shape::Tuple, dims=1:length(shape))
directional gradient operator along the dimensions dims for an array of size shape.
Required Argument
T- type of elements, .e.g.Float64forComplexF32
Required Keyword argument
shape::NTuple{N,Int}- shape of the array (e.g., image)
Optional Keyword argument
dims- dimension(s) along which the gradient is applied; default is1:length(shape)S- storage type of the operator, e.g.Vector{T}(default) orCuArray{T, 1}
Moving to another array backend
Adapt.adapt(CuArray, op)returns a new gradient operator for the target backend, and copy(op) returns a new one with the same storage type. The target is the backing array type without element-type parameters (e.g. Array, JLArray, CuArray or ROCArray). Unlike S, which takes a parameterized type such as CuArray{T, 1}, an element-typed target such as Array{Float64} is not supported, even when its element type matches op. Adapting does not change the precision: choose T at construction. Both rebuild the operator and its temporary storage from shape and the directions taken from dims at construction; a later change of the vector passed as dims, or an iterator consumed by the construction, has no effect. op itself is not modified. The directions stay on the host. An element-typed target whose element type differs from op, such as CuArray{Float32} for a Float64 operator, throws an ArgumentError. An operator built with an S of another element type cannot be adapted to any target and throws an ArgumentError; copy keeps it as it is.
LinearOperatorCollection.ProdOp — Type
ProdOp(A,B)composition/product of two Operators. Computes (A * (B * x)). Differs with composition via * since it can handle normal operator and allows for specialisation on A and B.
LinearOperatorCollection.NormalOp — Type
NormalOp(T::Type; parent, weights)Lazy normal operator of parent with an optional weighting operator weights. Computes adjoint(parent) * weights * parent.
Required Argument
T- type of elements, .e.g.Float64forComplexF32
Required Keyword argument
parent- Base operator
Optional Keyword argument
weights- Optional weights for normal operator. Must already be of formweights = adjoint.(w) .* w
LinearOperatorCollection.normalOperator — Function
normalOperator(prod::ProdOp{T, <:WeightingOp, matT}; kwargs...)Fuses weights of WeightingOp by computing adjoint.(weights) .* weights
normalOperator(parent (, weights); kwargs...)
Constructs a normal operator of the parent in an opinionated way, i.e. it tries to apply optimisations to the resulting operator.
normalOperator(op::RowBlockOp, W = nothing; kwargs...)the normal operator adjoint(op) * W * op as the sum of the normal operators of the blocks (each with the part of the weights W that belongs to its rows), so that specialized normal operators of the blocks are used.
LinearOperatorCollection.WaveletOp — Type
WaveletOp(shape, wt=wavelet(WT.db2))
returns a ẀaveletOp <: AbstractLinearOperator, which performs a Wavelet transform on a given input array.
Arguments
shape- size of the Array to transform- (
wt=wavelet(WT.db2)) - Wavelet to apply
LinearOperatorCollection.RadonOp — Type
RadonOp(::Type{T}; shape::NTuple{N, Int}, angles, geometry = RadonParallelCircle(shape[1], -(shape[1]-1)÷2:(shape[1]-1)÷2), μ = nothing, S = Vector{T}) where {T, N}Generates a RadonOp which evaluates the Radon transform operator and its adjoint (backprojection) for a given geometry and projection angles.
Arguments:
T- element type for the operator (e.g.,Float64,ComplexF32)shape::NTuple{N, Int}- size of the imageangles- array of projection anglesgeometry- Radon geometry descriptor (default: parallel beam circle)μ- optional attenuation map (for attenuated Radon transform)S- storage type for internal vectors (default:Vector{T})
Adapt.adapt(target, op) rebuilds the operator for target with the same shape and geometry; array angles and μ are adapted to target, ranges and scalars are kept.
LinearOperatorCollection.NFFTOp — Type
NFFTOpImpl(shape::Tuple, tr::Trajectory; kargs...)
NFFTOpImpl(shape::Tuple, tr::AbstractMatrix; kargs...)generates a NFFTOpImpl which evaluates the MRI Fourier signal encoding operator using the NFFT.
Arguments:
shape::NTuple{D,Int64}- size of image to encode/reconstructnodes=nothing- Array containg the trajectory nodestoeplitz=false-oversamplingFactor=1.25kernelSize=3precompute = AbstractNFFTs.TENSORPrecompute flag for the NFFT backend- (
kargs) - additional keyword arguments for the NFFT plan - (
cache=true) - cache a defensive copy of the node matrix and plan-constructor arguments forAdapt.adapt; this uses additional memory. Set tofalseto avoid that retained state and opt out of reconstruction support
Adapt.adapt(target, op) preserves the node geometry, NFFT backend, plan settings, and toeplitz; it replays the cached constructor arguments with target-backed nodes and rebuilds plans, workspaces, and closures for the target. If cache=false, adapting the operator raises an explicit ArgumentError because the constructor arguments were not retained.
LinearOperatorCollection.FFTOp — Type
FFTOp(T::Type; shape::Tuple, shift=true, unitary=true)
returns an operator which performs an FFT on Arrays of type T
Arguments:
T::Type- type of the array to transformshape::Tuple- size of the array to transform- (
shift=true) - if true, fftshifts are performed - (
unitary=true) - if true, FFT is normalized such that it is unitary - (
S = Vector{T}) - type of temporary vector, change to use on GPU - (
kwargs...) - keyword arguments given to fft plan - (
cache=true) - cache the FFT plan kwargs forAdapt.adapt; set tofalseto opt out of that reconstruction support
Adapt.adapt(target, op) preserves the shape, shift, and normalization convention, planner options, and rebuilds the plans, workspaces, and closures for target. If cache=false, adapting the operator raises an explicit ArgumentError because the planner options were not retained.
LinearOperatorCollection.DCTOp — Type
DCTOpImpl(T::Type, shape::Tuple, dcttype=2)
returns a DCTOpImpl <: AbstractLinearOperator which performs a DCT on a given input array.
Arguments:
T::Type- type of the array to transformshape::Tuple- size of the array to transformdcttype- type of DCT (currently2and4are supported)
LinearOperatorCollection.DSTOp — Type
DSTOp(T::Type, shape::Tuple)
returns a LinearOperator which performs a DST on a given input array.
Arguments:
T::Type- type of the array to transformshape::Tuple- size of the array to transform
Modules = [LinearOperatorCollection, isdefined(Base, :getextension) ? Base.getextension(LinearOperatorCollection, :LinearOperatorFFTWExt) : LinearOperatorCollection.LinearOperatorFFTWExt, isdefined(Base, :getextension) ? Base.getextension(LinearOperatorCollection, :LinearOperatorNFFTWExt) : LinearOperatorCollection.LinearOperatorNFFTWExt, isdefined(Base, :getextension) ? Base.getextension(LinearOperatorCollection, :LinearOperatoRadonWExt) : LinearOperatorCollection.LinearOperatorRadonExt, isdefined(Base, :getextension) ? Base.getextension(LinearOperatorCollection, :LinearOperatorWaveletExt) : LinearOperatorCollection.LinearOperatorWaveletExt, ]