help-octave
[Top][All Lists]
Advanced

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

Re: parallel package


From: samuel WEBER
Subject: Re: parallel package
Date: Fri, 22 Apr 2016 12:00:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

Hi,

I only see your message now, so sorry for the lag...

There are 2 errors I think in your code.

First, pararrayfun accept only function name or function handle, without any argument. All arguments of the function must be another argument of pararrayfun.
Ex:
a=pararrayfun(5, @cumsum, 1:10) is ok, but
a=pararrayfun(5, @cumsum(1:10)) is incorrect.
So your function should look like : vector_out = pararrayfun(5, @parquad, vector_x) (Note the "@" and the argument after the function handle)

Secondly, I suspect a confusion between vector_x and vector_in.

Hope is help...

Samuël

On 15/04/2016 17:10, Clinton Winant wrote:
I want to be able to compute 5 integrals in parallel.  I have read
http://wiki.octave.org/Parallel_package
in spite of the title this page contains nothing about parcellfun, 
I have built the following test routine:

vector_in = 1:5;

vector_out = pararrayfun(5,parquad(procid), vector_x)


function out=parquad(procid)
  switch procid
    case{1}
      out=quadgk(@(r) ntgrnd1(r),0,1);
    case{2}
      out=2*quadgk(@(r) ntgrnd1(r),0,1);
    case{3}
      out=3*quadgk(@(r) ntgrnd1(r),0,1);
    case{4}
      out=4*quadgk(@(r) ntgrnd1(r),0,1);
    case{5}
      out=5*quadgk(@(r) ntgrnd1(r),0,1);
  endswitch
endfunction

The error return is:

>> testpararrayfun
error: 'procid' undefined near line 3 column 36
error: called from
    testpararrayfun at line 3 column 12

Can anybody throw some light on this??

Thanks


_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave


reply via email to

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