MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / tests

Function tests

linear_algebra/src/rayleigh_quotient.py:54–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52
53
54def tests() -> None:
55 a = np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]])
56 v = np.array([[1], [2], [3]])
57 assert is_hermitian(a), f"{a} is not hermitian."
58 print(rayleigh_quotient(a, v))
59
60 a = np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]])
61 assert is_hermitian(a), f"{a} is not hermitian."
62 assert rayleigh_quotient(a, v) == float(3)
63
64
65if __name__ == "__main__":

Callers 1

Calls 2

is_hermitianFunction · 0.85
rayleigh_quotientFunction · 0.85

Tested by

no test coverage detected