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

Add log and exp support for rust #16286

Closed
savente93 opened this issue May 17, 2024 · 1 comment
Closed

Add log and exp support for rust #16286

savente93 opened this issue May 17, 2024 · 1 comment
Labels
enhancement New feature or an improvement of an existing feature

Comments

@savente93
Copy link
Contributor

Description

In python the log etc. functions are provided by supporting numpy. However I am writing a library on top of polars in Rust, and am really feeling the lack of a logarithm. A lot of information theoretical and statstic processes are quire reliant on logarithms or exponents. Given that logarithms have dedicated CPU instructions (source: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24592.pdf page 319) I think it would be best to see if polars can support this directly instead of building it on top of it.

Having the base be an argument is nice to have, but not necessary as arbitrary bases can be calculated from another one quite easily.

I would expect it to work just like other arithmetic functions:

df!("x" => [2,4,6,16,32,64,128,512,1024,2048])?.select(&[col("x").log().alias("log_x")])

should give back the following data frame:

df!("log_x" => [1,2,3,4,5,6,7,8,9,10])?
@savente93 savente93 added the enhancement New feature or an improvement of an existing feature label May 17, 2024
@savente93
Copy link
Contributor Author

My appologies, I since found that it is actually already in the code base. I'd tried to search for it, but did not find it before, presumably because it was hidden behind a feature flag, and this can be difficult to navigate. mea culpa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant