Skip to main content

compute_sve_general

Function compute_sve_general 

Source
pub fn compute_sve_general<K>(
    kernel: K,
    epsilon: Option<f64>,
    cutoff: Option<f64>,
    max_num_svals: Option<usize>,
    twork: TworkType,
) -> Result<SVEResult, Error>
where K: AbstractKernel + KernelProperties + Clone + 'static,
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). None selects the best accuracy of the working precision (about 1.6e-16 in Float64X2).
  • cutoff - Relative tolerance for singular value truncation: singular values smaller than cutoff times the largest singular value are discarded. None selects 2 * machine epsilon of the working precision, about 4.44e-16 for Float64 and 4.93e-32 for Float64X2, as in compute_sve. The SVD of the full-domain matrix already discards singular values below 2 * machine epsilon times the largest one, so a smaller cutoff has no effect. Must be in [0, 1].
  • max_num_svals - Maximum number of singular values to keep
  • twork - Working precision type (Auto for automatic selection)

§Returns

SVEResult containing singular functions and values

§Errors

§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.