# [−][src]Trait nalgebra::ComplexField

    pub trait ComplexField: 'static + MeetSemilattice + JoinSemilattice + SubsetOf<Self> + SupersetOf<f64> + Field<Output = Self> + Send + Copy + Sync + Neg + Any + Debug + Display + FromPrimitive + Num + NumAssign {
        type RealField: RealField;
        fn from_real(re: Self::RealField) -> Self;
        fn real(self) -> Self::RealField;
        fn imaginary(self) -> Self::RealField;
        fn modulus(self) -> Self::RealField;
        fn modulus_squared(self) -> Self::RealField;
        fn argument(self) -> Self::RealField;
        fn norm1(self) -> Self::RealField;
        fn scale(self, factor: Self::RealField) -> Self;
        fn unscale(self, factor: Self::RealField) -> Self;
        fn floor(self) -> Self;
        fn ceil(self) -> Self;
        fn round(self) -> Self;
        fn trunc(self) -> Self;
        fn fract(self) -> Self;
        fn mul_add(self, a: Self, b: Self) -> Self;
        fn abs(self) -> Self::RealField;
        fn hypot(self, other: Self) -> Self::RealField;
        fn recip(self) -> Self;
        fn conjugate(self) -> Self;
        fn sin(self) -> Self;
        fn cos(self) -> Self;
        fn sin_cos(self) -> (Self, Self);
        fn tan(self) -> Self;
        fn asin(self) -> Self;
        fn acos(self) -> Self;
        fn atan(self) -> Self;
        fn sinh(self) -> Self;
        fn cosh(self) -> Self;
        fn tanh(self) -> Self;
        fn asinh(self) -> Self;
        fn acosh(self) -> Self;
        fn atanh(self) -> Self;
        fn is_finite(&self) -> bool;
        fn log(self, base: Self::RealField) -> Self;
        fn log2(self) -> Self;
        fn log10(self) -> Self;
        fn ln(self) -> Self;
        fn ln_1p(self) -> Self;
        fn sqrt(self) -> Self;
        fn try_sqrt(self) -> Option<Self>;
        fn exp(self) -> Self;
        fn exp2(self) -> Self;
        fn exp_m1(self) -> Self;
        fn powi(self, n: i32) -> Self;
        fn powf(self, n: Self::RealField) -> Self;
        fn powc(self, n: Self) -> Self;
        fn cbrt(self) -> Self;

        fn to_polar(self) -> (Self::RealField, Self::RealField) { ... }
        fn to_exp(self) -> (Self::RealField, Self) { ... }
        fn signum(self) -> Self { ... }
        fn sinh_cosh(self) -> (Self, Self) { ... }
        fn sinc(self) -> Self { ... }
        fn sinhc(self) -> Self { ... }
        fn cosc(self) -> Self { ... }
        fn coshc(self) -> Self { ... }
    }

Trait shared by all complex fields and its subfields (like real numbers).

Complex numbers are equipped with functions that are commonly used on complex numbers and reals. The results of those functions only have to be approximately equal to the actual theoretical values.

## Associated Types

### `type RealField: RealField`

Type of the coefficients of a complex number.

Loading content...

## Required methods

### `fn from_real(re: Self::RealField) -> Self`

Builds a pure-real complex number from the given value.

### `fn real(self) -> Self::RealField`

The real part of this complex number.

### `fn imaginary(self) -> Self::RealField`

The imaginary part of this complex number.

### `fn modulus(self) -> Self::RealField`

The modulus of this complex number.

### `fn modulus_squared(self) -> Self::RealField`

The squared modulus of this complex number.

### `fn argument(self) -> Self::RealField`

The argument of this complex number.

### `fn norm1(self) -> Self::RealField`

The sum of the absolute value of this complex number's real and imaginary part.

### `fn scale(self, factor: Self::RealField) -> Self`

Multiplies this complex number by `factor`.

### `fn unscale(self, factor: Self::RealField) -> Self`

Multiplies this complex number by `factor`.

### `fn floor(self) -> Self`

### `fn ceil(self) -> Self`

### `fn round(self) -> Self`

### `fn trunc(self) -> Self`

### `fn fract(self) -> Self`

### `fn mul_add(self, a: Self, b: Self) -> Self`

### `fn abs(self) -> Self::RealField`

The absolute value of this complex number: `self / self.signum()`.

This is equivalent to `self.modulus()`.

### `fn hypot(self, other: Self) -> Self::RealField`

Computes (self.conjugate() * self + other.conjugate() * other).sqrt()

