Skip to content
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

[WIP] Impl AMOS.zairy in pure julia #463

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5e5a374
amos: add SciPy license
inkydragon Jan 20, 2024
780d7ec
amos: add const array: I1_MACH, D1_MACH
inkydragon Jan 20, 2024
cfa7c7e
amos: add helper func and test
inkydragon Jan 20, 2024
40bcb26
amos: impl helper func `uchk`
inkydragon Jan 20, 2024
d14a0e9
test: AMOS.uchk
inkydragon Jan 20, 2024
789dafd
test: gen more test cases
inkydragon Jan 20, 2024
2c0171d
amos: clean doc uchk
inkydragon Jan 20, 2024
0aaa8f8
amos: uchk clean doc, donot use full uppercase
inkydragon Jan 20, 2024
ca9babb
test: amos const
inkydragon Jan 20, 2024
4cfed75
test: AMOS.GAMMALN_GLN
inkydragon Jan 20, 2024
43f6353
test: amos const size
inkydragon Jan 20, 2024
8d26f18
amos: add GAMMALN_GLN , GAMMALN_CF
inkydragon Jan 20, 2024
78ca2ab
amos: impl and test AMOS.gammaln
inkydragon Jan 20, 2024
535d806
amos: rm trailing space
inkydragon Jan 20, 2024
48fd26e
amos: gammaln add note
inkydragon Jan 20, 2024
9a7e747
amos\helper: add impl ref link
inkydragon Jan 20, 2024
87d744b
amos: impl `AMOS.kscl!`
inkydragon Jan 21, 2024
97252f9
amos: kscl! update comments
inkydragon Jan 21, 2024
4804264
amos: impl `AMOS.s1s2!`
inkydragon Jan 21, 2024
8a4520a
amos: move uchk to file
inkydragon Jan 21, 2024
c8f2670
amos: move gammaln to file
inkydragon Jan 21, 2024
8f31410
amos: move s1s2 to file
inkydragon Jan 21, 2024
79e2110
amos: move kscl to file
inkydragon Jan 21, 2024
7d6bc42
amos: add const INV_2PI
inkydragon Jan 21, 2024
b89d6f2
amos: impl `AMOS.asyi!`
inkydragon Jan 22, 2024
4feb64b
amos: impl `AMOS.mlri!`
inkydragon Jan 22, 2024
b774554
amos: init `AMOS.seri!` impl
inkydragon Jan 22, 2024
c710a8c
amos: impl `AMOS.seri!`
inkydragon Jan 22, 2024
3e28dab
amos: impl `AMOS.bknu!`
inkydragon Jan 22, 2024
3236baa
amos: bknu: add missing var init
inkydragon Jan 22, 2024
2734b52
amos: impl `AMOS.acai!`
inkydragon Jan 22, 2024
222fa44
BUG:amos: fix typo in `bknu`
inkydragon Jan 22, 2024
b4f18d8
amos: impl `AMOS.airy`
inkydragon Jan 22, 2024
c18e324
amos: todo add more tests
inkydragon Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SpecialFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export
cosint,
lbinomial

include("amos/AMOS.jl")
include("bessel.jl")
include("erf.jl")
include("ellip.jl")
Expand Down
28 changes: 28 additions & 0 deletions src/amos/AMOS.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module AMOS
include("const.jl")
include("warp.jl")

# internal subroutines
_subroutine_names = [
# No deps, leaf Functions
"uchk",
"gammaln",
"s1s2",
"asyi",
# Only deps on leaf functions
"kscl",
"mlri",
"seri",
"bknu",
# Othsers
"acai",
] # _subroutine_names

for fname in _subroutine_names
include(joinpath("subroutines", "$(fname).jl"))
end

# AMOS API
include("airy.jl")

end # AMOS
99 changes: 99 additions & 0 deletions src/amos/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
The code implementation in this folder is translated from the C code in [`scipy/special/_amos.c`](https://github.com/scipy/scipy/blob/main/scipy/special/_amos.c) to julia.

The license for the SciPy project is [BSD 3-Clause "New" or "Revised" License](https://github.com/scipy/scipy/blob/main/LICENSE.txt).

See below for the license.
```
/*
* This file accompanied with the implementation file _amos.c is a
* C translation of the Fortran code written by D.E. Amos with the
* following original description:
*
*
* A Portable Package for Bessel Functions of a Complex Argument
* and Nonnegative Order
*
* This algorithm is a package of subroutines for computing Bessel
* functions and Airy functions. The routines are updated
* versions of those routines found in TOMS algorithm 644.
*
* Disclaimer:
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ISSUED BY SANDIA LABORATORIES,
* A PRIME CONTRACTOR TO THE
* UNITED STATES DEPARTMENT OF ENERGY
* * * * * * * * * * * * * * NOTICE * * * * * * * * * * * * * * *
* THIS REPORT WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY THE
* UNITED STATES GOVERNMENT. NEITHER THE UNITED STATES NOR THE
* UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR
* EMPLOYEES, NOR ANY OF THEIR CONTRACTORS, SUBCONTRACTORS, OR THEIR
* EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY
* LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS
* OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT OR PROCESS
* DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE
* PRIVATELY OWNED RIGHTS.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* THIS CODE HAS BEEN APPROVED FOR UNLIMITED RELEASE.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*
*
* The original Fortran code can be found at https://www.netlib.org/amos/
*
* References:
*
* [1]: Abramowitz, M. and Stegun, I. A., Handbook of Mathematical
* Functions, NBS Applied Math Series 55, U.S. Dept. of Commerce,
* Washington, D.C., 1955
*
* [2]: Amos, D. E., Algorithm 644, A Portable Package For Bessel
* Functions of a Complex Argument and Nonnegative Order, ACM
* Transactions on Mathematical Software, Vol. 12, No. 3,
* September 1986, Pages 265-273, DOI:10.1145/7921.214331
*
* [3]: Amos, D. E., Remark on Algorithm 644, ACM Transactions on
* Mathematical Software, Vol. 16, No. 4, December 1990, Page
* 404, DOI:10.1145/98267.98299
*
* [4]: Amos, D. E., A remark on Algorithm 644: "A portable package
* for Bessel functions of a complex argument and nonnegative order",
* ACM Transactions on Mathematical Software, Vol. 21, No. 4,
* December 1995, Pages 388-393, DOI:10.1145/212066.212078
*
* [5]: Cody, W. J., Algorithm 665, MACHAR: A Subroutine to
* Dynamically Determine Machine Parameters, ACM Transactions on
* Mathematical Software, Vol. 14, No. 4, December 1988, Pages
* 303-311, DOI:10.1145/50063.51907
*
*/

/*
* Copyright (C) 2024 SciPy developers
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* a. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* b. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* c. Names of the SciPy Developers may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
```
Loading
Loading