Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Numpy in different platforms

I have a piece of code which computes the Helmholtz-Hodge Decomposition. I've been running on my Mac OS Yosemite and it was working just fine. A month ago, however, my Mac got pretty slow (it was really old), and I opted to buy a new notebook (Windows 8.1, Dell).

After installing all Python libs and so on, I continued my work running this same code (versioned in Git). And then the result was pretty weird, completely different from the one obtained in the old notebook.

For instance, what I do is to construct to matrices a and b(really long calculus) and then I call the solver:

s = numpy.linalg.solve(a, b)

This was returning a (wrong, and different of the result obtained in my Mac, which was right).

Then, I tried to use:

s = scipy.linalg.solve(a, b)

And the program exits with code 0 but at the middle of it. Then, I just made a simple test of:

print 'here1'
s = scipy.linalg.solve(a, b)
print 'here2'

And here2 is never printed.

I tried:

print 'here1'
x, info = numpy.linalg.cg(a, b)
print 'here2'

And the same happens.

I also tried to check the solution after using numpy.linalg.solve:

print numpy.allclose(numpy.dot(a, s), b)

And I got a False (?!).

I don't know what is happening, how to find a solution, I just know that the same code runs in my Mac, but it would be very good if I could run it in other platforms. Now I'm stucked in this problem (don't have a Mac anymore) and with no clue about the cause.

The weirdest thing is that I don't receive any error on runtime warning, no feedback at all.

Thank you for any help.

EDIT:

Numpy Suit Test Results:

enter image description here

Scipy Suit Test Results:

enter image description here

like image 793
pceccon Avatar asked May 13 '15 00:05

pceccon


People also ask

Is NumPy used in industry?

NumPy is one of the most powerful Python libraries. It is used in the industry for array computing.

Where we can use NumPy?

The NumPy API is used extensively in Pandas, SciPy, Matplotlib, scikit-learn, scikit-image and most other data science and scientific Python packages. The NumPy library contains multidimensional array and matrix data structures (you'll find more information about this in later sections).

Is NumPy only for Python?

The only prerequisite for installing NumPy is Python itself. If you don't have Python yet and want the simplest way to get started, we recommend you use the Anaconda Distribution - it includes Python, NumPy, and many other commonly used packages for scientific computing and data science.

Why NumPy is faster than list?

NumPy Arrays are faster than Python Lists because of the following reasons: An array is a collection of homogeneous data-types that are stored in contiguous memory locations. On the other hand, a list in Python is a collection of heterogeneous data types stored in non-contiguous memory locations.


1 Answers

Download Anaconda package manager

http://continuum.io/downloads

When you download this it will already have all the dependencies for numpy worked out for you. It installs locally and will work on most platforms.

like image 160
aapponi Avatar answered Sep 20 '22 21:09

aapponi