BUG: Always return a real dtype from linalg.cond (gh-18304) (#29333) by charris · Pull Request #29500 · numpy/numpy
…py#29333) * BUG: Always return a real dtype from linalg.cond. Addresses numpygh-18304. The condition number of a matrix is the product of two norms, which are always non-negative and real-valued, so the condition number itself should be non-negative and real-valued. This commit returns the proper real dtype from `linalg.cond`, and includes tests for the condition number of a complex matrix in various norms. * ENH: Change type of complex results only. This commit addresses a reviewer comment on the blanket application of `abs(r)`. It specifically ensures the return type of complex-valued matrices will be the corresponding real type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters