Skip to content

Commit

Permalink
Merge pull request #53 from iliailmer/multivar-factorize
Browse files Browse the repository at this point in the history
Multivariate factorization (thanks to @iliailmer )
  • Loading branch information
pogudingleb authored Nov 14, 2021
2 parents b1e66c3 + 560fc51 commit 9c0737f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StructuralIdentifiability"
uuid = "220ca800-aa68-49bb-acd8-6037fa93a544"
authors = ["Ruiwen Dong, Christian Goodbrake, Heather Harrington, Gleb Pogudin <[email protected]>"]
version = "0.3.0"
version = "0.3.1"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
27 changes: 5 additions & 22 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,32 +181,15 @@ end

# ------------------------------------------------------------------------------

function factor_via_singular(polys::Array{<: MPolyElem{fmpq},1})
if isempty(polys)
return []
end
original_ring = parent(polys[1])
R_sing, var_sing = Singular.PolynomialRing(Singular.QQ, map(string, symbols(original_ring)))
result = Array{typeof(polys[1]),1}()
for p in polys
@debug "\t Factoring with Singular a polynomial of size $(length(p))"
@debug p
p_sing = parent_ring_change(p, R_sing)
for f in Singular.factor(p_sing)
@debug f
push!(result, parent_ring_change(f[1], original_ring))
end
end
return result
end

# ------------------------------------------------------------------------------

function fast_factor(poly::MPolyElem{fmpq})
prelim_factors = uncertain_factorization(poly)
cert_factors = map(pair -> pair[1], filter(f -> f[2], prelim_factors))
uncert_factors = map(pair -> pair[1], filter(f -> !f[2], prelim_factors))
append!(cert_factors, factor_via_singular(uncert_factors))
for p in uncert_factors
for f in Nemo.factor(p)
push!(cert_factors, f[1])
end
end
return cert_factors
end

Expand Down

2 comments on commit 9c0737f

@iliailmer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/48774

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 9c0737fb670b0a4b67323e9b2aa252184c743fd2
git push origin v0.3.1

Please sign in to comment.