Closed beomki-yeo closed 1 year ago
Clients will not be expected to use types like algebra::determinant::partial_pivot_lud directly, right?
Right. They should not be exposed to clients in general.
In case users want to call the decomposed matrix thru algebra::cmath::matrix::decomposition::lud
, it will be problematic because SMatrix doesn't seem to have LU decompose function.
But I don't think we have a specific use case for that.
This PR is motivated by the poor precision of the cofactor method of
cmath
plugin: The single precision result of the cofactor method is quite different from the double precision one.Following values is the determinant of 6x6 matrix that appears during the kalman filtering
eigen-eigen float: 0.00000000004306401069
eigen-eigen double: 0.00000000004306355415
array-cmath float with cofactor: 0.00000000004327766964 (BAD)
array-cmath double with cofactor: 0.00000000004306355415
array-cmath float with partial pivot LU decomposition: 0.00000000004306400722
array-cmath double with partial pivot LU decomposition: 0.00000000004306355415
It is obvious that LU decomposition gives more reliable result with single precision.