<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Den 13.02.2011 01:02, skrev eat:
<blockquote
cite="mid:AANLkTimE0Z9ZLY9pDhDraTGsa0PPsAiOWE4Gkk2xk8TU@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div>Now, I'm not pretending to know what kind of a person a
'typical' numpy user is. But I'm assuming that there just
exists more than me with roughly similar questions in their
(our) minds and who wish to utilize numpy more 'pythonic; all
batteries included' way. Ocassionally I (we) may ask really
stupid questions, but please beare with us.</div>
</div>
</blockquote>
<br>
It was not a stupid question. It is not intuitive that N
multiplications and N additions can be faster than just N additions.<br>
<br>
<blockquote
cite="mid:AANLkTimE0Z9ZLY9pDhDraTGsa0PPsAiOWE4Gkk2xk8TU@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div> If you need fast loops, you<br>
</div>
<blockquote style="border-left: 1px solid rgb(204, 204, 204);
margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"
class="gmail_quote">
can always write your own Fortran or C, and even insert OpenMP
pragmas.</blockquote>
<div>That's a very important potential, but surely not all numpy
users are expected to master that ;-)<br>
</div>
</div>
</blockquote>
<br>
Anyone who is serious about scintific computing should spend some
time to learn Fortran 95, C, or both.<br>
<br>
Fortran is easier to learn and use, and has arrays like NumPy. C is
more portable, but no so well suited for numerical computing.<br>
<br>
One of the strengths of NumPy, compared to e.g. Matlab, is the easy
integration with C and Fortran libraries using tools like ctypes,
f2py, Cython, or Swig. If you have ever tried to write a MEX file
for Matlab, you'll appreciate NumPy. <br>
<br>
It is also a big strength to learn to use certain numerical
libraries, like BLAS and LAPACK (e.g. Intel MKL and AMD ACML), IMSL,
FFTW, NAG, et al., to avoid reinventing the wheel. Most of the
numerical processing in scientific computing is done by these
libraries, so even learning to use them and call them from Python
(e.g. with ctypes) is a very useful skill. Premature optimization
might be the root of all evil in computer programming, but
reinventing the wheel is the root of all evil in scienfic computing.
People far to often resort to C or Fortran, when they should just
have called a (well known) library function. But apart from that,
knowing C and/or Fortran is a too important skill to ignore. For
example, just knowing about C and Fortran data types and calling
conventions makes using existing libraries with ctypes or f2py
easier. Go ahead and learn it, you will not regret it. <br>
<br>
(What you probably will regret, is wasting your time on learning
Fortran i/o or C++. We have Python for that.)<br>
<br>
<br>
Sturla<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>