Simple Matrix class

Robert Kern robert.kern at gmail.com
Wed Jan 24 16:18:07 EST 2007


Paul McGuire wrote:
> On Jan 24, 1:47 pm, Robert Kern <robert.k... at gmail.com> wrote:
>> Paul McGuire wrote:
>>> And the purpose/motivation for "reimplementing it better" would be
>>> what, exactly?  So I can charge double for it?
>> So you can have accurate results, and you get a good linear solver out of the
>> process. The method you use is bad in terms of accuracy as well as efficiency.
> 
> Dang, I thought I was testing the results sufficiently!  What is the
> accuracy problem?  In my test cases, I've randomly created test
> matrices, inverted, then multiplied, then compared to the identity
> matrix, with the only failures being when I start with a singular
> matrix, which shouldn't invert anyway.

Ill-conditioned matrices. You should grab a copy of _Matrix Computations_ by
Gene H. Golub and Charles F. Van Loan.

For example, try the Hilbert matrix n=6.

  H_ij = 1 / (i + j - 1)

  http://en.wikipedia.org/wiki/Hilbert_matrix

While all numerical solvers have issues with ill-conditioned matrices, your
method runs into them faster.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list