Giter Club home page Giter Club logo

estrin.jl's Introduction

Estrin.jl

Build Status Coverage

Estrin.jl is an implementation of the Estrin's scheme for evaluating polynomials in Julia.

Installation

Type ] in the Julia REPL to use the package mode, then type the following command to install the package.

add Estrin

Usage

julia> using Estrin

# generate a random polynomial
julia> C = rand(10);

julia> poly = Poly(C);

# evaluate the polynomial at x = 1
julia> s = poly(1.0)

julia> s  sum(C)
true

The Estrin's scheme

Given an arbitrary polynomial

$$P(x) = C_0 + C_1 x + C_2 x^2 + C_3 x^3 + ⋯ + C_n x^n$$

one can group adjacent terms into sub-expressions of the form $(A + Bx)$ and rewrite it as a polynomial in $x^2$:

$$P(x) = (C_0 + C_1x) + (C_2 + C_3 x) x^2 + ⋯ = Q(x^2).$$

These parameter can be calculated in parallel via SIMD, which can be more efficient than the traditional Horner's method.

However, it is obvious that the Estrin's scheme needed additional $N$ registers to store the intermediate results, which may be a bottleneck when the polynomial is large. Thus, the tile-based Estrin's scheme is proposed to reduce the number of registers needed. Instead of calculating the polynomial in one step, the tile-based Estrin's scheme divides the polynomial into multiple tiles (here I took the tiling size as $n = 16$), as

$$P(x) = C'_0 + C'_1 x^{n} + C'_2 x^{2n} + C'_3 x^{3n} + ⋯ = Q(x^{n})$$

where $C'_i$ is the coefficient of the $i$-th tile calculated by the Estrin's scheme. Then this process can be repeated recursively until the polynomial is small enough.

Benchmarks

Benchmarks scripts and results are stored in the following repo: https://github.com/ArrogantGao/Polynomial_Benchmarks. The results are shown below, where I compared the performance of Estrin's scheme (with and without tiling) with Horner's method and the Polynomials.jl package.

estrin.jl's People

Contributors

arrogantgao avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

estrin.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.