Skip to main content

AbsSquared

Trait AbsSquared 

Source
pub trait AbsSquared {
    type Output;

    // Required method
    fn abs_squared(self) -> Self::Output;
}
Expand description

Computes the squared absolute value of a number.

For a real number this is just its square, but for a complex number it is the sum of the squares of its real and imaginary parts. In both cases it equals $|x|^2$; for Gaussian integers and Gaussian rationals this quantity is also called the norm.

Required Associated Types§

Required Methods§

Source

fn abs_squared(self) -> Self::Output

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AbsSquared for f32

Source§

fn abs_squared(self) -> f32

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = f32

Source§

impl AbsSquared for f64

Source§

fn abs_squared(self) -> f64

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = f64

Source§

impl AbsSquared for i8

Source§

fn abs_squared(self) -> i8

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = i8

Source§

impl AbsSquared for i16

Source§

fn abs_squared(self) -> i16

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = i16

Source§

impl AbsSquared for i32

Source§

fn abs_squared(self) -> i32

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = i32

Source§

impl AbsSquared for i64

Source§

fn abs_squared(self) -> i64

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = i64

Source§

impl AbsSquared for i128

Source§

fn abs_squared(self) -> i128

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = i128

Source§

impl AbsSquared for isize

Source§

fn abs_squared(self) -> isize

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = isize

Source§

impl AbsSquared for u8

Source§

fn abs_squared(self) -> u8

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = u8

Source§

impl AbsSquared for u16

Source§

fn abs_squared(self) -> u16

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = u16

Source§

impl AbsSquared for u32

Source§

fn abs_squared(self) -> u32

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = u32

Source§

impl AbsSquared for u64

Source§

fn abs_squared(self) -> u64

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = u64

Source§

impl AbsSquared for u128

Source§

fn abs_squared(self) -> u128

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = u128

Source§

impl AbsSquared for usize

Source§

fn abs_squared(self) -> usize

Computes the squared absolute value of a number. For real types this is the same as squaring.

$f(x) = |x|^2 = x^2$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

type Output = usize

Implementors§