Skip to content

Commit de3baa0

Browse files
committed
refactor(structure): remove unused 'num_elements' field from Morphism
- refactor: eliminate unnecessary 'num_elements' field from Morphism structure
1 parent c001794 commit de3baa0

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/group_morphism.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ pub struct Morphism<G: Group> {
5959
pub group_elements: Vec<G>,
6060
/// The total number of scalar variables allocated.
6161
pub num_scalars: usize,
62-
///The total number of group elements allocated.
63-
pub num_elements: usize,
6462
}
6563

6664
/// Perform a simple multi-scalar multiplication (MSM) over scalars and points.
@@ -93,7 +91,6 @@ impl<G: Group> Morphism<G> {
9391
linear_combination: Vec::new(),
9492
group_elements: Vec::new(),
9593
num_scalars: 0,
96-
num_elements: 0,
9794
}
9895
}
9996

@@ -205,13 +202,11 @@ where
205202
/// # Returns
206203
/// A vector of [`PointVar`] representing the newly allocated group element indices.
207204
pub fn allocate_elements(&mut self, n: usize) -> Vec<PointVar> {
208-
let start = self.morphism.num_elements;
205+
let start = self.morphism.group_elements.len();
209206
self.morphism
210207
.group_elements
211208
.extend(repeat_n(G::identity(), n));
212-
let points = (start..start + n).map(PointVar).collect::<Vec<_>>();
213-
self.morphism.num_elements += n;
214-
points
209+
(start..start + n).map(PointVar).collect::<Vec<_>>()
215210
}
216211

217212
/// Sets the values of group elements at specified indices.

0 commit comments

Comments
 (0)