pub struct TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,{
pub elems: Vec<FE>,
/* private fields */
}
Expand description
An element of the tensor algebra defined as the tensor product of FE
and FE
as fields.
A tensor algebra element is a length $D$ vector of FE
field elements, where $D$ is the degree
of FE
as an extension of F
. The algebra has a “vertical subring” and a “horizontal subring”,
which are both isomorphic to FE
as a field.
See DP24 Section 2 for further details.
Fields§
§elems: Vec<FE>
Implementations§
source§impl<F, FE> TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
sourcepub fn new(elems: Vec<FE>) -> Self
pub fn new(elems: Vec<FE>) -> Self
Constructs an element from a vector of vertical subring elements.
§Preconditions
elems
must have lengthFE::DEGREE
, otherwise this will pad or truncate.
sourcepub fn vertical_elems(&self) -> &[FE]
pub fn vertical_elems(&self) -> &[FE]
Returns a slice of the vertical subfield elements composing the tensor algebra element.
sourcepub fn tensor(vertical: FE, horizontal: FE) -> Self
pub fn tensor(vertical: FE, horizontal: FE) -> Self
Tensor product of a vertical subring element and a horizontal subring element.
sourcepub fn from_vertical(x: FE) -> Self
pub fn from_vertical(x: FE) -> Self
Constructs a TensorAlgebra
in the vertical subring.
sourcepub fn try_extract_vertical(&self) -> Option<FE>
pub fn try_extract_vertical(&self) -> Option<FE>
If the algebra element lives in the vertical subring, this returns it as a field element.
sourcepub fn scale_vertical(self, scalar: FE) -> Self
pub fn scale_vertical(self, scalar: FE) -> Self
Multiply by an element from the vertical subring.
source§impl<F, FE> TensorAlgebra<F, FE>
impl<F, FE> TensorAlgebra<F, FE>
sourcepub fn scale_horizontal(self, scalar: FE) -> Self
pub fn scale_horizontal(self, scalar: FE) -> Self
Multiply by an element from the vertical subring.
Internally, this performs a transpose, vertical scaling, then transpose sequence. If multiple horizontal scaling operations are required and performance is a concern, it may be better for the caller to do the transposes directly and amortize their cost.
Trait Implementations§
source§impl<F, FE> Add<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> Add<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
source§impl<F, FE> AddAssign<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> AddAssign<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
source§fn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
+=
operation. Read moresource§impl<F, FE> Clone for TensorAlgebra<F, FE>
impl<F, FE> Clone for TensorAlgebra<F, FE>
source§fn clone(&self) -> TensorAlgebra<F, FE>
fn clone(&self) -> TensorAlgebra<F, FE>
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<F, FE> Debug for TensorAlgebra<F, FE>
impl<F, FE> Debug for TensorAlgebra<F, FE>
source§impl<F, FE> Default for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> Default for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
source§impl<F, FE> PartialEq for TensorAlgebra<F, FE>
impl<F, FE> PartialEq for TensorAlgebra<F, FE>
source§impl<F, FE> Sub<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> Sub<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
source§impl<F, FE> SubAssign<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> SubAssign<&TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
source§fn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
-=
operation. Read moresource§impl<'a, F, FE> Sum<&'a TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<'a, F, FE> Sum<&'a TensorAlgebra<F, FE>> for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
impl<F, FE> Eq for TensorAlgebra<F, FE>
impl<F, FE> StructuralPartialEq for TensorAlgebra<F, FE>where
F: Field,
FE: ExtensionField<F>,
Auto Trait Implementations§
impl<F, FE> Freeze for TensorAlgebra<F, FE>
impl<F, FE> RefUnwindSafe for TensorAlgebra<F, FE>where
<FE as WithUnderlier>::Underlier: Sized,
<F as WithUnderlier>::Underlier: Sized,
F: RefUnwindSafe,
FE: RefUnwindSafe,
impl<F, FE> Send for TensorAlgebra<F, FE>
impl<F, FE> Sync for TensorAlgebra<F, FE>
impl<F, FE> Unpin for TensorAlgebra<F, FE>where
<FE as WithUnderlier>::Underlier: Sized,
<F as WithUnderlier>::Underlier: Sized,
F: Unpin,
FE: Unpin,
impl<F, FE> UnwindSafe for TensorAlgebra<F, FE>where
<FE as WithUnderlier>::Underlier: Sized,
<F as WithUnderlier>::Underlier: Sized,
F: UnwindSafe,
FE: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more