-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const APL = AbstractPolynomialLike | ||
|
||
function _expectation(μ::Measure, p::APL, f) | ||
function _expectation(μ::Measure{T, BT}, p::APL, f) where {T, BT} | ||
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))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment in MultivariateBases. |
||
while i <= length(μ.x) && m != μ.x[i] | ||
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 $μ") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would not call it |
||
end | ||
s += f(μ.a[i], coefficient(t)) | ||
s += f(μ.a[i], c) | ||
i += 1 | ||
end | ||
s | ||
|
There was a problem hiding this comment.
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{...}