Talk:QR decomposition: Difference between revisions

no edit summary
(→‎Draft status: promote)
No edit summary
Line 10:
The code does do the job, but is quite ugly, and overly long. Much improvement is needed, and all the matrix_delete() calls would make you appreciate garbage collection that much more. --[[User:Ledrug|Ledrug]] 01:26, 29 June 2011
: Is the D version (that is a port of the Common Lisp version) any better?
I believe the code has a problem. Under certain circumstances, division by zero will occur in the line
vdiv(e, vnorm(e, m->m), e, m->m);
The reason seems to be that the loop which creates the Householder matrices loops over the number of rows in the input matrix m (m->m), and attempts to extract a column with the same index as the row index from the matrix z (which has the same dimensions as m). This is fine if m->m <= m->n. For purposes of solving over-determined equation systems, however, we will have m->m > m->n. Consequently, we will try to extract non-existing columns from the matrix z, and what they contain will be indeterminate. Should it happen that all column elements are zero, the division by zero referred to above will take place. This of course renders the whole calculation useless.
 
== Common Lisp example ==
Anonymous user