Skip to content

support for structured data #40

@esheldon

Description

@esheldon

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 x

as 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 x

This 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions