An introduction to SciPy
An introduction to SciPy
Posted Jan 19, 2021 23:59 UTC (Tue) by Cyberax (✭ supporter ✭, #52523)In reply to: An introduction to SciPy by xxiao
Parent article: An introduction to SciPy
Yes.
> the heavy duty is still executed in c/c++ modules, the python/scipy here are just glue
The problem happens once you can't express an algorithm using existing primitives in scipy/numpy and forced to do a tight loop in actual Python.
My most recent example: a dynamic programming-based optimization task. It can't be readily vectorized and pure Python version is just too slow.
Posted Jan 20, 2021 14:36 UTC (Wed)
by mikapfl (subscriber, #84646)
[Link] (4 responses)
Posted Jan 20, 2021 18:36 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (3 responses)
Posted Jan 21, 2021 15:55 UTC (Thu)
by mikapfl (subscriber, #84646)
[Link] (1 responses)
Posted Jan 21, 2021 21:23 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Sometimes you have no choice but to use workarounds. But with a nice alternative (Julia) existing, why bother?
Posted Jan 21, 2021 16:03 UTC (Thu)
by marcel.oliver (subscriber, #5441)
[Link]
One of these is a simple tridiagonal solver, which is more than 3 times faster than Scipy's solve_banded (which shows that built-in functions are not always best as, in this case, the built-in solver is more general) and about 120 times faster than native Python.
So there are certainly speed and GIL issues in Python in serious need of fixing (maybe Numba is the way forward, but I did not have the need to try it yet). And, of course, Julia is an interesting and clean approach (that would probably have eaten Scipy's lunch if it was around 10 years earlier) but the tradeoffs for switching Ecosystems are still not so clear, especially since heavy-duty numerical code is still dominated, for good reason, by Fortran and C/C++.
The big advantage of Python is that the language and software landscape is not domain specific, yet it works very well and very naturally for array-based computation and data processing. So it's pretty seemless from symbolic computation (Sympy) via numerics to dedicated plotting, output, GUI, and networking components.
An introduction to SciPy
An introduction to SciPy
An introduction to SciPy
An introduction to SciPy
Just a data point: I have some, admittedly simple, Cython scripts that survived the Python 2 to 3 transition without change, which is more than can be said for a lot of other Python code, even though the transition of scientific software was generally relatively painless.
An introduction to SciPy