stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

[RFC]: add missing single precision `nan` modules for `stats/strided`

Open 0PrashantYadav0 opened this issue 3 months ago • 10 comments

Description

This RFC proposes to add missing single precision nan modules for stats/strided, which include :

  • [ ] snanmeanpw
  • [ ] snanmeankbn
  • [ ] snanmeankbn2
  • [ ] snanmeanli
  • [ ] snanmeanlipw
  • [ ] snanmeanstdev
  • [ ] snanmeanstdevpn
  • [ ] snanmeanvar
  • [ ] snanmeanvarpn
  • [ ] sdsnanmean
  • [ ] sdsnanmeanpn
  • [ ] sdsnanmeanwd
  • [ ] sdsnanmeanpw
  • [ ] snanvariance
  • [ ] snanvariancech
  • [ ] snanvariancepn
  • [ ] snanvariancetk
  • [ ] snanvariancewd
  • [ ] snanvarianceyc
  • [ ] snanstdev
  • [ ] snanstdevch
  • [ ] snanstdevpn
  • [ ] snanstdevtk
  • [ ] snanstdevwd
  • [ ] snanstdevyc
  • [ ] snansem
  • [ ] snansemch
  • [ ] snansempn
  • [ ] snansemtk
  • [ ] snansemwd
  • [ ] snansemyc
  • [ ] snanrangeabs
  • [ ] snanmidrangeabs
  • [ ] snancumax
  • [ ] snancumaxabs
  • [ ] snancumin
  • [ ] snancuminabs

NOTE: Priority is top to bottom.

Related Issues

None

Questions

  1. How many packages do we really need ? ( I have already eliminate those packages which not useful or not feasible )
  2. What should be the priority of all the modules mentioned here?

Other

No.

Checklist

  • [x] I have read and understood the Code of Conduct.
  • [x] Searched for existing issues and pull requests.
  • [x] The issue name begins with RFC:.

0PrashantYadav0 avatar Aug 05 '26 15:08 0PrashantYadav0

For single precision, there are lots of modules which are expected to be present. Currently I am checking all the missing packages and soon create new RFC for them.

0PrashantYadav0 avatar Aug 05 '26 15:08 0PrashantYadav0

I have implemented snanmeankbn as an initial prototype to establish and verify the single-precision C implementation pattern, strided memory logic, $n = 0$ edge-case handling, and JS bindings for this series.

Draft PR: #14175

Once maintainers review the structural approach and CI checks pass on this initial PR, I will proceed with the remaining priority modules on the list.

AryanSharma48 avatar Aug 11 '26 18:08 AryanSharma48

Hi @AryanSharma48 thank you for working on these modules. Looking forward for your contribution. Feel free to tag me if you need any help or review.

0PrashantYadav0 avatar Aug 11 '26 18:08 0PrashantYadav0

Hi @0PrashantYadav0! The GitHub Actions CI workflows are currently awaiting maintainer approval to run. Whenever you have a moment, could you please trigger/approve the workflow for this PR #14175? Thanks!

AryanSharma48 avatar Aug 11 '26 18:08 AryanSharma48

There is no need to run checks manually, they will start as soon as you open the PR.

0PrashantYadav0 avatar Aug 11 '26 18:08 0PrashantYadav0

Got it @0PrashantYadav0 , thanks! I've marked the PR #14175 as "Ready for review".

Since this is my first contribution from a new fork, GitHub automatically holds the runners and displays a "12 workflows awaiting approval from a maintainer" banner at the top of the PR. Whenever you or another maintainer have a moment to click "Approve and run" on the Actions tab, the CI checks will start running.

AryanSharma48 avatar Aug 11 '26 20:08 AryanSharma48

@0PrashantYadav0 There was a reason many of these packages were held up. Namely, we needed to refactor the various upstream packages, such as snannsum, etc, to return structs, rather than numbers. Just took a look at some of the implementations, which are trying to use snancount, etc. That is the wrong approach and not what is desired.

kgryte avatar Aug 14 '26 07:08 kgryte

Thanks @kgryte , understood. The downstream NaN stats modules should wait until upstream snannsum* primitives return { sum, count } as a struct, rather than using snancount or hand-rolled NaN loops. I’ll pause downstream work and focus on upstream once that pattern is defined. If there’s a reference PR/RFC for the struct API, please share it.

0PrashantYadav0 avatar Aug 14 '26 08:08 0PrashantYadav0

@kgryte As we adreay dnannsum* modules. Do we need to refactor the existing modules in stats/strided/* accordingly?

0PrashantYadav0 avatar Aug 14 '26 08:08 0PrashantYadav0

New modules that needed to be added before them :

  • [ ] @stdlib/blas/ext/base/snannsum
  • [ ] @stdlib/blas/ext/base/snannsumkbn
  • [ ] @stdlib/blas/ext/base/snannsumkbn2
  • [ ] @stdlib/blas/ext/base/snannsumors
  • [ ] @stdlib/blas/ext/base/snannsumpw
  • [ ] @stdlib/blas/ext/base/dsnannsum
  • [ ] @stdlib/blas/ext/base/sdsnannsumors

Refactors ( not new packages ):

  • [ ] dnannsum
  • [ ] dnannsumkbn
  • [ ] dnannsumkbn2
  • [ ] dnannsumors
  • [ ] dnannsumpw -> struct-return { sum, count }

0PrashantYadav0 avatar Aug 14 '26 09:08 0PrashantYadav0