#[repr(C)]pub struct Complex {
pub re: f64,
pub im: f64,
}Expand description
Uiua’s complex number type
Fields§
§re: f64The real part
im: f64The imaginary part
Implementations§
Source§impl Complex
impl Complex
Sourcepub fn min(self, rhs: impl Into<Complex>) -> Complex
pub fn min(self, rhs: impl Into<Complex>) -> Complex
Get the minimum of the real and imaginary parts of two complex numbers, ignoring NaN
Sourcepub fn max(self, rhs: impl Into<Complex>) -> Complex
pub fn max(self, rhs: impl Into<Complex>) -> Complex
Get the maximum of the real and imaginary parts of two complex numbers, ignoring NaN
Sourcepub fn floor(self) -> Complex
pub fn floor(self) -> Complex
Get the floor of the real and imaginary parts of a complex number
Sourcepub fn ceil(self) -> Complex
pub fn ceil(self) -> Complex
Get the ceiling of the real and imaginary parts of a complex number
Sourcepub fn from_polar(r: f64, theta: f64) -> Complex
pub fn from_polar(r: f64, theta: f64) -> Complex
Convert polar coordinates to a complex number
Sourcepub fn powc(self, power: impl Into<Complex>) -> Complex
pub fn powc(self, power: impl Into<Complex>) -> Complex
Raise a complex number to a complex power
Sourcepub fn log(self, base: impl Into<Complex>) -> Complex
pub fn log(self, base: impl Into<Complex>) -> Complex
Calculate the logarithm of a complex number
Sourcepub fn safe_mul(self, rhs: impl Into<Complex>) -> Complex
pub fn safe_mul(self, rhs: impl Into<Complex>) -> Complex
Multiply by another complex number, with 0 × ∞ = 0
pub fn recip(self) -> Complex
Trait Implementations§
Source§impl<T> AddAssign<T> for Complex
impl<T> AddAssign<T> for Complex
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl ArrayValue for Complex
impl ArrayValue for Complex
Source§fn get_scalar_fill(fill: &Fill<'_>) -> Result<FillValue<Self>, &'static str>
fn get_scalar_fill(fill: &Fill<'_>) -> Result<FillValue<Self>, &'static str>
Get the scalar fill value from the environment
Source§fn get_array_fill(
fill: &Fill<'_>,
) -> Result<FillValue<Array<Self>>, &'static str>
fn get_array_fill( fill: &Fill<'_>, ) -> Result<FillValue<Array<Self>>, &'static str>
Get the array fill value from the environment
Source§fn array_hash<H: Hasher>(&self, hasher: &mut H)
fn array_hash<H: Hasher>(&self, hasher: &mut H)
Hash the value
Source§fn nested_value(&self) -> Option<&Value>
fn nested_value(&self) -> Option<&Value>
Get a nested value
Source§fn has_wildcard(&self) -> bool
fn has_wildcard(&self) -> bool
Check if this element has the wildcard value
Source§fn is_sortable(&self) -> bool
fn is_sortable(&self) -> bool
Whether this value can be sorted
Source§fn dbg_validate(arr: &Array<Self>)
fn dbg_validate(arr: &Array<Self>)
Validate array correctness in debug mode
Source§impl<'de> Deserialize<'de> for Complex
impl<'de> Deserialize<'de> for Complex
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Complex, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Complex, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> DivAssign<T> for Complex
impl<T> DivAssign<T> for Complex
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreSource§impl FromIterator<Complex> for Value
impl FromIterator<Complex> for Value
Source§impl<T> MulAssign<T> for Complex
impl<T> MulAssign<T> for Complex
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moreSource§impl PartialOrd for Complex
impl PartialOrd for Complex
Source§impl Serialize for Complex
impl Serialize for Complex
Source§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,
Serialize this value into the given Serde serializer. Read more
Source§impl<T> SubAssign<T> for Complex
impl<T> SubAssign<T> for Complex
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moreimpl Copy for Complex
impl Eq for Complex
impl Pod for Complex
Auto Trait Implementations§
impl Freeze for Complex
impl RefUnwindSafe for Complex
impl Send for Complex
impl Sync for Complex
impl Unpin for Complex
impl UnwindSafe for Complex
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 more