-
Notifications
You must be signed in to change notification settings - Fork 5
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
Tw/interface #5
Tw/interface #5
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5 +/- ##
==========================================
- Coverage 96.87% 96.08% -0.79%
==========================================
Files 10 10
Lines 224 281 +57
==========================================
+ Hits 217 270 +53
- Misses 7 11 +4 ☔ View full report in Codecov by Sentry. |
src/fixed.jl
Outdated
``` | ||
=# | ||
function MP.coefficients(p, Basis::Type{<:AbstractPolynomialBasis}) | ||
basis = maxdegree_basis(Basis, variables(p), maxdegree(p)) |
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.
Define
function MP.coefficients(p, Basis::Type{<:AbstractPolynomialBasis})
return MP.coefficients(p, maxdegree_basis(Basis, variables(p), maxdegree(p)))
end
function MP.coefficients(p, basis::AbstractPolynomialBasis)
# ...
end
It is needed for https://github.com/JuliaAlgebra/MultivariateMoments.jl/pull/16/files#r438604571
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.
Specifying an instantiated basis would kind of imply that we return a vector of coefficients of length length(basis)
. So far I am deleting zero coefficients to be consistent with coefficients(p)
.
I introduced inner products for the orthogonal bases and defined |
src/chebyshev.jl
Outdated
elseif mod(i, 2) == 1 | ||
return 0 | ||
else | ||
n = Int(i/2) |
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.
n = div(i, 2)
src/chebyshev.jl
Outdated
function sp(i::Int) | ||
if i == 0 | ||
return π | ||
elseif mod(i, 2) == 1 |
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.
elseif isodd(i)
src/chebyshev.jl
Outdated
return 0 | ||
else | ||
n = Int(i/2) | ||
return π*factorial(i)/(2^i * factorial(n)^2) |
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.
This will very quickly exceed the capacity of Int64
. We can simplify factorial(i)
with factorial(n)
, do pi / 2^i
so that it transforms to Float64
before multiplying with factorial(n)
src/chebyshev.jl
Outdated
function sp(i::Int) | ||
if i == 0 | ||
return π/2 | ||
elseif mod(i, 2) == 1 |
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.
Similar comments than for the other one
src/legendre.jl
Outdated
@@ -28,3 +28,15 @@ reccurence_third_coef(::Type{<:LegendreBasis}, degree) = -(degree - 1) | |||
reccurence_deno_coef(::Type{<:LegendreBasis}, degree) = degree | |||
|
|||
degree_one_univariate_polynomial(::Type{<:LegendreBasis}, variable::MP.AbstractVariable) = MA.@rewrite(variable + 0) | |||
|
|||
function scalar_product_function(::Type{<:LegendreBasis}) |
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.
function scalar_product_function(::Type{<:LegendreBasis}, i::Int)
struct PolynomialInBasis{C, B}
coefficients::Vector{C}
basis::B
end and instead of |
|
I unified the interface for Monomial and Polynomial Bases (now the field is called elements).
The idea is, that
<:AbstractPolynomialBasis
is a wrapper for a familiy of polynomials that we label as a basis in some sense (similar toMP.MonomialVector
).I added
iterate
,getindex
, and acoefficients(poly, basis_type)
function which returns a vector of coefficients which should yieldI'm working on changes to depended packages.