# How to multiply between each elements of a encrypted vector to save memory? CKKS

**URL:** <https://openfhe.discourse.group/t/how-to-multiply-between-each-elements-of-a-encrypted-vector-to-save-memory-ckks/1577>\
**Category:** FHE Questions\
**Tags:** questions\
**Created:** [September 16, 2024, 5:50pm UTC](https://openfhe.discourse.group/t/how-to-multiply-between-each-elements-of-a-encrypted-vector-to-save-memory-ckks/1577 "2024-09-16T17:50:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@Jason](https://openfhe.discourse.group/u/Jason)\
**Post date:** [September 16, 2024, 5:50pm UTC](https://openfhe.discourse.group/t/how-to-multiply-between-each-elements-of-a-encrypted-vector-to-save-memory-ckks/1577/1 "2024-09-16T17:50:01Z")

</div>

In CKKS scheme, I have a encrypted ciphertext of a vector. I need to multiply each elements of ciphertext. I can do by EvalMult, EvalRotate. But this way multiplicative depth will increase. It is resourcefully expensive. How I can do another way so save memory resource?

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [September 18, 2024, 12:15am UTC](https://openfhe.discourse.group/t/how-to-multiply-between-each-elements-of-a-encrypted-vector-to-save-memory-ckks/1577/2 "2024-09-18T00:15:20Z")

</div>

If you deal with a large dataset size, I would suggest using a different packing for your application where the numbers you need to multiply by are placed in different ciphertexts. In other words, if you have vertical packing now, you might want to switch to a horizontal packing. When you do the multiplications, you should use the binary tree approach (such as the one implemented in `EvalMany` in OpenFHE).
