Interface

CKKSEncoder

CKKSEncoder

Members

number

# readonly slotCount

The total number of CKKS slots available to hold data

View Source ckks-encoder.ts, line 133

Methods

# decode(plainText, poolopt) → {Float64Array}

Decodes a plaintext polynomial into double-precision floating-point real numbers. Dynamic memory allocations in the process are allocated from the memory pool pointed to by the given MemoryPoolHandle.
Parameters:
Name Type Attributes Default Description
plainText PlainText Data to decode
pool MemoryPoolHandle <optional>
MemoryPoolHandle.global MemoryPool to use

View Source ckks-encoder.ts, line 99

TypedArray containing the decoded data
Float64Array
Example
import SEAL from 'node-seal'
const seal = await SEAL()
...
const ckksEncoder = seal.CKKSEncoder(context)

const plainText = ckksEncoder.encode(Float64Array.from([1, 2, 3]))

const result = ckksEncoder.decode(plainText)

# delete()

Delete the underlying WASM instance. Should be called before dereferencing this object to prevent the WASM heap from growing indefinitely.

View Source ckks-encoder.ts, line 45

# encode(array, scale, plainTextopt, poolopt) → {PlainText|void}

Encodes a vector of double-precision floating-point real numbers into a plaintext polynomial. Append zeros if vector size is less than N/2. Dynamic memory allocations in the process are allocated from the memory pool pointed to by the given MemoryPoolHandle.
Parameters:
Name Type Attributes Default Description
array Float64Array Data to encode
scale number Scaling parameter defining encoding precision
plainText PlainText <optional>
Destination to store the encoded result
pool MemoryPoolHandle <optional>
MemoryPoolHandle.global MemoryPool to use

View Source ckks-encoder.ts, line 59

A new PlainText holding the encoded data or void if one was provided
PlainText | void
Example
import SEAL from 'node-seal'
const seal = await SEAL()
...
const ckksEncoder = seal.CKKSEncoder(context)

const plainText = ckksEncoder.encode(Float64Array.from([1.11, -2.222, 3.333]), Math.pow(2, 20))