$\begingroup$

The nuclear norm is defined by this [from wikipedia]:

$$\|A\|_* = \text{trace} \left( \sqrt{A^*A} \right) = \sum_{i=i}^{\min\{m,n\}}\sigma_i(A)$$

I get the derivation of this equation. However, I wanted to test it in MATLAB. So used this script:

clc; clear; close all; P = rand([3,4]); PTP = P'*P; %compute trace(P'*P) B = sqrt(P'*P); S1 = trace(B) %Compute sum of sigma_i(P) E = svd(P); S2 = sum(E) %Do the same for eigenvalues E3 = sqrt(eig(P*P')); S3 = sum(E3) 

But for some reason, the values inside S1 and S2 does not match. I do not understand where I did wrong. Could anybody help?

$\endgroup$1

1 Answer

$\begingroup$

On the line

B = sqrt(P'*P); 

"sqrt" in Matlab calculates element-wise square root.

You probably want to use "sqrtm" : matrix square root instead.

$\endgroup$2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy