use std::cmp::Ordering;
pub trait Conj {
type Output;
fn conj(self) -> Self::Output;
}
pub trait Max<Other = Self> {
type Output;
fn max(self, other: Other) -> Self::Output;
}
pub trait Min<Other = Self> {
type Output;
fn min(self, other: Other) -> Self::Output;
}
pub trait TotalCmp: Sized + Copy {
fn total_cmp(self, other: Self) -> Ordering;
#[inline(always)]
fn lt(self, other: Self) -> bool {
matches!(self.total_cmp(other), Ordering::Less)
}
#[inline(always)]
fn le(self, other: Self) -> bool {
self.lt(other) || self.eq(other)
}
#[inline(always)]
fn ge(self, other: Self) -> bool {
self.gt(other) || self.eq(other)
}
#[inline(always)]
fn gt(self, other: Self) -> bool {
matches!(self.total_cmp(other), Ordering::Greater)
}
#[inline(always)]
fn eq(self, other: Self) -> bool {
matches!(self.total_cmp(other), Ordering::Equal)
}
}
pub trait Abs {
type Output;
fn abs(self) -> Self::Output;
}
pub trait Square {
type Output;
fn square(self) -> Self::Output;
}
pub trait AbsSquare {
type Output;
fn abs_square(self) -> Self::Output;
}
pub trait Sqrt {
type Output;
fn sqrt(self) -> Self::Output;
}
pub trait Recip {
type Output;
fn recip(self) -> Self::Output;
}
pub trait Exp {
type Output;
fn exp(self) -> Self::Output;
}
pub trait Ln {
type Output;
fn ln(self) -> Self::Output;
}
pub trait Sin {
type Output;
fn sin(self) -> Self::Output;
}
pub trait Cos {
type Output;
fn cos(self) -> Self::Output;
}
pub trait Tan {
type Output;
fn tan(self) -> Self::Output;
}
pub trait Asin {
type Output;
fn asin(self) -> Self::Output;
}
pub trait Acos {
type Output;
fn acos(self) -> Self::Output;
}
pub trait Atan {
type Output;
fn atan(self) -> Self::Output;
}
pub trait Sinh {
type Output;
fn sinh(self) -> Self::Output;
}
pub trait Cosh {
type Output;
fn cosh(self) -> Self::Output;
}
pub trait Tanh {
type Output;
fn tanh(self) -> Self::Output;
}
pub trait Asinh {
type Output;
fn asinh(self) -> Self::Output;
}
pub trait Acosh {
type Output;
fn acosh(self) -> Self::Output;
}
pub trait Atanh {
type Output;
fn atanh(self) -> Self::Output;
}