MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / apply_mask

Function apply_mask

ciphercore-base/src/mpc/mpc_psi.rs:457–472  ·  view source on GitHub ↗

Multiply the column by the mask/null column Assumes that column mask is binary and it has the same number of rows as the column

(column: Node, column_mask: Node, prf_keys: Node)

Source from the content-addressed store, hash-verified

455// Multiply the column by the mask/null column
456// Assumes that column mask is binary and it has the same number of rows as the column
457fn apply_mask(column: Node, column_mask: Node, prf_keys: Node) -> Result<Node> {
458 let t = get_column_type(&column)?;
459 let column_shape = t.get_shape();
460 // Reshape the mask to multiply row-wise
461 let mut mask_shape = vec![column_shape[0]];
462 if column_shape.len() > 1 {
463 mask_shape.extend(vec![1; column_shape.len() - 1]);
464 }
465 let column_mask = reshape_shared_array(column_mask, array_type(mask_shape, BIT))?;
466
467 if t.get_scalar_type() == BIT {
468 multiply_mpc(column, column_mask, prf_keys, true)
469 } else {
470 mixed_multiply_mpc(column, column_mask, prf_keys)
471 }
472}
473
474// Share a column if it is public
475fn share_column(column: Node, prf_keys: Node) -> Result<Node> {

Callers 1

instantiateMethod · 0.85

Calls 8

get_column_typeFunction · 0.85
reshape_shared_arrayFunction · 0.85
multiply_mpcFunction · 0.85
mixed_multiply_mpcFunction · 0.85
get_shapeMethod · 0.80
array_typeFunction · 0.50
extendMethod · 0.45
get_scalar_typeMethod · 0.45

Tested by

no test coverage detected