Support generalized universal functions
See original GitHub issueCupy does not offer generalized universal functions. I would like to discuss how should we proceed and implement this feature.
https://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html
TODOs
- Parse gufuncs signatures to retrieve the core dimensions.
- Modify
core.pyx::ndarray::__array_ufunc__
to remove the signature check. - Given the signature, modify
_kernel.pyx::ufunc::__call__
to call the function sub-arraywise. Ufunc class relies on elementwise kernels when calling_get_ufunc_kernel
. GUfuncs can also call kernels operating on regular vectors. - Convert cupy inner1d, matmat, vecmat, matvec, matmul, outer_inner to actual gufuncs
- Add features such as
axes
,order
, etc.
List of numpy gufuncs (thanks to @asi1024)
(n?,k),(k,m?)->(n?,m?)
matmul
(m,m)->(),()
slogdet
(m,m)->()
det
(m,m)->(m),(m,m)
eigh_lo
eigh_up
eig
(m,m)->(m)
eigvalsh_up
eigvalsh_lo
eigvals
(m,m),(m,n)->(m,n)
solve
(m,m),(m)->(m)
solve1
(m, m)->(m, m)
inv
(m,m)->(m,m)
cholesky_lo
(m,n)->(m)
svd_m
(m,n)->(n)
svd_n
(m,n)->(m,m),(m),(m,n)
svd_m_s
(m,n)->(m,n),(n),(n,n)
svd_n_s
(m,n)->(m,m),(m),(n,n)
svd_m_f
(m,n)->(m,m),(n),(n,n)
svd_n_f
(m,n),(m,nrhs),()->(n,nrhs),(nrhs),(),(m)
lstsq_m
(m,n),(m,nrhs),()->(n,nrhs),(nrhs),(),(n)
lstsq_n
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Generalized Universal Function API — NumPy v1.24 Manual
Generalized Universal Function API#. There is a general need for looping over not only functions on scalars but also over functions on vectors...
Read more >Generalized Universal Function API — NumPy v1.9 Manual
Generalized Universal Function API¶. There is a general need for looping over not only functions on scalars but also over functions on vectors...
Read more >Creating NumPy universal functions - Numba documentation
Those which operate on higher dimensional arrays and scalars, these are “generalized universal functions” or gufuncs ( @guvectorize below).
Read more >Generalized Universal Function in numpy - Stack Overflow
Generalized Universal Function in numpy ... I'm trying make a generalized ufunc using numpy API. ... Someone could help me? In init function...
Read more >Developers - Support generalized universal functions - - Bountysource
Cupy does not offer generalized universal functions. I would like to discuss how should we proceed and implement this feature.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 for this feature:)
Actually there’s people on the NumPy team who know much more about this than I do - I’ll ping @mattip and @seberg here for input.
I am interested to work on this project under GSoC '20 and I am currently writing the proposal for it. Understood all the concepts quite nicely accept the feature
order
? Can you please elaborate a bit more on that @emcastillo ?