Struct ntru::types::NtruTernPoly [] [src]

pub struct NtruTernPoly {
    // some fields omitted
}

A ternary polynomial, i.e. all coefficients are equal to -1, 0, or 1.

Methods

impl NtruTernPoly
[src]

fn new(n: u16, ones: &[u16], neg_ones: &[u16]) -> NtruTernPoly

fn rand(n: u16, num_ones: u16, num_neg_ones: u16, rand_ctx: &NtruRandContext) -> Option<NtruTernPoly>

Random ternary polynomial

Generates a random ternary polynomial. If an error occurs, it will return None.

fn get_n(&self) -> u16

fn get_ones(&self) -> &[u16]

fn get_neg_ones(&self) -> &[u16]

fn to_int_poly(&self) -> NtruIntPoly

Ternary to general integer polynomial

Converts a NtruTernPoly to an equivalent NtruIntPoly.

Trait Implementations

impl Default for NtruTernPoly
[src]

fn default() -> NtruTernPoly

Returns the "default value" for a type. Read more

impl Clone for NtruTernPoly
[src]

fn clone(&self) -> NtruTernPoly

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for NtruTernPoly
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl PartialEq for NtruTernPoly
[src]

fn eq(&self, other: &NtruTernPoly) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.