Skip to content

working with tw/MB#16

Open
tweisser wants to merge 3 commits into
JuliaAlgebra:masterfrom
tweisser:master
Open

working with tw/MB#16
tweisser wants to merge 3 commits into
JuliaAlgebra:masterfrom
tweisser:master

Conversation

@tweisser

@tweisser tweisser commented Jun 8, 2020

Copy link
Copy Markdown

Applied necessary changes to make MM run with my changes to MB.

For use in PolyJuMP I changed Moment and Measure to allow for APLs and AbstractPolynomialBasis respectively.

Comment thread src/atomic.jl Outdated
measure(η::AtomicMeasure, x) = Measure(η, x)
function Measure(η::AtomicMeasure{T}, x::AbstractVector{TT}) where {T, TT}
Measure{T, monomialtype(TT), monovectype(x)}(η, x)
Measure{T, MB.MonomialBasis}(η, x)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The full type is MB.MonomialBasis{...}

Comment thread src/expectation.jl Outdated
end
if i > length(μ.x)
error("The polynomial $p has a nonzero term $t with monomial $(t.x) for which the expectation is not known in $μ")
error("The polynomial $p has a nonzero term $(c*m) with basis function $(m) for which the expectation is not known in $μ")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would not call it term $(c * m) but rather coordinate $c or something like that

Comment thread src/expectation.jl Outdated
s = 0
for t in terms(p)
while i <= length(μ.x) && monomial(t) != μ.x[i]
for (c, m) in zip(coefficients(p, BT), MB.basis_covering_monomials(BT, monomials(p)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

coefficients(p, BT) computes maxdegree_basis(Basis, variables(p), maxdegree(p)) which may not match with the basis basis = MB.basis_covering_monomials(BT, monomials(p)), use coefficients(p, basis) instead maybe

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

See my comment in MultivariateBases.

Comment thread src/measure.jl Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants