Skip to content

Commit

Permalink
MacaulayNullspace from MomentMatrix (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Aug 12, 2024
1 parent 4e12afb commit b8ffd61
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/null.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ struct MacaulayNullspace{T,MT<:AbstractMatrix{T},BT<:MB.AbstractPolynomialBasis}
basis::BT
accuracy::T
end

function MacaulayNullspace(matrix::AbstractMatrix{T}, basis) where {T}
return MacaulayNullspace(matrix, basis, Base.rtoldefault(T))
end

function MacaulayNullspace(
ν::MomentMatrix,
rank_check::RankCheck,
ldlt::LowRankLDLTAlgorithm = SVDLDLT(),
)
M = value_matrix(ν)
chol = low_rank_ldlt(M, ldlt, rank_check)
@assert size(chol.L, 1) == LinearAlgebra.checksquare(M)
return MacaulayNullspace(chol.L, ν.basis, accuracy(chol))
end

function Base.getindex(
null::MacaulayNullspace{T,MT,<:MB.MonomialBasis},
monos,
Expand Down Expand Up @@ -58,11 +70,8 @@ function compute_support!(
rank_check::RankCheck,
solver::ImageSpaceSolver,
)
M = value_matrix(ν)
chol = low_rank_ldlt(M, solver.ldlt, rank_check)
@assert size(chol.L, 1) == LinearAlgebra.checksquare(M)
ν.support =
solve(MacaulayNullspace(chol.L, ν.basis, accuracy(chol)), solver.null)
null = MacaulayNullspace(ν, rank_check, solver.ldlt)
ν.support = solve(null, solver.null)
return
end

Expand Down

0 comments on commit b8ffd61

Please sign in to comment.