Skip to content

Commit

Permalink
remove dependency on FastTransforms (#33)
Browse files Browse the repository at this point in the history
* remove dependency on FastTransforms

* fix typo in comments

* be explicit about imports from SpecialFunctions

* extra project for tests

* CompatHelper for tests

* add LinearAlgebra to test dependencies

* use FastGaussQuadrature via PolynomialBases in tests

* fix Path to conda environment is not valid
  • Loading branch information
ranocha authored Jul 14, 2022
1 parent 4b222b6 commit ba37ac9
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} # optional
run: julia -e 'using CompatHelper; CompatHelper.main()'
run: julia -e 'using CompatHelper; CompatHelper.main(; subdirs=["", "test"])'
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
env:
PYTHON: ""
- name: Fix weird Conda.jl/PyCall.jl/SymPy.jl build error
env:
PYTHON: ""
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.activate("test")
println("Try instantiating the test environment")
try
Pkg.instantiate()
println("Successfully instantiated the test environment")
catch e
display(e)
end
println("Try building SymPy")
try
Pkg.build("SymPy")
import SymPy
println("Successfully built SymPy")
catch e
display(e)
end
- uses: julia-actions/julia-runtest@v1
env:
PYTHON: ""
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
notebooks/.ipynb_checkpoints/
**/*.jl.cov
**/*.jl.*.cov
**/*.jl.mem
**/.ipynb_checkpoints/
**/Manifest.toml

14 changes: 2 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,18 @@ version = "0.4.13-pre"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
FastTransforms = "057dd010-8810-581a-b7be-e3fc3b93f78c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
ArgCheck = "2.0"
FFTW = "1"
FastGaussQuadrature = "0.4.2"
FastTransforms = "0.11, 0.12, 0.13, 0.14"
Requires = "1"
SpecialFunctions = "1, 2"
UnPack = "1"
julia = "1.6"

[extras]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8"
SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["InteractiveUtils", "StaticArrays", "SymEngine", "SymPy", "Test"]
8 changes: 4 additions & 4 deletions src/PolynomialBases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module PolynomialBases

using LinearAlgebra

using ArgCheck
using FastGaussQuadrature: gausslegendre, gausslobatto, gaussjacobi
using FastTransforms: clenshawcurtisnodes, clenshawcurtisweights, chebyshevmoments1
using ArgCheck: @argcheck
using FFTW: FFTW
using FastGaussQuadrature: FastGaussQuadrature, gausslegendre, gausslobatto, gaussjacobi
using Requires: @require
using UnPack: @unpack
using SpecialFunctions
using SpecialFunctions: gamma


# types
Expand Down
17 changes: 15 additions & 2 deletions src/nodal_bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,21 @@ function ClenshawCurtis(p::Int, T=Float64)
nodes = T[0]
weights = T[2]
else
nodes = clenshawcurtisnodes(T, p+1) |> collect
weights = clenshawcurtisweights(chebyshevmoments1(T, p+1))
nodes = Vector{T}(undef, p + 1)
for k in eachindex(nodes)
nodes[k] = sinpi(convert(T, p + 2 - 2 * k) / (2 * p))
end

weights = zeros(T, p + 1)
for i in 0:2:p
@inbounds weights[i+1] = convert(T, 2) / convert(T, (1 - i^2))
end
rmul!(weights, inv(convert(T, p)))
plan = FFTW.plan_r2r!(weights, FFTW.REDFT00)
plan * weights
half = inv(convert(T, 2))
weights[1] *= half
weights[end] *= half
end
baryweights = barycentric_weights(nodes)
D = derivative_matrix(nodes, baryweights)
Expand Down
12 changes: 12 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8"
SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
StaticArrays = "1"
SymEngine = "0.8"
SymPy = "1"
2 changes: 1 addition & 1 deletion test/gegenbauer_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy
x, α = SymPy.symbols("x, alpha")

Expand Down
2 changes: 1 addition & 1 deletion test/hahn_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy
x, α, β, N = SymPy.symbols("x, alpha, beta, N")

Expand Down
2 changes: 1 addition & 1 deletion test/hermite_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy
x = SymPy.symbols("x")

Expand Down
4 changes: 2 additions & 2 deletions test/jacobi_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases, FastGaussQuadrature
using Test, PolynomialBases, PolynomialBases.FastGaussQuadrature

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy
x, α, β = SymPy.symbols("x, alpha, beta")

Expand Down
2 changes: 1 addition & 1 deletion test/laguerre_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy
x, α = SymPy.symbols("x, alpha")

Expand Down
4 changes: 2 additions & 2 deletions test/legendre_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases, FastGaussQuadrature
using Test, PolynomialBases, PolynomialBases.FastGaussQuadrature

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy
x = SymPy.symbols("x")

Expand Down
2 changes: 1 addition & 1 deletion test/sympy_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Test, PolynomialBases

if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not install on https://github.com/JuliaComputing/NewPkgEval.jl
if !haskey(ENV, "JULIA_PKGEVAL") # sympy is not installed on https://github.com/JuliaComputing/NewPkgEval.jl
import SymPy

tol = 5.e-15
Expand Down

0 comments on commit ba37ac9

Please sign in to comment.