sparse icon indicating copy to clipboard operation
sparse copied to clipboard

Implementing `repeat` function

Open prady0t opened this issue 7 months ago • 3 comments

What type of PR is this? (check all applicable)

  • [ ] 💾 Refactor
  • [x] 🪄 Feature
  • [ ] 🐞 Bug Fix
  • [ ] 🔧 Optimization
  • [ ] 📚 Documentation
  • [ ] 🧪 Test
  • [ ] 🛠️ Other

Related issues

  • Related issue #
  • Closes #

Checklist

  • [ ] Code follows style guide
  • [ ] Tests added
  • [ ] Documented the changes

Part of the effort to adhere to array API standards. Similar to np.repeat but for sparse arrays.

prady0t avatar Jun 02 '25 11:06 prady0t

@hameerabbasi Will add tests after your reviews

prady0t avatar Jun 02 '25 12:06 prady0t

CodSpeed Performance Report

Merging #875 will degrade performances by 29.65%

Comparing prady0t:array-api-tests-adherence (ea38652) with main (9988853)

Summary

⚡ 2 improvements
❌ 1 regressions
✅ 337 untouched benchmarks

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
test_gcxs_dot_ndarray[coo-m=200-n=200-p=200] 2.8 ms 2 ms +42.81%
test_index_fancy[side=100-rank=1-format='coo'] 939.4 µs 1,335.2 µs -29.65%
test_index_slice[side=100-rank=2-format='gcxs'] 2.4 ms 2 ms +21.97%

codspeed-hq[bot] avatar Jun 02 '25 12:06 codspeed-hq[bot]

Yes, there were a few bugs, mostly with reshaping. I've removed them and added the tests. Hopefully, this is a correct implementation. The function still doesn't account for uneven repeats.

prady0t avatar Jun 02 '25 21:06 prady0t

I think this is ready to be merged

prady0t avatar Jun 23 '25 21:06 prady0t

Thanks, @prady0t!

hameerabbasi avatar Jun 24 '25 03:06 hameerabbasi