pub trait ComplexScalarConstructors: FpScalar<InnerType = Self::RawComplex> {
type RawComplex: RawComplexTrait<RawReal = <Self::RealType as RealScalar>::RawReal>;
// Required method
fn try_new_complex(
real: <Self::RawComplex as RawComplexTrait>::RawReal,
imag: <Self::RawComplex as RawComplexTrait>::RawReal,
) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>;
// Provided methods
fn new_complex(real: Self::RealType, imag: Self::RealType) -> Self { ... }
fn try_new_pure_real(
real_part: <Self::RawComplex as RawComplexTrait>::RawReal,
) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors> { ... }
fn try_new_pure_imaginary(
imag_part: <Self::RawComplex as RawComplexTrait>::RawReal,
) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors> { ... }
fn new_pure_real(real_part: Self::RealType) -> Self { ... }
fn new_pure_imaginary(imag_part: Self::RealType) -> Self { ... }
}
Expand description
Trait for constructing complex scalar types from their raw components.
Required Associated Types§
Sourcetype RawComplex: RawComplexTrait<RawReal = <Self::RealType as RealScalar>::RawReal>
type RawComplex: RawComplexTrait<RawReal = <Self::RealType as RealScalar>::RawReal>
The raw underlying complex type (e.g., num::Complex<f64>
or rug::Complex
).
Required Methods§
Sourcefn try_new_complex(
real: <Self::RawComplex as RawComplexTrait>::RawReal,
imag: <Self::RawComplex as RawComplexTrait>::RawReal,
) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>
fn try_new_complex( real: <Self::RawComplex as RawComplexTrait>::RawReal, imag: <Self::RawComplex as RawComplexTrait>::RawReal, ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>
Tries to create a new complex scalar from its raw real and imaginary parts.
Provided Methods§
Sourcefn new_complex(real: Self::RealType, imag: Self::RealType) -> Self
fn new_complex(real: Self::RealType, imag: Self::RealType) -> Self
Creates a new complex scalar from its (validated) real and imaginary parts.
Sourcefn try_new_pure_real(
real_part: <Self::RawComplex as RawComplexTrait>::RawReal,
) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>
fn try_new_pure_real( real_part: <Self::RawComplex as RawComplexTrait>::RawReal, ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>
Tries to create a new complex scalar from a raw real part, with a zero imaginary part.
Sourcefn try_new_pure_imaginary(
imag_part: <Self::RawComplex as RawComplexTrait>::RawReal,
) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>
fn try_new_pure_imaginary( imag_part: <Self::RawComplex as RawComplexTrait>::RawReal, ) -> Result<Self, <Self::RawComplex as RawScalarTrait>::ValidationErrors>
Tries to create a new complex scalar from a raw imaginary part, with a zero real part.
fn new_pure_real(real_part: Self::RealType) -> Self
fn new_pure_imaginary(imag_part: Self::RealType) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ComplexScalarConstructors for Complex<f64>
impl ComplexScalarConstructors for Complex<f64>
type RawComplex = Complex<f64>
fn try_new_complex( real_part: f64, imag_part: f64, ) -> Result<Self, ErrorsValidationRawComplex<ErrorsValidationRawReal<f64>>>
Implementors§
Source§impl<K: NumKernel> ComplexScalarConstructors for ComplexValidated<K>
Implement the ComplexScalarConstructors
trait for the ComplexValidated
type.
impl<K: NumKernel> ComplexScalarConstructors for ComplexValidated<K>
Implement the ComplexScalarConstructors
trait for the ComplexValidated
type.