Inner Product: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 47: Line 47:
</source>
</source>
== History ==
== History ==
Inner product appeared in early [[Iverson Notation]] as <math>^f_g</math> and applied even to non-[[scalar function]]s, like [[Compress]], Iverson bringing:
Inner product appeared in early [[Iverson Notation]] as <math>^f_g</math> and applied even to non-[[scalar function]]s, like [[Compress]], Iverson bringing:<ref>[[Ken Iverson]]. [[A Programming Language]. §1.11 ''The language''.</ref>
:<math>
:<math>
\begin{align}
\begin{align}
Line 115: Line 115:
</source>
</source>
== Differences between dialects ==
== Differences between dialects ==
Implementations differ on the exact behaviour of inner product when the right operand is not a [[scalar function]]. It follows from page 121 of the ISO/IEC 13751:2001(E) [[standard]] specifies that <source lang=apl inline>X f.g Y</source> is equivalent to <source lang=apl inline>⊃⍤0 f/¨ (⊂[⍴⍴x]x)∘.g ⊂[1]y</source>. This is indeed what [[APL2]], [[APLX]], and [[ngn/apl]] follow, while [[Dyalog APL]] and [[GNU APL]] use <source lang=apl inline>⊃⍤0 f/¨ (⊂[⍴⍴x]x)∘.(g¨) ⊂[1]y</source>.
Implementations differ on the exact behaviour of inner product when the right operand is not a [[scalar function]]. It follows from page 121 of the ISO/IEC 13751:2001(E) [[standard]] specifies that <source lang=apl inline>X f.g Y</source> is equivalent to <source lang=apl inline>⊃⍤0 f/¨ (⊂[⍴⍴x]x)∘.g ⊂[1]y</source>. This is indeed what [[APL2]], [[APLX]], and [[ngn/apl]] follow, while [[Dyalog APL]] and [[GNU APL]] use <source lang=apl inline>⊃⍤0 f/¨ (⊂[⍴⍴x]x)∘.(g¨) ⊂[1]y</source>.