aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-26 13:57:46 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-26 14:04:03 -0400
commitc0b4791b6c9f8f8b7c967e7fcaf91425790da879 (patch)
tree2b0db97ad3b91bda3c8d867e1617dedf38c1d5b4 /src
parent47005fec6f720b893e2417995384075e50135c98 (diff)
Special case for simple Group
Diffstat (limited to 'src')
-rw-r--r--src/r.bqn17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/r.bqn b/src/r.bqn
index 5f51cfcf..0e6b5038 100644
--- a/src/r.bqn
+++ b/src/r.bqn
@@ -572,6 +572,19 @@ GroupInds←{
((⊢Fill⥊⟜⟨⟩)0⌜) Fill (<<⟨⟩) ∾⌜⌜´ {⊏⟜(⥊Range≢𝕩)⌜ G⥊𝕩}⌜
⟩ 𝕩
}
+Group1←ToArray⊸{
+ n←=𝕨
+ "𝕨⊔𝕩: Rank of simple 𝕨 must be at most rank of 𝕩" ! n≤=𝕩
+ ld←(≢𝕨)-¨n↑s←≢𝕩
+ dr←(1=n)◶⟨0,1=0⊸⊑⟩ld
+ "𝕨⊔𝕩: Lengths of 𝕨 must equal to 𝕩, or one more only in a rank-1 component" ! dr◶⟨1×´0⊸=⌜,1⟩ld
+ SX←((n==𝕩)◶{c←1×´t←n↓s⋄(𝕩⊑˜c⊸×⊸+)⌜⟜(t⥊↕c)}‿{⊑⟜𝕩⌜} ⥊𝕩)∘⊣ _fillBy_ ⊢⟜𝕩
+ (SX⟨⟩) Fill dr SX _group ⥊𝕨
+}
+GroupGen←{
+ "𝕨⊔𝕩: 𝕩 must be an array" ! IsArray 𝕩
+ 𝕨(2≤≡𝕨)◶Group1‿GroupM𝕩
+}
÷ ↩ ÷ _perv
⋆ ↩ ⋆ _perv
@@ -662,9 +675,7 @@ _repeat_←{
» ← FC⊸ShiftBefore ⊘ ShiftBefore _fillBy_ (⊢⊘IF)
« ← FC⊸ShiftAfter ⊘ ShiftAfter _fillBy_ (⊢⊘IF)
-GroupGen←{
- "𝕨⊔𝕩: 𝕩 must be an array" ! IsArray 𝕩
- 𝕨↩Pair∘ToArray⍟(2>≡)𝕨
+GroupM←{
"𝕨⊔𝕩: Compound 𝕨 must be a list" ! 1==𝕨
n←0+´r←=⌜𝕨
"𝕨⊔𝕩: Total rank of 𝕨 must be at most rank of 𝕩" ! n≤=𝕩