Skip to content

Commit c14536b

Browse files
authored
Orient duplicate axis bug (#723)
* Fix bug with `orient`'s duplicate axis checking * Add a test to account for this case
1 parent 2aa9f62 commit c14536b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/algorithm/dyadic/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,8 +1442,8 @@ impl<T: ArrayValue> Array<T> {
14421442
}
14431443
if undices
14441444
.iter()
1445-
.zip(undices.iter().skip(1))
1446-
.any(|(a, b)| a == b)
1445+
.enumerate()
1446+
.any(|(i, a)| undices[..i].contains(a))
14471447
{
14481448
return match env.scalar_fill() {
14491449
Ok(fill) => self.filled_orient(undices, fill.value, env),

tests/dyadic.ua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
⍤⤙≍ ⬚0[1 0_2 0_0_3 0_0_0_4] ⬚0⤸ 0_0 [1 2 3 4]
1919
⍤⤙≍ [[1_2 0_0] [0_0 3_4]] ⬚0⤸ 0_0 [1_2 3_4]
2020
⍤⤙≍ [[1_0 0_0] [0_0 0_2]] ⬚0⤸ 0_0_0 [1 2]
21+
⍤⤙≍ [[1_2 0_0]_[3_4 0_0] [0_0 5_6]_[0_0 7_8]] ⬚0⤸ 0_1_0 +1°△2_2_2
2122

2223
# Anti orient
2324
⍤⤙≍ ⍉⟜(⌝⤸¯1) °△ 2_3_4

0 commit comments

Comments
 (0)