General APL language issues

### Re: Question about inner product

J defines the dot product in terms of rank. For verbs u and v, the dot product is:
Code: Select all
`    u@(v"(1+lv,_))`

where lv is the left rank of v and _ is infinity. The common inner product in math and in APL, +.×, would then be:
Code: Select all
`    +⌿@×"1 ∞`

(The left rank of × is 0.) Coupled with the prefix agreement in J, this prescribes an efficient implementation (factor of 10). For example, if x←2 3⍴⍳6 and y←10+3 4⍴⍳12, this +⌿@×"1 ∞ definition prescribes that the two rows of the result be computed as:
Code: Select all
`    +⌿ 0 1 2×⍤¯1 ⊢y    +⌿ 3 4 5×⍤¯1 ⊢y`

See Inner Product -- An Old/New Problem http://www.jsoftware.com/papers/innerproduct/ip.htm .

Each left and each right can be effected using rank (J or Dyalog) in a more general way. For example, you can say each row of the left against the entire of the right, the entire of the left against each scalar of the right, etc.:

Code: Select all
`      x←2 3⍴⍳6      y←3 2⍴'abcdef'      x {⍺⍵}⍤0 99⊢y  ⍝ link each left┌─┬──┐│0│ab││ │cd││ │ef│├─┼──┤│1│ab││ │cd││ │ef│├─┼──┤│2│ab││ │cd││ │ef│└─┴──┘┌─┬──┐│3│ab││ │cd││ │ef│├─┼──┤│4│ab││ │cd││ │ef│├─┼──┤│5│ab││ │cd││ │ef│└─┴──┘      x {⍺⍵}⍤1 99⊢y  ⍝ link each left row┌─────┬──┐│0 1 2│ab││     │cd││     │ef│├─────┼──┤│3 4 5│ab││     │cd││     │ef│└─────┴──┘      x {⍺⍵}⍤99 1⊢y  ⍝ link each right row┌─────┬──┐│0 1 2│ab││3 4 5│  │├─────┼──┤│0 1 2│cd││3 4 5│  │├─────┼──┤│0 1 2│ef││3 4 5│  │└─────┴──┘`
Roger|Dyalog

Posts: 205
Joined: Thu Jul 28, 2011 10:53 am

### 99=infinity?

I would like to see {+-}infinity introduced into Dyalog APL, as was
done in J, so that I can stop using the unsightly 99 in my
rank conjunction expressions.

If _ and _ are not available, may I suggest using a lazy 8?

Thanks, Bob
rbe

Posts: 8
Joined: Fri Apr 13, 2018 7:55 pm

Previous