Skip to content

Commit

Permalink
Further simplifying codebase by starting to remove multiply_sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminsavage committed May 13, 2024
1 parent 393eb7f commit b766bed
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions ipa-core/src/protocol/basics/mul/semi_honest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,22 @@ where
{
let role = ctx.role();

let mut rhs = a.right_arr().clone() * b.right_arr();

// Compute the value (d_i) we want to send to the right helper (i+1).
let right_d =
a.left_arr().clone() * b.right_arr() + a.right_arr().clone() * b.left_arr() - prss_left;

ctx.send_channel::<<F as Vectorizable<N>>::Array>(role.peer(Direction::Right))
.send(record_id, &right_d)
.await?;
rhs += right_d;

rhs += prss_right;
let rhs = a.right_arr().clone() * b.right_arr() + right_d + prss_right;

// Sleep until helper on the left sends us their (d_i-1) value.
let mut lhs = a.left_arr().clone() * b.left_arr();
let left_d: <F as Vectorizable<N>>::Array = ctx
.recv_channel(role.peer(Direction::Left))
.receive(record_id)
.await?;
lhs += left_d;

lhs += prss_left;
let lhs = a.left_arr().clone() * b.left_arr() + left_d + prss_left;

Ok(Replicated::new_arr(lhs, rhs))
}
Expand Down

0 comments on commit b766bed

Please sign in to comment.