eval_chebyshev_function_ptxt: Chebyshev approximation of a function, in the clear

View source: R/key-switching.R

eval_chebyshev_function_ptxtR Documentation

Chebyshev approximation of a function, in the clear

Description

The cleartext counterpart of eval_chebyshev_function(): it evaluates the degree-degree Chebyshev approximation of func on ⁠[a, b]⁠ at the points ptxt, with the arithmetic OpenFHE uses on ciphertexts. Comparing its result with func(ptxt) gives the approximation error of a degree before any encrypted computation is run.

Usage

eval_chebyshev_function_ptxt(func, ptxt, a, b, degree)

Arguments

func

A function of one number returning one number.

ptxt

Numeric vector of points in ⁠[a, b]⁠.

a, b

Numeric; the interval.

degree

Integer; the degree of the approximation, at least 1.

Value

A numeric vector the length of ptxt.

Examples

x <- seq(-1, 1, by = 0.5)
eval_chebyshev_function_ptxt(exp, x, -1, 1, 8L) - exp(x)

openfhe.R documentation built on Nov. 13, 2026, 5:07 p.m.