pub struct Complex64Base;Expand description
An approximate implementation of the complex numbers C, using 64 bit floating
point numbers.
§Warning
Since floating point numbers do not exactly represent the complex numbers, and this crate follows
a mathematically precise approach, we cannot provide any function related to equality.
In particular, Complex64Base.eq_el(a, b) is not supported, and will panic.
Hence, this ring has only limited use within this crate, and is currently only used for
floating-point FFTs.
Implementations§
Source§impl Complex64Base
impl Complex64Base
pub fn abs(&self, Complex64El: Complex64El) -> f64
pub fn conjugate(&self, Complex64El: Complex64El) -> Complex64El
pub fn exp(&self, Complex64El: Complex64El) -> Complex64El
pub fn closest_gaussian_int(&self, Complex64El: Complex64El) -> (i64, i64)
pub fn ln_main_branch(&self, Complex64El: Complex64El) -> Complex64El
pub fn is_absolute_approx_eq( &self, lhs: Complex64El, rhs: Complex64El, absolute_threshold: f64, ) -> bool
pub fn is_relative_approx_eq( &self, lhs: Complex64El, rhs: Complex64El, relative_limit: f64, ) -> bool
pub fn is_approx_eq( &self, lhs: Complex64El, rhs: Complex64El, precision: u64, ) -> bool
pub fn from_f64(&self, x: f64) -> Complex64El
pub fn root_of_unity(&self, i: i64, n: i64) -> Complex64El
pub fn re(&self, Complex64El: Complex64El) -> f64
pub fn im(&self, Complex64El: Complex64El) -> f64
Trait Implementations§
Source§impl CanHomFrom<Complex64Base> for Complex64Base
impl CanHomFrom<Complex64Base> for Complex64Base
type Homomorphism = ()
fn has_canonical_hom(&self, from: &Self) -> Option<()>
fn map_in( &self, _from: &Self, el: <Self as RingBase>::Element, _: &Self::Homomorphism, ) -> <Self as RingBase>::Element
fn map_in_ref( &self, from: &S, el: &S::Element, hom: &Self::Homomorphism, ) -> Self::Element
fn mul_assign_map_in( &self, from: &S, lhs: &mut Self::Element, rhs: S::Element, hom: &Self::Homomorphism, )
fn mul_assign_map_in_ref( &self, from: &S, lhs: &mut Self::Element, rhs: &S::Element, hom: &Self::Homomorphism, )
Source§impl<I: ?Sized + IntegerRing> CanHomFrom<I> for Complex64Base
impl<I: ?Sized + IntegerRing> CanHomFrom<I> for Complex64Base
type Homomorphism = ()
fn has_canonical_hom(&self, _from: &I) -> Option<Self::Homomorphism>
fn map_in( &self, from: &I, el: <I as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element
fn map_in_ref( &self, from: &I, el: &<I as RingBase>::Element, _hom: &Self::Homomorphism, ) -> Self::Element
fn mul_assign_map_in( &self, from: &S, lhs: &mut Self::Element, rhs: S::Element, hom: &Self::Homomorphism, )
fn mul_assign_map_in_ref( &self, from: &S, lhs: &mut Self::Element, rhs: &S::Element, hom: &Self::Homomorphism, )
Source§impl<I> CanHomFrom<RationalFieldBase<I>> for Complex64Base
impl<I> CanHomFrom<RationalFieldBase<I>> for Complex64Base
type Homomorphism = <Complex64Base as CanHomFrom<<I as RingStore>::Type>>::Homomorphism
fn has_canonical_hom( &self, from: &RationalFieldBase<I>, ) -> Option<Self::Homomorphism>
fn map_in( &self, from: &RationalFieldBase<I>, el: <RationalFieldBase<I> as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element
fn map_in_ref( &self, from: &RationalFieldBase<I>, el: &<RationalFieldBase<I> as RingBase>::Element, hom: &Self::Homomorphism, ) -> Self::Element
fn mul_assign_map_in( &self, from: &S, lhs: &mut Self::Element, rhs: S::Element, hom: &Self::Homomorphism, )
fn mul_assign_map_in_ref( &self, from: &S, lhs: &mut Self::Element, rhs: &S::Element, hom: &Self::Homomorphism, )
Source§impl CanIsoFromTo<Complex64Base> for Complex64Base
impl CanIsoFromTo<Complex64Base> for Complex64Base
Source§impl Clone for Complex64Base
impl Clone for Complex64Base
Source§fn clone(&self) -> Complex64Base
fn clone(&self) -> Complex64Base
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 moreSource§impl DivisibilityRing for Complex64Base
impl DivisibilityRing for Complex64Base
Source§fn checked_left_div(
&self,
lhs: &Self::Element,
rhs: &Self::Element,
) -> Option<Self::Element>
fn checked_left_div( &self, lhs: &Self::Element, rhs: &Self::Element, ) -> Option<Self::Element>
Checks whether there is an element
x such that rhs * x = lhs, and
returns it if it exists. Read moreSource§type PreparedDivisorData = ()
type PreparedDivisorData = ()
Additional data associated to a fixed ring element that can be used
to speed up division by this ring element. Read more
Source§fn divides_left(&self, lhs: &Self::Element, rhs: &Self::Element) -> bool
fn divides_left(&self, lhs: &Self::Element, rhs: &Self::Element) -> bool
Returns whether there is an element
x such that rhs * x = lhs.
If you need such an element, consider using DivisibilityRing::checked_left_div(). Read moreSource§fn divides(&self, lhs: &Self::Element, rhs: &Self::Element) -> bool
fn divides(&self, lhs: &Self::Element, rhs: &Self::Element) -> bool
Same as
DivisibilityRing::divides_left(), but requires a commutative ring.Source§fn checked_div(
&self,
lhs: &Self::Element,
rhs: &Self::Element,
) -> Option<Self::Element>
fn checked_div( &self, lhs: &Self::Element, rhs: &Self::Element, ) -> Option<Self::Element>
Same as
DivisibilityRing::checked_left_div(), but requires a commutative ring.Source§fn is_unit(&self, x: &Self::Element) -> bool
fn is_unit(&self, x: &Self::Element) -> bool
Returns whether the given element is a unit, i.e. has an inverse.
Source§fn balance_factor<'a, I>(&self, _elements: I) -> Option<Self::Element>
fn balance_factor<'a, I>(&self, _elements: I) -> Option<Self::Element>
Function that computes a “balancing” factor of a sequence of ring elements.
The only use of the balancing factor is to increase performance, in particular,
dividing all elements in the sequence by this factor should make them
“smaller” resp. cheaper to process. Read more
Source§fn prepare_divisor(&self, x: Self::Element) -> PreparedDivisor<Self>
fn prepare_divisor(&self, x: Self::Element) -> PreparedDivisor<Self>
“Prepares” an element of this ring for division. Read more
Source§fn checked_left_div_prepared(
&self,
lhs: &Self::Element,
rhs: &PreparedDivisor<Self>,
) -> Option<Self::Element>
fn checked_left_div_prepared( &self, lhs: &Self::Element, rhs: &PreparedDivisor<Self>, ) -> Option<Self::Element>
Same as
DivisibilityRing::checked_left_div() but for a prepared divisor. Read moreSource§fn divides_left_prepared(
&self,
lhs: &Self::Element,
rhs: &PreparedDivisor<Self>,
) -> bool
fn divides_left_prepared( &self, lhs: &Self::Element, rhs: &PreparedDivisor<Self>, ) -> bool
Same as
DivisibilityRing::divides_left() but for a prepared divisor. Read moreSource§fn is_unit_prepared(&self, x: &PreparedDivisor<Self>) -> bool
fn is_unit_prepared(&self, x: &PreparedDivisor<Self>) -> bool
Same as
DivisibilityRing::is_unit() but for a prepared divisor. Read moreSource§impl EuclideanRing for Complex64Base
impl EuclideanRing for Complex64Base
Source§fn euclidean_div_rem(
&self,
_lhs: Self::Element,
_rhs: &Self::Element,
) -> (Self::Element, Self::Element)
fn euclidean_div_rem( &self, _lhs: Self::Element, _rhs: &Self::Element, ) -> (Self::Element, Self::Element)
Computes euclidean division with remainder. Read more
Source§fn euclidean_deg(&self, _: &Self::Element) -> Option<usize>
fn euclidean_deg(&self, _: &Self::Element) -> Option<usize>
Defines how “small” an element is. For details, see
EuclideanRing.Source§impl Field for Complex64Base
impl Field for Complex64Base
Source§impl PartialEq for Complex64Base
impl PartialEq for Complex64Base
Source§impl PrincipalIdealRing for Complex64Base
impl PrincipalIdealRing for Complex64Base
Source§fn checked_div_min(
&self,
lhs: &Self::Element,
rhs: &Self::Element,
) -> Option<Self::Element>
fn checked_div_min( &self, lhs: &Self::Element, rhs: &Self::Element, ) -> Option<Self::Element>
Similar to
DivisibilityRing::checked_left_div() this computes a “quotient” q
of lhs and rhs, if it exists. However, we impose the additional constraint
that this quotient be minimal, i.e. there is no q' with q' | q properly and
q' * rhs = lhs. Read moreSource§fn extended_ideal_gen(
&self,
_lhs: &Self::Element,
_rhs: &Self::Element,
) -> (Self::Element, Self::Element, Self::Element)
fn extended_ideal_gen( &self, _lhs: &Self::Element, _rhs: &Self::Element, ) -> (Self::Element, Self::Element, Self::Element)
Computes a Bezout identity for the generator
g of the ideal (lhs, rhs)
as g = s * lhs + t * rhs. Read moreSource§fn annihilator(&self, val: &Self::Element) -> Self::Element
fn annihilator(&self, val: &Self::Element) -> Self::Element
Source§fn create_elimination_matrix(
&self,
a: &Self::Element,
b: &Self::Element,
) -> ([Self::Element; 4], Self::Element)
fn create_elimination_matrix( &self, a: &Self::Element, b: &Self::Element, ) -> ([Self::Element; 4], Self::Element)
Creates a matrix
A of unit determinant such that A * (a, b)^T = (d, 0).
Returns (A, d).Source§impl RingBase for Complex64Base
impl RingBase for Complex64Base
Source§type Element = Complex64El
type Element = Complex64El
Type of elements of the ring
fn clone_el(&self, val: &Self::Element) -> Self::Element
fn add_assign( &self, Complex64El: &mut Self::Element, Complex64El: Self::Element, )
fn negate_inplace(&self, Complex64El: &mut Self::Element)
fn mul_assign( &self, Complex64El: &mut Self::Element, Complex64El: Self::Element, )
fn from_int(&self, value: i32) -> Self::Element
fn eq_el(&self, _: &Self::Element, _: &Self::Element) -> bool
Source§fn pow_gen<R: IntegerRingStore>(
&self,
x: Self::Element,
power: &El<R>,
integers: R,
) -> Self::Elementwhere
R::Type: IntegerRing,
fn pow_gen<R: IntegerRingStore>(
&self,
x: Self::Element,
power: &El<R>,
integers: R,
) -> Self::Elementwhere
R::Type: IntegerRing,
Raises
x to the power of an arbitrary, nonnegative integer given by
a custom integer ring implementation. Read moreSource§fn is_commutative(&self) -> bool
fn is_commutative(&self) -> bool
Returns whether the ring is commutative, i.e.
a * b = b * a for all elements a, b.
Note that addition is assumed to be always commutative.Source§fn is_noetherian(&self) -> bool
fn is_noetherian(&self) -> bool
Returns whether the ring is noetherian, i.e. every ideal is finitely generated. Read more
Source§fn is_approximate(&self) -> bool
fn is_approximate(&self) -> bool
Returns whether this ring computes with approximations to elements.
This would usually be the case for rings that are based on
f32 or
f64, to represent real or complex numbers. Read moreSource§fn dbg_within<'a>(
&self,
Complex64El: &Self::Element,
out: &mut Formatter<'a>,
env: EnvBindingStrength,
) -> Result
fn dbg_within<'a>( &self, Complex64El: &Self::Element, out: &mut Formatter<'a>, env: EnvBindingStrength, ) -> Result
Writes a human-readable representation of
value to out, taking into account the possible context
to place parenthesis as needed. Read moreSource§fn characteristic<I: IntegerRingStore + Copy>(&self, ZZ: I) -> Option<El<I>>where
I::Type: IntegerRing,
fn characteristic<I: IntegerRingStore + Copy>(&self, ZZ: I) -> Option<El<I>>where
I::Type: IntegerRing,
Returns the characteristic of this ring as an element of the given
implementation of
ZZ. Read morefn add_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn sub_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn mul_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn zero(&self) -> Self::Element
fn one(&self) -> Self::Element
fn neg_one(&self) -> Self::Element
fn is_zero(&self, value: &Self::Element) -> bool
fn is_one(&self, value: &Self::Element) -> bool
fn is_neg_one(&self, value: &Self::Element) -> bool
fn square(&self, value: &mut Self::Element)
fn negate(&self, value: Self::Element) -> Self::Element
fn sub_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)
fn mul_assign_int(&self, lhs: &mut Self::Element, rhs: i32)
fn mul_int(&self, lhs: Self::Element, rhs: i32) -> Self::Element
fn mul_int_ref(&self, lhs: &Self::Element, rhs: i32) -> Self::Element
Source§fn sub_self_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)
fn sub_self_assign(&self, lhs: &mut Self::Element, rhs: Self::Element)
Computes
lhs := rhs - lhs.Source§fn sub_self_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
fn sub_self_assign_ref(&self, lhs: &mut Self::Element, rhs: &Self::Element)
Computes
lhs := rhs - lhs.fn add_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element
fn add_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element
fn add_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element
fn add(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element
fn sub_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element
fn sub_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element
fn sub_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element
fn sub(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element
fn mul_ref(&self, lhs: &Self::Element, rhs: &Self::Element) -> Self::Element
fn mul_ref_fst(&self, lhs: &Self::Element, rhs: Self::Element) -> Self::Element
fn mul_ref_snd(&self, lhs: Self::Element, rhs: &Self::Element) -> Self::Element
fn mul(&self, lhs: Self::Element, rhs: Self::Element) -> Self::Element
Source§impl RingExtension for Complex64Base
impl RingExtension for Complex64Base
Source§fn from(&self, x: El<Self::BaseRing>) -> Self::Element
fn from(&self, x: El<Self::BaseRing>) -> Self::Element
Maps an element of the base ring into this ring. Read more
Source§fn mul_assign_base(&self, lhs: &mut Self::Element, rhs: &El<Self::BaseRing>)
fn mul_assign_base(&self, lhs: &mut Self::Element, rhs: &El<Self::BaseRing>)
Computes
lhs := lhs * rhs, where rhs is mapped into this
ring via RingExtension::from_ref(). Note that this may be
faster than self.mul_assign(lhs, self.from_ref(rhs)).impl Copy for Complex64Base
impl Domain for Complex64Base
impl StructuralPartialEq for Complex64Base
Auto Trait Implementations§
impl Freeze for Complex64Base
impl RefUnwindSafe for Complex64Base
impl Send for Complex64Base
impl Sync for Complex64Base
impl Unpin for Complex64Base
impl UnwindSafe for Complex64Base
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<R> ComputeInnerProduct for R
impl<R> ComputeInnerProduct for R
Source§default fn inner_product_ref_fst<'a, I>(
&self,
els: I,
) -> <R as RingBase>::Element
default fn inner_product_ref_fst<'a, I>( &self, els: I, ) -> <R as RingBase>::Element
Computes the inner product
sum_i lhs[i] * rhs[i].Source§default fn inner_product_ref<'a, I>(&self, els: I) -> <R as RingBase>::Element
default fn inner_product_ref<'a, I>(&self, els: I) -> <R as RingBase>::Element
Computes the inner product
sum_i lhs[i] * rhs[i].Source§impl<R, S> CooleyTuckeyButterfly<S> for R
impl<R, S> CooleyTuckeyButterfly<S> for R
Source§default fn butterfly<V, H>(
&self,
hom: H,
values: &mut V,
twiddle: &<S as RingBase>::Element,
i1: usize,
i2: usize,
)
default fn butterfly<V, H>( &self, hom: H, values: &mut V, twiddle: &<S as RingBase>::Element, i1: usize, i2: usize, )
Should compute
(values[i1], values[i2]) := (values[i1] + twiddle * values[i2], values[i1] - twiddle * values[i2])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>
Converts
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>
Converts
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 moreSource§impl<R> KaratsubaHint for R
impl<R> KaratsubaHint for R
Source§default fn karatsuba_threshold(&self) -> usize
default fn karatsuba_threshold(&self) -> usize
Define a threshold from which on
KaratsubaAlgorithm will use the Karatsuba algorithm. Read moreSource§impl<R> LinSolveRing for Rwhere
R: PrincipalIdealRing + ?Sized,
impl<R> LinSolveRing for Rwhere
R: PrincipalIdealRing + ?Sized,
Source§default fn solve_right<V1, V2, V3, A>(
&self,
lhs: SubmatrixMut<'_, V1, <R as RingBase>::Element>,
rhs: SubmatrixMut<'_, V2, <R as RingBase>::Element>,
out: SubmatrixMut<'_, V3, <R as RingBase>::Element>,
allocator: A,
) -> SolveResultwhere
V1: AsPointerToSlice<<R as RingBase>::Element>,
V2: AsPointerToSlice<<R as RingBase>::Element>,
V3: AsPointerToSlice<<R as RingBase>::Element>,
A: Allocator,
default fn solve_right<V1, V2, V3, A>(
&self,
lhs: SubmatrixMut<'_, V1, <R as RingBase>::Element>,
rhs: SubmatrixMut<'_, V2, <R as RingBase>::Element>,
out: SubmatrixMut<'_, V3, <R as RingBase>::Element>,
allocator: A,
) -> SolveResultwhere
V1: AsPointerToSlice<<R as RingBase>::Element>,
V2: AsPointerToSlice<<R as RingBase>::Element>,
V3: AsPointerToSlice<<R as RingBase>::Element>,
A: Allocator,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R> StrassenHint for R
impl<R> StrassenHint for R
Source§default fn strassen_threshold(&self) -> usize
default fn strassen_threshold(&self) -> usize
Define a threshold from which on
StrassenAlgorithm will use the Strassen algorithm. Read more