Struct snarkvm_console_algorithms::Scalar
[−]pub struct Scalar<E> where
E: Environment, { /* private fields */ }
Implementations
impl<E> Scalar<E> where
E: Environment,
impl<E> Scalar<E> where
E: Environment,
pub const SIZE_IN_BITS: usize = <E::Scalar>::SIZE_IN_BITS
pub const SIZE_IN_BITS: usize = <E::Scalar>::SIZE_IN_BITS
The scalar size in bits.
pub const SIZE_IN_BYTES: usize = (<E::Scalar>::SIZE_IN_BITS + 7) / 8
pub const SIZE_IN_BYTES: usize = (<E::Scalar>::SIZE_IN_BITS + 7) / 8
The scalar size in bytes.
pub const SIZE_IN_DATA_BITS: usize = <E::Scalar>::SIZE_IN_DATA_BITS
pub const SIZE_IN_DATA_BITS: usize = <E::Scalar>::SIZE_IN_DATA_BITS
The scalar capacity for data bits.
pub const fn new(scalar: <E as Environment>::Scalar) -> Scalar<E>
pub const fn new(scalar: <E as Environment>::Scalar) -> Scalar<E>
Initializes a new scalar.
Trait Implementations
impl<E> Add<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Add<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Add<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Add<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> AddAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> AddAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
fn add_assign(&mut self, other: &Scalar<E>)
fn add_assign(&mut self, other: &Scalar<E>)
Adds other
to self
.
impl<E> AddAssign<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> AddAssign<Scalar<E>> for Scalar<E> where
E: Environment,
fn add_assign(&mut self, other: Scalar<E>)
fn add_assign(&mut self, other: Scalar<E>)
Adds other
to self
.
impl<E> Clone for Scalar<E> where
E: Clone + Environment,
<E as Environment>::Scalar: Clone,
impl<E> Clone for Scalar<E> where
E: Clone + Environment,
<E as Environment>::Scalar: Clone,
impl<E> Compare<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Compare<Scalar<E>> for Scalar<E> where
E: Environment,
fn is_less_than(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
fn is_less_than(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
Returns true
if self
is less than other
.
fn is_greater_than(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
fn is_greater_than(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
Returns true
if self
is greater than other
.
fn is_less_than_or_equal(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
fn is_less_than_or_equal(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
Returns true
if self
is less than or equal to other
.
fn is_greater_than_or_equal(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
fn is_greater_than_or_equal(
&self,
other: &Scalar<E>
) -> <Scalar<E> as Compare<Scalar<E>>>::Output
Returns true
if self
is greater than or equal to other
.
type Output = Boolean<E>
impl<E> Debug for Scalar<E> where
E: Environment,
impl<E> Debug for Scalar<E> where
E: Environment,
impl<E> Deref for Scalar<E> where
E: Environment,
impl<E> Deref for Scalar<E> where
E: Environment,
impl<'de, E> Deserialize<'de> for Scalar<E> where
E: Environment,
impl<'de, E> Deserialize<'de> for Scalar<E> where
E: Environment,
fn deserialize<D>(
deserializer: D
) -> Result<Scalar<E>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Scalar<E>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserializes the scalar from a string or bytes.
impl<E> Display for Scalar<E> where
E: Environment,
impl<E> Display for Scalar<E> where
E: Environment,
impl<E> Distribution<Scalar<E>> for Standard where
E: Environment,
impl<E> Distribution<Scalar<E>> for Standard where
E: Environment,
fn sample<R>(&self, rng: &mut R) -> Scalar<E> where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> Scalar<E> where
R: Rng + ?Sized,
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
impl<E> Div<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Div<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Div<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Div<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> DivAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> DivAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
fn div_assign(&mut self, other: &Scalar<E>)
fn div_assign(&mut self, other: &Scalar<E>)
Divides self
by other
.
impl<E> DivAssign<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> DivAssign<Scalar<E>> for Scalar<E> where
E: Environment,
fn div_assign(&mut self, other: Scalar<E>)
fn div_assign(&mut self, other: Scalar<E>)
Divides self
by other
.
impl<E> Double for Scalar<E> where
E: Environment,
impl<E> Double for Scalar<E> where
E: Environment,
impl<E> Equal<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Equal<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> FromBits for Scalar<E> where
E: Environment,
impl<E> FromBits for Scalar<E> where
E: Environment,
fn from_bits_le(bits_le: &[bool]) -> Result<Scalar<E>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Scalar<E>, Error>
Initializes a new scalar from a list of little-endian bits.
- If
bits_le
is longer thanE::Scalar::size_in_bits()
, the excess bits are enforced to be0
s. - If
bits_le
is shorter thanE::Scalar::size_in_bits()
, it is padded with0
s up to scalar size.
fn from_bits_be(bits_be: &[bool]) -> Result<Scalar<E>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Scalar<E>, Error>
Initializes a new scalar from a list of big-endian bits without leading zeros.
impl<E> FromBytes for Scalar<E> where
E: Environment,
impl<E> FromBytes for Scalar<E> where
E: Environment,
impl<E> FromStr for Scalar<E> where
E: Environment,
impl<E> FromStr for Scalar<E> where
E: Environment,
impl<E> Hash for Scalar<E> where
E: Hash + Environment,
<E as Environment>::Scalar: Hash,
impl<E> Hash for Scalar<E> where
E: Hash + Environment,
<E as Environment>::Scalar: Hash,
impl<E> Inverse for Scalar<E> where
E: Environment,
impl<E> Inverse for Scalar<E> where
E: Environment,
impl<E> Mul<&Group<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<&Group<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<&Scalar<E>> for Group<E> where
E: Environment,
impl<E> Mul<&Scalar<E>> for Group<E> where
E: Environment,
impl<E> Mul<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<Group<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<Group<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<Scalar<E>> for Group<E> where
E: Environment,
impl<E> Mul<Scalar<E>> for Group<E> where
E: Environment,
impl<E> Mul<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Mul<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> MulAssign<&Scalar<E>> for Group<E> where
E: Environment,
impl<E> MulAssign<&Scalar<E>> for Group<E> where
E: Environment,
fn mul_assign(&mut self, other: &Scalar<E>)
fn mul_assign(&mut self, other: &Scalar<E>)
Multiplies self
by other
.
impl<E> MulAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> MulAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
fn mul_assign(&mut self, other: &Scalar<E>)
fn mul_assign(&mut self, other: &Scalar<E>)
Multiplies self
by other
.
impl<E> MulAssign<Scalar<E>> for Group<E> where
E: Environment,
impl<E> MulAssign<Scalar<E>> for Group<E> where
E: Environment,
fn mul_assign(&mut self, other: Scalar<E>)
fn mul_assign(&mut self, other: Scalar<E>)
Multiplies self
by other
.
impl<E> MulAssign<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> MulAssign<Scalar<E>> for Scalar<E> where
E: Environment,
fn mul_assign(&mut self, other: Scalar<E>)
fn mul_assign(&mut self, other: Scalar<E>)
Multiplies self
by other
.
impl<E> Neg for Scalar<E> where
E: Environment,
impl<E> Neg for Scalar<E> where
E: Environment,
impl<E> One for Scalar<E> where
E: Environment,
impl<E> One for Scalar<E> where
E: Environment,
impl<E> Ord for Scalar<E> where
E: Environment,
impl<E> Ord for Scalar<E> where
E: Environment,
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
impl<E> Parser for Scalar<E> where
E: Environment,
impl<E> Parser for Scalar<E> where
E: Environment,
impl<E> PartialEq<Scalar<E>> for Scalar<E> where
E: PartialEq<E> + Environment,
<E as Environment>::Scalar: PartialEq<<E as Environment>::Scalar>,
impl<E> PartialEq<Scalar<E>> for Scalar<E> where
E: PartialEq<E> + Environment,
<E as Environment>::Scalar: PartialEq<<E as Environment>::Scalar>,
impl<E> PartialOrd<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> PartialOrd<Scalar<E>> for Scalar<E> where
E: Environment,
fn partial_cmp(&self, other: &Scalar<E>) -> Option<Ordering>
fn partial_cmp(&self, other: &Scalar<E>) -> Option<Ordering>
Returns the lexicographic ordering of self
and other
.
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<E> Pow<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Pow<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Pow<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Pow<Scalar<E>> for Scalar<E> where
E: Environment,
impl<'a, E> Product<&'a Scalar<E>> for Scalar<E> where
E: Environment,
impl<'a, E> Product<&'a Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Product<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Product<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Serialize for Scalar<E> where
E: Environment,
impl<E> Serialize for Scalar<E> where
E: Environment,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serializes the scalar into a string or as bytes.
impl<E> SizeInBits for Scalar<E> where
E: Environment,
impl<E> SizeInBits for Scalar<E> where
E: Environment,
fn size_in_bits() -> usize
fn size_in_bits() -> usize
Returns the scalar size in bits.
impl<E> SizeInBytes for Scalar<E> where
E: Environment,
impl<E> SizeInBytes for Scalar<E> where
E: Environment,
fn size_in_bytes() -> usize
fn size_in_bytes() -> usize
Returns the scalar size in bytes.
impl<E> SizeInDataBits for Scalar<E> where
E: Environment,
impl<E> SizeInDataBits for Scalar<E> where
E: Environment,
fn size_in_data_bits() -> usize
fn size_in_data_bits() -> usize
Returns the scalar capacity for data bits.
impl<E> Square for Scalar<E> where
E: Environment,
impl<E> Square for Scalar<E> where
E: Environment,
impl<E> Sub<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Sub<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Sub<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Sub<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> SubAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> SubAssign<&Scalar<E>> for Scalar<E> where
E: Environment,
fn sub_assign(&mut self, other: &Scalar<E>)
fn sub_assign(&mut self, other: &Scalar<E>)
Subtracts other
from self
.
impl<E> SubAssign<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> SubAssign<Scalar<E>> for Scalar<E> where
E: Environment,
fn sub_assign(&mut self, other: Scalar<E>)
fn sub_assign(&mut self, other: Scalar<E>)
Subtracts other
from self
.
impl<'a, E> Sum<&'a Scalar<E>> for Scalar<E> where
E: Environment,
impl<'a, E> Sum<&'a Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Sum<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Sum<Scalar<E>> for Scalar<E> where
E: Environment,
impl<E> Ternary for Scalar<E> where
E: Environment,
impl<E> Ternary for Scalar<E> where
E: Environment,
impl<E> ToBits for Scalar<E> where
E: Environment,
impl<E> ToBits for Scalar<E> where
E: Environment,
impl<E> ToBytes for Scalar<E> where
E: Environment,
impl<E> ToBytes for Scalar<E> where
E: Environment,
impl<E> ToField for Scalar<E> where
E: Environment,
impl<E> ToField for Scalar<E> where
E: Environment,
impl<E> TypeName for Scalar<E> where
E: Environment,
impl<E> TypeName for Scalar<E> where
E: Environment,
impl<E> Zero for Scalar<E> where
E: Environment,
impl<E> Zero for Scalar<E> where
E: Environment,
impl<E> Copy for Scalar<E> where
E: Copy + Environment,
<E as Environment>::Scalar: Copy,
impl<E> Eq for Scalar<E> where
E: Eq + Environment,
<E as Environment>::Scalar: Eq,
impl<E> GroupTrait<Scalar<E>> for Group<E> where
E: Environment,
impl<E> ScalarTrait for Scalar<E> where
E: Environment,
impl<E> StructuralEq for Scalar<E> where
E: Environment,
impl<E> StructuralPartialEq for Scalar<E> where
E: Environment,
Auto Trait Implementations
impl<E> RefUnwindSafe for Scalar<E> where
<E as Environment>::Scalar: RefUnwindSafe,
impl<E> Send for Scalar<E>
impl<E> Sync for Scalar<E>
impl<E> Unpin for Scalar<E> where
<E as Environment>::Scalar: Unpin,
impl<E> UnwindSafe for Scalar<E> where
<E as Environment>::Scalar: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more