Skip to content

Commit 1754a2e

Browse files
authored
Add vector norm test
1 parent 96a944c commit 1754a2e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/numpy/linalg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@
106106
ref_result = 16.881943016134134
107107
print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
108108

109+
a = np.array([[0, 1, 2], [5, 4, 8], [4, 4, 8] ], dtype=np.int16)
110+
result = (np.linalg.norm(a,axis=1))
111+
ref_result = np.array([2.236068, 10.24695, 9.797959]) #Problem when element > 10?
112+
for i in range(3):
113+
print(math.isclose(result[i], ref_result[i], rel_tol=1E-6, abs_tol=1E-6))
114+
109115
if use_ulab:
110116
print(np.linalg.trace(np.eye(3)))
111117
else:

0 commit comments

Comments
 (0)