From 374082a7b7f265dfa04c8aeadc0f3cd01cba5b07 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 26 Jul 2020 14:32:06 -0400 Subject: Use a binary search for Bins --- dzref_full | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dzref_full b/dzref_full index a909861c..f85bbed6 100755 --- a/dzref_full +++ b/dzref_full @@ -372,12 +372,20 @@ _bins←{ c←1-˜=𝕨 ! 0≤c ! c≤=𝕩 - lw←×´sw←1↓≢𝕨 + lw←×´sw←1 Cell 𝕨 cw←lw 𝔽○(⊑⟜(⥊𝕨)) _getCellCmp 0 ! 0⊸<◶⟨1,∧´0≤˜·cw¨⟜(lw⊸+)lw×↕∘-⟜1⟩≠𝕨 - sx←c-⊸↑≢𝕩 ⋄ lc←sw 0 _cmpLen sx + cx←c-˜=𝕩 + sx←cx Cell 𝕩 ⋄ lc←sw 0 _cmpLen sx cc ← (⊑⟜(⥊𝕨))⊸𝔽⟜(⊑⟜(⥊𝕩)) _getCellCmp´ lc - ((×´sw)×↕≠𝕨) (0<≠𝕨)◶⟨0¨∘⊢,+˝Cc⌜≤0˜⟩ (×´sx)×(⊢⥊·↕×´)c-⊸↓≢𝕩 + n←≠𝕨 + B←(×´sw)⊸×⊸Cc≤0˜ + BS ← (0⟜1)𝕩} + 1+(n+1)R ¯1 + } + BS¨ (×´sx) × ⥊⟜(↕×´)⊑⟜(≢𝕩)¨↕cx } OccurrenceCount ← ⊐˜(⊢-⊏)⍋∘⍋ -- cgit v1.2.3