Skip to content

Commit 24e5ba0

Browse files
committed
fix for "complex" with backend="builtins" (#11)
1 parent 4f01ae8 commit 24e5ba0

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wheels/
2424
.installed.cfg
2525
*.egg
2626
MANIFEST
27+
_version.py
2728

2829
# PyInstaller
2930
# Usually these files are written by a python script from a template
@@ -102,3 +103,6 @@ venv.bak/
102103

103104
# mypy
104105
.mypy_cache/
106+
107+
# IDE
108+
.vscode/

autoray/autoray.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
AUTORAY - backend agnostic array operations.
33
44
5-
Copyright 2019-2021 Johnnie Gray
5+
Copyright 2019-2023 Johnnie Gray
66
77
Licensed under the Apache License, Version 2.0 (the "License");
88
you may not use this file except in compliance with the License.
@@ -889,7 +889,7 @@ def builtins_get_dtype_name(x):
889889

890890

891891
_FUNCS["builtins", "get_dtype_name"] = builtins_get_dtype_name
892-
892+
_FUNCS["builtins", "complex"] = complex
893893

894894
# ---------------------------------- numpy ---------------------------------- #
895895

tests/test_autoray.py

+8
Original file line numberDiff line numberDiff line change
@@ -716,3 +716,11 @@ def f(x):
716716
assert y == 2
717717
y = mycomposedfn(x)
718718
assert y == 2
719+
720+
721+
def test_builtins_complex():
722+
re = 1.0
723+
im = 2.0
724+
z = ar.do('complex', re, im)
725+
assert z == 1.0 + 2.0j
726+
assert ar.infer_backend(z) == "builtins"

0 commit comments

Comments
 (0)