From d10706f63931c5577e8795e8573d5d66e2066e7d Mon Sep 17 00:00:00 2001 From: Kai Schmidt Date: Wed, 10 Jan 2024 13:52:51 -0800 Subject: [PATCH] fix a crash with fixed pervasive math --- src/algorithm/mod.rs | 4 ++-- tests/units.ua | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/algorithm/mod.rs b/src/algorithm/mod.rs index 52186648c..3c6a3b975 100644 --- a/src/algorithm/mod.rs +++ b/src/algorithm/mod.rs @@ -162,7 +162,7 @@ where .all(|(b, a)| b == a) { a.shape.drain(..fixes); - for &dim in b.shape[..fixes].iter().rev() { + for &dim in b.shape.iter().take(fixes).rev() { a.reshape_scalar(dim); } } @@ -177,7 +177,7 @@ where .all(|(a, b)| a == b) { b.shape.drain(..fixes); - for &dim in a.shape[..fixes].iter().rev() { + for &dim in a.shape.iter().take(fixes).rev() { b.reshape_scalar(dim); } } diff --git a/tests/units.ua b/tests/units.ua index 01ba2e5c3..a875cd8dc 100644 --- a/tests/units.ua +++ b/tests/units.ua @@ -18,6 +18,7 @@ ⍤⊃⋅∘≍ [3_2_1 4_3_2 5_4_3] - ¤[1 2 3] [4 5 6] ⍤⊃⋅∘≍ 0_3 △ +¤ ↯3 0 ↯0_3 0 ⍤⊃⋅∘≍ 1_3 △ +¤ ↯3 0 ↯1_3 0 +⍤⊃⋅∘≍ ⇡10 + ¤¤0 ⇡10 # Filled pervasive math ⍤⊃⋅∘≍ [1_1 0_0] ⬚0↥ ↯ 2_2 0 ↯ 1_2 1