HighOrderOp
Use the explicit CPU path to inspect a small encoding problem before choosing low-rank approximation or GPU storage. It evaluates the physical phase directly; its ordinary adjoint is a backprojection, not an inverse. See the encoding model for units, normalization and mask support.
Example
using HighOrderMRI
grid = Grid(8, 8, 1, 1e-3, 1e-3, 5e-3)
kspha = zeros(Float64, 9, 32)
kspha[2, :] .= range(-200.0, 200.0; length=32)
times = collect(range(0.0, 3e-3; length=32))
op = HighOrderOp(grid, kspha, times; arrayType=Array, nBlock=4)
x = ones(ComplexF64, prod(grid.matrixSize))
y = op * x
backprojection = reshape(adjoint(op) * y, grid.matrixSize)
@assert size(op) == (32, 64)Current boundaries
When kspha_dt is supplied, only the forward action becomes a derivative product. Its adjoint remains the ordinary encoding adjoint; do not use this configuration in an adjoint-based solve or a normal product. The CUDA array helpers can downcast Float64 input vectors internally; use the CPU path for an independently checked Float64 reference. These limitations are not changed by the documentation migration.
API
Type
HighOrderOpExplicit array-based MRI encoding operator on CPU or CUDA. It evaluates the selected field phase directly, with forward sign exp(+2πim * phase) and normalization 1/sqrt(count(mask)). Input vectors span the full image grid; output vectors order samples first and receive coils second. The ordinary adjoint conjugates both phase and coil sensitivities.
Source: src/EncodingOperator/HighOrderOp.jl
Constructor
HighOrderOp(grid::Grid{T},
kspha::AbstractArray{T, 2},
times::AbstractVector{T};
fieldmap::AbstractArray{T} = zeros(T, grid.matrixSize...),
csm::AbstractArray{Complex{T}} = ones(Complex{T}, grid.matrixSize..., 1),
mask::AbstractArray{Bool} = trues(grid.matrixSize...),
concomitant = nothing,
recon_terms::Union{Nothing, AbstractString} = nothing,
k_nominal::AbstractArray{T, 2} = kspha[2:4, :],
kspha_dt = nothing,
nBlock::Int64 = 50,
arrayType::Type{<:AbstractArray} = CuArray,
verbose::Bool = false) where T <: AbstractFloatConstruct an explicit encoding operator from integrated field coefficients kspha of size (9,nSam) or (16,nSam), and times of length nSam. Use metres for grid coordinates, seconds for times, Hz for fieldmap, and cycles/m^p for order-p coefficients (cycles for the constant term). The constructor does not integrate fields or convert radians to cycles.
fieldmap and mask match grid.matrixSize; csm has an additional final coil dimension. For nZ == 1, 2D maps/masks and (nX,nY,nCha) coil maps are accepted. The mask must contain at least one voxel. Both precision and device placement of solver inputs must match the chosen backend.
recon_terms=nothing selects all orders ("111" for 9 terms, "1111" for 16). A zero disables its order; disabling first-order error substitutes the three rows of k_nominal rather than setting the Fourier trajectory to zero. The default nominal rows are copied from kspha, so a distinct nominal trajectory must be supplied for this replacement to change the model.
concomitant, when supplied, has shape (4,nSam) and contains integrated coefficients in cycles/m² for z², x²+y², xz, yz, in the same frame and origin as the grid. It is independent of recon_terms and ignored when kspha_dt is supplied.
nBlock is a positive block count, capped at nSam; a remainder uses an additional final block. arrayType=Array selects CPU computation; CuArray selects CUDA. verbose=false does not suppress every setup message.
With kspha_dt, the forward product evaluates the trajectory-derivative expression used for delay estimation. The current adjoint still evaluates the ordinary encoding adjoint: do not use this derivative object for adjoint-based solves or normal products. The derivative does not include a concomitant coefficient derivative.
Known precision limitation: the array-based CUDA product helpers use gpu, which can downcast Float64 input vectors to Float32 internally. Use the CPU path when an independently checked Float64 explicit reference is required.
The returned operator has size (nSam*nCha, prod(grid.matrixSize)) and complex element type Complex{T}. It represents the full image grid, including zero columns outside the mask; the adjoint is a backprojection, not an inverse.