fhelium/ntt_operations.h
#include <fhelium/ntt_operations.h> · namespace fhelium::ntt
NTT transitions selected by NTT policy name over the tables of one direction.
A policy name is one of the FHElium NTT backend names: radix2_indexed, radix2_compact, radix2_compact_shoup32, and radix{4,8,16}_compact. NttTables::parameters holds the rns_params of the transformed rows and NttTables::schedule the schedule of the policy family: indexed radix-2 reads twiddles, even indices, and odd indices; compact radix-2 reads twiddles; fixed radix reads outer twiddles and radix root powers. Forward transitions read forward tables and inverse transitions inverse tables.
A transition is one of forward_montgomery (coefficient Montgomery to NTT Montgomery), forward_to_montgomery (coefficient standard to NTT Montgomery), inverse_montgomery (NTT Montgomery to coefficient Montgomery in inverse_to_standard (NTT Montgomery to coefficient standard in inverse_to_standard_lazy (the same in inverse_to_centered (NTT Montgomery to centered coefficients).
| Function | Devices | Summary |
|---|---|---|
transform_ | Any device | Applies transition to residues in place with the schedule tables of policy ntt_backend. |
transform | Any device | Returns transition of residues with the schedule tables of policy ntt_backend; residues is unchanged. |
transform_out | Any device | Out form of transform: writes transition of residues to out, a Tensor of the same shape, dtype and device disjoint from residues. |
transform_
function View source
void fhelium::ntt::transform_(
at::Tensor& residues,
const NttTables& tables,
std::string_view ntt_backend,
std::string_view transition);2
3
4
5
Devices: Any device
Torch operator: torch.ops.fhelium_ntt_ops.transform_
fhelium_ntt_ops::transform_(Tensor(a!) residues, Tensor?[] tables, str ntt_backend, str transition) -> ()Applies transition to residues in place with the schedule tables of policy ntt_backend.
transform
function View source
at::Tensor fhelium::ntt::transform(
const at::Tensor& residues,
const NttTables& tables,
std::string_view ntt_backend,
std::string_view transition);2
3
4
5
Devices: Any device
Torch operator: torch.ops.fhelium_ntt_ops.transform
fhelium_ntt_ops::transform(Tensor residues, Tensor?[] tables, str ntt_backend, str transition) -> TensorReturns transition of residues with the schedule tables of policy ntt_backend; residues is unchanged.
transform_out
function View source
void fhelium::ntt::transform_out(
const at::Tensor& residues,
const NttTables& tables,
std::string_view ntt_backend,
std::string_view transition,
at::Tensor& out);2
3
4
5
6
Devices: Any device
Out form of transform: writes transition of residues to out, a Tensor of the same shape, dtype and device disjoint from residues.