4 ms·
It does work in theory and for integer numbers. Such an algorithm might be used in practice when numerical stability is concerned, but condition number can cert
by renonce 3y ago
It does work in theory and for integer numbers. Such an algorithm might be used in practice when numerical stability is concerned, but condition number can certainly be defined somewhere in another textbook and you just need more context to tell it to use another method.
- cafaxo 3y agoEdit: Sorry, I completely messed up my original answer here. A better version: Let's say we are in a setting where we only work with integers. A matrix is invertible iff its determinant is invertible in the underlying ring. The only invertible elements in Z are -1 and 1. So, the code is also incorrect in the integer setting. Here, we should not check for 0, but for -1 or 1.
- thaumasiotes 3y agoIf I'm reading you correctly, you'd also need to flip the response to the check: where the original test for 0 determines that a matrix is singular if it does find 0, the new test for ±1 should determine that a matrix is singular if it does not find ±1?
- cafaxo 3y agoYes, exactly.