[Numpy-discussion] Proposal for matrix_rank function in numpy

Robert Kern robert.kern@gmail....
Tue Dec 15 13:45:55 CST 2009


On Tue, Dec 15, 2009 at 11:01, Matthew Brett <matthew.brett@gmail.com> wrote:
> Hi,
>
> Following on from the occasional discussion on the list, can I propose
> a small matrix_rank function for inclusion in numpy/linalg?
>
> I suggest it because it seems rather a basic need for linear algebra,
> and it's very small and simple...
>
> I've appended an implementation with some doctests in the hope that it
> will be acceptable,

I think you need a real example of a nontrivial numerically
rank-deficient matrix. Note that c_[eye(4), eye(4)] is actually a
full-rank matrix. A matrix is full rank if its numerical rank is equal
to min(rows, cols) not max(rows, cols). Taking I=eye(4); I[-1,-1] =
0.0 should be a sufficient example.

> Robert - I hope you don't mind me quoting you in the notes.

I certainly. However, you do not need to cite me; I'm in the authors
list already. On the other hand, you probably shouldn't copy-and-paste
anything I write on the mailing list to use in a docstring. On the
mailing list, I am answering a particular question and use a different
voice than is appropriate for a docstring.

Also, a full citation of Golub and Van Loan would be appropriate:

.. [1] G. H. Golub and C. F. Van Loan, _Matrix Computations_.
Baltimore: Johns Hopkins University Press, 1996.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list