det-rs
Calculate the determinant of a square matrix using a Rust macro
This macro should not be used directly. Instead, it should be called inside a function that is used elsewhere.
Usage
Calculate the area of a parallelogram:
Calculate a 4D orthogonal vector using nalgebra:
Usually det!
should be used in these cases, but strangely, it causes a type recursion error,
so we use det_copy!
instead. Note, that the constructors (eg. Vector4::x()
) are executed multiple times.
To avoid this, bind the vectors to a variable first and pass in the variable instead.
Requirements
There are various macros for various types of values.
det_copy!
T: Copy
T: Mul<T, Output=T>
T: Sub<T, Output=T>
T: Add<T, Output=T>
det_clone!
T: Clone
T: Mul<T, Output=T>
T: Sub<T, Output=T>
T: Add<T, Output=T>
det!
T: Mul<T, Output=T>
for<'a> &'a T: Mul<T, Output=T>
for<'a, 'b> &'a T: Mul<&'b T, Output=T>
T: Sub<T, Output=T>
T: Add<T, Output=T>