bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] an other inner product ,., bug


From: Juergen Sauermann
Subject: Re: [Bug-apl] an other inner product ,., bug
Date: Fri, 18 May 2018 17:03:24 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Hi Jay,

yes. Even worse: there is another subtle difference in the inner products of IBM APL2 and the
ISO standard.

IBM APL2 states (language reference, page 165) and also does this:

A f.g B  ←→  f/¨ (⊂[⍴⍴A]A) ∘.g ⊂[1]B

The ISO standard follows suit, except that it has a special case for A and B being vectors:

"If A and B are both vectors, return f/A g B."   (ISO standard, page 121 with A=A1 and B=B1).

GNU APL follows the ISO standard, so in David's example A g B is 1 2 3 , 4 5 6 (or: 1 2 3 4 5 6)
and ,/1 2 3 4 5 6 is ⊂(1 2 3 4 5 6). The enclose is needed because the reduction of a vector has
to be a scalar (according to the Implementation parameter  "Enclose-Reduction-Style" which GNU APL
and IBM APL2 have chosen).

Best Regards,
/// Jürgen


On 05/18/2018 03:31 PM, Jay Foad wrote:
This is a subtle difference in the definition of inner product. On vectors:

A f.g B  ←→  ⊂f/A g B  ⍝ APL2
A f.g B  ←→  f/A g¨ B  ⍝ NARS2000, Dyalog

Jay.

On 17 May 2018 at 17:52, David Tran <address@hidden> wrote:
Hi,

Below shows the bug:

1 2 3 ,., 4 5 6

result: 1 2 3 4 5 6
expected: 1 4 2 5 3 6


Thanks,
David


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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