Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00b1 committed Jul 2, 2024
1 parent 6e149c8 commit 455205a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
22 changes: 19 additions & 3 deletions src/beignet/polynomial/__div.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import torch
from torch import Tensor

from .__nonzero import _nonzero


def _div(
func: Callable,
Expand All @@ -31,7 +29,25 @@ def _div(
def f(x: Tensor) -> Tensor:
indicies = torch.flip(x, [0])

indicies = _nonzero(indicies, size=1)
indicies = torch.nonzero(indicies, as_tuple=False)

if indicies.shape[0] > 1:
indicies = indicies[:1]

if indicies.shape[0] < 1:
indicies = torch.concatenate(
[
indicies,
torch.full(
[
1 - indicies.shape[0],
indicies.shape[1],
],
0,
),
],
0,
)

return x.shape[0] - 1 - indicies[0][0]

Expand Down
6 changes: 0 additions & 6 deletions src/beignet/polynomial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from .__get_domain import _get_domain
from .__map_domain import _map_domain
from .__map_parameters import _map_parameters
from .__nonzero import _nonzero
from .__normed_hermite_e_n import _normed_hermite_e_n
from .__normed_hermite_n import _normed_hermite_n
from .__nth_slice import _nth_slice
Expand Down Expand Up @@ -289,22 +288,17 @@
__all__ = [
"_c_series_to_z_series",
"_div",
"_evaluate",
"_fit",
"_flattened_vandermonde",
"_from_roots",
"_get_domain",
"_map_domain",
"_map_parameters",
"_nonzero",
"_normed_hermite_e_n",
"_normed_hermite_n",
"_nth_slice",
"_pad_along_axis",
"_pow",
"_trim_coefficients",
"_trim_sequence",
"_vandermonde",
"_z_series_mul",
"_z_series_to_c_series",
"chebyshev_polynomial_to_polynomial",
Expand Down

0 comments on commit 455205a

Please sign in to comment.