-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
It is convenient to have data packed into structures. For example, if a
calculation requires a large number of pieces of information, it is preferable
to have the following ( I realize this is a bit of a contrived example)
def func(sarray):
for i=0,range(sarray.size):
x = sarray['a'][i] + sarray['b'][i] + ... sarray['z'][i]
# do something with xas opposed to
def func(a, b, c, d, ......, z):
for i in xrange(a.size):
x = a[i] + b[i] ... + z[i];
# do something with xThis could be solved by accepting structured arrays for input
sarray = zeros(n, dtype=[('a','f8'),('b','f8'),....('z','f8')])
res=func(sarray)(edited for bugs)
Metadata
Metadata
Assignees
Labels
No labels