[SciPy-dev] unexpectedly slow norm()

Robert Kern robert.kern@gmail....
Wed Mar 19 13:44:41 CDT 2008


On Wed, Mar 19, 2008 at 2:22 AM, Nathan Bell <wnbell@gmail.com> wrote:
> I use norm() frequently in my own codes and I was recently surprised
>  to see it near the top of my profiling results.  It seems that both
>  SciPy and NumPy incur a large amount of overhead in this operation.

They are general functions for computing a variety of norms, not just
the L2 norm. The numpy implementation of the L2 norm avoids some
unnecessary function calls and could replace the scipy one. Both do a
general formulation for both complex and real arrays which is probably
costing us. If you would like to code up the extra test for realness
to evaluate the L2 norm faster, go ahead.

-- 
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 Scipy-dev mailing list