Skip to content

Commit

Permalink
fix: dont forget to increment
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto committed Oct 30, 2024
1 parent 0c0aca0 commit ff3c682
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/circuit/ops/layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4323,11 +4323,13 @@ pub fn floor<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>(
// set the last element to zero and then recompose
let zero = create_constant_tensor(F::ZERO, 1);

let assigned_zero = region.assign(&config.custom_gates.inputs[1], &zero)?;
let assigned_zero = region.assign(&config.custom_gates.inputs[0], &zero)?;
let assigned_zero = assigned_zero.get_inner_tensor()?[0].clone();
let negative_one = create_constant_tensor(integer_rep_to_felt(-1), 1);
let assigned_negative_one = region.assign(&config.custom_gates.inputs[1], &negative_one)?;

region.increment(1);

let dims = decomposition.dims().to_vec();
let first_dims = decomposition.dims().to_vec()[..decomposition.dims().len() - 1].to_vec();

Expand Down Expand Up @@ -4435,11 +4437,13 @@ pub fn ceil<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>(
// set the last element to zero and then recompose
let zero = create_constant_tensor(F::ZERO, 1);

let assigned_zero = region.assign(&config.custom_gates.inputs[1], &zero)?;
let assigned_zero = region.assign(&config.custom_gates.inputs[0], &zero)?;
let assigned_zero = assigned_zero.get_inner_tensor()?[0].clone();
let one = create_constant_tensor(integer_rep_to_felt(1), 1);
let assigned_one = region.assign(&config.custom_gates.inputs[1], &one)?;

region.increment(1);

let dims = decomposition.dims().to_vec();
let first_dims = decomposition.dims().to_vec()[..decomposition.dims().len() - 1].to_vec();

Expand Down Expand Up @@ -4547,12 +4551,14 @@ pub fn round<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>(
// set the last element to zero and then recompose
let zero = create_constant_tensor(F::ZERO, 1);

let assigned_zero = region.assign(&config.custom_gates.inputs[1], &zero)?;
let assigned_zero = region.assign(&config.custom_gates.inputs[0], &zero)?;
let assigned_zero = assigned_zero.get_inner_tensor()?[0].clone();
let one = create_constant_tensor(integer_rep_to_felt(1), 1);
let assigned_one = region.assign(&config.custom_gates.inputs[1], &one)?;
let negative_one = create_constant_tensor(integer_rep_to_felt(-1), 1);
let assigned_negative_one = region.assign(&config.custom_gates.inputs[1], &negative_one)?;
let assigned_negative_one = region.assign(&config.custom_gates.output, &negative_one)?;

region.increment(1);

// if scale is not exactly divisible by 2 we warn
if scale.0 % 2.0 != 0.0 {
Expand Down

0 comments on commit ff3c682

Please sign in to comment.