Absolute Zero...

Hey all.

I'm doing some work on my linear algebra package. I'm actually writing a function to factorise a square matrix 'A' into LU components. Anyway, that isn't important. Here is the U component I'm looking at:

U =
765 2938 7
-1.37668e-014 -1014.87 -2.58954
-1.95463e-016 1.45717e-016 0.927951

Now those values which are incredibly small are meant to be zero. I'm working with doubles and they are all initialised to zero.

Some relevant code:

1
2
3
4
lead = U(i,j);
L(i,j) = lead/U(rowCount,j);
...
U(i,k) = U(i,k) - L(i,j)*U(rowCount,k);


Do you think this is due to the division on line 2? I'm not really sure what is going on. MATLAB returns zeros.

Any thoughts?

Nick.
Doubles use floating point representation, which approximates their values. A double will rarely have an exact value.
Thanks for that Bazzy!
Topic archived. No new replies allowed.