pub struct EvalCost {
pub n_adds: usize,
pub n_muls: usize,
pub n_squares: usize,
}
Expand description
The breakdown of the number of operations it takes to evaluate this circuit.
Fields§
§n_adds: usize
Number of additions.
Addition is a relatively cheap operation.
n_muls: usize
Number of multiplications.
Multiplications are a dominating factor in the evaluation cost.
n_squares: usize
Number of squares.
Squares are a relatively cheap operation. Generally we assume that squaring takes the 1/5th of a single multiplication.
Implementations§
Source§impl EvalCost
impl EvalCost
pub fn add(n_adds: usize) -> Self
pub fn mul(n_muls: usize) -> Self
pub fn square(n_squares: usize) -> Self
Sourcepub fn mult_cost_approx(&self) -> usize
pub fn mult_cost_approx(&self) -> usize
Returns an approximate cost to evaluate an expression as a single number.
Since the evaluation time is dominated by the number of multiplications we can roughly gauge the cost by the number of the multiplications. We count the number of squares as 1/5th of a single multiplication.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EvalCost
impl RefUnwindSafe for EvalCost
impl Send for EvalCost
impl Sync for EvalCost
impl Unpin for EvalCost
impl UnwindSafe for EvalCost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more