pub fn prepare_fansi_spectral(
grid: &Grid,
bdir: (f64, f64, f64),
) -> (Fft3dWorkspace, Vec<f64>, Vec<f64>)Expand description
Pre-compute spectral operators shared by the FANSI-family nonlinear solvers (NDI, nlTV, nlTGV, L1-QSM, WH-QSM, HD-QSM).
Unlike prepare_admm_spectral, this does not bake the data term into an RHS,
because those solvers carry a separately-updated data auxiliary variable. It
returns the reusable primitives instead:
Fft3dWorkspace— reusable FFT plans (unnormalized forwardfft3d, normalized inverseifft3d, matching MATLABfftn/ifftn).k_kernel— the real k-space dipole kernelD(k)(same convention as the rest of the crate: continuous kernel, includes voxel-size scaling, DC = 0).ee2— the real spectral LaplacianEE2(k) = |E1|² + |E2|² + |E3|², i.e. the frequency response ofbdiv ∘ fgrad. Use as the regularization term in the x-subproblem denominator so it stays consistent with real-spacefgrad_inplace/bdiv_inplace(which share the same voxel-size scaling).
The x-subproblem denominator for these solvers is therefore
mu2 * k_kernel² + mu * ee2 (all real), matching FANSI’s
mu2*abs(Kernel).^2 + mu*EE2.