Skip to content

Commit

Permalink
Rename Project
Browse files Browse the repository at this point in the history
  • Loading branch information
dominic-chang committed Oct 13, 2023
1 parent 82d2a7c commit e916124
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "FElliptic"
name = "JacobiElliptic"
uuid = "2a8b799e-c098-4961-872a-356c768d184c"
authors = ["dominicchang <dchang3419@hotmail.com>"]
version = "0.1.0"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# FElliptic
FElliptic is an implementation of Toshio Fukushima's algorithms for calculating [Elliptic Integrals and Jacobi Elliptic Functions](https://ieeexplore.ieee.org/document/7203795).
# JacobiElliptic
JacobiElliptic is an implementation of Toshio Fukushima's algorithms for calculating [Elliptic Integrals and Jacobi Elliptic Functions](https://ieeexplore.ieee.org/document/7203795).

## Features
- Type stable and preserving
- [Metal.jl](/~https://github.com/JuliaGPU/Metal.jl) and [CUDA.jl](/~https://github.com/JuliaGPU/CUDA.jl) compatible
## Documentation
[![Dev](https://img.shields.io/badge/docs-stable-blue.svg)](https://dchang10.github.io/FElliptic.jl/dev/)
[![Dev](https://img.shields.io/badge/docs-stable-blue.svg)](https://dchang10.github.io/JacobiElliptic.jl/dev/)

## Repo Status
[![Build Status](/~https://github.com/dchang10/FElliptic.jl/workflows/CI/badge.svg)](/~https://github.com/dchang10/FElliptic.jl/actions)
[![Coverage](https://codecov.io/gh/dchang10/FElliptic.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/dchang10/FElliptic.jl)
[![Build Status](/~https://github.com/dchang10/JacobiElliptic.jl/workflows/CI/badge.svg)](/~https://github.com/dchang10/JacobiElliptic.jl/actions)
[![Coverage](https://codecov.io/gh/dchang10/JacobiElliptic.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/dchang10/JacobiElliptic.jl)
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FElliptic = "2a8b799e-c098-4961-872a-356c768d184c"
JacobiElliptic = "2a8b799e-c098-4961-872a-356c768d184c"
14 changes: 7 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Documenter, FElliptic
using Documenter, JacobiElliptic

makedocs(sitename="FElliptic.jl")
makedocs(sitename="JacobiElliptic.jl")

makedocs(;
modules=[FElliptic],
modules=[JacobiElliptic],
authors="Dominic <dchang3419@hotmail.com> and contributors",
repo="/~https://github.com/dchang10/FElliptic/blob/{commit}{path}#{line}",
sitename="FElliptic",
repo="/~https://github.com/dchang10/JacobiElliptic/blob/{commit}{path}#{line}",
sitename="JacobiElliptic",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://dchang10.github.io/FElliptic",
canonical="https://dchang10.github.io/JacobiElliptic",
edit_link="main",
assets=String[],
),
Expand All @@ -19,4 +19,4 @@ makedocs(;
],
)

deploydocs(repo = "github.com/dchang10/FElliptic.git",)
deploydocs(repo = "github.com/dchang10/JacobiElliptic.git",)
22 changes: 11 additions & 11 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FElliptic API
# JacobiElliptic API

## Index
```@index
Expand All @@ -7,18 +7,18 @@ api.md

### Elliptic Integrals
```@docs
FElliptic.K
FElliptic.E
FElliptic.F
FElliptic.Pi
FElliptic.J
JacobiElliptic.K
JacobiElliptic.E
JacobiElliptic.F
JacobiElliptic.Pi
JacobiElliptic.J
```

### Jacobi Elliptic Functions
```@docs
FElliptic.sn
FElliptic.cn
FElliptic.dn
FElliptic.asn
FElliptic.acn
JacobiElliptic.sn
JacobiElliptic.cn
JacobiElliptic.dn
JacobiElliptic.asn
JacobiElliptic.acn
```
6 changes: 3 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
```@meta
CurrentModule = FElliptic
CurrentModule = JacobiElliptic
```

# FElliptic
FElliptic is an implementation of Toshio Fukushima's algorithms for calculating [Elliptic Integrals and Jacobi Elliptic Functions](https://ieeexplore.ieee.org/document/7203795).
# JacobiElliptic
JacobiElliptic is an implementation of Toshio Fukushima's algorithms for calculating [Elliptic Integrals and Jacobi Elliptic Functions](https://ieeexplore.ieee.org/document/7203795).

### Features
- Type stable and preserving
Expand Down
2 changes: 1 addition & 1 deletion src/FElliptic.jl → src/JacobiElliptic.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module FElliptic
module JacobiElliptic
using StaticArrays, Setfield
using DocStringExtensions
export K, E, F, Pi, J
Expand Down
24 changes: 12 additions & 12 deletions test/GPUtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end
mtlarr = MtlArray([typ(n) for n in range(1e-3,1e-3, length=10)])
@testset "Standard m" begin
@testset "m :$m)" for m in range(zero(typ), one(typ),length=10)
FElliptic.Pi.(mtlarr, typ(m))
JacobiElliptic.Pi.(mtlarr, typ(m))
end
end
end
Expand All @@ -62,7 +62,7 @@ end
@testset "n :$(round*180/pi, digits=2))" for n in range(1e-3,1e-3, length=10)
@testset "Standard m" begin
@testset "m :$m)" for m in range(zero(typ), one(typ),length=10)
gpuvals = FElliptic.Pi.(typ(n), mtlarr, typ(m))
gpuvals = JacobiElliptic.Pi.(typ(n), mtlarr, typ(m))
end
end
end
Expand All @@ -81,20 +81,20 @@ end
mtlarr = MtlArray(arr)
m = 0.1f0

@test typeof(FElliptic.sn.(mtlarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.cn.(mtlarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.dn.(mtlarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.sd.(mtlarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.sc.(mtlarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.sn.(mtlarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.cn.(mtlarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.dn.(mtlarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.sd.(mtlarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.sc.(mtlarr, m)) == MtlVector{Float32}
else
cuarr = CuArray(arr)
m = 0.1f0

@test typeof(FElliptic.sn.(cuarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.cn.(cuarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.dn.(cuarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.sd.(cuarr, m)) == MtlVector{Float32}
@test typeof(FElliptic.sc.(cuarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.sn.(cuarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.cn.(cuarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.dn.(cuarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.sd.(cuarr, m)) == MtlVector{Float32}
@test typeof(JacobiElliptic.sc.(cuarr, m)) == MtlVector{Float32}

end

Expand Down
58 changes: 29 additions & 29 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Test
using FElliptic
using JacobiElliptic
using ArbNumerics
using DelimitedFiles: readdlm

Expand Down Expand Up @@ -42,15 +42,15 @@ end
@testset "Elliptic K" begin
@testset for typ in [Float32, Float64]
@testset "$typ $m" for m in [0.001, 0.01, 0.1, 0.2, 0.3, 0.5, 0.5, 0.8, 0.9, 0.99, 0.999]
@test FElliptic.K(typ(m)) typ(ArbNumerics.elliptic_k(typ(m)))
@test JacobiElliptic.K(typ(m)) typ(ArbNumerics.elliptic_k(typ(m)))
end
end
end

@testset "Complete Elliptic E" begin
@testset "Type: $typ" for typ in [Float32, Float64]
@testset "$(typ(m))" for m in [0.001, 0.01, 0.1, 0.19, 0.29, 0.39, 0.49, 0.59, 0.69, 0.79, 0.89, 0.99, 0.999]
@test FElliptic.E(typ(m)) ArbNumerics.elliptic_e(typ(m))
@test JacobiElliptic.E(typ(m)) ArbNumerics.elliptic_e(typ(m))
end
end
end
Expand All @@ -76,7 +76,7 @@ end
@testset "φ = $(i*mmax)" for i in -1:0.1:1.0
φ = i*(mmax*(1-1e-3))
if φ != zero(typ)
@test FElliptic.F(typ(φ), typ(m)) / ArbNumerics.elliptic_f(typ(φ), typ(m)) one(typ) atol=1e-4
@test JacobiElliptic.F(typ(φ), typ(m)) / ArbNumerics.elliptic_f(typ(φ), typ(m)) one(typ) atol=1e-4
end
end
end
Expand Down Expand Up @@ -105,7 +105,7 @@ end
@testset "φ = $(i*mmax)" for i in -1:0.1:1.0
φ = i*(mmax*(0.999))
if φ != zero(typ)
@test FElliptic.E(typ(φ), typ(m)) / ArbNumerics.elliptic_e(typ(φ), typ(m)) one(typ) atol=1e-4
@test JacobiElliptic.E(typ(φ), typ(m)) / ArbNumerics.elliptic_e(typ(φ), typ(m)) one(typ) atol=1e-4
end
end
end
Expand All @@ -120,22 +120,22 @@ end
@testset "n : $n" for n in range(1e-3,typ == Float32 ? 0.99 : 0.999, length=10)
@testset "Standard m" begin
@testset "m : $m" for m in range(0.1, typ == Float32 ? 0.99 : 0.999,length=20)
@test FElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
end
end
@testset "small m" begin
@testset "m :$m" for m in [3.874e-4, 4.25e-3, 6.83e-2]
@test FElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
end
end
@testset "large m" begin
@testset "m :$m" for m in [1-3.874e-4, 1-4.25e-3, 1-6.83e-2]
@test FElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
end
end
@testset "negative m" begin
@testset "m :$m" for m in [-3.874e-4, -4.25e-3, -6.83e-2]
@test FElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-4
end
end
end
Expand All @@ -148,7 +148,7 @@ end
@testset "φ = $(i*mmax)" for i in -1:0.1:1.0
φ = i*(mmax*(1-1e-3))
if φ != zero(typ)
@test FElliptic.Pi(typ(n), typ(φ), typ(m)) / ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) one(typ) atol=1e-4
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m)) / ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) one(typ) atol=1e-4
end
end
end
Expand All @@ -158,11 +158,11 @@ end
@testset "φ : " for φ in range/2, 3π, length=10)
@testset "n : $n" for n in range(1e-3,typ == Float32 ? 0.99 : 0.999, length=10)
@testset "m : $m" for m in range(1e-3, typ == Float32 ? 0.99 : 0.999,length=20)
@test FElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-5
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-5
end
@testset "large m" begin
@testset "m :$m)" for m in [1-1e-5, 1-3.874e-4, 1-4.25e-3, 1-6.83e-2, 1-1.32e-1]
@test FElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-5
@test JacobiElliptic.Pi(typ(n), typ(φ), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(φ), typ(m)) typ(1.0) atol=1e-5
end
end
end
Expand All @@ -176,7 +176,7 @@ end
@testset "$typ" for typ in [Float32, Float64]
@testset "n : $n" for n in range(1e-3,10, length=10)
@testset "m : $m" for m in range(0.1, 0.999,length=20)
@test FElliptic.Pi(typ(n), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(m)) typ(1.0) atol=1e-4
@test JacobiElliptic.Pi(typ(n), typ(m))/ArbNumerics.elliptic_pi(typ(n), typ(m)) typ(1.0) atol=1e-4
end
end
end
Expand Down Expand Up @@ -215,32 +215,32 @@ end
θc = θss[j₁, i]/denom
θd = θns[j₁, i]/denom

@test FElliptic.sn(u, m) θs / θn atol=2.5e-6
@test FElliptic.cn(u, m) θc / θn atol=2.5e-6
@test FElliptic.dn(u, m) θd / θn atol=2.5e-6
@test JacobiElliptic.sn(u, m) θs / θn atol=2.5e-6
@test JacobiElliptic.cn(u, m) θc / θn atol=2.5e-6
@test JacobiElliptic.dn(u, m) θd / θn atol=2.5e-6

@test FElliptic.sd(u, m) θs / θd atol=2.5e-6
@test JacobiElliptic.sd(u, m) θs / θd atol=2.5e-6
if ϵ != 90
# very sensitive around u = K,
# estimate of K(0) = pi/2 + 4e-9, so cosine causes errors
# also, errors build up in ϵ ≥75°, so lower tolerences for that
@test FElliptic.sc(u, m) θs / θc atol=1e-7
@test JacobiElliptic.sc(u, m) θs / θc atol=1e-7
end
end
end
end
#@testset "u = $u" for u in -1.:0.21:1.0
# @test FElliptic.sn(u,0) ≈ sin(u)
# @test FElliptic.cn(u,0) ≈ cos(u)
# @test FElliptic.dn(u,0) ≈ 1.
# @test FElliptic.sd(u,0) ≈ sin(u)
# @test FElliptic.sc(u,0) ≈ tan(u)

# @test FElliptic.sn(u,1) ≈ tanh(u)
# @test FElliptic.cn(u,1) ≈ sech(u)
# @test FElliptic.dn(u,1) ≈ sech(u)
# @test FElliptic.sd(u,1) ≈ sinh(u)
# @test FElliptic.sc(u,1) ≈ sinh(u)
# @test JacobiElliptic.sn(u,0) ≈ sin(u)
# @test JacobiElliptic.cn(u,0) ≈ cos(u)
# @test JacobiElliptic.dn(u,0) ≈ 1.
# @test JacobiElliptic.sd(u,0) ≈ sin(u)
# @test JacobiElliptic.sc(u,0) ≈ tan(u)

# @test JacobiElliptic.sn(u,1) ≈ tanh(u)
# @test JacobiElliptic.cn(u,1) ≈ sech(u)
# @test JacobiElliptic.dn(u,1) ≈ sech(u)
# @test JacobiElliptic.sd(u,1) ≈ sinh(u)
# @test JacobiElliptic.sc(u,1) ≈ sinh(u)
#end

end
Expand Down

0 comments on commit e916124

Please sign in to comment.