-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpc.trunc not accurate for values of f > 3 #88
Comments
Hi @AlessandroAmadoriTNO, interesting question! You are trying to use To get better results, while working with secure integers still, you can set secint = mpc.SecInt(l=64)
p = secint.field.modulus # grab the extra large prime modulus
secint = mpc.SecInt(l=32, p=p) # sets bit length to l and uses the given (oversized) p Or, you can work with secure fixed-point numbers, but then of double bit length to make your test numbers fit as integers, setting secint = mpc.SecFxp(l=64) This way And, also you can use the keyword parameter |
I have a made a small adjustment to To make sure all parties do the same number of iterations, change the two lines in the middle of the program to: output_value = await mpc.output(sec_number)
scaling_factors = range(0, int(math.log2(abs(output_value)))) |
Perfect! I tested it and it seems to fix our issues. Thank you for the quick fix. Will a new release v0.11 be made? |
OK, nice. There will be a new release maybe in a few months. For the latest version install mpyc directly from GitHub. |
Hello @lschoe
I hope you are doing well 😄
I was testing around the
mpc.trunc
function and I noticed that the result for "high" values off
does not return an accurate result:This is the code I used to test it
and already for
f
> 3 the output was a very large negative number completely off from what I expected.For example:
I played around with the source code in runtime and I noticed that in https://github.com/lschoe/mpyc/blob/master/mpyc/runtime.py#L794
the computation works correctly until the right shift is performed. Does it have to do with the fact that the element
a-c+r.value
is a finite field element and not an integer?I get the same behavior for mpyc 0.9 and 0.10 and I have tested it with 1 and 3 players
Thank you!
The text was updated successfully, but these errors were encountered: