Skip to content

Commit

Permalink
test_faddeeva_w
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00b1 committed Jun 4, 2024
1 parent e0102ff commit c0517b7
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/beignet/special/test__erfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _strategy(function):


@hypothesis.given(_strategy())
def test_erf(data):
def test_erfc(data):
input, output = data

torch.testing.assert_close(beignet.special.erfc(input), output)
65 changes: 65 additions & 0 deletions tests/beignet/special/test__faddeeva_w.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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=function(
hypothesis.strategies.integers(
min_value=128,
max_value=512,
),
),
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,
),
),
function(
hypothesis.strategies.integers(
min_value=128,
max_value=512,
),
),
dtype=torch.float64,
),
indexing="xy",
)

input = x + 1.0j * y

return input, scipy.special.wofz(input)


@hypothesis.given(_strategy())
def test_faddeeva_w(data):
input, output = data

torch.testing.assert_close(beignet.special.faddeeva_w(input), output)

0 comments on commit c0517b7

Please sign in to comment.