Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In [308]: A = np.array([[1,-2j],[2j,5]])
- In [310]: B = np.array([[1, 2], [2, 4]])
- In [311]: def test_matrices(*args):
- ...: result = {'success': [], 'failure': []}
- ...: for m in args:
- ...: try:
- ...: np.linalg.cholesky(m)
- ...: result['success'].append(m)
- ...: except np.linalg.LinAlgError:
- ...: result['failure'].append(m)
- ...: return result
- ...:
- In [312]: test_matrices(A, B)
- Out[312]:
- {'success': [array([[ 1.+0.j, -0.-2.j],
- [ 0.+2.j, 5.+0.j]])],
- 'failure': [array([[1, 2],
- [2, 4]])]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement