Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
chore(acir)!: remove Linear struct (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Mar 20, 2023
1 parent aab9a35 commit bbb6d92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 191 deletions.
35 changes: 6 additions & 29 deletions acir/src/native_types/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::native_types::{Linear, Witness};
use crate::native_types::Witness;
use crate::serialization::{read_field_element, read_u32, write_bytes, write_u32};
use acir_field::FieldElement;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -417,7 +417,11 @@ impl From<Witness> for Expression {
/// a multi-variate polynomial and a `Witness`
/// can be seen as a univariate polynomial
fn from(wit: Witness) -> Expression {
Linear::from_witness(wit).into()
Expression {
q_c: FieldElement::zero(),
linear_combinations: vec![(FieldElement::one(), wit)],
mul_terms: Vec::new(),
}
}
}

Expand All @@ -427,33 +431,6 @@ impl From<&Witness> for Expression {
}
}

impl From<&Linear> for Expression {
fn from(lin: &Linear) -> Expression {
Expression {
q_c: lin.add_scale,
linear_combinations: vec![(lin.mul_scale, lin.witness)],
mul_terms: Vec::new(),
}
}
}
impl From<Linear> for Expression {
fn from(lin: Linear) -> Expression {
Expression::from(&lin)
}
}

impl Add<&Expression> for &Linear {
type Output = Expression;
fn add(self, rhs: &Expression) -> Expression {
&Expression::from(self) + rhs
}
}
impl Add<&Linear> for &Expression {
type Output = Expression;
fn add(self, rhs: &Linear) -> Expression {
&Expression::from(rhs) + self
}
}
impl Sub<&Witness> for &Expression {
type Output = Expression;
fn sub(self, rhs: &Witness) -> Expression {
Expand Down
160 changes: 0 additions & 160 deletions acir/src/native_types/linear.rs

This file was deleted.

2 changes: 0 additions & 2 deletions acir/src/native_types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
mod arithmetic;
mod linear;
mod witness;

pub use arithmetic::Expression;
pub use linear::Linear;
pub use witness::Witness;

0 comments on commit bbb6d92

Please sign in to comment.