455,587 Members | 1,731 Online
Need help? Post your question and get tips & solutions from a community of 455,587 IT Pros & Developers. It's quick & easy.

# numarray.array can be VERY slow

 P: n/a #! /usr/bin/env python """Should this program take 4.3 seconds to run? I have a Linux PC with an AMD Athlon XP 2000+ chip (1.7Gh). I use Python 2.4.1 and numarray 1.2.3, both compliled from source.""" import time, numarray from numarray.numerictypes import * nested = [] for i in range(8): inner = [] for j in range(8): inner.append(numarray.ones((256,256), Float64)) nested.append(inner) t = time.clock() arr = numarray.array(nested) print time.clock() - t Jul 18 '05 #1
2 Replies

 P: n/a Yes because that is a bad way to things. There is no reason to be working with a list when it could be done directly with numarray. Jul 18 '05 #2

 P: n/a Edward C. Jones wrote: #! /usr/bin/env python """Should this program take 4.3 seconds to run? I have a Linux PC with an AMD Athlon XP 2000+ chip (1.7Gh). I use Python 2.4.1 and numarray 1.2.3, both compliled from source.""" import time, numarray from numarray.numerictypes import * nested = [] for i in range(8): inner = [] for j in range(8): inner.append(numarray.ones((256,256), Float64)) nested.append(inner) t = time.clock() arr = numarray.array(nested) print time.clock() - t As mentioned, this has nothing to do with numarray, and everything to do with your inexplicable use of lists. Why don't you just write this as: arr = numarray.ones((8, 8, 256, 256), Float64) ?? STeVe Jul 18 '05 #3

### This discussion thread is closed

Replies have been disabled for this discussion.

### Similar topics

Browse more Python Questions on Bytes