Skip to content

Prefer .T over np.transpose() for matrix transposition #33

@SaFE-APIOpt

Description

@SaFE-APIOpt

Pykov/pykov.py

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions