Skip to main content

igraph_complex_t

Struct igraph_complex_t 

Source
pub struct igraph_complex_t { /* private fields */ }

Implementations§

Source§

impl igraph_complex_t

Source

pub const fn new(re: f64, im: f64) -> Self

Builds a complex number from its real and imaginary parts.

Source

pub const fn re(&self) -> f64

The real part.

Source

pub const fn im(&self) -> f64

The imaginary part.

Source§

impl igraph_complex_t

Source

pub fn conj(self) -> Self

The complex conjugate (igraph_complex_conj, undocumented in igraph_complex.h).

Source

pub fn inv(self) -> Self

The multiplicative inverse 1 / z (igraph_complex_inv, undocumented in igraph_complex.h).

Source

pub fn sqrt(self) -> Self

The principal square root (igraph_complex_sqrt, undocumented in igraph_complex.h).

Source

pub fn exp(self) -> Self

The exponential e^z (igraph_complex_exp, undocumented in igraph_complex.h).

Source

pub fn ln(self) -> Self

The principal natural logarithm (igraph_complex_log, undocumented in igraph_complex.h).

Source

pub fn log10(self) -> Self

The principal base-10 logarithm (igraph_complex_log10, undocumented in igraph_complex.h).

Source

pub fn sin(self) -> Self

The sine (igraph_complex_sin, undocumented in igraph_complex.h).

Source

pub fn cos(self) -> Self

The cosine (igraph_complex_cos, undocumented in igraph_complex.h).

Source

pub fn tan(self) -> Self

The tangent (igraph_complex_tan, undocumented in igraph_complex.h).

Source

pub fn sec(self) -> Self

The secant 1 / cos z (igraph_complex_sec, undocumented in igraph_complex.h).

Source

pub fn csc(self) -> Self

The cosecant 1 / sin z (igraph_complex_csc, undocumented in igraph_complex.h).

Source

pub fn cot(self) -> Self

The cotangent 1 / tan z (igraph_complex_cot, undocumented in igraph_complex.h).

Source§

impl igraph_complex_t

Source

pub const I: Self

The complex number i.

Source

pub fn from_polar(r: f64, theta: f64) -> Self

Builds r·e^{iθ} from polar coordinates (igraph_complex_polar, undocumented in igraph_complex.h).

use igraph::igraph_complex_t as Complex;
let z = Complex::from_polar(2.0, std::f64::consts::FRAC_PI_2);
assert!(z.almost_equals(Complex::new(0.0, 2.0), 1e-12));
assert_eq!((z * z).re(), -4.0);
Source

pub fn sqrt_real(x: f64) -> Self

The (principal) square root of a real number, which may be imaginary (igraph_complex_sqrt_real, undocumented in igraph_complex.h).

Source

pub fn abs(self) -> f64

The modulus |z| (igraph_complex_abs, undocumented in igraph_complex.h).

Source

pub fn logabs(self) -> f64

The natural logarithm of the modulus, ln |z|, computed accurately (igraph_complex_logabs, undocumented in igraph_complex.h).

Source

pub fn arg(self) -> f64

The argument (phase angle) in (-π, π] (igraph_complex_arg, undocumented in igraph_complex.h).

Source

pub fn almost_equals(self, other: Self, eps: f64) -> bool

Whether self and other are equal up to the relative tolerance eps (igraph_complex_almost_equals).

Source

pub fn pow(self, exponent: Self) -> Self

The complex power self^exponent (igraph_complex_pow, undocumented in igraph_complex.h).

Source

pub fn powf(self, exponent: f64) -> Self

The real power self^exponent (igraph_complex_pow_real, undocumented in igraph_complex.h).

Source

pub fn log(self, base: Self) -> Self

The logarithm in base base (igraph_complex_log_b, undocumented in igraph_complex.h).

Source

pub fn add_real(self, x: f64) -> Self

Adds a real number (igraph_complex_add_real, undocumented in igraph_complex.h).

Source

pub fn add_imag(self, y: f64) -> Self

Adds an imaginary number i·y (igraph_complex_add_imag, undocumented in igraph_complex.h).

Source

pub fn sub_real(self, x: f64) -> Self

Subtracts a real number (igraph_complex_sub_real, undocumented in igraph_complex.h).

Source

pub fn sub_imag(self, y: f64) -> Self

Subtracts an imaginary number i·y (igraph_complex_sub_imag, undocumented in igraph_complex.h).

Source

pub fn mul_real(self, x: f64) -> Self

Multiplies by a real number (igraph_complex_mul_real, undocumented in igraph_complex.h).

Source

pub fn mul_imag(self, y: f64) -> Self

Multiplies by an imaginary number i·y (igraph_complex_mul_imag, undocumented in igraph_complex.h).

Source

pub fn div_real(self, x: f64) -> Self

Divides by a real number (igraph_complex_div_real, undocumented in igraph_complex.h).

Source

pub fn div_imag(self, y: f64) -> Self

Divides by an imaginary number i·y (igraph_complex_div_imag, undocumented in igraph_complex.h).

Trait Implementations§

Source§

impl Add for igraph_complex_t

Source§

fn add(self, rhs: Self) -> Self

Complex arithmetic with igraph_complex_add.

Source§

type Output = igraph_complex_t

The resulting type after applying the + operator.
Source§

impl AddAssign for igraph_complex_t

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for igraph_complex_t

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for igraph_complex_t

Source§

impl Debug for igraph_complex_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for igraph_complex_t

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for igraph_complex_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats like igraph does (igraph_complex_snprintf), e.g. 1+2i.

Source§

impl Div for igraph_complex_t

Source§

fn div(self, rhs: Self) -> Self

Complex arithmetic with igraph_complex_div.

Source§

type Output = igraph_complex_t

The resulting type after applying the / operator.
Source§

impl DivAssign for igraph_complex_t

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl Extend<igraph_complex_t> for igraph_vector_complex_t

Source§

fn extend<I: IntoIterator<Item = igraph_complex_t>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<(f64, f64)> for igraph_complex_t

Source§

fn from((re, im): (f64, f64)) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for igraph_complex_t

Source§

fn from(re: f64) -> Self

A complex number with zero imaginary part.

Source§

impl FromIterator<igraph_complex_t> for igraph_vector_complex_t

Source§

fn from_iter<I: IntoIterator<Item = igraph_complex_t>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Mul for igraph_complex_t

Source§

fn mul(self, rhs: Self) -> Self

Complex arithmetic with igraph_complex_mul.

Source§

type Output = igraph_complex_t

The resulting type after applying the * operator.
Source§

impl MulAssign for igraph_complex_t

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for igraph_complex_t

Source§

fn neg(self) -> Self

Negation (igraph_complex_neg, undocumented in igraph_complex.h).

Source§

type Output = igraph_complex_t

The resulting type after applying the - operator.
Source§

impl PartialEq for igraph_complex_t

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sub for igraph_complex_t

Source§

fn sub(self, rhs: Self) -> Self

Complex arithmetic with igraph_complex_sub.

Source§

type Output = igraph_complex_t

The resulting type after applying the - operator.
Source§

impl SubAssign for igraph_complex_t

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.