From bug-octave-request at bevo dot che dot wisc dot edu Tue Jun 5 11:33:58 2001 Subject: det() hangs on large matrix From: "John W. Eaton" To: ptdeboer at cs dot utwente dot nl (Pieter-Tjerk de Boer) Cc: bug-octave at bevo dot che dot wisc dot edu Date: Tue, 5 Jun 2001 11:33:52 -0500 On 5-Jun-2001, Pieter-Tjerk de Boer wrote: | Bug report for Octave 2.0.16 configured for sparc-sun-solaris2.6 | | Description: | ----------- | | For some large matrices, trying to calculate the determinant using det() | seems to hang Octave. I.e., for as long as I have waited, no answer (nor an | error message and/or prompt) appears, while for other matrices of the same | size and similar content the answer appears within a second or so. | | | Repeat-By: | --------- | | - Download the following file (size is about 200 kB): | http://www.cs.utwente.nl/~ptdeboer/det_hangs.dat.gz | - Gunzip it | - Start Octave, and load the file; this loads a matrix called 'mm1' of | size 161 x 161 | - Type det(mm1) | On my machine, after 20 minutes Octave is still busy with this example. | | Note that I expect (given the problem in which this matrix came up) that if | the calculation wouldn't hang, Octave would warn that the matrix is singular | to machine precision and return a determinant of 0. | | For comparison, typing det (mm1(1:155,1:155)) produces an answer almost | immediately. Octave uses DGEDI from Linpack to compute the determinant. The problem is that in this loop in DGEDI, 30 IF (DABS(DET(1)) .LT. TEN) GO TO 40 DET(1) = DET(1)/TEN DET(2) = DET(2) + 1.0D0 GO TO 30 40 CONTINUE your matrix results in DET(1) == Inf. So dividing it by TEN does not reduce its value and its absolute value never becomes less than 10, and the loop repeats indefinitely. I don't know of a good solution for the problem. jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------