vstack

Engine.vstack(ciphertexts)
Stack ciphertexts in sequence vertically (row wise). All the input ciphertexts should have the same level, NTT state, rescaled state, and multiparty state.
  • Input:
    • list[Ciphertext]
  • Output:
    • Ciphertext

Warning

  • The matrix form does not yet support this operation.
import numpy as np
from desilofhe import Engine

engine = Engine()
secret_key = engine.create_secret_key()
slot_count = engine.slot_count  # 8192

message_1 = np.full(slot_count, 1)
ciphertext_1 = engine.encrypt(message_1, secret_key)

message_2 = np.repeat([2, 3], slot_count)
ciphertext_2 = engine.encrypt(message_2, secret_key)

# each row holds engine.slot_count (8192) slots
# contents of ciphertext_1:
# [[1, 1, ..., 1]]
# contents of ciphertext_2:
# [[2, 2, ..., 2],
#  [3, 3, ..., 3]]

ciphertext_3 = engine.vstack([ciphertext_1, ciphertext_2])

# contents of ciphertext_3:
# [[1, 1, ..., 1],
#  [2, 2, ..., 2],
#  [3, 3, ..., 3]]