Learn R Programming

openfhe.R (version 1.6.1)

eval_chebyshev_function_ptxt: 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)

Value

A numeric vector the length of ptxt.

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.

Examples

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

Run the code above in your browser using DataLab