diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-21 19:48:24 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-21 19:48:24 -0400 |
| commit | 93f75e97685520cdad3afab0134e2f65e5e211e2 (patch) | |
| tree | 790c97ead26f8417b199922136f69397c703ddad /docs/doc/transpose.html | |
| parent | b3ecbb5695a5a0a0637c924da0022abca940ffee (diff) | |
Add Insert (˝) 1-modifier
Diffstat (limited to 'docs/doc/transpose.html')
| -rw-r--r-- | docs/doc/transpose.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/doc/transpose.html b/docs/doc/transpose.html index 3b5af23b..93e5da73 100644 --- a/docs/doc/transpose.html +++ b/docs/doc/transpose.html @@ -3,7 +3,7 @@ <h1 id="transpose">Transpose</h1> <p>As in APL, Transpose (<code><span class='Function'>⍉</span></code>) is a tool for rearranging the axes of an array. BQN's version is tweaked to align better with the leading axis model and make common operations easier.</p> <h2 id="monadic-transpose">Monadic Transpose</h2> -<p>Transposing a matrix exchanges its axes, mirroring it across the diagonal. APL extends the function to any rank by reversing all axes, but this generalization isn't very natural and is almost never used. The main reason for it is to maintain the equivalence <code><span class='Value'>a</span> <span class='Function'>MP</span> <span class='Value'>b</span> <span class='Gets'>←→</span> <span class='Value'>a</span> <span class='Function'>MP</span><span class='Modifier2'>⌾</span><span class='Function'>⍉</span> <span class='Value'>b</span></code>, where <code><span class='Function'>MP</span> <span class='Gets'>←</span> <span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>´</span><span class='Function'><</span><span class='Modifier'>˘</span><span class='Paren'>)</span><span class='Modifier2'>∘</span><span class='Function'>×</span><span class='Modifier2'>⎉</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>∞</span></code> is the generalized matrix product. But even here APL's Transpose is suspect. It does much more work than it needs to, as we'll see.</p> +<p>Transposing a matrix exchanges its axes, mirroring it across the diagonal. APL extends the function to any rank by reversing all axes, but this generalization isn't very natural and is almost never used. The main reason for it is to maintain the equivalence <code><span class='Value'>a</span> <span class='Function'>MP</span> <span class='Value'>b</span> <span class='Gets'>←→</span> <span class='Value'>a</span> <span class='Function'>MP</span><span class='Modifier2'>⌾</span><span class='Function'>⍉</span> <span class='Value'>b</span></code>, where <code><span class='Function'>MP</span> <span class='Gets'>←</span> <span class='Function'>+</span><span class='Modifier'>˝</span><span class='Modifier2'>∘</span><span class='Function'>×</span><span class='Modifier2'>⎉</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>∞</span></code> is the generalized matrix product. But even here APL's Transpose is suspect. It does much more work than it needs to, as we'll see.</p> <p>BQN's transpose takes the first axis of its argument and moves it to the end.</p> <pre> <span class='Function'>≢</span> <span class='Value'>a23456</span> <span class='Gets'>←</span> <span class='Function'>↕</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>6</span> <span class='Bracket'>⟨</span> <span class='Number'>2</span> <span class='Number'>3</span> <span class='Number'>4</span> <span class='Number'>5</span> <span class='Number'>6</span> <span class='Bracket'>⟩</span> |
