24
edits
(Created page with "{{Built-in|Inner Product|<nowiki>.</nowiki>}}, is a dyadic operator, which will produce a dyadic function when applied with two dyadic functions. In APL, the inner...") |
m (→Examples) |
||
Line 19: | Line 19: | ||
For example, when applying inner-product to a 2D array, the column count of the left array must match with the row count of the right array, otherwise we will get an error. | For example, when applying inner-product to a 2D array, the column count of the left array must match with the row count of the right array, otherwise we will get an error. | ||
<source lang=apl> | <source lang=apl> | ||
x ← 2 3⍴⍳10 | ⎕ ← x ← 2 3⍴⍳10 | ||
y ← 4 | 1 2 3 | ||
4 5 6 | |||
⎕ ← y ← 4 2⍴⍳10 | |||
1 2 | |||
3 4 | |||
5 6 | |||
7 8 | |||
x+.×y | x+.×y | ||
LENGTH ERROR | LENGTH ERROR | ||
x+.×y | x+.×y | ||
∧ | ∧ | ||
y ← 3 2⍴⍳10 ⍝ reshape y to be compatible with x | ⎕ ← y ← 3 2⍴⍳10 ⍝ reshape y to be compatible with x | ||
x+.×y | x+.×y | ||
22 28 | 22 28 | ||
49 64 | 49 64 | ||
</source> | </source> |
edits