[Tutor] From Numpy Import *

Evert Rol evert.rol at gmail.com
Fri Nov 9 10:10:46 CET 2007

> Thank-you!  It is important for us to avoid potential code  
> conflicts and so we'll standardize on the import <package name>  
> syntax.
> On a related note:
> We are using both NumPy and SciPy.  Consider the example y = Ax  
> where A is a sparse matrix.  If A is qualified as a scipy object  
> then do y and x also have to be scipy objects or can they be numpy  
> objects?

scipy is mostly written with numpy as its core, so in general you  
should be able to use numpy objects with scipy objects (not sure, but  
I guess most scipy objects will have a numpy object as their base).
The best is simply to try it out! In this particular case, x can be a  
numpy array; y is created in the process, so will be the type of  
object most suited to the outcome of the equation (ie, you cannot  
state beforehand if it's a numpy or scipy object); in this case,  
again a numpy array.
See also the scipy tutorial on the scipy.org website, where numpy and  
scipy objects are freely mixed.

More information about the Tutor mailing list