pub struct ForeignElement<F: Field, const B: usize, const N: usize> {
pub limbs: [F; N],
/* private fields */
}
Expand description
Represents a foreign field element Represents a foreign field element
Fields§
§limbs: [F; N]
limbs in little endian order
Implementations§
Source§impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N>
impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N>
Sourcepub fn new(limbs: [F; N]) -> Self
pub fn new(limbs: [F; N]) -> Self
Creates a new foreign element from an array containing N limbs
Sourcepub fn from_biguint(big: BigUint) -> Self
pub fn from_biguint(big: BigUint) -> Self
Initializes a new foreign element from a big unsigned integer
Panics if the BigUint is too large to fit in the N
limbs
Sourcepub fn neg(&self, modulus: &BigUint) -> Self
pub fn neg(&self, modulus: &BigUint) -> Self
Initializes a new foreign element from an absolute BigUint
but the equivalent
foreign element obtained corresponds to the negated input. It first converts the
input big element to a big integer modulo the foreign field modulus, and then
computes the negation of the result.
Sourcepub fn from_be(bytes: &[u8]) -> Self
pub fn from_be(bytes: &[u8]) -> Self
Initializes a new foreign element from a set of bytes in big endian
Sourcepub fn to_biguint(&self) -> BigUint
pub fn to_biguint(&self) -> BigUint
Obtains the big integer representation of the foreign field element
Source§impl<F: PrimeField, const B: usize, const N: usize> ForeignElement<F, B, N>
impl<F: PrimeField, const B: usize, const N: usize> ForeignElement<F, B, N>
Sourcepub fn from_field(field: F) -> Self
pub fn from_field(field: F) -> Self
Initializes a new foreign element from an element in the native field
Trait Implementations§
Source§impl<F: Clone + Field, const B: usize, const N: usize> Clone for ForeignElement<F, B, N>
impl<F: Clone + Field, const B: usize, const N: usize> Clone for ForeignElement<F, B, N>
Source§fn clone(&self) -> ForeignElement<F, B, N>
fn clone(&self) -> ForeignElement<F, B, N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more