rsdiff_math/linalg/
fields.rs1use core::marker::PhantomData;
6use num::complex::Complex;
7use num::traits::real::Real;
8pub trait Field {
12 const RANK: Option<usize> = None;
13 type Elem: ?Sized;
14
15 fn kind(&self) -> Fields;
16 fn rank(&self) -> usize;
18 fn size(&self) -> usize;
20}
21
22pub enum Fields {
23 Real(R),
24 Complex(C),
25}
26
27pub struct R<T = f64>
28where
29 T: Real,
30{
31 _elem: PhantomData<T>,
32}
33
34pub struct C<T = f64>
35where
36 T: Real,
37{
38 _elem: PhantomData<Complex<T>>,
39}
40
41pub trait ComplexField {
42 type DType;
43}
44
45pub trait Scalar {
46 type Complex: ComplexField<DType = Self::Real>;
47 type Real: Scalar<Real = Self::Real>;
48}
49
50#[cfg(test)]
51mod tests {}