use super::multi_bit_external_product_glwe::variance_multi_bit_external_product_glwe;

/// Final reduced noise generated by the final multi bit bootstrap step.
/// Note that it does not depends from input noise, assuming the bootstrap is successful
#[allow(clippy::too_many_arguments)]
pub fn variance_multi_bit_blind_rotate(
    in_lwe_dimension: u64,
    out_glwe_dimension: u64,
    out_polynomial_size: u64,
    log2_base: u64,
    level: u64,
    ciphertext_modulus_log: u32,
    fft_precision: u32,
    variance_bsk: f64,
    grouping_factor: u32,
    jit_fft: bool,
) -> f64 {
    assert_eq!(
        in_lwe_dimension % (grouping_factor as u64),
        0,
        "in_lwe_dimension ({in_lwe_dimension}) has \
    to be a multiple of grouping_factor ({grouping_factor})"
    );
    (in_lwe_dimension / (grouping_factor as u64)) as f64
        * variance_multi_bit_external_product_glwe(
            out_glwe_dimension,
            out_polynomial_size,
            log2_base,
            level,
            ciphertext_modulus_log,
            fft_precision,
            variance_bsk,
            grouping_factor,
            jit_fft,
        )
}
