-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
124 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
# beignet.special | ||
|
||
::: beignet.special.dawson_integral_f | ||
## Error and Related Functions | ||
|
||
::: beignet.special.error_erf | ||
::: beignet.special.error_erfc | ||
::: beignet.special.error_erfi | ||
|
||
## Dawson and Fresnel Integrals | ||
|
||
::: beignet.special.dawson_integral_f | ||
::: beignet.special.faddeeva_w |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import beignet.special | ||
import hypothesis | ||
import hypothesis.strategies | ||
import scipy | ||
import torch | ||
|
||
|
||
@hypothesis.strategies.composite | ||
def _strategy(function): | ||
x, y = torch.meshgrid( | ||
torch.linspace( | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=-10, | ||
max_value=-10, | ||
), | ||
), | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=10, | ||
max_value=10, | ||
), | ||
), | ||
steps=128, | ||
dtype=torch.float64, | ||
), | ||
torch.linspace( | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=-10, | ||
max_value=-10, | ||
), | ||
), | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=10, | ||
max_value=10, | ||
), | ||
), | ||
steps=128, | ||
dtype=torch.float64, | ||
), | ||
indexing="xy", | ||
) | ||
|
||
input = x + 1.0j * y | ||
|
||
return input, scipy.special.dawsn(input) | ||
|
||
|
||
@hypothesis.given(_strategy()) | ||
def test_dawson_integral_f(data): | ||
input, output = data | ||
|
||
torch.testing.assert_close(beignet.special.dawson_integral_f(input), output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import beignet.special | ||
import hypothesis | ||
import hypothesis.strategies | ||
import scipy | ||
import torch | ||
|
||
|
||
@hypothesis.strategies.composite | ||
def _strategy(function): | ||
x, y = torch.meshgrid( | ||
torch.linspace( | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=-10, | ||
max_value=-10, | ||
), | ||
), | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=10, | ||
max_value=10, | ||
), | ||
), | ||
steps=128, | ||
dtype=torch.float64, | ||
), | ||
torch.linspace( | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=-10, | ||
max_value=-10, | ||
), | ||
), | ||
function( | ||
hypothesis.strategies.floats( | ||
min_value=10, | ||
max_value=10, | ||
), | ||
), | ||
steps=128, | ||
dtype=torch.float64, | ||
), | ||
indexing="xy", | ||
) | ||
|
||
input = x + 1.0j * y | ||
|
||
return input, scipy.special.erfi(input) | ||
|
||
|
||
@hypothesis.given(_strategy()) | ||
def test_error_erfi(data): | ||
input, output = data | ||
|
||
torch.testing.assert_close(beignet.special.error_erfi(input), output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters