Skip to main content

poly_roots_backend_for

Function poly_roots_backend_for 

Source
pub fn poly_roots_backend_for(
    requested: ComputeBackend,
    n: usize,
) -> ComputeBackend
Expand description

The ComputeBackend the closed-form polynomial kernels would actually use for n equations if asked for requested — without running anything.

The polynomial counterpart of root_batch_backend_for, differing only in using the POLY_ROOTS_MIN_EQUATIONS size floor.

§Arguments

  • requested — the backend a caller would pass to cubic_roots_batch and friends.
  • n — the number of equations in the batch, dimensionless.

§Returns

Either ComputeBackend::Serial or ComputeBackend::CpuMulti.

§Example

use outram_foam_basic_lib::compute::ComputeBackend;
use outram_foam_basic_lib::math::parallel::poly_roots_backend_for;

assert_eq!(poly_roots_backend_for(ComputeBackend::CpuMulti, 64), ComputeBackend::Serial);
assert_eq!(poly_roots_backend_for(ComputeBackend::Serial, 1 << 20), ComputeBackend::Serial);