Browse Source

Minor Bug Fix (#87)

master
Tom Shen 2 years ago
committed by GitHub
parent
commit
986ab20ac0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      src/poly/domain/mod.rs

+ 4
- 7
src/poly/domain/mod.rs

@ -92,7 +92,7 @@ impl Radix2DomainVar {
/// returns all points of `h*g^{position}<g^{n-query_pos.len()}>` /// returns all points of `h*g^{position}<g^{n-query_pos.len()}>`
/// ///
/// # Panics /// # Panics
/// This function panics when `query_pos.len() != coset_dim` or `query_pos.len() != self.dim`.
/// This function panics when `query_pos.len() < log2_num_cosets`.
pub fn query_position_to_coset( pub fn query_position_to_coset(
&self, &self,
query_pos: &[Boolean<F>], query_pos: &[Boolean<F>],
@ -113,12 +113,9 @@ fn truncate_to_coset_index(
codeword_dim: u64, codeword_dim: u64,
coset_dim: u64, coset_dim: u64,
) -> Vec<Boolean<F>> { ) -> Vec<Boolean<F>> {
assert!(query_pos.len() == codeword_dim as usize || query_pos.len() == coset_dim as usize);
if query_pos.len() == codeword_dim as usize {
query_pos[0..(query_pos.len() - coset_dim as usize)].to_vec()
} else {
query_pos.to_vec()
}
let log2_num_cosets = (codeword_dim - coset_dim) as usize;
assert!(query_pos.len() >= log2_num_cosets);
query_pos[0..log2_num_cosets].to_vec()
} }
#[cfg(test)] #[cfg(test)]

Loading…
Cancel
Save