view mftoolbox/polar_svd.m @ 3:d24a00dabdc2 draft

Added first test and Makefile after figuring out how to!!! Also removed fontconfig rubbish created by a bug in my GNU/linux system. Note: review E.B. Davies's paper "Approximate Diagonalization" for tricky diagonalization problems.
author Antonio Pino Robles <data.script93@gmail.com>
date Fri, 15 May 2015 20:24:25 +0200
parents 8f23314345f4
children
line wrap: on
line source

function [U,H] = polar_svd(A)
%POLAR_SVD   Canonical polar decomposition via singular value decomposition.
%   [U,H] = POLAR_SVD(A) computes a matrix U of the same dimension
%   (m-by-n) as A, and a Hermitian positive semi-definite matrix H,
%   such that A = U*H.
%   U is a partial isometry with range(U^*) = range(H).
%   If A has full rank then U has orthonormal columns if m >= n
%   and orthonormal rows if m <= n.
%   U and H are computed via an SVD of A.

[P,S,Q] = svd(A,'econ');
U = P*Q';
r = sum( diag(S) > norm(A,1)*eps/2 );
U = P(:,1:r)*Q(:,1:r)';
if nargout == 2
   H = Q*S*Q';
   H = (H + H')/2;      % Force Hermitian by taking nearest Hermitian matrix.
end