Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00b1 committed Jun 4, 2024
1 parent 2b739b7 commit 3c13d96
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
9 changes: 9 additions & 0 deletions src/beignet/special/_dawson_integral_f.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@


def dawson_integral_f(input: Tensor) -> Tensor:
r"""
Parameters
----------
input : Tensor
Returns
-------
Tensor
"""
return math.sqrt(torch.pi) / 2.0 * torch.exp(-(input**2)) * error_erfi(input)
11 changes: 11 additions & 0 deletions src/beignet/special/_error_erf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,15 @@


def error_erf(input: Tensor) -> Tensor:
r"""
Error function.
Parameters
----------
input : Tensor
Returns
-------
Tensor
"""
return 1.0 - error_erfc(input)
11 changes: 11 additions & 0 deletions src/beignet/special/_error_erfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,15 @@


def error_erfc(input: Tensor) -> Tensor:
r"""
Complementary error function.
Parameters
----------
input : Tensor
Returns
-------
Tensor
"""
return torch.exp(-torch.pow(input, 2)) * faddeeva_w(1.0j * input)
5 changes: 3 additions & 2 deletions src/beignet/special/_error_erfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@


def error_erfi(input: Tensor) -> Tensor:
r"""Imaginary error function.
r"""
Imaginary error function.
Parameters
----------
input: Tensor
input : Tensor
Returns
-------
Expand Down
16 changes: 6 additions & 10 deletions src/beignet/special/_faddeeva_w.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,15 @@ def _faddeeva_w_impl(z):
return _voigt_v_impl(z.real, z.imag) + 1j * _voigt_l_impl(z.real, z.imag)


def faddeeva_w(input: Tensor):
r"""Compute faddeeva w function using method described in [1].
def faddeeva_w(input: Tensor) -> Tensor:
r"""
Parameters
----------
input: Tensor
complex input
input : Tensor
References
----------
[1] Al Azah, Mohammad, and Simon N. Chandler-Wilde.
"Computation of the complex error function using modified trapezoidal rules."
SIAM Journal on Numerical Analysis 59.5 (2021): 2346-2367.
Returns
-------
Tensor
"""
# use symmetries to map to upper right quadrant of complex plane
imag_negative = input.imag < 0.0
Expand Down

0 comments on commit 3c13d96

Please sign in to comment.