Data analysis in ciphertext state

is there a method in CKKS ciphertext that can access the i-th number in a vector, such as two vectors? I just want to know which vector has a larger number in the i-th position. How can this be implemented

Accessing an i-th number is quite simple (it can be done using a rotation). Comparing two numbers (in a general way) is harder (computationally expensive in FHE). It can either be done using FHEW/TFHE or by switching from CKKS to FHEW.TFHE (EvalSign procedure in OpenFHE) or using a polynomial approximation of the sign function (for the latter, there is a challenge at There are special-purpose algorithms that are much faster but they are not typically compatible with other homomorphic operations over integers/real numbers.

Thank you for your answer. I have looked at the example code and it seems that the result greater than or less than 0 still needs to be decrypted to be visible?

Actually, I want to calculate min/max under ciphertext. My idea is to first find x=sign (A-B), and then calculate max=x·A+(1-x)·B, but in FHEW.TFHE, the EvalSign function returns the value which seems to be of Boolean type and cannot be directly multiplied?

I looked at your example of comparison of ciphertext, but I found a contradiction, which is that after comparing the ciphertext, I must decrypt it to obtain which ciphertext is larger or smaller. If I consider a scenario where the client uploads ciphertext and the server analyzes it, the server needs to decrypt it to complete the comparison. So he can decrypt the comparison results, which means he can also directly decrypt the ciphertext. What is the significance of doing so? How should I implement this system?

For min/argmin, I suggest looking at the following example: openfhe-development/src/pke/examples/scheme-switching.cpp at v1.1.2 · openfheorg/openfhe-development · GitHub

The result of comparison does not need to be decrypted. The FHE computations can be continued after this.