help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data structure for simulation


From: Jaroslav Hajek
Subject: Re: data structure for simulation
Date: Tue, 17 Mar 2009 15:29:04 +0100

On Tue, Mar 17, 2009 at 3:14 PM, Francesco Potorti` <address@hidden> wrote:
> I want to run a simulation on several inputs.  I can easily number each
> input from 1 to 262143.  For each input, I have an output made of a
> struct, like this:
>
> octave> rss18(262143)
> ans =
> {
>  tplemap =
>     1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1
>  samples =  10
>  qlev =
>     0.50000   0.70000   0.75000   0.80000   0.90000
>  qval =
>     0.14278   1.39793   2.57294   2.93048   3.87450
>  qerr =
>     0.14338   1.48273   1.64111   1.69764       Inf
> }
>
> Where rss18 is a struct array whose only non-empty element is currently
> the last one:
>
> octave> whos rss18
> Variables in the current scope:
>
>  Attr Name        Size                     Bytes  Class
>  ==== ====        ====                     =====  =====
>       rss18       1x262143                   146  struct
>
> Total is 262143 elements using 146 bytes
>
> Now I would like to exploit a cluster of nodes by running several Octave
> instances in parallel, each computing a subset of the 1:262143 space. (I
> do not need anything more sophisticated.)  In the end, each of the
> running Octaves would create its own struct array, which will be
> partially empty.
>
> I cannot find an efficient way of:
> - finding which array elements are nonempty

This does not make much sense to me. Any element of your struct array
is again a struct.
Maybe you mean a particular field slice of your struct array?

For instance,
find (! cellfun (@isempty, {rss18.tplemap}))
will pick those indices whose tplemap field is empty.
> - merging arrays with different sets of nonempty elements

Create a new struct array and insert the portions into it via indexed
assignment. What's wrong?


>
> Maybe struct arrays are not the best data structure for this purpose?
>

Maybe. Maybe if you gave more detailed question...



-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]