aboutsummaryrefslogtreecommitdiff
path: root/libpsi/src/maths/numeric_float.rs
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2024-09-24 21:33:51 +0200
committerhachem <im@hachem.wtf>2024-09-24 21:33:51 +0200
commitc07ab7911bd50d0060841690a863333a9a3f226d (patch)
tree5deb12fc8234d553318e4615ae21ddfcc6db4ab4 /libpsi/src/maths/numeric_float.rs
parent26010345eedc716c70e8a4219005db19b266c960 (diff)
rename project
Diffstat (limited to 'libpsi/src/maths/numeric_float.rs')
-rw-r--r--libpsi/src/maths/numeric_float.rs65
1 files changed, 0 insertions, 65 deletions
diff --git a/libpsi/src/maths/numeric_float.rs b/libpsi/src/maths/numeric_float.rs
deleted file mode 100644
index 3591f24..0000000
--- a/libpsi/src/maths/numeric_float.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-use super::{Complex, Float};
-
-impl Float for f32 {
- fn sqrt(self) -> Self {
- libm::sqrtf(self)
- }
-
- fn atan2(y: Self, x: Self) -> Self {
- libm::atan2f(y, x)
- }
-}
-
-impl Float for f64 {
- fn sqrt(self) -> Self {
- libm::sqrt(self)
- }
-
- fn atan2(y: Self, x: Self) -> Self {
- libm::atan2(y, x)
- }
-}
-
-impl Float for Complex<f32> {
- fn sqrt(self) -> Self {
- let r = self.abs();
- let theta = self.phase();
-
- let sqrt_r = libm::sqrtf(r);
- let sqrt_theta = theta / 2.0;
-
- Complex::new(
- sqrt_r * libm::cosf(sqrt_theta),
- sqrt_r * libm::sinf(sqrt_theta),
- )
- }
-
- fn atan2(y: Self, x: Self) -> Self {
- Complex::new(
- libm::atan2f(y.real, x.real),
- libm::atan2f(y.imaginary, x.imaginary),
- )
- }
-}
-
-impl Float for Complex<f64> {
- fn sqrt(self) -> Self {
- let r = self.abs();
- let theta = self.phase();
-
- let sqrt_r = libm::sqrt(r);
- let sqrt_theta = theta / 2.0;
-
- Complex::new(
- sqrt_r * libm::cos(sqrt_theta),
- sqrt_r * libm::sin(sqrt_theta),
- )
- }
-
- fn atan2(y: Self, x: Self) -> Self {
- Complex::new(
- libm::atan2(y.real, x.real),
- libm::atan2(y.imaginary, x.imaginary),
- )
- }
-}