1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use core::ops::{Mul, MulAssign, Neg};
use num_traits::One;
use super::{smul, smul_mut};
#[inline]
pub fn inv<'out, T>(out: &'out mut [T; 3], b: &[T; 3]) -> &'out mut [T; 3]
where
T: One + Neg<Output = T>,
for<'a, 'b> &'a T: Mul<&'b T, Output = T>,
{
smul(out, b, &-T::one())
}
#[inline]
pub fn inv_mut<'out, T>(out: &'out mut [T; 3]) -> &'out mut [T; 3]
where
T: One + Neg<Output = T>,
for<'a> T: MulAssign<&'a T>,
{
smul_mut(out, &-T::one())
}