### `fn recip(self) -> Self`

### `fn conjugate(self) -> Self`

### `fn sin(self) -> Self`

### `fn cos(self) -> Self`

### `fn sin_cos(self) -> (Self, Self)`

### `fn tan(self) -> Self`

### `fn asin(self) -> Self`

### `fn acos(self) -> Self`

### `fn atan(self) -> Self`

### `fn sinh(self) -> Self`

### `fn cosh(self) -> Self`

### `fn tanh(self) -> Self`

### `fn asinh(self) -> Self`

### `fn acosh(self) -> Self`

### `fn atanh(self) -> Self`

### `fn is_finite(&self) -> bool`

### `fn log(self, base: Self::RealField) -> Self`

### `fn log2(self) -> Self`

### `fn log10(self) -> Self`

### `fn ln(self) -> Self`

### `fn ln_1p(self) -> Self`

### `fn sqrt(self) -> Self`

### `fn try_sqrt(self) -> Option<Self>`

### `fn exp(self) -> Self`

### `fn exp2(self) -> Self`

### `fn exp_m1(self) -> Self`

### `fn powi(self, n: i32) -> Self`

### `fn powf(self, n: Self::RealField) -> Self`

### `fn powc(self, n: Self) -> Self`

### `fn cbrt(self) -> Self`

Loading content...

## Provided methods

### `fn to_polar(self) -> (Self::RealField, Self::RealField)`

The polar form of this complex number: (modulus, arg)

### `fn to_exp(self) -> (Self::RealField, Self)`

The exponential form of this complex number: (modulus, e^{i arg})

### `fn signum(self) -> Self`

The exponential part of this complex number: `self / self.modulus()`

### `fn sinh_cosh(self) -> (Self, Self)`

### `fn sinc(self) -> Self`

Cardinal sine

### `fn sinhc(self) -> Self`

### `fn cosc(self) -> Self`

Cardinal cos

### `fn coshc(self) -> Self`

Loading content...

## Implementations on Foreign Types

### `impl ComplexField for f64`[src]

#### `type RealField = f64`

#### `fn from_real(re: <f64 as ComplexField>::RealField) -> f64`[src]

#### `fn real(self) -> <f64 as ComplexField>::RealField`[src]

#### `fn imaginary(self) -> <f64 as ComplexField>::RealField`[src]

#### `fn norm1(self) -> <f64 as ComplexField>::RealField`[src]

#### `fn modulus(self) -> <f64 as ComplexField>::RealField`[src]

#### `fn modulus_squared(self) -> <f64 as ComplexField>::RealField`[src]

#### `fn argument(self) -> <f64 as ComplexField>::RealField`[src]

#### `fn to_exp(self) -> (f64, f64)`[src]

#### `fn recip(self) -> f64`[src]

#### `fn conjugate(self) -> f64`[src]

#### `fn scale(self, factor: <f64 as ComplexField>::RealField) -> f64`[src]

#### `fn unscale(self, factor: <f64 as ComplexField>::RealField) -> f64`[src]

#### `fn floor(self) -> f64`[src]

#### `fn ceil(self) -> f64`[src]

#### `fn round(self) -> f64`[src]

#### `fn trunc(self) -> f64`[src]

#### `fn fract(self) -> f64`[src]

#### `fn abs(self) -> f64`[src]

#### `fn signum(self) -> f64`[src]

#### `fn mul_add(self, a: f64, b: f64) -> f64`[src]

#### `fn powi(self, n: i32) -> f64`[src]

#### `fn powf(self, n: f64) -> f64`[src]

#### `fn powc(self, n: f64) -> f64`[src]

#### `fn sqrt(self) -> f64`[src]

#### `fn try_sqrt(self) -> Option<f64>`[src]

#### `fn exp(self) -> f64`[src]

#### `fn exp2(self) -> f64`[src]

#### `fn exp_m1(self) -> f64`[src]

#### `fn ln_1p(self) -> f64`[src]

#### `fn ln(self) -> f64`[src]

#### `fn log(self, base: f64) -> f64`[src]

#### `fn log2(self) -> f64`[src]

#### `fn log10(self) -> f64`[src]

#### `fn cbrt(self) -> f64`[src]

#### `fn hypot(self, other: f64) -> <f64 as ComplexField>::RealField`[src]

#### `fn sin(self) -> f64`[src]

#### `fn cos(self) -> f64`[src]

#### `fn tan(self) -> f64`[src]

#### `fn asin(self) -> f64`[src]

#### `fn acos(self) -> f64`[src]

#### `fn atan(self) -> f64`[src]

