Skip to content

Correct way to use mpc.np_concatenate() #100

Closed Answered by lschoe
abraj asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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 arr1and arr2 as you've defined them aren't secure arrays: these are just arrays that happen to have secint elements.

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 concat_arr you get something like

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@abraj
Comment options

@lschoe
Comment options

@abraj
Comment options

Answer selected by abraj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants