OpenMined / TenSEAL

A library for doing homomorphic encryption operations on tensors
Apache License 2.0
807 stars 156 forks source link

Max operation for 2 encrypted numbers #313

Open spnzig opened 3 years ago

spnzig commented 3 years ago

How to calculate the max of two homomorphically encrypted numbers.

If 'a' and 'b' are two numbers, then I can find max using the below x = (a + b) 0.5 y =(a - b) 0.5 z = sqrt(y * y)

As sqrt function is not supported, I tried converting it to power z = (y * y) power (0.5)

But I get an error.

TypeError: pow(): incompatible function arguments. The following argument types are supported:
    1. (self: _tenseal_cpp.CKKSVector, arg0: int) -> _tenseal_cpp.CKKSVector

Invoked with: <_tenseal_cpp.CKKSVector object at 0x0000012E7741AE68>, 0.5

Is there any way to solve this?

image

youben11 commented 3 years ago

pow on ckksvector only supports integer