Hi everyone,
I’m working with vectors (vector1 and vector2) and I’d like to achieve a specific sign evaluation process. Here’s the scenario:
-
I want to use the evalsign
function (or equivalent) on the first elements of both vectors.
-
If evalsign
returns 0 (meaning the sign is zero), I need to move on to the second elements and apply evalsign
again.
-
This process should continue until a non-zero sign is encountered in either vector.
In essence, I’m looking for an efficient way to determine the first non-zero sign among the corresponding elements in two vectors.
Is there a recommended approach to achieve this in Python, C++, or other programming languages? Any insights or code examples would be greatly appreciated!
The functionality you are describing is data-dependent, i.e., continue if the number is negative, stop if the number is positive. This actually reveals information about the encrypted data to the evaluator, and thus, homomorphic encryption is not the best tool for this. It seems like functional encryption is better suited, so look into that.
In order to not reveal information about the encrypted data, you can run “evalsign” on the whole vector, and return the signs (EvalCompareSchemeSwitching). You could also run argmin on the vector of signs to obtain a position which has a positive number, but the implementation of argmin through scheme switching (EvalMinSchemeSwitching) does not necessarily give you the first occurrence of the minimum value if there are multiple elements with the same minimum value.