he_ring::rings::hypercube

Struct HypercubeStructure

Source
pub struct HypercubeStructure { /* private fields */ }
Expand description

Represents a hypercube, which is a map

  h: { 0, ..., m1 - 1 } x ... x { 0, ..., mr - 1 } -> (Z/nZ)^*
                     a1,  ...,  ar                 -> prod_i gi^ai

such that the composition (mod <p>) ∘ h is a bijection.

We use the following notation:

  • n and p as above
  • d is the order of <p> as subgroup of (Z/nZ)*
  • mi is the length of the i-th “hypercube dimension” as above
  • gi is the generator of the i-th hypercube dimension

Implementations§

Source§

impl HypercubeStructure

Source

pub fn new( galois_group: CyclotomicGaloisGroup, p: CyclotomicGaloisGroupEl, d: usize, ms: Vec<usize>, gs: Vec<CyclotomicGaloisGroupEl>, ) -> Self

Source

pub fn halevi_shoup_hypercube( galois_group: CyclotomicGaloisGroup, p: i64, ) -> Self

Computes “the” Halevi-Shoup hypercube as described in [https://ia.cr/2014/873].

Note that the Halevi-Shoup hypercube is unique except for the ordering of prime factors of n. This function uses a deterministic but unspecified ordering.

Source

pub fn map_1d(&self, dim_idx: usize, steps: i64) -> CyclotomicGaloisGroupEl

Source

pub fn map(&self, idxs: &[i64]) -> CyclotomicGaloisGroupEl

Source

pub fn map_usize(&self, idxs: &[usize]) -> CyclotomicGaloisGroupEl

Source

pub fn std_preimage(&self, g: CyclotomicGaloisGroupEl) -> &[usize]

Source

pub fn is_tensor_product_compatible(&self) -> bool

Source

pub fn factor_of_n(&self, dim_idx: usize) -> Option<i64>

Source

pub fn p(&self) -> CyclotomicGaloisGroupEl

Source

pub fn frobenius(&self, power: i64) -> CyclotomicGaloisGroupEl

Source

pub fn d(&self) -> usize

Source

pub fn m(&self, i: usize) -> usize

Source

pub fn g(&self, i: usize) -> CyclotomicGaloisGroupEl

Source

pub fn ord_g(&self, i: usize) -> usize

Source

pub fn n(&self) -> usize

Source

pub fn dim_count(&self) -> usize

Source

pub fn galois_group(&self) -> &CyclotomicGaloisGroup

Source

pub fn element_count(&self) -> usize

Source

pub fn hypercube_iter<'b, G, T>( &'b self, for_slot: G, ) -> impl ExactSizeIterator<Item = T> + use<'b, G, T>
where G: 'b + Clone + FnMut(&[usize]) -> T, T: 'b,

Source

pub fn element_iter<'b>( &'b self, ) -> impl ExactSizeIterator<Item = CyclotomicGaloisGroupEl> + use<'b>

Trait Implementations§

Source§

impl Clone for HypercubeStructure

Source§

fn clone(&self) -> HypercubeStructure

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IsEq<T> for T
where T: ?Sized,

Source§

fn from_ref<'a>(t: &'a T) -> &'a T

Source§

fn to_ref<'a>(&'a self) -> &'a T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V