program in python, using numpy is disappointingly slow.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
program in python, using numpy is disappointingly slow.
Is there some trick to telling python (2.7) about ATLAS? I wrote a function to find the intersection of a line and a plane, first in C++, then in Python and then in PHP. Even PHP, which is mathematically challenged, run 3x faster than Python.
Code:
def ray_test( ray, plane ) :
d = ray.get_delta()
if np.dot( d, plane.normal() ) > -1e-9 :
return 0
p0 = plane.get_p0()
A = np.transpose( [-d, plane.get_p1() - p0, plane.get_p2() - p0] )
return np.linalg.solve( A, ray.get_origin() - p0 )
As you can see, I call dot and cross products, transpose and solve, which should be passed on to the ATLAS library but it doesn't seem like it is. What am I doing wrong?
Okay, that sounds promising. I'm not sure how to do that but I'll look into it.
If you're building numpy from source, then you simply have ATLAS installed when you build numpy. While I haven't confirmed this personally, you would likely see in the console output that ATLAS was detected at compile time.
What I did was grab Numpy 1.9.1 from Slackbuilds.org and process it as usual ( bash numpy.Slackbuild) which compiles th source and creates a Slackware package, and then installpkg on the package it created. Atlas is installed as lapack-atlas-3.3.1-x86-64-1_SBo according to my package list ( in /var/log/packages ). I saw no indication on an option to include ATLAS nor any mention that it has done so. I'm pretty sure the Armadillo package and C++ are using it though.
I suppose what I need to do is link the C++ version into a Python lib so I can import it and use it. I'll put that on my list of things to do and maybe, in a year ot two, ... lol
I suppose what I need to do is link the C++ version into a Python lib so I can import it and use it. I'll put that on my list of things to do and maybe, in a year ot two, ... lol
Or you could contact the SlackBuild maintainer like I recommended?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.