-
Notifications
You must be signed in to change notification settings - Fork 40
Prefer .T over np.transpose() for matrix transposition #33
Copy link
Copy link
Open
Description
Line 1335 in 56abc5b
| numpy_A_trans = numpy.transpose(numpy_A) |
In the line:
numpy_A_trans = numpy.transpose(numpy_A) it's recommended to use the shorthand .T instead:
numpy_A_trans = numpy_A.T .T provides the same result as np.transpose() for 2D arrays, but with less overhead since it directly accesses the array's transpose attribute rather than calling a function. It also improves code readability and follows the idiomatic style in NumPy-based codebases.
This change improves both performance and clarity without affecting functionality.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels