diff --git a/src/quanguru/QuantumToolbox/evolution.py b/src/quanguru/QuantumToolbox/evolution.py index 1f99747c..0c03c984 100644 --- a/src/quanguru/QuantumToolbox/evolution.py +++ b/src/quanguru/QuantumToolbox/evolution.py @@ -305,7 +305,7 @@ def _preSO(operator: Matrix, identity: Matrix = None) -> Matrix: if identity is None: identity = sp.identity(operator.shape[0], format="csc") - pre = sp.kron(identity, operator, format='csc') + pre = sp.kron(operator, identity, format='csc') return pre if sp.issparse(operator) else pre.A def _postSO(operator: Matrix, identity: Matrix = None) -> Matrix: @@ -338,7 +338,7 @@ def _postSO(operator: Matrix, identity: Matrix = None) -> Matrix: if identity is None: identity = sp.identity(operator.shape[0], format="csc") - pos = sp.kron(operator.transpose(), identity, format='csc') + pos = sp.kron(identity, operator.transpose(), format='csc') return pos if sp.issparse(operator) else pos.A def _prepostSO(operatorA: Matrix, operatorB: Optional[Matrix] = None) -> Matrix: @@ -371,7 +371,7 @@ def _prepostSO(operatorA: Matrix, operatorB: Optional[Matrix] = None) -> Matrix: """ if operatorB is None: operatorB = operatorA - prepost = sp.kron(operatorB.transpose(), operatorA, format='csc') + prepost = sp.kron(operatorA, operatorB.transpose(), format='csc') return prepost if sp.issparse(operatorA) else prepost.A def evolveOpen(initialState, totalTime, timeStep: float = 1.0, Hamiltonian: Optional[Matrix] = None,# pylint: disable=dangerous-default-value,unsubscriptable-object,too-many-arguments # noqa: E501 diff --git a/src/quanguru/QuantumToolbox/states.py b/src/quanguru/QuantumToolbox/states.py index 04cec2e3..b37c74e2 100644 --- a/src/quanguru/QuantumToolbox/states.py +++ b/src/quanguru/QuantumToolbox/states.py @@ -542,7 +542,7 @@ def mat2Vec(denMat: Matrix) -> Matrix: # pylint: disable=invalid-name [1]] """ - return denMat.T.reshape(np.prod(np.shape(denMat)), 1) + return denMat.reshape(np.prod(np.shape(denMat)), 1) def vec2Mat(vec: Matrix) -> Matrix: # pylint: disable=invalid-name r""" @@ -575,7 +575,7 @@ def vec2Mat(vec: Matrix) -> Matrix: # pylint: disable=invalid-name a = vec.shape n = int(np.sqrt(a[0])) - mat = vec.reshape((n, n)).T + mat = vec.reshape((n, n)) return mat def BellStates(bs: str = 'Phi+', sparse: bool = True) -> Matrix: