Skip to content

Commit

Permalink
Add Support for evluation of system of polynomials and better homogen…
Browse files Browse the repository at this point in the history
…ization
  • Loading branch information
saschatimme committed Nov 14, 2017
1 parent 337278f commit 9d0809f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Index = UInt16
const Delimiter = UInt16
const Exponent = UInt16

struct PolyConfig{T}
mutable struct PolyConfig{T}
monomials_delimiters::Vector{Delimiter}
monomials::Vector{Index}
grad_monomials_delimiters::Vector{Vector{Tuple{Delimiter, Exponent}}}
Expand Down
5 changes: 3 additions & 2 deletions src/poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ end

(p::Polynomial)(x) = evaluate(p, x)

evaluate(F::Vector{<:Polynomial}, x::AbstractVector) = map(f -> evaluate(f, x), F)
"""
substitute(p::Polynomial, i, x)
Expand Down Expand Up @@ -349,8 +350,8 @@ end
Makes `p` homogenous, if `ishomogenized(p)` is `true` this is just the identity.
The homogenization variable will always be considered as the first variable of the polynomial.
"""
function homogenize(p::Polynomial, variable::Symbol=:x0)
if p.homogenized
function homogenize(p::Polynomial, variable::Symbol=:x0; respect_homogenous=true)
if p.homogenized || (respect_homogenous && ishomogenous(p))
p
else
monomials_degree = sum(exponents(p), 1)
Expand Down

0 comments on commit 9d0809f

Please sign in to comment.