Operators for matrix: current choices (Was Matlab vs Python ...)

Gareth McCaughan gjm11 at g.local
Wed Jul 19 16:01:22 EDT 2000


Huaiyu Zhu wrote:

[Tim Hochberg:]
>> Personally I think that this an overlarge crop of operators to be
>> adding. Since I prefer something like:
>>
>> A.inv * B 
>>
>> to 
>>
>> A \ B
> 
> They are equal in math, but not in practice.  The former takes O(n^3)
> computation while the latter is O(n^2).  The former is also less accurate
> for near singular A because of rounding error.

You can do A\B in O(n^2) time? That's news to me. In fact,
I don't believe you.

(It *is* true that there are more efficient ways to solve
linear equations than by inverting the matrix, but as someone's
pointed out you don't actually need to invert the matrix when
you calculate A.inv() [or, if you insist, A.inv]. You could,
e.g., do an LU decomposition instead.)

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction



More information about the Python-list mailing list