cfg_if::cfg_if! {
if #[cfg(feature="f64")] {
pub type Flt = f64;
pub const pi: Flt = std::f64::consts::PI;
}
else if #[cfg(feature="f32")] {
pub type Flt = f32;
pub const pi: Flt = std::f32::consts::PI;
}
else {
std::compile_error!("feature should be f32 or f64");
}
}
cfg_if::cfg_if! {
if #[cfg(feature = "python-bindings")] {
pub use numpy::ndarray::{ArrayD, ArrayViewD, ArrayViewMutD};
pub use numpy::ndarray::prelude::*;
pub use numpy::{IntoPyArray,PyArray, PyArray1, PyArrayDyn, PyArrayLike1, PyReadonlyArrayDyn};
pub use numpy::ndarray::Zip;
pub use pyo3::prelude::*;
pub use pyo3::exceptions::PyValueError;
pub use pyo3::{pymodule, types::PyModule, PyResult};
pub use pyo3::anyhow::*;
pub use pyo3;
} else {
pub use ndarray::prelude::*;
pub use ndarray::Zip;
pub use ndarray::{Array1, Array2, ArrayView1};
} }
use ndarray::OwnedRepr;
use num::complex::Complex;
pub use num::complex::ComplexFloat;
pub type VdView<'a> = ArrayView1<'a, Flt>;
pub type VcView<'a> = ArrayView1<'a, Cflt>;
pub type Cflt = Complex<Flt>;
pub const I: Cflt = Cflt::new(0., 1.);
pub type Vd = Vec<Flt>;
pub type Vc = Vec<Cflt>;
pub type Dcol = Array1<Flt>;
pub type Ccol = Array1<Cflt>;
pub type Dmat = Array2<Flt>;
pub type Cmat = Array2<Cflt>;
cfg_if::cfg_if! {
if #[cfg(feature = "python-bindings")] {
pub type PyArr1<'py, T> = Bound<'py, PyArray<T, ndarray::Dim<[usize; 1]>>>;
pub type PyArr1Flt<'py> = PyArr1<'py, Flt>;
pub type PyArr1Cflt<'py> = PyArr1<'py, Cflt>;
}}