mirror of
https://github.com/Sunscreen-tech/Sunscreen.git
synced 2026-04-19 03:00:06 -04:00
removed is_multiplication from operatoin trait
This commit is contained in:
@@ -142,13 +142,6 @@ impl OperationTrait for FheOperation {
|
||||
fn is_ordered(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
FheOperation::Multiply | FheOperation::MultiplyPlaintext
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -282,6 +282,11 @@ pub type ZkpApplication = Application<Zkp>;
|
||||
*/
|
||||
pub type FheZkpApplication = Application<FheZkp>;
|
||||
|
||||
type Group = String;
|
||||
|
||||
/**
|
||||
* Allows for abstract interaction with a context group stack.
|
||||
*/
|
||||
pub enum ContextEnum {
|
||||
Fhe(FheContext),
|
||||
Zkp(ZkpContext),
|
||||
|
||||
@@ -151,10 +151,6 @@ impl OperationTrait for Operation {
|
||||
fn is_ordered(&self) -> bool {
|
||||
matches!(self, Operation::InvokeGadget(_))
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(self, Operation::Mul)
|
||||
}
|
||||
}
|
||||
|
||||
impl Operation {
|
||||
|
||||
@@ -586,10 +586,6 @@ mod tests {
|
||||
fn is_ordered(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(self, Self::Mul)
|
||||
}
|
||||
}
|
||||
|
||||
type TestGraph = Context<Operation, ()>;
|
||||
|
||||
@@ -78,10 +78,6 @@ pub trait Operation: Clone + Debug + Hash + PartialEq + Eq {
|
||||
*/
|
||||
fn is_ordered(&self) -> bool;
|
||||
|
||||
/**
|
||||
* Whether or not this operation involves a multiplication.
|
||||
*/
|
||||
fn is_multiplication(&self) -> bool;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -175,9 +175,6 @@ mod tests {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(self, Operation::Mul)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_graph() -> CompilationResult<Operation> {
|
||||
|
||||
@@ -4,7 +4,6 @@ use sunscreen_compiler_common::Operation as OperationTrait;
|
||||
use crate::Literal;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Hash, Deserialize, PartialEq, Eq)]
|
||||
//#[serde(tag = "type")]
|
||||
/**
|
||||
* An operation in the execution graph.
|
||||
*/
|
||||
@@ -150,7 +149,4 @@ impl OperationTrait for Operation {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(self, Self::Multiply | Self::MultiplyPlaintext)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,7 @@ pub struct BfvNodeType {
|
||||
/**
|
||||
* Gets the multiplicative depth of a node in the compilation graph.
|
||||
*/
|
||||
pub fn get_mult_depth<O>(graph: &StableGraph<NodeInfo<O>, EdgeInfo>, start_node: NodeIndex) -> u64
|
||||
where
|
||||
O: OperationTrait,
|
||||
pub fn get_mult_depth(graph: &StableGraph<NodeInfo<FheOperation>, EdgeInfo>, start_node: NodeIndex) -> u64
|
||||
{
|
||||
let mut queue: VecDeque<(NodeIndex, u64)> = VecDeque::new();
|
||||
let mut visited: HashMap<NodeIndex, bool> = HashMap::new();
|
||||
@@ -57,12 +55,10 @@ where
|
||||
while let Some((node, depth)) = queue.pop_front() {
|
||||
visited.insert(node, true);
|
||||
|
||||
let curr_depth = depth
|
||||
+ graph
|
||||
.node_weight(node)
|
||||
.unwrap()
|
||||
.operation
|
||||
.is_multiplication() as u64;
|
||||
let curr_depth = match graph.node_weight(node).unwrap().operation {
|
||||
FheOperation::Multiply => depth + 1,
|
||||
_ => depth
|
||||
};
|
||||
|
||||
max_depth = max_depth.max(curr_depth);
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@ impl OperationTrait for Operation {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(self, Operation::Mul)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -178,10 +178,6 @@ impl OperationTrait for Operation {
|
||||
fn is_ordered(&self) -> bool {
|
||||
matches!(self, Operation::InvokeGadget(_))
|
||||
}
|
||||
|
||||
fn is_multiplication(&self) -> bool {
|
||||
matches!(self, Operation::Mul)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user