Closed winnnnnny closed 1 year ago
The default dtype
for functions like np.zeros
is float
, and that causes the unexpected behavior.
To fix this use a call like np.zeros((4, 4), dtype=int)
or np.zeros((4, 4), dtype=object)
.
If you search for np.zeros
in the mpyc
repo you'll find a couple of examples.
There is no warning yet for this use of float
arrays, still TODO:
https://github.com/lschoe/mpyc/blob/867cc0a957fe606aaba09001bb85be17b8b53395/mpyc/finfields.py#L712-L717
Got it! Thank you for your replying.
Hello, sorry for disturbing you.
I observed that when an array is created from np.zeros with mpc.SecInt and one is subtracted from it, it is still printed out as zeros instead of negative ones. In addition, when two is added to it, it is printed out as ones instead of twos.
Here is an example.
Here is the result.
When the zero array is created with finfields.GF, the array with negative ones can printed out successfully.
The result is shown below.
I cannot find the reason behind this behavior. Could you help me to explain this?