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
impl UnitVector
sourcepub fn new(
size: usize,
ith: usize
) -> Result<Self, UnitVectorInitializationError>
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
.
pub fn iter(&self) -> UnitVectorIter ⓘ
pub fn len(&self) -> usize
pub fn ith(&self) -> usize
pub fn is_jth(&self, j: usize) -> bool
pub fn jth(&self, j: usize) -> Scalar
Trait Implementations§
source§impl Clone for UnitVector
impl Clone for UnitVector
source§fn clone(&self) -> UnitVector
fn clone(&self) -> UnitVector
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more