1
$\begingroup$

I need to find an absolute value for a variable, but it is homomorphic encrypted. So, sometimes my x might be x=2, or other times x=-4. I want my function to always return the positive value even if the input is positive or negative, without knowing how it actually is. I can't do comparison. All i can do is add/sub/mult with my variable x, and it's negation. Can you think at a mathematic way to build a function that always returns me the positive value?? Thank you!

$\endgroup$
  • 1
    $\begingroup$ Multiply $x$ by itself and compute the square root. $\endgroup$ – Mauro ALLEGRANZA Jun 8 '17 at 8:12
  • $\begingroup$ Thx, but the problem is that I can multiply x by itself, but then I can not make sqrt ... like i said the value is encrypted so i have a limited number of operations. $\endgroup$ – Andrei En Jun 8 '17 at 8:14
  • $\begingroup$ Do you have a way to recognize integers, even after encryption? Say you wanted to tell if your number is even or odd rather than positive or negative. Could you simply divide by 2 and check if the outcome is integral, or does the encoding make that impossible? $\endgroup$ – Vincent Jun 8 '17 at 10:43
  • $\begingroup$ Using add/sub/mult, you always get a differentiable function. But the absolute value is not differentiable at $0$. Therefore it is impossible to express the absolute value only in terms of add, sub and mult. $\endgroup$ – Reinhard Meier Jun 8 '17 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.