#### `fn sin_cos(self) -> (f64, f64)`[src]

#### `fn sinh(self) -> f64`[src]

#### `fn cosh(self) -> f64`[src]

#### `fn tanh(self) -> f64`[src]

#### `fn asinh(self) -> f64`[src]

#### `fn acosh(self) -> f64`[src]

#### `fn atanh(self) -> f64`[src]

#### `fn is_finite(&self) -> bool`[src]

### `impl ComplexField for f32`[src]

#### `type RealField = f32`

#### `fn from_real(re: <f32 as ComplexField>::RealField) -> f32`[src]

#### `fn real(self) -> <f32 as ComplexField>::RealField`[src]

#### `fn imaginary(self) -> <f32 as ComplexField>::RealField`[src]

#### `fn norm1(self) -> <f32 as ComplexField>::RealField`[src]

#### `fn modulus(self) -> <f32 as ComplexField>::RealField`[src]

#### `fn modulus_squared(self) -> <f32 as ComplexField>::RealField`[src]

#### `fn argument(self) -> <f32 as ComplexField>::RealField`[src]

#### `fn to_exp(self) -> (f32, f32)`[src]

#### `fn recip(self) -> f32`[src]

#### `fn conjugate(self) -> f32`[src]

#### `fn scale(self, factor: <f32 as ComplexField>::RealField) -> f32`[src]

#### `fn unscale(self, factor: <f32 as ComplexField>::RealField) -> f32`[src]

#### `fn floor(self) -> f32`[src]

#### `fn ceil(self) -> f32`[src]

#### `fn round(self) -> f32`[src]

#### `fn trunc(self) -> f32`[src]

#### `fn fract(self) -> f32`[src]

#### `fn abs(self) -> f32`[src]

#### `fn signum(self) -> f32`[src]

#### `fn mul_add(self, a: f32, b: f32) -> f32`[src]

#### `fn powi(self, n: i32) -> f32`[src]

#### `fn powf(self, n: f32) -> f32`[src]

#### `fn powc(self, n: f32) -> f32`[src]

#### `fn sqrt(self) -> f32`[src]

#### `fn try_sqrt(self) -> Option<f32>`[src]

#### `fn exp(self) -> f32`[src]

#### `fn exp2(self) -> f32`[src]

#### `fn exp_m1(self) -> f32`[src]

#### `fn ln_1p(self) -> f32`[src]

#### `fn ln(self) -> f32`[src]

#### `fn log(self, base: f32) -> f32`[src]

#### `fn log2(self) -> f32`[src]

#### `fn log10(self) -> f32`[src]

#### `fn cbrt(self) -> f32`[src]

#### `fn hypot(self, other: f32) -> <f32 as ComplexField>::RealField`[src]

#### `fn sin(self) -> f32`[src]

#### `fn cos(self) -> f32`[src]

#### `fn tan(self) -> f32`[src]

#### `fn asin(self) -> f32`[src]

#### `fn acos(self) -> f32`[src]

#### `fn atan(self) -> f32`[src]

#### `fn sin_cos(self) -> (f32, f32)`[src]

#### `fn sinh(self) -> f32`[src]

#### `fn cosh(self) -> f32`[src]

#### `fn tanh(self) -> f32`[src]

#### `fn asinh(self) -> f32`[src]

#### `fn acosh(self) -> f32`[src]

#### `fn atanh(self) -> f32`[src]

#### `fn is_finite(&self) -> bool`[src]

Loading content...

## Implementors

