-
I am getting the error secint = mpc.SecInt(32)
arr1 = np.array([secint(1), secint(2), secint(3)])
arr2 = np.array([secint(4), secint(5), secint(6)])
concat_arr = mpc.np_concatenate((arr1, arr2)) # IndexError: tuple index out of range
print(concat_arr) Am I not using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Indeed, you need to do things a bit differently. To start with, do not use the "internal/low-level" function concat_arr = np.concatenate((arr1, arr2)) The MPyC runtime will figure out (under the hood) what to do if any secure arrays are involved. However, arrays So, what you probably want to write is this: arr1 = secint.array(np.array([1, 2, 3]))
arr2 = secint.array(np.array([4, 5, 6]))
concat_arr = np.concatenate((arr1, arr2)) If you print this So, the contents of array Take a look at demos like np_id3gini.py and np_lpsolver.py and so on to see the use of secure Numpy arrays "in action". |
Beta Was this translation helpful? Give feedback.
Indeed, you need to do things a bit differently.
To start with, do not use the "internal/low-level" function
mpc.np_concatenate()
in your code at user level. Instead, use the standard Numpy call, like this:The MPyC runtime will figure out (under the hood) what to do if any secure arrays are involved. However, arrays
arr1
andarr2
as you've defined them aren't secure arrays: these are just arrays that happen to havesecint
elements.So, what you probably want to write is this:
If you print this
concat_arr
you get something like