mirror of
https://github.com/zkonduit/ezkl.git
synced 2026-01-13 08:17:57 -05:00
Compare commits
1 Commits
v23.0.3
...
ac/simpler
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
704813cc15 |
@@ -1,7 +1,7 @@
|
||||
import ezkl
|
||||
|
||||
project = 'ezkl'
|
||||
release = '23.0.3'
|
||||
release = '0.0.0'
|
||||
version = release
|
||||
|
||||
|
||||
|
||||
@@ -159,18 +159,17 @@ pub fn diff_less_than<F: PrimeField + TensorType + PartialOrd + std::hash::Hash>
|
||||
values: &[&ValTensor<F>; 2],
|
||||
constant: F,
|
||||
) -> Result<(), CircuitError> {
|
||||
let distance = l1_distance(config, region, values)?;
|
||||
|
||||
let constant = create_constant_tensor(constant, 1);
|
||||
let is_less = less(config, region, &[&distance, &constant])?;
|
||||
|
||||
// assert the result is 1
|
||||
let comparison_unit = create_constant_tensor(F::ONE, is_less.len());
|
||||
enforce_equality(config, region, &[&is_less, &comparison_unit])?;
|
||||
let diff = pairwise(config, region, values, BaseOp::Sub)?;
|
||||
let int_rep_constant = felt_to_integer_rep(constant);
|
||||
range_check(
|
||||
config,
|
||||
region,
|
||||
&[&diff],
|
||||
&(-int_rep_constant + 1, int_rep_constant - 1),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Performs division of a tensor by a constant value.
|
||||
///
|
||||
/// This function divides each element in a tensor by a scalar divisor value, using
|
||||
@@ -6229,9 +6228,9 @@ pub(crate) fn recompose<F: PrimeField + TensorType + PartialOrd + std::hash::Has
|
||||
(0..num_first_dims)
|
||||
.flat_map(|_| {
|
||||
(0..n).rev().map(|x| {
|
||||
let base = (*base as IntegerRep).checked_pow(x as u32);
|
||||
let base = (*base).checked_pow(x as u32);
|
||||
if let Some(base) = base {
|
||||
Ok(ValType::Constant(integer_rep_to_felt(base)))
|
||||
Ok(ValType::Constant(integer_rep_to_felt(base as IntegerRep)))
|
||||
} else {
|
||||
Err(CircuitError::DecompositionBaseOverflow)
|
||||
}
|
||||
@@ -6341,9 +6340,9 @@ pub(crate) fn decompose<F: PrimeField + TensorType + PartialOrd + std::hash::Has
|
||||
(0..input.len())
|
||||
.flat_map(|_| {
|
||||
(0..*n).rev().map(|x| {
|
||||
let base = (*base as IntegerRep).checked_pow(x as u32);
|
||||
let base = (*base).checked_pow(x as u32);
|
||||
if let Some(base) = base {
|
||||
Ok(ValType::Constant(integer_rep_to_felt(base)))
|
||||
Ok(ValType::Constant(integer_rep_to_felt(base as IntegerRep)))
|
||||
} else {
|
||||
Err(CircuitError::DecompositionBaseOverflow)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user