I think $P(a) != $P(b) will work.

It would probably work with $PDL(a) == $PDL(b) as well but I don't know.

A quick test should answer the question.  I'm hoping Craig or
another PDL::PP expert can weigh in from their experience and
expertise.

Cheers,
Chris

On 2/4/2017 14:00, Luis Mochan wrote:
> 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


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