1

I am reading this paper, where at page $68$, section 3.3 (numerical examples for the Drazin inverse), the randomly generated matrix with specified rank and with the property that each eigenvalue is real and has single multiplicity is constructed. It is mentioned that such matrices can be constructed by taking $A = PDP^{*}$, where $P$ is random orthogonal matrix, $D =diag(\lambda_1, \lambda_2, \ldots \lambda_r,0,\ldots 0) $. Eigenvalues $\lambda_1, \lambda_2, \ldots \lambda_r,0$ are arbitrary randomly generated positive real numbers. $P^{*}$ denote the conjugate transpose of the matrix $P$.

I need help to make matlab code for constructing matrices with such properties.

Thank you very much for your time.

Srijan
  • 12,518
  • 10
  • 73
  • 115
  • You can construct a random orthogonal matrix by randomly generating a matrix $M$ (using Matlab's randn function, for example), then computing the QR factorization of $M$ (using Matlab's qr function). – littleO Dec 04 '14 at 23:13
  • @lttle0 Thanks for the comment. For the matrix $P$, I can use orth(randn(n,n)) but I am not sure how to construct matrix $D$. – Srijan Dec 04 '14 at 23:19
  • Hmm, one option would be to use the Matlab function rand to randomly generate the positive numbers $\lambda_1,\ldots, \lambda_r$. – littleO Dec 04 '14 at 23:22
  • @littleO But it is mentioned that they are eigenvalues. This is something making me confuse. – Srijan Dec 04 '14 at 23:25

1 Answers1

2

Here's one way to construct $A$ using Matlab:

N = 100;
r = 10;

P = orth(randn(N));
lambda = zeros(N,1);
lambda(1:r) = rand(r,1);

D = diag(lambda);

A = P*D*P';

You can check that the rank of $A$ is $r$ and that the eigenvalues of $A$ are the values stored in the variable lambda.

littleO
  • 51,938