Talk:Reduced row echelon form: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 30: Line 30:


I tried putting in a singular matrix into the C# code and it is giving divide by zero errors. When I told it to skip when it is dividing by zero, the results keep changing. Also I corrected an error in the C# code that caused the lead value to be out of bounds.
I tried putting in a singular matrix into the C# code and it is giving divide by zero errors. When I told it to skip when it is dividing by zero, the results keep changing. Also I corrected an error in the C# code that caused the lead value to be out of bounds.
: I won't be able to test it myself, but can you provide a sample matrix that reproduces the problem? --[[User:Short Circuit|Michael Mol]] 03:08, 10 October 2010 (UTC)

Revision as of 03:08, 10 October 2010

"Break" vs. "return" bug

The original author of the Python example mistakenly translated the keyword stop that appears in the Wikipedia pseudocode as break rather than the correct return. This created a control-flow bug that didn't manifest itself when the program was run on the example matrix given in the task description, but did cause an exception if the program was run on, e.g.,

 1  2  3  4  3  1
 2  4  6  2  6  2
 3  6 18  9  9 -6
 4  8 12 10 12  4
 5 10 24 11 15 -4

I noticed and fixed the bug a couple of days ago, but it seems that several of the other examples written before then (being, by and large, translations from the Python) copied the bug. Hence, I've marked all the examples that looked like they might have this bug with the needs-review template. Note that I erred on the side of false positives. That is, I'm pretty sure the examples I didn't mark are bug-free, but some of the ones I did mark may be fine. —Underscore 00:25, 5 May 2009 (UTC)

I ran the ALGOL 68 version and got:

(( 1.0000,  2.0000,  0.0000,  0.0000,  3.0000,  4.0000), 
 ( 0.0000,  0.0000,  1.0000,  0.0000,  0.0000, -1.0000), 
 ( 0.0000,  0.0000,  0.0000,  1.0000,  0.0000,  0.0000), 
 ( 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000), 
 ( 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000))

Vs the current python version which got:

1, 2, 0, 0, 3, 4
0, 0, 1, 0, 0, -1
0, 0, 0, 1, 0, 0
0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0

It looks like - currently- they are both getting the same answer... next step is it to get out a pencil.

NevilleDNZ 01:46, 5 May 2009 (UTC)

Code doesn't work for singular matrices

I tried putting in a singular matrix into the C# code and it is giving divide by zero errors. When I told it to skip when it is dividing by zero, the results keep changing. Also I corrected an error in the C# code that caused the lead value to be out of bounds.

I won't be able to test it myself, but can you provide a sample matrix that reproduces the problem? --Michael Mol 03:08, 10 October 2010 (UTC)