would allow Scipy to have a pure random number generator, whereas
numpy could keep its fancier (but slower) array-based random number
generators.
Robert Kern wrote:
> Anne Archibald wrote:
>> On 09/03/07, Robert Kern <[EMAIL PROTECTED]> wrote:
>>> Mark P. Miller wrote:
&
Robert Kern wrote:
> scipy.random is not a package. scipy/__init__.py does a "from numpy
import *"
> and thus pulls in numpy.random.
>
Got it...and one more question:
What about using something like
from numpy.random import mtrand
And then using mtrand.seed and mtrand.normal in code?
Would
This discussion has much in common with a previous thread that I started
("When and where to use Numpy...").
I fully admit to being a naive numpy user, but it seems to me that it
would be helpful if the documentation provided some explicit statements
to inform potential users about the best typ
Charles R Harris wrote:
> I won't comment on the code itself. Tell us what you want to do and I
> bet we can speed it up.
>
Here's a bit of sample code. It's actually very useful for my purposes.
Are there good ways to express these ideas in numpy as opposed to
using all of the nested loop
>
> I won't comment on the code itself.
Appreciate it :). Again, I'm just pointing out an example! I would
guess that I'm not the only person using numpy in this sort of
unsophisticated manner!
Tell us what you want to do and I
> bet we can speed it up.
>
> Chuck
I'll probably do that in
array1[aa,bb]=array1[x1,x2]
>>> import timeit
>>> t=timeit.Timer("numpytest()", "from __main__ import numpytest")
>>> t.timeit(100)
17.143569084897678
>>> t.timeit(100)
17.183305140737161
>>> t.timeit(100)
17.283449432818969
>
One more note (this perhaps may need a separate topic):
I've been using the Enthought python edition that contains python 2.4.3
and numpy 0.9.9.2706. After Robert Kern pointed out that I should try
numpy 1.0.1, I went ahead and installed it (downloaded a few hours ago:
"numpy-1.0.1.win32-py2.4
>>
>
> Ops, this seems a bug with your numpy version:
>
> In [46]:array1 = numpy.zeros((10,10),int)
> In [47]:array1.itemset((5,5),9)
> In [48]:array1
> Out[48]:
> array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
>[0,
> try with
>
array1.itemset((5,5),9)
Yep...tried that. But I don't get it!
>>> import numpy
>>> array1 = numpy.zeros((10,10),int)
>>> array1
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0
0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
-Mark (now using 1.0.1)
Robert Kern wrote:
> Mark P. Miller wrote:
>> Travis: Can you clarify this for me. The book doesn't have much detail
>> here and seems to differ from your
Travis: Can you clarify this for me. The book doesn't have much detail
here and seems to differ from your notation (which gives me errors).
>> Getting single indices like this is a bit slower for NumPy then for
>> lists because of all the possibilities that must be distinguished for
>> array
>> ##imports
>> import numpy as NP
>>from numpy.random import randint
>> #numpy array code
>> array1 = NP.zeros((50,50), int)
>>
>> def random1():
>> c = array1(randint(10), randint(10))
>>
>>
> Is this a bug? You can't "call" an array. Did you mean,
> array1[randint(10), randint(10)]?
eit.Timer("random2()", "from __main__ import random2")
>>> t.timeit(1)
0.24217882440370886
>>> t.timeit(1)
0.077239146316060214
>>> t.timeit(1)
0.07531906988197079
>>> t.timeit(1)
0.075705711200498627
-Mark
Perry Green
I've been using Numpy arrays for some work recently. Just for fun, I
compared some "representative" code using Numpy arrays and an object
comprised of nested lists to represent my arrays. To my surprise, the
array of nested lists outperformed Numpy in this particular application
(in my actual
Sorry...this somehow ended up in the wrong place. Apologies...I'm still getting
a feel for how this query system works!
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
es of what I was trying to
convey though. Does that particular bit of code require optimization?
Thanks,
-Mark
--
Dr. Mark P. Miller
Department of Biology
5305 Old Main Hill
Utah State University
Logan, UT 84322-5305 USA
><><><><><><><>&
should I be using
some other approach to call numpy's uniform generator?
-Mark
--
Dr. Mark P. Miller
Department of Biology
5305 Old Main Hill
Utah State University
Logan, UT 84322-5305 USA
><><><><><><><><><><><><>
17 matches
Mail list logo