FastPower

A faster approximation to floating point power, at the trade-off of some accuracy

https://github.com/sciml/fastpower.jl

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.8%) to scientific vocabulary

Keywords from Contributors

matrix-exponential pde ode partial-differential-equations sde differential-equations integral automatic-differentiation stochastic-differential-equations scientific-ai
Last synced: 6 months ago · JSON representation ·

Repository

A faster approximation to floating point power, at the trade-off of some accuracy

Basic Info
  • Host: GitHub
  • Owner: SciML
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Size: 59.6 KB
Statistics
  • Stars: 10
  • Watchers: 3
  • Forks: 2
  • Open Issues: 2
  • Releases: 4
Created over 1 year ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

FastPower.jl

A faster approximation to floating point power, at the trade-off of some accuracy. While Julia's built-in floating point ^ tries to achieve ~1ulp accuracy, this version of floating point power approximation achieves much fewer digits of accuracy (approximately 10 digits of accuracy) while being much faster. This is developed as a library in order to make the choice to opt-in as a replacement to ^ very easy but deliberate on the side of the user.

Installation

julia using Pkg Pkg.add("FastPower")

Using FastPower.jl

Using FastPower.jl is dead simple: instead of x^y, do the following:

julia using FastPower FastPower.fastpower(x,y)

That's it. That's all there is.

FastPower vs FastMath (@fastmath)

The name simply derives from the Julia standard of x_fast for things that are approximations. FastPower is simply the the ^_fast or pow_fast function, following the standard conventions developed from Base. However, this differs from the pow_fast you get from Base which is still a lot more accurate. FastPower.fastpower loses about 12 digits of accuracy on Float64, so it's about 3-4 digits of accuracy. For many applications, such as the adaptivity algorithm when solving differential equations, this can be a sufficient amount of accuracy for a power function approximation.

This approximation is tested for the range of x^y where x>=0 and y>=0. If x<=1, then the approximation is accurate for very large values of y. If x<100, then the approximation is accurate for y<1. If x>100, or if x is large and y is large, caution should be used.

What about FastPow.jl?

These two packages are completely unrelated since FastPow.jl is a specialization for literal integer powers: powers that are not only integers but appear as literal constants in the source code. It does things like:

julia x^5

which is transformed by the @fastpow macro to be computed via:

julia sq = x^2 fourth = sq^2 fourth * 2

This is faster than ^(::AbstractFloat, Integer) but with a bit of accuracy loss compared to what LLVM generates by default for x^5.

Meanwhile, FastPower.jl is all about floating-point powers (whose value may only be known at runtime).

Why is this not in Base?

Maybe it could be. If you wish to change pow_fast to this, open a PR. There can be a debate as to which one is better. However, as separate package there is no debate: use this one if the less accuracy and more speed is appropriate for your needs. Arguably, FastMath should be split from Base.

Also, one major purpose of this package is to allow for the bithacking to be held in a place that allows for extensions which enable compatibility with automatic differentiation. Extensions for:

  • Enzyme
  • ForwardDiff
  • Tracker
  • ReverseDiff
  • MonteCarloMeasurements
  • Measurements

currently exist for this function. More can be added on-demand. This allows for pow_fast to be safe in most AD contexts, though in some cases improved extensions could be created which improve performance.

Owner

  • Name: SciML Open Source Scientific Machine Learning
  • Login: SciML
  • Kind: organization
  • Email: contact@chrisrackauckas.com

Open source software for scientific machine learning

Citation (CITATION.bib)

@article{DifferentialEquations.jl-2017,
 author = {Rackauckas, Christopher and Nie, Qing},
 doi = {10.5334/jors.151},
 journal = {The Journal of Open Research Software},
 keywords = {Applied Mathematics},
 note = {Exported from https://app.dimensions.ai on 2019/05/05},
 number = {1},
 pages = {},
 title = {DifferentialEquations.jl – A Performant and Feature-Rich Ecosystem for Solving Differential Equations in Julia},
 url = {https://app.dimensions.ai/details/publication/pub.1085583166 and http://openresearchsoftware.metajnl.com/articles/10.5334/jors.151/galley/245/download/},
 volume = {5},
 year = {2017}
}

GitHub Events

Total
  • Release event: 2
  • Watch event: 1
  • Delete event: 8
  • Issue comment event: 12
  • Push event: 11
  • Pull request review event: 1
  • Pull request review comment event: 1
  • Pull request event: 21
  • Create event: 16
Last Year
  • Release event: 2
  • Watch event: 1
  • Delete event: 8
  • Issue comment event: 12
  • Push event: 11
  • Pull request review event: 1
  • Pull request review comment event: 1
  • Pull request event: 21
  • Create event: 16

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 26
  • Total Committers: 5
  • Avg Commits per committer: 5.2
  • Development Distribution Score (DDS): 0.269
Past Year
  • Commits: 26
  • Committers: 5
  • Avg Commits per committer: 5.2
  • Development Distribution Score (DDS): 0.269
Top Committers
Name Email Commits
Christopher Rackauckas a****s@c****m 19
Steven G. Johnson s****j@m****u 3
oscarddssmith o****h@j****m 2
dependabot[bot] 4****] 1
Anant Thazhemadam a****m@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 24
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 1 day
  • Total issue authors: 3
  • Total pull request authors: 5
  • Average comments per issue: 1.33
  • Average comments per pull request: 0.46
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 3
  • Pull requests: 24
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 1 day
  • Issue authors: 3
  • Pull request authors: 5
  • Average comments per issue: 1.33
  • Average comments per pull request: 0.46
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • stevengj (1)
  • ChrisRackauckas (1)
  • JuliaTagBot (1)
Pull Request Authors
  • ChrisRackauckas (12)
  • dependabot[bot] (6)
  • oscardssmith (4)
  • thazhemadam (2)
  • stevengj (2)
Top Labels
Issue Labels
question (1)
Pull Request Labels
dependencies (6) github_actions (4)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 6,271 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
juliahub.com: FastPower

A faster approximation to floating point power, at the trade-off of some accuracy

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,271 Total
Rankings
Downloads: 0.9%
Dependent repos count: 3.2%
Average: 6.8%
Dependent packages count: 16.3%
Last synced: 7 months ago

Dependencies

.github/workflows/CompatHelper.yml actions
.github/workflows/Downstream.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v4 composite
  • julia-actions/julia-buildpkg latest composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/FormatCheck.yml actions
.github/workflows/Invalidations.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/Tests.yml actions