aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-03 16:36:34 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-03 16:36:34 -0400
commit5c2e7dcc6883f121088b1e6556698a02c4668749 (patch)
treef5511df92f0147673dfd310d0c97be297456e4ee /src
parentbd8c5efa3a9aa79df09016bfd9c047023e7cf75d (diff)
Allow ⊏ to handle trailing unchanged axes in dyadic ⍉, speeding up cases with large cells
Diffstat (limited to 'src')
-rw-r--r--src/r1.bqn7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/r1.bqn b/src/r1.bqn
index 73050a70..2bd1aa72 100644
--- a/src/r1.bqn
+++ b/src/r1.bqn
@@ -239,9 +239,10 @@ _reorderAxesSub_←{
"𝕨⍉𝕩: Length of 𝕨 must not exceed rank of 𝕩" ! (≠𝕨)≤r←=𝕩
"𝕨⍉𝕩: 𝕨 must consist of valid axis indices" ! 1∧´(Nat∧<⟜r)⌜𝕨
r𝔽↩n←GroupLen𝕨
- a←𝔾 𝕨∾(/0⊸=⌜n)∾{𝕩⊸+⌜↕r-𝕩}≠n
- l‿s←a⊸Group1⌜⋈⟜Stride≢𝕩
- (⌊´⌜l) (0<≠∘⊢)◶⟨⥊,((<0)+⌜´s(<+´)⊸(×⌜)⟜↕¨⊣)⊸⊏⟜⥊⟩ _fillBy_ ⊢ 𝕩
+ k←≠a←𝔾 𝕨∾/0⊸=⌜n
+ c‿d←k(↑⋈↓)≢𝕩
+ l‿s←a⊸Group1⌜⋈⟜Stride c
+ (⌊´⌜l) (0<≠∘⊢)◶⟨∾⟜d⊸⥊,((<0)+⌜´s(<+´)⊸(×⌜)⟜↕¨⊣)⊏(⟨1×´c⟩∾d)⥊⊢⟩ ⥊𝕩
}
HandleDupAxes←{
r←𝕨-0+´(0⌈-⟜1)⌜𝕩