Skip to content

Commit

Permalink
Update layouts.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Nov 8, 2024
1 parent ff0cc0a commit 0a53f0d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/circuit/ops/layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ fn is_closest_to<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>(
let is_closest_to_0 = less_equal(config, region, &[l1_distance_0.clone(), l1_distance_1])?;
let is_closest_to_1 = less_equal(config, region, &[l1_distance_0, l1_distance_2])?;

// if we wanted to be more explicit about this condition we would:
// let is_equal_0 = equals(config, region, &[l1_distance_0.clone(), l1_distance_1])?;
// let is_equal_1 = equals(config, region, &[l1_distance_0, l1_distance_2])?;
// let both_equal = and(config, region, &[is_equal_0, is_equal_1])?;
// enforce_equality(config, region, &[both_equal, F::ZERO])?;

let is_closest = and(config, region, &[is_closest_to_0, is_closest_to_1])?;

let mut comparison_unit = create_constant_tensor(integer_rep_to_felt(1), is_closest.len());
Expand Down

0 comments on commit 0a53f0d

Please sign in to comment.