Fields
dat: [f32; 2]
Implementations
sourceimpl ComplexF32
impl ComplexF32
sourcepub fn rect(x: f32, y: f32) -> ComplexF32
pub fn rect(x: f32, y: f32) -> ComplexF32
This function uses the rectangular Cartesian components (x,y) to return the complex number z = x + i y.
sourcepub fn polar(r: f32, theta: f32) -> ComplexF32
pub fn polar(r: f32, theta: f32) -> ComplexF32
This function returns the complex number z = r \exp(i \theta) = r (\cos(\theta) + i \sin(\theta)) from the polar representation (r,theta).
sourcepub fn arg(&self) -> f32
pub fn arg(&self) -> f32
This function returns the argument of the complex number z, \arg(z), where -\pi < \arg(z) <= \pi.
sourcepub fn abs2(&self) -> f32
pub fn abs2(&self) -> f32
This function returns the squared magnitude of the complex number z, |z|^2.
sourcepub fn logabs(&self) -> f32
pub fn logabs(&self) -> f32
This function returns the natural logarithm of the magnitude of the complex number z, \log|z|.
It allows an accurate evaluation of \log|z| when |z| is close to one. The direct evaluation of log(gsl_complex_abs(z)) would lead to a loss of precision in this case.
sourcepub fn add(&self, other: &ComplexF32) -> ComplexF32
pub fn add(&self, other: &ComplexF32) -> ComplexF32
This function returns the sum of the complex numbers a and b, z=a+b.
sourcepub fn sub(&self, other: &ComplexF32) -> ComplexF32
pub fn sub(&self, other: &ComplexF32) -> ComplexF32
This function returns the difference of the complex numbers a and b, z=a-b.
sourcepub fn mul(&self, other: &ComplexF32) -> ComplexF32
pub fn mul(&self, other: &ComplexF32) -> ComplexF32
This function returns the product of the complex numbers a and b, z=ab.
sourcepub fn div(&self, other: &ComplexF32) -> ComplexF32
pub fn div(&self, other: &ComplexF32) -> ComplexF32
This function returns the quotient of the complex numbers a and b, z=a/b.
sourcepub fn add_real(&self, x: f32) -> ComplexF32
pub fn add_real(&self, x: f32) -> ComplexF32
This function returns the sum of the complex number a and the real number x, z=a+x.
sourcepub fn sub_real(&self, x: f32) -> ComplexF32
pub fn sub_real(&self, x: f32) -> ComplexF32
This function returns the difference of the complex number a and the real number x, z=a-x.
sourcepub fn mul_real(&self, x: f32) -> ComplexF32
pub fn mul_real(&self, x: f32) -> ComplexF32
This function returns the product of the complex number a and the real number x, z=ax.
sourcepub fn div_real(&self, x: f32) -> ComplexF32
pub fn div_real(&self, x: f32) -> ComplexF32
This function returns the quotient of the complex number a and the real number x, z=a/x.
sourcepub fn add_imag(&self, x: f32) -> ComplexF32
pub fn add_imag(&self, x: f32) -> ComplexF32
This function returns the sum of the complex number a and the imaginary number iy, z=a+iy.
sourcepub fn sub_imag(&self, x: f32) -> ComplexF32
pub fn sub_imag(&self, x: f32) -> ComplexF32
This function returns the difference of the complex number a and the imaginary number iy, z=a-iy.
sourcepub fn mul_imag(&self, x: f32) -> ComplexF32
pub fn mul_imag(&self, x: f32) -> ComplexF32
This function returns the product of the complex number a and the imaginary number iy, z=a*(iy).
sourcepub fn div_imag(&self, x: f32) -> ComplexF32
pub fn div_imag(&self, x: f32) -> ComplexF32
This function returns the quotient of the complex number a and the imaginary number iy, z=a/(iy).
sourcepub fn conjugate(&self) -> ComplexF32
pub fn conjugate(&self) -> ComplexF32
This function returns the complex conjugate of the complex number z, z^* = x - i y.
sourcepub fn inverse(&self) -> ComplexF32
pub fn inverse(&self) -> ComplexF32
This function returns the inverse, or reciprocal, of the complex number z, 1/z = (x - i y)/ (x^2 + y^2).
sourcepub fn negative(&self) -> ComplexF32
pub fn negative(&self) -> ComplexF32
This function returns the negative of the complex number z, -z = (-x) + i(-y).
sourcepub fn sqrt(&self) -> ComplexF32
pub fn sqrt(&self) -> ComplexF32
This function returns the square root of the complex number z, \sqrt z.
The branch cut is the negative real axis. The result always lies in the right half of the complex plane.
sourcepub fn sqrt_real(x: f32) -> ComplexF32
pub fn sqrt_real(x: f32) -> ComplexF32
This function returns the complex square root of the real number x, where x may be negative.
sourcepub fn pow(&self, other: &ComplexF32) -> ComplexF32
pub fn pow(&self, other: &ComplexF32) -> ComplexF32
The function returns the complex number z raised to the complex power a, z^a.
This is computed as \exp(\log(z)*a) using complex logarithms and complex exponentials.
sourcepub fn pow_real(&self, x: f32) -> ComplexF32
pub fn pow_real(&self, x: f32) -> ComplexF32
This function returns the complex number z raised to the real power x, z^x.
sourcepub fn exp(&self) -> ComplexF32
pub fn exp(&self) -> ComplexF32
This function returns the complex exponential of the complex number z, \exp(z).
sourcepub fn log(&self) -> ComplexF32
pub fn log(&self) -> ComplexF32
This function returns the complex natural logarithm (base e) of the complex number z, \log(z). The branch cut is the negative real axis.
sourcepub fn log10(&self) -> ComplexF32
pub fn log10(&self) -> ComplexF32
This function returns the complex base-10 logarithm of the complex number z, \log_10 (z).
sourcepub fn log_b(&self, other: &ComplexF32) -> ComplexF32
pub fn log_b(&self, other: &ComplexF32) -> ComplexF32
This function returns the complex base-b logarithm of the complex number z, \log_b(z). This quantity is computed as the ratio \log(z)/\log(b).
sourcepub fn sin(&self) -> ComplexF32
pub fn sin(&self) -> ComplexF32
This function returns the complex sine of the complex number z, \sin(z) = (\exp(iz) - \exp(-iz))/(2i).
sourcepub fn cos(&self) -> ComplexF32
pub fn cos(&self) -> ComplexF32
This function returns the complex cosine of the complex number z, \cos(z) = (\exp(iz) + \exp(-iz))/2.
sourcepub fn tan(&self) -> ComplexF32
pub fn tan(&self) -> ComplexF32
This function returns the complex tangent of the complex number z, \tan(z) = \sin(z)/\cos(z).
sourcepub fn sec(&self) -> ComplexF32
pub fn sec(&self) -> ComplexF32
This function returns the complex secant of the complex number z, \sec(z) = 1/\cos(z).
sourcepub fn csc(&self) -> ComplexF32
pub fn csc(&self) -> ComplexF32
This function returns the complex cosecant of the complex number z, \csc(z) = 1/\sin(z).
sourcepub fn cot(&self) -> ComplexF32
pub fn cot(&self) -> ComplexF32
This function returns the complex cotangent of the complex number z, \cot(z) = 1/\tan(z).
sourcepub fn arcsin(&self) -> ComplexF32
pub fn arcsin(&self) -> ComplexF32
This function returns the complex arcsine of the complex number z, \arcsin(z). The branch cuts are on the real axis, less than -1 and greater than 1.
sourcepub fn arcsin_real(z: f32) -> ComplexF32
pub fn arcsin_real(z: f32) -> ComplexF32
This function returns the complex arcsine of the real number z, \arcsin(z).
- For z between -1 and 1, the function returns a real value in the range [-\pi/2,\pi/2].
- For z less than -1 the result has a real part of -\pi/2 and a positive imaginary part.
- For z greater than 1 the result has a real part of \pi/2 and a negative imaginary part.
sourcepub fn arccos(&self) -> ComplexF32
pub fn arccos(&self) -> ComplexF32
This function returns the complex arccosine of the complex number z, \arccos(z). The branch cuts are on the real axis, less than -1 and greater than 1.
sourcepub fn arccos_real(z: f32) -> ComplexF32
pub fn arccos_real(z: f32) -> ComplexF32
This function returns the complex arccosine of the real number z, \arccos(z).
- For z between -1 and 1, the function returns a real value in the range [0,\pi].
- For z less than -1 the result has a real part of \pi and a negative imaginary part.
- For z greater than 1 the result is purely imaginary and positive.
sourcepub fn arctan(&self) -> ComplexF32
pub fn arctan(&self) -> ComplexF32
This function returns the complex arctangent of the complex number z, \arctan(z). The branch cuts are on the imaginary axis, below -i and above i.
sourcepub fn arcsec(&self) -> ComplexF32
pub fn arcsec(&self) -> ComplexF32
This function returns the complex arcsecant of the complex number z, \arcsec(z) = \arccos(1/z).
sourcepub fn arcsec_real(z: f32) -> ComplexF32
pub fn arcsec_real(z: f32) -> ComplexF32
This function returns the complex arcsecant of the real number z, \arcsec(z) = \arccos(1/z).
sourcepub fn arccsc(&self) -> ComplexF32
pub fn arccsc(&self) -> ComplexF32
This function returns the complex arccosecant of the complex number z, \arccsc(z) = \arcsin(1/z).
sourcepub fn arccsc_real(z: f32) -> ComplexF32
pub fn arccsc_real(z: f32) -> ComplexF32
This function returns the complex arccosecant of the real number z, \arccsc(z) = \arcsin(1/z).
sourcepub fn arccot(&self) -> ComplexF32
pub fn arccot(&self) -> ComplexF32
This function returns the complex arccotangent of the complex number z, \arccot(z) = \arctan(1/z).
sourcepub fn sinh(&self) -> ComplexF32
pub fn sinh(&self) -> ComplexF32
This function returns the complex hyperbolic sine of the complex number z, \sinh(z) = (\exp(z) - \exp(-z))/2.
sourcepub fn cosh(&self) -> ComplexF32
pub fn cosh(&self) -> ComplexF32
This function returns the complex hyperbolic cosine of the complex number z, \cosh(z) = (\exp(z) + \exp(-z))/2.
sourcepub fn tanh(&self) -> ComplexF32
pub fn tanh(&self) -> ComplexF32
This function returns the complex hyperbolic tangent of the complex number z, \tanh(z) = \sinh(z)/\cosh(z).
sourcepub fn sech(&self) -> ComplexF32
pub fn sech(&self) -> ComplexF32
This function returns the complex hyperbolic secant of the complex number z, \sech(z) = 1/\cosh(z).
sourcepub fn csch(&self) -> ComplexF32
pub fn csch(&self) -> ComplexF32
This function returns the complex hyperbolic cosecant of the complex number z, \csch(z) = 1/\sinh(z).
sourcepub fn coth(&self) -> ComplexF32
pub fn coth(&self) -> ComplexF32
This function returns the complex hyperbolic cotangent of the complex number z, \coth(z) = 1/\tanh(z).
sourcepub fn arcsinh(&self) -> ComplexF32
pub fn arcsinh(&self) -> ComplexF32
This function returns the complex hyperbolic arcsine of the complex number z, \arcsinh(z). The branch cuts are on the imaginary axis, below -i and above i.
sourcepub fn arccosh(&self) -> ComplexF32
pub fn arccosh(&self) -> ComplexF32
This function returns the complex hyperbolic arccosine of the complex number z, \arccosh(z).
The branch cut is on the real axis, less than 1.
Note that in this case we use the negative square root in formula 4.6.21 of Abramowitz & Stegun giving \arccosh(z)=\log(z-\sqrt{z^2-1}).
sourcepub fn arccosh_real(z: f32) -> ComplexF32
pub fn arccosh_real(z: f32) -> ComplexF32
This function returns the complex hyperbolic arccosine of the real number z, \arccosh(z).
sourcepub fn arctanh(&self) -> ComplexF32
pub fn arctanh(&self) -> ComplexF32
This function returns the complex hyperbolic arctangent of the complex number z, arctanh(z).
The branch cuts are on the real axis, less than -1 and greater than 1.
sourcepub fn arctanh_real(z: f32) -> ComplexF32
pub fn arctanh_real(z: f32) -> ComplexF32
This function returns the complex hyperbolic arctangent of the real number z, \arctanh(z).
sourcepub fn arcsech(&self) -> ComplexF32
pub fn arcsech(&self) -> ComplexF32
This function returns the complex hyperbolic arcsecant of the complex number z, \arcsech(z) = \arccosh(1/z).
sourcepub fn arccsch(&self) -> ComplexF32
pub fn arccsch(&self) -> ComplexF32
This function returns the complex hyperbolic arccosecant of the complex number z, \arccsch(z) = \arcsin(1/z).
sourcepub fn arccoth(&self) -> ComplexF32
pub fn arccoth(&self) -> ComplexF32
This function returns the complex hyperbolic arccotangent of the complex number z, \arccoth(z) = \arctanh(1/z).
pub fn real(&self) -> f32
pub fn imaginary(&self) -> f32
Trait Implementations
sourceimpl Clone for ComplexF32
impl Clone for ComplexF32
sourcefn clone(&self) -> ComplexF32
fn clone(&self) -> ComplexF32
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ComplexF32
impl Debug for ComplexF32
sourceimpl Default for ComplexF32
impl Default for ComplexF32
sourcefn default() -> ComplexF32
fn default() -> ComplexF32
Returns the “default value” for a type. Read more
sourceimpl PartialEq<ComplexF32> for ComplexF32
impl PartialEq<ComplexF32> for ComplexF32
sourcefn eq(&self, other: &ComplexF32) -> bool
fn eq(&self, other: &ComplexF32) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ComplexF32) -> bool
fn ne(&self, other: &ComplexF32) -> bool
This method tests for !=
.
impl Copy for ComplexF32
impl StructuralPartialEq for ComplexF32
Auto Trait Implementations
impl RefUnwindSafe for ComplexF32
impl Send for ComplexF32
impl Sync for ComplexF32
impl Unpin for ComplexF32
impl UnwindSafe for ComplexF32
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more