Operators for matrix: current choices (Was Matlab vs Python ...)
Charles Boncelet
boncelet at eecis.udel.edu
Wed Jul 19 14:42:59 EDT 2000
Huaiyu Zhu wrote:
> >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.
Let me interject: Both computing A.inv and solving AX=B takes O(n^3)
operations. It is often preferable that an expression like A\B be
computed as solve(A,B) for numerical reasons and occasionally when
special algorithms for A can be exploited, e.g., when A is structured or
it is known that A and/or B has special properties.
This is similar to why the numerical people want += operators (besides
saving typing): Special methods can be invoked automatically.
--
Charles Boncelet 302-831-8008
Dept of Electrical and Computer Engineering 302-831-4316 (fax)
University of Delaware boncelet at eecis.udel.edu
http://www.eecis.udel.edu/~boncelet/
More information about the Python-list
mailing list