mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-16 04:23:41 +02:00
refactor: unnecessary code in scalar_mat_op removed
This commit is contained in:
parent
1ba7566a62
commit
b8c26fd41d
2 changed files with 2 additions and 4 deletions
|
@ -213,8 +213,6 @@ 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)))
|
||||
if np.sqrt(len(x)) != dim:
|
||||
raise Exception('Input has to have dim**2 entries')
|
||||
|
||||
mat = []
|
||||
for i in range(dim):
|
||||
|
@ -227,8 +225,6 @@ def _scalar_mat_op(op, obs, **kwargs):
|
|||
|
||||
if isinstance(obs, np.ndarray):
|
||||
raveled_obs = (1 * (obs.ravel())).tolist()
|
||||
elif isinstance(obs, list):
|
||||
raveled_obs = obs
|
||||
else:
|
||||
raise TypeError('Unproper type of input.')
|
||||
return derived_observable(_mat, raveled_obs, **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue