Noise assessment in ciphertext elements

The described noise assessment and reduction methods are an experimental approach to manage noise in hypergraph space ciphertexts with a redefined vector basis.

(* other part *)


let delta_noise c r b alpha =
  let sum_square_noise row =
    Array.fold_left (fun acc noise -> acc +. (noise ** 2.)) 0. row
  in
  let total_noise_power =
    Array.fold_left (fun acc row -> acc +. sum_square_noise row) 0. c
  in
  let row_noise_sums =
    Array.map (Array.fold_left (+.) 0.) c
  in
  let col_noise_sums =
    let t m =
      Array.init (Array.length m.(0)) (fun i ->
          Array.init (Array.length m) (fun j -> m.(j).(i))
        )
    in
    t c |> Array.map (Array.fold_left (+.) 0.)
  in
  let diff_noise_power i j =
    let d = (f row_noise_sums.(i) -. g col_noise_sums.(j)) ** 2. in
    c.(i).(j) ** 2. *. d
  in
  let sum_diff_noise_power =
    Array.fold_left
      (fun acc i ->
         Array.fold_left
           (fun acc j -> acc +. diff_noise_power i j)
           acc
           (Array.init r (fun x -> x))
      )
      0.
      (Array.init r (fun x -> x))
  in
  let noise_metric = sqrt sum_diff_noise_power in
  let threshold = b *. (total_noise_power ** alpha) in
  noise_metric > threshold

let gen_mat n m =
  let rec row m acc =
    if m = 0 then acc
    else row (m - 1) (Random.float 10. :: acc)
  in
  let rec matrix_rows n acc =
    if n = 0 then acc
    else matrix_rows (n - 1) (Array.of_list (row m []) :: acc)
  in
  Array.of_list (matrix_rows n [])

let apply_to_mat matrix f =
  Array.map (Array.map f) matrix

let apply_to_mat_rows matrix f =
  Array.map (fun row -> Array.map f row) matrix

let apply_to_mat_cols matrix f =
  let transpose matrix =
    Array.init (Array.length matrix.(0)) (fun i ->
        Array.init (Array.length matrix) (fun j -> matrix.(j).(i))
      )
  in
  let transposed_matrix = transpose matrix in
  apply_to_mat_rows transposed_matrix f

let apply_to_mat_elems matrix f =
  apply_to_mat_rows matrix (fun x -> apply_to_mat_cols x f)
[|[|5.62085760000828749; 3.64599873975302824; 0.732020911345016|];

[|1.6030584666173513; 9.89430673142578776; 8.60497981031593717|];

[|6.03989915708647551; 1.04701452775957016; 5.56547340832736914|]|]

After the bootstrapping procedure, a re-evaluation occurs to determine the noise elements in the ciphertext vector:

Estimation methodology after bootstrapping is done by calculating the interaction between the elements of the noise matrix and the elements of the ciphertext matrix through the consistency function, expressed through the internal sum.

The product applies this analysis to the entire hypergraph for all pairs of elements, the exponential function determines the distribution of noise by determining deviations from the reference average level.

Asymptotic behavior is brought to explicit form through an integral (a continuum analogue of a sum with an analysis of the upper limit of complexity).

Last updated