Pykov
Pykov copied to clipboard
Prefer .T over np.transpose() for matrix transposition
https://github.com/riccardoscalco/Pykov/blob/56abc5be18195378fdc3ffc8cc0fbefd55bb43ee/pykov.py#L1335
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.