Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working with tw/MB #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

working with tw/MB #16

wants to merge 3 commits into from

Conversation

tweisser
Copy link

@tweisser tweisser commented Jun 8, 2020

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.

src/atomic.jl Outdated
@@ -45,9 +45,9 @@ end

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
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{...}

i += 1
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
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

i = 1
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
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
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.

src/measure.jl Outdated Show resolved Hide resolved
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