Skip to content

Commit 9d0809f

Browse files
committed
Add Support for evluation of system of polynomials and better homogenization
1 parent 337278f commit 9d0809f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/config.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Index = UInt16
55
const Delimiter = UInt16
66
const Exponent = UInt16
77

8-
struct PolyConfig{T}
8+
mutable struct PolyConfig{T}
99
monomials_delimiters::Vector{Delimiter}
1010
monomials::Vector{Index}
1111
grad_monomials_delimiters::Vector{Vector{Tuple{Delimiter, Exponent}}}

src/poly.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ end
221221

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

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

0 commit comments

Comments
 (0)