Back to Eqiora docs Skip to main content

Scalar

Trait Scalar 

pub trait Scalar:
    Copy
    + PartialEq
    + Debug
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + Neg<Output = Self>
    + Sealed {
    const DOMAIN: ScalarDomain;
    const STORAGE: ScalarType;
}
Description

Arithmetic scalar types admitted into quantities. Ordering is a separate bound; complex quantities support equality only.

ⓘ
use eqiora_core::quantity::{Quantity, dim};
use num_complex::Complex64;
let z = Quantity::<Complex64, dim::LengthDim>::from_scalar(Complex64::new(1., 2.));
let _ = z < z;

Required Associated Constants§

const DOMAIN: ScalarDomain

Mathematical domain, independent of storage precision.

const STORAGE: ScalarType

Representation of each real component.

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§

§

impl Scalar for f32

§

const DOMAIN: ScalarDomain = crate::ScalarDomain::Real

§

const STORAGE: ScalarType = crate::ScalarType::F32

§

impl Scalar for f64

§

const DOMAIN: ScalarDomain = crate::ScalarDomain::Real

§

const STORAGE: ScalarType = crate::ScalarType::F64

§

impl Scalar for Complex<f32>

§

const DOMAIN: ScalarDomain = crate::ScalarDomain::Complex

§

const STORAGE: ScalarType = crate::ScalarType::F32

§

impl Scalar for Complex<f64>

§

const DOMAIN: ScalarDomain = crate::ScalarDomain::Complex

§

const STORAGE: ScalarType = crate::ScalarType::F64

Implementors§