Mercurial > matrix-functions
diff toolbox/invol.m @ 0:8f23314345f4 draft
Create local repository for matrix toolboxes. Step #0 done.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Wed, 06 May 2015 14:56:53 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolbox/invol.m Wed May 06 14:56:53 2015 +0200 @@ -0,0 +1,21 @@ +function A = invol(n) +%INVOL An involutory matrix. +% A = INVOL(N) is an N-by-N involutory (A*A = EYE(N)) and +% ill-conditioned matrix. +% It is a diagonally scaled version of HILB(N). +% NB: B = (EYE(N)-A)/2 and B = (EYE(N)+A)/2 are idempotent (B*B = B). + +% Reference: +% A.S. Householder and J.A. Carpenter, The singular values +% of involutory and of idempotent matrices, Numer. Math. 5 (1963), +% pp. 234-237. + +A = hilb(n); + +d = -n; +A(:, 1) = d*A(:, 1); + +for i = 1:n-1 + d = -(n+i)*(n-i)*d/(i*i); + A(i+1, :) = d*A(i+1, :); +end