pub fn compute_sve_general<K>(
kernel: K,
epsilon: Option<f64>,
cutoff: Option<f64>,
max_num_svals: Option<usize>,
twork: TworkType,
) -> Result<SVEResult, Error>Expand description
Main SVE computation function for general kernels (centrosymmetric or non-centrosymmetric)
Discretizes the kernel on its full domain [-xmax, xmax] × [-ymax, ymax]
with NonCentrosymmSVE, which only requires AbstractKernel.
Centrosymmetric kernels are expanded correctly as well: their half-domain
SVEHints segments are mirrored onto the full domain, so the singular
values agree with compute_sve up to rounding. The even/odd block
structure is not exploited, however: the SVD is taken of one matrix with
twice as many rows and columns as each block used by compute_sve
(asymptotically about four times the work), the singular functions carry no
parity tag, and the singular functions of (nearly) degenerate singular
values may mix the even and odd sectors. For kernels implementing
CentrosymmKernel, such as LogisticKernel
and RegularizedBoseKernel, prefer
compute_sve.
This function cannot select CentrosymmSVE by itself even when
AbstractKernel::is_centrosymmetric returns true: that strategy needs
the reduced kernels of CentrosymmKernel::compute_reduced, and a
K: AbstractKernel bound cannot be refined to K: CentrosymmKernel
without trait specialization, which stable Rust does not provide.
§Arguments
kernel- The kernel to expand (can be centrosymmetric or non-centrosymmetric)epsilon- Required accuracy, in (0, 1).Noneselects the best accuracy of the working precision (about 1.6e-16 in Float64X2).cutoff- Relative tolerance for singular value truncation: singular values smaller thancutofftimes the largest singular value are discarded.Noneselects2 * machine epsilonof the working precision, about 4.44e-16 for Float64 and 4.93e-32 for Float64X2, as incompute_sve. The SVD of the full-domain matrix already discards singular values below2 * machine epsilontimes the largest one, so a smallercutoffhas no effect. Must be in [0, 1].max_num_svals- Maximum number of singular values to keeptwork- Working precision type (Auto for automatic selection)
§Returns
SVEResult containing singular functions and values
§Errors
Error::InvalidParameterifepsilonis not in (0, 1),cutoffis not in [0, 1], ormax_num_svalsisSome(0); checked before any workError::NonFiniteInputif the discretized kernel has a NaN or infinite entry (e.g. a cutoff Λ so small that 1/Λ overflows)Error::DecompositionFailedif an SVD fails
§FPU State Warning
This function checks for dangerous FPU settings (Flush-to-Zero and Denormals-Are-Zero)
that can cause incorrect results. If detected, it temporarily corrects the FPU state
and prints a warning. If you see this warning, add -fp-model precise flag when
compiling with Intel Fortran.