From 2bf25adfdfcce4caff4544cda2b3e66ad7359bfc Mon Sep 17 00:00:00 2001 From: Justin Konkle Date: Mon, 15 Apr 2024 15:48:27 -0600 Subject: [PATCH 1/3] Fixed AttributeError: module 'numpy' has no attribute 'float' --- pyop/convert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From af179d9a4aad077da7e6d1defe9070a5d86c477d Mon Sep 17 00:00:00 2001 From: Justin Konkle Date: Mon, 15 Apr 2024 15:50:27 -0600 Subject: [PATCH 2/3] Fixed TypeError: arrays to stack must be passed as a "sequence" type such as list or tuple. --- pyop/block.py | 10 +++++----- pyop/utilities.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) 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/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) From 0b964a1878947b615777011fdcc838773333003e Mon Sep 17 00:00:00 2001 From: Justin Konkle Date: Mon, 15 Apr 2024 15:53:35 -0600 Subject: [PATCH 3/3] Fixed ValueError: dimension mismatch --- tests/convert_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))