diff --git a/pyop/block.py b/pyop/block.py index af02331..31d4e9b 100644 --- a/pyop/block.py +++ b/pyop/block.py @@ -190,8 +190,8 @@ def forwardFunction(x): ## Apply each operator to corresponding subvector and concatenate ## the results. - sub_outvecs = (b(v) for (b, v) in six.moves.zip(blocks, - vec_components)) + sub_outvecs = [b(v) for (b, v) in six.moves.zip(blocks, + vec_components)] ## Concatenate the output sub-vectors together. return npvstack(sub_outvecs) @@ -206,8 +206,8 @@ def adjointFunction(x): ## Apply each operator to corresponding subvector and concatenate ## the results. - sub_outvecs = (b.T(v) for (b, v) in six.moves.zip(blocks, - vec_components)) + sub_outvecs = [b.T(v) for (b, v) in six.moves.zip(blocks, + vec_components)] ## Concatenate the output sub-vectors together. return npvstack(sub_outvecs) @@ -252,7 +252,7 @@ def opFunction(x): ## Apply each operator (forward or adjoint) to the input vector to ## get output vector sub-components. - sub_outvecs = (b(x) for b in vert_blocks) + sub_outvecs = [b(x) for b in vert_blocks] ## Concatenate the output sub-vectors together. return npvstack(sub_outvecs) diff --git a/pyop/convert.py b/pyop/convert.py index e910c86..b660d33 100644 --- a/pyop/convert.py +++ b/pyop/convert.py @@ -112,7 +112,7 @@ def toMatrix(O, sparse = False): # Scipy # ########### -def toScipyLinearOperator(O, dtype = np.float): +def toScipyLinearOperator(O, dtype = np.float64): ''' Converts a LinearOperator into a scipy.sparse.linalg.LinearOperator Scipy comes with come handy functions for calculating properties of a diff --git a/pyop/utilities.py b/pyop/utilities.py index c361ce0..c1bed5b 100644 --- a/pyop/utilities.py +++ b/pyop/utilities.py @@ -134,7 +134,7 @@ def matvec(f): @matmat def wrapper(x): - return np.column_stack(f(c) for c in x.T) + return np.column_stack([f(c) for c in x.T]) return __wrapIfPy3(wrapper, f) diff --git a/tests/convert_test.py b/tests/convert_test.py index 522ea58..d8c9025 100644 --- a/tests/convert_test.py +++ b/tests/convert_test.py @@ -74,4 +74,4 @@ def testToScipyLinearOperator(): np.testing.assert_allclose(A_op(input_mat), A_sci(input_mat)) np.testing.assert_allclose(A_op.T(input_mat), - A_sci.rmatvec(input_mat)) + A_sci.rmatmat(input_mat))