# Packing Matrix-Vector Multiplication in Fully Homomorphic Encryption

DevFeed: [Packing Matrix-Vector Multiplication in Fully Homomorphic Encryption](<https://devfeed.tech/articles/packing-matrix-vector-multiplication-in-fully-homomorphic-encryption-40487.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2024/09/06/packing-matrix-vector-multiplication-in-fhe/>)

Published: 2024-09-07T04:18:09Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [homomorphic encryption](<https://devfeed.tech/topics/homomorphic-encryption.md>), [FHE](<https://devfeed.tech/topics/fhe.md>), [Encryption](<https://devfeed.tech/topics/encryption.md>), [layout](<https://devfeed.tech/topics/layout.md>), [parallel](<https://devfeed.tech/topics/parallel.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [arithmetic](<https://devfeed.tech/tags/arithmetic.md>), [code](<https://devfeed.tech/tags/code.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [data](<https://devfeed.tech/tags/data.md>), [encryption](<https://devfeed.tech/tags/encryption.md>), [fhe](<https://devfeed.tech/tags/fhe.md>), [github-repository](<https://devfeed.tech/tags/github-repository.md>), [homomorphic-encryption](<https://devfeed.tech/tags/homomorphic-encryption.md>), [layout](<https://devfeed.tech/tags/layout.md>), [linear-algebra](<https://devfeed.tech/tags/linear-algebra.md>), [lwe](<https://devfeed.tech/tags/lwe.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [packing](<https://devfeed.tech/tags/packing.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [rlwe](<https://devfeed.tech/tags/rlwe.md>), [simd](<https://devfeed.tech/tags/simd.md>), [strategies](<https://devfeed.tech/tags/strategies.md>)

## AI overview

This article explains packing for SIMD-style fully homomorphic encryption. It describes how to arrange plaintext data in RLWE ciphertexts so matrix-vector multiplication requires fewer alignment multiplications and rotations, then introduces two basic packing techniques and a computational model.

## Source excerpt

In my recent overview of homomorphic encryption, I underemphasized the importance of data layout when working with arithmetic (SIMD-style) homomorphic encryption schemes. In the FHE world, the name given to data layout strategies is called "packing," because it revolves around putting multiple plaintext data into RLWE ciphertexts in carefully-chosen ways that mesh well with the operations you'd like to perform. By "mesh well" I mean it reduces the number of extra multiplications and rotations required merely to align data elements properly, rather than doing the actual computation you care about.