Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC]: move @stdlib/math/base/ops/* packages to @stdlib/number/* and @stdlib/complex/* #2261

Open
3 tasks done
kgryte opened this issue May 24, 2024 · 2 comments
Open
3 tasks done
Labels
RFC Request for comments. Feature requests and proposed changes.

Comments

@kgryte
Copy link
Member

kgryte commented May 24, 2024

Description

This RFC proposes moving packages found in @stdlib/math/base/ops to respective sub-namespaces in @stdlib/number/* and @stdlib/complex/*. For example,

  • @stdlib/math/base/ops/add => @stdlib/number/float64/base/add
  • @stdlib/math/base/ops/addf => @stdlib/number/float32/base/add
  • ...

Currently, we rely on prefixes and suffixes to distinguish packages in ops; however, this practice breaks down when wanting to add C variants for various integer dtypes. To keep things cleaner, this RFC advocates for migrating to dedicated dtype sub-namespaces for arithmetic, binary, and logical operations, where the latter were already planned for dtype sub-namespaces. Moving their arithmetic counterparts seems better for the sake of consistency than following the math/base/special precedent which stems from C99 and is primarily oriented to floating-point numbers.

Related Issues

Questions

No.

Other

Note that this RFC does not propose changing math/base/special. This applies only to ops which are more universal for each numeric dtype, and where we do actually want dedicated C interfaces for each dtype (e.g., int8_t stdlib_int8_base_add( int8_t x, int8_t y )).

The migration path would be as follows:

  • Copy dtype-specific packages to their respective sub-namespaces.
  • Update all require paths using the dtype-specific packages.
  • Remove all dtype-specific packages from @stdlib/math/base/ops namespace.

cc @Planeshifter

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@kgryte kgryte added the RFC Request for comments. Feature requests and proposed changes. label May 24, 2024
@yashathwani
Copy link

Please assign me this issue!

@gururaj1512
Copy link
Contributor

@stdlib/math/base/ops/add => @stdlib/number/float64/base/add
@stdlib/math/base/ops/add3 => @stdlib/number/float64/base/add3
@stdlib/math/base/ops/add4 => @stdlib/number/float64/base/add4
@stdlib/math/base/ops/add5 => @stdlib/number/float64/base/add5
@stdlib/math/base/ops/addf => @stdlib/number/float32/base/add

@stdlib/math/base/ops/cdiv => @stdlib/complex/float64/base/cdiv
@stdlib/math/base/ops/cneg => @stdlib/complex/float64/base/cneg
@stdlib/math/base/ops/cnegf => @stdlib/complex/float32/base/cneg
@stdlib/math/base/ops/csub => @stdlib/complex/float64/base/csub
@stdlib/math/base/ops/csubf => @stdlib/complex/float32/base/csub

@stdlib/math/base/ops/div => @stdlib/number/float64/base/div
@stdlib/math/base/ops/divf => @stdlib/number/float32/base/div
@stdlib/math/base/ops/mul => @stdlib/number/float64/base/mul
@stdlib/math/base/ops/mulf => @stdlib/number/float32/base/mul
@stdlib/math/base/ops/sub => @stdlib/number/float64/base/sub
@stdlib/math/base/ops/subf => @stdlib/number/float32/base/sub

@stdlib/math/base/ops/imul => @stdlib/number/int32/base/imul
@stdlib/math/base/ops/imuldw => @stdlib/number/int32/base/imuldw
@stdlib/math/base/ops/umul => @stdlib/number/uint32/base/umul
@stdlib/math/base/ops/umuldw => @stdlib/number/uint32/base/umuldw

@kgryte, can you confirm if these mappings are correct or if any adjustments are needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for comments. Feature requests and proposed changes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants