JuliaAlgebra / StaticPolynomials.jl

Fast evaluation of multivariate polynomials
https://juliaalgebra.github.io/StaticPolynomials.jl/latest/
Other
16 stars 4 forks source link

Parameters #19

Closed saschatimme closed 6 years ago

saschatimme commented 6 years ago

This adds the capabilities to define certain variables of a polynomial as parameters.

@polyvar x y a b
F = PolynomialSystem(x^2+x*y+a+a*x, x+y+b, parameters=[a, b])

Since I needed to make changes in in systems anyway I used it to address #17 and threw out the old systems implementation (which was quite hacky) for a much cleaner one. As a consequence the AbstractSystem is gone as well as all the hacky Systems.SystemN types.

The old systems(...) constructor still works but is deprecated.

codecov-io commented 6 years ago

Codecov Report

Merging #19 into master will increase coverage by 8.79%. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #19      +/-   ##
========================================
+ Coverage    91.2%   100%   +8.79%     
========================================
  Files          10     10              
  Lines         364    394      +30     
========================================
+ Hits          332    394      +62     
+ Misses         32      0      -32
Impacted Files Coverage Δ
src/sexponents.jl 100% <100%> (ø) :arrow_up:
src/gradient_codegen.jl 100% <100%> (ø) :arrow_up:
src/evaluation.jl 100% <100%> (ø) :arrow_up:
src/evaluate_codegen.jl 100% <100%> (ø) :arrow_up:
src/polynomial.jl 100% <100%> (ø) :arrow_up:
src/codegen_helpers.jl 100% <100%> (+4.34%) :arrow_up:
src/evalpoly.jl 100% <100%> (+3.03%) :arrow_up:
src/show.jl 100% <100%> (+4.05%) :arrow_up:
src/helpers.jl 100% <100%> (ø) :arrow_up:
src/polynomial_system.jl 100% <100%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e9c9914...2c1e159. Read the comment docs.

saschatimme commented 6 years ago

It also seems that the compiler likes the new systems more. For INV6Q in #7 evaluate reduces from 44.9ns to 33.2ns and jacobian from 116.3ns to 90.4ns. :)

saschatimme commented 6 years ago

@cortner Are you able to use this or would it be too much work to adapt the changes? If necessary I also can not deprecate the systems method if it helps.

cortner commented 6 years ago

Do you mean dropping the old systems constructor? That's perfectly fine.

I actually use StaticPolynomials in very few (but extremely crucial) places, so adapting my codes will not be much work. And I am far away from transitioning to 1.0 anyhow. If I run into problems, you will hear :)