use std::ops::{Add, Div, Mul, Sub};
pub trait Scalarish:
Copy + Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Div<Output = Self>
{
fn from_f64(x: f64) -> Self;
fn sin(self) -> Self;
fn cos(self) -> Self;
fn exp(self) -> Self;
fn ln(self) -> Self;
fn sqrt(self) -> Self;
fn recip(self) -> Self;
}
impl Scalarish for f64 {
fn from_f64(x: f64) -> Self {
x
}
fn sin(self) -> Self {
self.sin()
}
fn cos(self) -> Self {
self.cos()
}
fn exp(self) -> Self {
self.exp()
}
fn ln(self) -> Self {
self.ln()
}
fn sqrt(self) -> Self {
self.sqrt()
}
fn recip(self) -> Self {
self.recip()
}
}