Skip to main content

ElementOpApply

Trait ElementOpApply 

pub trait ElementOpApply: Copy {
    // Provided methods
    fn conj(self) -> Self { ... }
    fn transpose(self) -> Self { ... }
    fn adjoint(self) -> Self { ... }
}
Expand description

Trait for types that support element operations (conj, transpose, adjoint).

Default implementations return self unchanged, so real-valued types (and custom types that don’t need complex operations) can simply write:

use strided_traits::ElementOpApply;

#[derive(Clone, Copy, Debug, PartialEq)]
struct MyType(f64);

impl ElementOpApply for MyType {}

// The provided methods leave the element unchanged.
assert_eq!(MyType(2.0).conj(), MyType(2.0));
assert_eq!(MyType(2.0).adjoint(), MyType(2.0));

Provided Methods§

fn conj(self) -> Self

fn transpose(self) -> Self

fn adjoint(self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

§

impl ElementOpApply for f32

§

impl ElementOpApply for f64

§

impl ElementOpApply for i8

§

impl ElementOpApply for i16

§

impl ElementOpApply for i32

§

impl ElementOpApply for i64

§

impl ElementOpApply for i128

§

impl ElementOpApply for isize

§

impl ElementOpApply for u8

§

impl ElementOpApply for u16

§

impl ElementOpApply for u32

§

impl ElementOpApply for u64

§

impl ElementOpApply for u128

§

impl ElementOpApply for usize

§

impl<T> ElementOpApply for Complex<T>
where T: Num + Copy + Clone + Neg<Output = T>,

§

fn conj(self) -> Complex<T>

§

fn transpose(self) -> Complex<T>

§

fn adjoint(self) -> Complex<T>

Implementors§