Skip to content

Commit

Permalink
ops tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
daanhb committed Aug 20, 2022
1 parent 56c03a4 commit bd21227
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"
BlockArrays = "0.16"
CompositeTypes = "0.1.2"
DSP = "0.6, 0.7"
DomainIntegrals = "0.3.6"
DomainSets = "0.5.11"
DomainIntegrals = "0.3.7"
DomainSets = "0.5.12"
FFTW = "1.3"
FastGaussQuadrature = "0.4"
FillArrays = "0.12,0.13"
Expand Down
2 changes: 2 additions & 0 deletions src/bases/modifiers/derived_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,5 @@ end
# Implementing similardictionary is all it takes.

similardictionary(dict::ConcreteDerivedDict, dict2::Dictionary) = ConcreteDerivedDict(dict2)

modifiersymbol(d::ConcreteDerivedDict) = "alias"
16 changes: 11 additions & 5 deletions src/bases/modifiers/operated_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,17 @@ function _unsafe_eval_element_derivative(dict::OperatedDict, idxn, x, order, op,
if isdiag(op)
diag(op, idx) * unsafe_eval_element_derivative(src(dict), idxn, x, order)
else
scratch_src[idx] = 1
apply!(op, scratch_dest, scratch_src)
scratch_src[idx] = 0
D = differentiation(superdict(dict))
eval_expansion(dest(D), D*scratch_dest, x)
if hasderivative(superdict(dict))
scratch_src[idx] = 1
apply!(op, scratch_dest, scratch_src)
scratch_src[idx] = 0
D = differentiation(superdict(dict))
eval_expansion(dest(D), D*scratch_dest, x)
else
A = matrix(op)
w = [unsafe_eval_element_derivative(src(dict), native_index(src(dict),k), x, order) for k in eachindex(src(dict))]
sum(A[k,idx] * w[k] for k in eachindex(dict))
end
end
end

Expand Down
10 changes: 5 additions & 5 deletions src/bases/poly/ops/orthopoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ function symmetric_jacobi_matrix(b::OPS)
J[k,k+1] = sqrt(β[k+1])
end
end
J
SymTridiagonal(J)
end

function roots(b::OPS{T}) where {T<:Number}
J = symmetric_jacobi_matrix(b)
eigen(J).values
end

function roots(b::OPS{T}) where {T<:Union{BigFloat}}
function roots(b::OPS{T}) where {T<:BigFloat}
J = symmetric_jacobi_matrix(b)
# assuming the user has imported GenericLinearAlgebra.jl
sort(real(eigvals!(J)))
Expand Down Expand Up @@ -406,8 +406,8 @@ end
See `monic_to_orthonormal_recurrence_coefficients`
"""
function monic_to_orthonormal_recurrence_coefficients!(a::Array{T},b::Array{T},c::Array{T}::Array{T}::Array{T}) where {T}
a .= 1 ./ sqrt.(view(β,2:length(β)))
b .= -1.0.*view(α,1:length(α)-1)./sqrt.(view(β,2:length(β)))
c .= sqrt.(view(β,1:length(β)-1)./view(β,2:length(β)))
a .= 1 ./ sqrt.(β[2:length(β)])
b .= -one(T).*α[1:length(α)-1]./sqrt.(β[2:length(β)])
c .= sqrt.(β[1:length(β)-1]./β[2:length(β)])
a,b,c
end

2 comments on commit bd21227

@daanhb
Copy link
Member Author

@daanhb daanhb commented on bd21227 Aug 20, 2022

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/66615

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.1 -m "<description of version>" bd212270afecb889923540557a60fb708f271cd2
git push origin v0.5.1

Please sign in to comment.