ericjang / svd3

Fast singular value decomposition, diagonalization, QR decomposition of 3x3 matrices.
MIT License
149 stars 19 forks source link

Precision is not high enough #1

Closed serpheroth closed 10 years ago

serpheroth commented 10 years ago

U * S * Vt deviates a little from the original matrix in the CPU implementation. Any way to improve the precision?

ericjang commented 10 years ago

hi, the original paper makes use of several numerical optimizations to trade speed for accuracy. if you want a more accurate SVD, use the std::sqrt() routine instead of the rsqrt approximation. that should give you a far more accurate answer, albeit slower.

serpheroth commented 10 years ago

I tested std::sqrtf(), why it is even faster? From ~0.44-0.45ms to ~0.40ms on my machine