Skip to content

Commit

Permalink
2d harmonics update
Browse files Browse the repository at this point in the history
  • Loading branch information
cortner committed Jun 6, 2024
1 parent e33fc5e commit f44580a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Polynomials4ML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ include("jacobiweights.jl")
include("monomials.jl")
include("chebbasis.jl")

#=
# 2d harmonics / trigonometric polynomials
include("trig.jl")
include("rtrig.jl")

#=
# 3d harmonics
include("sphericalharmonics/sphericalharmonics.jl")
Expand All @@ -74,13 +74,13 @@ include("linear.jl")
# generic machinery for wrapping poly4ml bases into lux layers
include("lux.jl")
=#

# basis components to implement cluster expansion methods
include("ace/ace.jl")
# include("ace/ace.jl")

# some nice utility functions to generate basis sets and other things
include("utils/utils.jl")
=#

# submodule with some useful utilities for writing unit tests
include("testing.jl")
Expand Down
3 changes: 2 additions & 1 deletion src/rtrig.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using HyperDualNumbers: Hyper

export RTrigBasis

Expand Down Expand Up @@ -31,6 +30,8 @@ function natural_indices(basis::RTrigBasis)
end

_valtype(basis::RTrigBasis, T::Type{<: Real}) = T

using HyperDualNumbers: Hyper
_valtype(::RTrigBasis, T::Type{<: Hyper{<: Real}}) = T

##
Expand Down
2 changes: 2 additions & 0 deletions src/trig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ index(basis::CTrigBasis, m::Integer) =
Base.length(basis::CTrigBasis) = 2 * basis.N + 1

_valtype(basis::CTrigBasis, T::Type{<: Real}) = complex(T)

using HyperDualNumbers: Hyper
_valtype(::CTrigBasis, T::Type{<: Hyper{<: Real}}) = complex(T)

# ----------------- main evaluation code
Expand Down
3 changes: 2 additions & 1 deletion src/utils/hyper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
using HyperDualNumbers: Hyper

## ---------- HyperDualNumbers utils ---------
Base.atan(y::Hyper{T}, x::Hyper{T}) where {T} = atan(y/x)*(x != 0) + (1-2*(y<0))*(pi*(x<0) + 1/2*pi*(x==0))
Base.atan(y::Hyper{T}, x::Hyper{T}) where {T} =
atan(y/x)*(x != 0) + (1-2*(y<0))*(pi*(x<0) + 1/2*pi*(x==0))
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ using Test
@testset "DiscreteWeights" begin include("test_discreteweights.jl"); end
@testset "Chebyshev" begin include("test_cheb.jl"); end

#=
# 2D Harmonics
@testset "TrigonometricPolynomials" begin include("test_trig.jl"); end
@testset "Real Trig Polys" begin include("test_rtrig.jl"); end

#=
# 3D Harmonics
@testset "Complex SphericalHarmonics" begin include("sphericalharmonics/test_cylm.jl"); end
@testset "Real Spherical Harmonics" begin include("sphericalharmonics/test_rylm.jl"); end
Expand Down

0 comments on commit f44580a

Please sign in to comment.