mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-16 15:20:24 +01:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
ea38f93110
3 changed files with 13 additions and 6 deletions
|
@ -203,7 +203,12 @@ def cholesky(x):
|
|||
return _mat_mat_op(anp.linalg.cholesky, x)
|
||||
|
||||
|
||||
def scalar_mat_op(op, obs, **kwargs):
|
||||
def det(x):
|
||||
"""Determinant of Obs valued matrices."""
|
||||
return _scalar_mat_op(anp.linalg.det, x)
|
||||
|
||||
|
||||
def _scalar_mat_op(op, obs, **kwargs):
|
||||
"""Computes the matrix to scalar operation op to a given matrix of Obs."""
|
||||
def _mat(x, **kwargs):
|
||||
dim = int(np.sqrt(len(x)))
|
||||
|
|
|
@ -1052,7 +1052,6 @@ def derived_observable(func, data, array_mode=False, **kwargs):
|
|||
raveled_data = data.ravel()
|
||||
|
||||
# Workaround for matrix operations containing non Obs data
|
||||
if array_mode is True:
|
||||
if not all(isinstance(x, Obs) for x in raveled_data):
|
||||
for i in range(len(raveled_data)):
|
||||
if isinstance(raveled_data[i], (int, float)):
|
||||
|
|
|
@ -311,6 +311,9 @@ def test_matrix_functions():
|
|||
for (i, j), entry in np.ndenumerate(diff):
|
||||
assert entry.is_zero()
|
||||
|
||||
# Check determinant
|
||||
assert pe.linalg.det(np.diag(np.diag(matrix))) == np.prod(np.diag(matrix))
|
||||
|
||||
|
||||
def test_complex_matrix_operations():
|
||||
dimension = 4
|
||||
|
|
Loading…
Add table
Reference in a new issue