On Wed, 2015-07-22 at 13:50 -0700, Vassily Litvinov wrote:
> 
[…]
> On 07/22/15 11:56, Russel Winder wrote:
> > 
[…]
> >    var sum: sync real = 0.0;
> >    forall i in 1..n do { sum += 1.0 / (1.0 + ((i - 0.5) * delta) ** 
> > 2);
> > }
> >    const pi = 4.0 * delta * sum;
> > 
> > ?

I just tried:

  var sum: real = 0.0;
  forall i in 1..n with (+ reduce sum) { sum += 1.0 / (1.0 + ((i - 0.5)
* delta) ** 2); }
  const pi = 4.0 * delta * sum;

but got the error:

$CHPL_HOME/modules/internal/ChapelRange.chpl:1299: In iterator 'these':
$CHPL_HOME/modules/internal/ChapelRange.chpl:1322: error: yields
outside of task constructs in the leader or standalone iterator are not
supported with reduce intents

Does this mean I am not up to date enough (I am using master from the
Git repository), or is this not working as yet?

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to