I try to access the elements of the encrypted vector and I want to perform operations on these elements. We can perform additions or multiplications on vectors in simple integers example on GitHub. However, when I try to access an element of the encrypted vector, the return type is different and I can’t perform operations. For example, I want to multiply all elements of an encrypted vector. Is there any way to perform this operation? Thank you for your time.

Accessing a single element in an encrypted vector is not straightforward. You can think of encrypted vectors in FHE as hard SIMD vectors that can be ideally operated on as single atomic units.
However, you can always use masking to get certain element(s) that you may want.
Suppose you have an encrypted vector v = Enc(1,2,3,4). To get the second element for example, you can compose a mask plaintext vector say m=(0,1,0,0) and compute Enc(0,2,0,0) = v \cdot m using plaintext-ciphertext homomorphic multiplication. You can also move around the items in the encrypted vector via rotation operations (EvalAtIndex).

If you want to do reduction operations such as finding the sum or product of all elements in an encrypted vector, you can do it more efficiently using rotate and add/mult algorithms. You may want to consult parallel-programming resources to find out more about these algorithms.

If you are interested in some efficient reduction algorithms and applications in FHE, these papers: 1 and 2 could be useful.

It is worth noting that, although SIMD encoding proved to be more efficient in several use cases, depending on your application, it could be possible that encrypting the data item by item (scalars instead of vectors) is more efficient. You may want to consider this option as well.

Basically, I want to multiply all elements of an encrypted vector and get an encrypted result. For example, I want to get Enc(4) for v = Enc(1, 2, 1, 2). Thank you for your response.

Assuming the input is Enc(1, 2, 1, 2), i.e., a vector, probably the fastest way would be to do 3 fast rotations using EvalFastRotation to get Enc(2,1,2,…), Enc(1,2,…), and Enc(2,…); then multiply all 4 of them by a mask (1,0,0,0); and finally multiply these 4 ciphertexts using EvalMultMany (using the binary tree technique). But there may be a more efficient way to do it if the input is represented differently.