Skip to content

Commit bf74bad

Browse files
authored
Merge pull request #327 from hugohadfield/cherrypick_linear_op_matrix
Improve speed of linear_operator_to_matrix
2 parents c07db7d + 49a7a1d commit bf74bad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clifford/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def linear_operator_as_matrix(func, input_blades, output_blades):
117117
ndimout = len(output_blades)
118118
mat = np.zeros((ndimout, ndimin))
119119
for i, b in enumerate(input_blades):
120-
mat[:, i] = np.array([func(b)[j] for j in output_blades])
120+
b_result = func(b)
121+
mat[:, i] = np.array([b_result[j] for j in output_blades])
121122
return mat
122123

123124

0 commit comments

Comments
 (0)