### `impl<N> ComplexField for Complex<N> where
N: RealField,` [src]

#### `type RealField = N`

#### `fn from_real(re: <Complex<N> as ComplexField>::RealField) -> Complex<N>`[src]

#### `fn real(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn imaginary(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn argument(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn modulus(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn modulus_squared(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn norm1(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn recip(self) -> Complex<N>`[src]

#### `fn conjugate(self) -> Complex<N>`[src]

#### `fn scale(self, factor: <Complex<N> as ComplexField>::RealField) -> Complex<N>`[src]

#### `fn unscale(self, factor: <Complex<N> as ComplexField>::RealField) -> Complex<N>`[src]

#### `fn floor(self) -> Complex<N>`[src]

#### `fn ceil(self) -> Complex<N>`[src]

#### `fn round(self) -> Complex<N>`[src]

#### `fn trunc(self) -> Complex<N>`[src]

#### `fn fract(self) -> Complex<N>`[src]

#### `fn mul_add(self, a: Complex<N>, b: Complex<N>) -> Complex<N>`[src]

#### `fn abs(self) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn exp2(self) -> Complex<N>`[src]

#### `fn exp_m1(self) -> Complex<N>`[src]

#### `fn ln_1p(self) -> Complex<N>`[src]

#### `fn log2(self) -> Complex<N>`[src]

#### `fn log10(self) -> Complex<N>`[src]

#### `fn cbrt(self) -> Complex<N>`[src]

#### `fn powi(self, n: i32) -> Complex<N>`[src]

#### `fn is_finite(&self) -> bool`[src]

#### `fn exp(self) -> Complex<N>`[src]

Computes `e^(self)`, where `e` is the base of the natural logarithm.

#### `fn ln(self) -> Complex<N>`[src]

Computes the principal value of natural logarithm of `self`.

This function has one branch cut:

- `(-∞, 0]`, continuous from above.

The branch satisfies `-π ≤ arg(ln(z)) ≤ π`.

#### `fn sqrt(self) -> Complex<N>`[src]

Computes the principal value of the square root of `self`.

This function has one branch cut:

- `(-∞, 0)`, continuous from above.

The branch satisfies `-π/2 ≤ arg(sqrt(z)) ≤ π/2`.

#### `fn try_sqrt(self) -> Option<Complex<N>>`[src]

#### `fn hypot(self, b: Complex<N>) -> <Complex<N> as ComplexField>::RealField`[src]

#### `fn powf(self, exp: <Complex<N> as ComplexField>::RealField) -> Complex<N>`[src]

Raises `self` to a floating point power.

#### `fn log(self, base: N) -> Complex<N>`[src]

Returns the logarithm of `self` with respect to an arbitrary base.

#### `fn powc(self, exp: Complex<N>) -> Complex<N>`[src]

Raises `self` to a complex power.

#### `fn sin(self) -> Complex<N>`[src]

Computes the sine of `self`.

#### `fn cos(self) -> Complex<N>`[src]

Computes the cosine of `self`.

#### `fn sin_cos(self) -> (Complex<N>, Complex<N>)`[src]

#### `fn tan(self) -> Complex<N>`[src]

Computes the tangent of `self`.

#### `fn asin(self) -> Complex<N>`[src]

Computes the principal value of the inverse sine of `self`.

This function has two branch cuts:

- `(-∞, -1)`, continuous from above.
- `(1, ∞)`, continuous from below.

The branch satisfies `-π/2 ≤ Re(asin(z)) ≤ π/2`.

#### `fn acos(self) -> Complex<N>`[src]

Computes the principal value of the inverse cosine of `self`.

This function has two branch cuts:

- `(-∞, -1)`, continuous from above.
- `(1, ∞)`, continuous from below.

The branch satisfies `0 ≤ Re(acos(z)) ≤ π`.

#### `fn atan(self) -> Complex<N>`[src]

Computes the principal value of the inverse tangent of `self`.

This function has two branch cuts:

- `(-∞i, -i]`, continuous from the left.
- `[i, ∞i)`, continuous from the right.

The branch satisfies `-π/2 ≤ Re(atan(z)) ≤ π/2`.

#### `fn sinh(self) -> Complex<N>`[src]

Computes the hyperbolic sine of `self`.

#### `fn cosh(self) -> Complex<N>`[src]

Computes the hyperbolic cosine of `self`.

#### `fn sinh_cosh(self) -> (Complex<N>, Complex<N>)`[src]

#### `fn tanh(self) -> Complex<N>`[src]

Computes the hyperbolic tangent of `self`.

#### `fn asinh(self) -> Complex<N>`[src]

Computes the principal value of inverse hyperbolic sine of `self`.

This function has two branch cuts:

- `(-∞i, -i)`, continuous from the left.
- `(i, ∞i)`, continuous from the right.

The branch satisfies `-π/2 ≤ Im(asinh(z)) ≤ π/2`.

#### `fn acosh(self) -> Complex<N>`[src]

Computes the principal value of inverse hyperbolic cosine of `self`.

This function has one branch cut:

- `(-∞, 1)`, continuous from above.

The branch satisfies `-π ≤ Im(acosh(z)) ≤ π` and `0 ≤ Re(acosh(z)) < ∞`.

#### `fn atanh(self) -> Complex<N>`[src]

Computes the principal value of inverse hyperbolic tangent of `self`.

This function has two branch cuts:

- `(-∞, -1]`, continuous from above.
- `[1, ∞)`, continuous from below.

The branch satisfies `-π/2 ≤ Im(atanh(z)) ≤ π/2`.

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)