Skip to content

NDArray M6: Int/Boolean/Float element types with ops, reductions, boolean indexing, and where#79

Merged
Quafadas merged 11 commits intomainfrom
copilot/implement-milestone-6-ndarray
Apr 9, 2026
Merged

NDArray M6: Int/Boolean/Float element types with ops, reductions, boolean indexing, and where#79
Quafadas merged 11 commits intomainfrom
copilot/implement-milestone-6-ndarray

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Part 0: Fix NDArray[Double] axis argmax/argmin return type to NDArray[Int]
  • Update existing reduction tests for the type change
  • Part 1a: ndarrayIntOps.scalaNDArray[Int] element-wise ops
  • Part 1b: ndarrayIntReductions.scalaNDArray[Int] reductions
  • Part 2: ndarrayBooleanOps.scalaNDArray[Boolean] logical ops + reductions
  • Part 3a: ndarrayFloatOps.scalaNDArray[Float] element-wise ops
  • Part 3b: ndarrayFloatReductions.scalaNDArray[Float] reductions
  • Part 4: ndarrayBooleanIndexing.scala — boolean mask indexing
  • Part 5: ndarrayWhere.scala — conditional where
  • Part 6: all.scala exports updated
  • Test files: Int ops, Int reductions, Boolean ops, Float ops, Float reductions
  • Fix native compile error: Removed import vecxt.BooleanArrays.* from ndarrayBooleanOps.scala; replaced a.data.not, a.data.any, a.data.allTrue, a.data.trues, a.data.not! delegations with inline while loops to avoid local extension name shadowing
  • Fix native compile error: Added @targetName annotations to all NDArray[Int] and NDArray[Float] extension methods that conflict after type erasure when exported to all.scala (same method names as NDArray[Double] extensions — product, sum, mean, min, max, argmax, argmin, neg, abs, +, -, *, /, >, <, >=, <=, =:=, !:=, +=, -=, *= etc.)
  • Test files for boolean indexing and where (not created)

Copilot AI linked an issue Apr 8, 2026 that may be closed by this pull request
…xing, where

Agent-Logs-Url: https://github.com/Quafadas/vecxt/sessions/039e1616-72d6-4f72-b5a0-13322445a4cc

Co-authored-by: Quafadas <24899792+Quafadas@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement milestone 6 for NDArray element types and operations NDArray M6: Int/Boolean/Float element types with ops, reductions, boolean indexing, and where Apr 8, 2026
Copilot AI requested a review from Quafadas April 8, 2026 14:35
@Quafadas
Copy link
Copy Markdown
Owner

Quafadas commented Apr 8, 2026

@copilot can you check the failiing tests on native ?

…erasure conflicts

Issue 1: Remove import vecxt.BooleanArrays.* from ndarrayBooleanOps.scala to
avoid scope conflict where local NDArray[Boolean] extension methods (any, all,
Replace all delegations with inline while loops.
Also fix in-place ops to check isColMajor instead of isContiguous so that
row-major transposed arrays correctly throw InvalidNDArray.

Issue 2: Add @TargetNAME annotations to all extension methods on NDArray[Int]
and NDArray[Float] that produce type-erasure 'double definition' conflicts on
Scala Native when exported together (NDArray[T] erases to NDArray for all T).
- ndarrayIntOps.scala: annotate binary ops, unary ops, in-place ops, comparisons
- ndarrayIntReductions.scala: add import + annotate all full/axis reductions
- ndarrayFloatOps.scala: annotate binary ops, unary ops, in-place ops, comparisons
- ndarrayFloatReductions.scala: add import + annotate all full/axis reductions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: Quafadas <24899792+Quafadas@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 8, 2026

@copilot can you check the failiing tests on native ?

Fixed in e20d97b. Two issues on native:

  1. BooleanArrays scope conflictimport vecxt.BooleanArrays.* inside NDArrayBooleanOps caused the local any/not/not! extension methods on NDArray[Boolean] to shadow the imported extensions on Array[Boolean]. Fixed by removing the import and replacing all delegations (a.data.any, a.data.allTrue, a.data.trues, a.data.not, a.data.not!) with direct inline while loops.

  2. Type-erasure "Double definition" conflicts — Extension methods on NDArray[Int] and NDArray[Float] share the same erased type signatures as the existing NDArray[Double] methods (e.g. product, sum, >, neg, etc.) when all are exported to all.scala. Scala Native is strict about this. Fixed by adding @targetName annotations to all conflicting extension methods in ndarrayIntOps.scala, ndarrayIntReductions.scala, ndarrayFloatOps.scala, and ndarrayFloatReductions.scala.

@Quafadas Quafadas merged commit 88edabb into main Apr 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NDArray M6

2 participants