pub struct BatchInverseResult {
pub inverses: Vec<FieldElement>,
}Expand description
Batch inversion result containing all computed inverses.
This struct holds the computed inverses of all input field elements.
The inverses are guaranteed to satisfy input[i] * result[i] ≡ 1 mod p
for all valid indices i.
Fields§
§inverses: Vec<FieldElement>The computed inverses, in the same order as the input elements
Implementations§
Source§impl BatchInverseResult
impl BatchInverseResult
Sourcepub fn get(&self, index: usize) -> &FieldElement
pub fn get(&self, index: usize) -> &FieldElement
Get the inverse at the specified index.
Returns a reference to the computed inverse for the element at the corresponding position in the input array. The inverses are stored in the same order as the input elements.
§Parameters
index- The index of the desired inverse (0 ≤ index < len())
§Returns
A reference to the computed inverse FieldElement
§Panics
Panics if index is out of bounds (index >= len()).
§Mathematical Guarantee
The returned inverse satisfies: input[index] * result[index] ≡ 1 mod p
where p is the field modulus.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the number of inverses computed.
Returns the total number of inverses in this result, which equals the number of input elements that were successfully inverted.
§Returns
The number of computed inverses
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the result contains no inverses.
Returns true if no inverses were computed (empty result). This typically occurs when an empty input array was provided.
§Returns
true if no inverses are stored, false otherwise
Sourcepub fn into_vec(self) -> Vec<FieldElement>
pub fn into_vec(self) -> Vec<FieldElement>
Convert into the internal vector of inverses.
Consumes this result and returns the underlying vector of computed inverses.
This is useful when you want to take ownership of the inverses rather than
borrowing them through the get() method.
§Returns
The vector of computed inverses in input order
§Performance
This operation is O(1) - no copying occurs, just ownership transfer.
Trait Implementations§
Source§impl Clone for BatchInverseResult
impl Clone for BatchInverseResult
Source§fn clone(&self) -> BatchInverseResult
fn clone(&self) -> BatchInverseResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more