Type Alias chain_vote::encrypted_vote::Vote

source ·
pub type Vote = UnitVector;
Expand description

A vote is represented by a standard basis unit vector of an N dimensional space

Effectively each possible vote is represented by an axis, where the actual voted option is represented by the unit vector this axis.

E.g.: given a 3 possible votes in the 0-indexed set {option 0, option 1, option 2}, then the vote “001” represents a vote for “option 2”

Aliased Type§

struct Vote {
    ith: usize,
    size: usize,
}

Fields§

§ith: usize§size: usize

Implementations§

source§

impl UnitVector

source

pub fn new( size: usize, ith: usize ) -> Result<Self, UnitVectorInitializationError>

Create a new ith unit vector, with size greater than zero, and greater than ith.

source

pub fn iter(&self) -> UnitVectorIter

source

pub fn len(&self) -> usize

source

pub fn ith(&self) -> usize

source

pub fn is_jth(&self, j: usize) -> bool

source

pub fn jth(&self, j: usize) -> Scalar

Trait Implementations§

source§

impl Clone for UnitVector

source§

fn clone(&self) -> UnitVector

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
source§

impl Debug for UnitVector

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for UnitVector

source§

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

Formats the value using the given formatter. Read more
source§

impl Copy for UnitVector