(Sorry; forgot to send to list)

----- Forwarded message from Luis Mochan <[email protected]> -----

Date: Sat, 4 Feb 2017 13:00:02 -0600
From: Luis Mochan <[email protected]>
To: Chris Marshall <[email protected]>
Subject: Re: [Pdl-general] Doubts about PDL::PP
User-Agent: NeoMutt/20161126 (1.7.1)

Hi Chris,
On Sat, Feb 04, 2017 at 12:25:09PM -0500, Chris Marshall wrote:
> Hi Luis-
> 
> I'm not an expert PP coder but I'm sure someone
> with more experience can correct my mistakes.
> My thoughts are in-line below...
> 
> --Chris
> 
> On 2/4/2017 11:22, Luis Mochan wrote:
> > ...

> > role of being both an input and output array.
> 
> I think the approach you want is a signature like 'a(n,m); [o]b(n,m);',
> set Inplace => 1 and then condition the Code section by checking
> if (a == b) as in the example below the description of the Inplace key
> options.
> 
> If the input and output PDLs are the same, which they will be if the
> user calls your routine with the inplace flag set on the input arg,
> then a==b and you can skip the copy.

Thanks. However if I test for a!=b in the Code section I get the errors:
  lib/Photonic/ExtraUtils.xs:1078:18: error: ‘a’ undeclared (first use in this 
function)
  if(a!=b){
     ^
  lib/Photonic/ExtraUtils.xs:1078:18: note: each undeclared identifier is 
reported only once for each function it appears in
  lib/Photonic/ExtraUtils.xs:1078:21: error: ‘b’ undeclared (first use in this 
function)
  if(a!=b){
        ^

I tried instead the test $P(a)!=$P(b) and it did compile. I haven't tested
the code yet, but is it to test the pointers to the data instead of
testing a and b directly? 

> 
> Otherwise, make the copy with the loops:
> 
>    loop(n) %{ loop(m) %{ $b() = $a(); %} %}
> 
Thanks! This seems to work. I thought it would only work for 1D arrays.

> and I believe you can leave out the arguments for the
> assignment operation.  This is definitely something that
> could use a specific example in the docs.
> I hope this helps and is correct!  :-)
Thanks!

My next problem is that in my routine I actually have more input and
output arrays. I guess that
  Inplace=>['a', 'b'],
is for that situation. This constructions indicates that a is the
input and b is the corresponding output? (My documentation has the
example
   Inplace => ['a','b']  if  Pars => 'a(); b(); [o]c(); [o]d();'
where both a and b are inputs; is this example correct?). Can one have
more than one Inplace argument for a routine with multiple inputs and
outputs?

Best regards,
Luis

----- End forwarded message -----

-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Apdo. Postal 48-3, 62251             |                           (*)/\/  \
Cuernavaca, Morelos, México          | [email protected]   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to