Re: [eigen] [RFC] Test helper to make a matrix with exact rank. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] [RFC] Test helper to make a matrix with exact rank.
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 2 Feb 2009 14:16:40 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=/Ym+UpTyYccKKzEDlQUAKKvZY04Ntu9kLoX2pn2tZzQ=; b=xRC3733hqoOHr93uK5jJabyi6/99MsBj+cqOrQe/zuWsWH2Ea+ZhregdEcBUZQ6q9d lJGeopboMmX1tGK0LqDr29gQ1hBnL7hnW05gAxs+Mskl0GK6GDnPDQxpJW5B8w5SkC4w 7L4fPoIS0OtIabcTRqRbEao4viv0sLjc5goRs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Nkm7q64F9jVS41tJ6FvDQkDasJZbtxPNju1uBV2CMZLOUYTg0bZF2O+Hw/YYjv/J0x P2N5wqgMNLRWVHdn/9GURk+r+q3pDGCkCrLHn2EWvID020HI78ULt0bLUmROysPqo4wJ 5ogix3EY8T5U7EODMgz2DF57x76Smux4CkCW0=
2009/2/2 Keir Mierle <mierle@xxxxxxxxx>:
> Here's a test routine to make a matrix with exact size and rank. It uses the
> SVD though, so may be too slow, and doesn't work on complex matrices
> (because SVD doesn't). Nevertheless, it is probably better than the current
> method of generating random matrices when it applies because the matrix will
> have excellent conditioning (i.e. the singular values will be 1, 1, 1, 1 ...
> (up to rank), 0, 0, 0, 0, 0).
>
> It works by making a random (tall) matrix of the desired size, then setting
> the first 'rank' singular values to 1.0, and the remaining singular values
> to zero. Then the matrix is reconstituted by multiplying it back together,
> creating a matrix with the desired rows, columns, and rank.
>
> Comments?
Sounds very good.
The code we currently have (doSomeRankPreserving...) works well for
large enough matrices, at least 20x20, but not for smaller sizes. On
the other hand, it is far less expensive for large sizes (O(n^2) vs
O(n^3)).
So I propose that we make a function doing the old way for size >=
20x20 and doing your way if either of the dimensions is <20.
(Just FYI we need it to be reasonably fast for sizes up to 1000x1000).
Cheers,
Benoit