Difference between revisions of "KyFanNorm"

From QETLAB
Jump to navigation Jump to search
(Created page with "{{Function |name=KyFanNorm |desc=Computes the Ky Fan k-norm of an operator |rel=kpNorm<br />SchattenNorm<br />TraceNorm |upd=December 1, 2012 |v=1....")
 
m (added CVX parameter)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Function
 
{{Function
 
|name=KyFanNorm
 
|name=KyFanNorm
|desc=Computes the [[Ky Fan norm|Ky Fan k-norm]] of an operator
+
|desc=Computes the Ky Fan norm|Ky Fan k-norm of an operator
 
|rel=[[kpNorm]]<br />[[SchattenNorm]]<br />[[TraceNorm]]
 
|rel=[[kpNorm]]<br />[[SchattenNorm]]<br />[[TraceNorm]]
 +
|cat=[[List of functions#Norms|Norms]]
 
|upd=December 1, 2012
 
|upd=December 1, 2012
|v=1.00}}
+
|cvx=yes (convex)}}
<tt>'''KyFanNorm'''</tt> is a [[List of functions|function]] that computes the [[Ky Fan norm|Ky Fan k-norm]] of an operator (i.e., the sum of its k largest singular values). It works with both full and sparse matrices.
+
<tt>'''KyFanNorm'''</tt> is a [[List of functions|function]] that computes the Ky Fan k-norm of an operator (i.e., the sum of its k largest singular values):
 +
: <math>\|X\|_{(k)} := \sum_{j=1}^k \sigma_j^{\downarrow}(X).</math>
 +
This function works with both full and sparse matrices, and can be used in the objective function or constraints of a CVX optimization problem.
  
 
==Syntax==
 
==Syntax==
Line 16: Line 19:
 
==Examples==
 
==Examples==
 
===Equals the operator norm when <tt>K = 1</tt> (but faster!)===
 
===Equals the operator norm when <tt>K = 1</tt> (but faster!)===
The Ky Fan 1-norm is just the operator norm, which is implemented in MATLAB by the <tt>[http://www.mathworks.com/help/symbolic/norm.html norm]</tt> function. However, the <tt>KyFanNorm</tt> function is typically faster than the <tt>norm</tt> function:
+
The Ky Fan 1-norm is just the operator norm, which is implemented in MATLAB by the <tt>[http://www.mathworks.com/help/matlab/ref/norm.html norm]</tt> function. However, the <tt>KyFanNorm</tt> function is typically much faster than the <tt>norm</tt> function:
<pre>
+
<syntaxhighlight>
 
>> X = rand(2500);
 
>> X = rand(2500);
 
>> tic; KyFanNorm(X,1)
 
>> tic; KyFanNorm(X,1)
Line 27: Line 30:
  
 
Elapsed time is 0.861377 seconds.
 
Elapsed time is 0.861377 seconds.
 +
 
>> tic; norm(X)
 
>> tic; norm(X)
 
   toc
 
   toc
Line 35: Line 39:
  
 
Elapsed time is 4.288788 seconds.
 
Elapsed time is 4.288788 seconds.
</pre>
+
</syntaxhighlight>
 +
 
 +
===Can be used with CVX===
 +
This function can be used directly in constraints or the objective function of CVX problems. The following code snippet computes the minimum value of $\mathrm{Tr}(S\rho)$ over all density matrices $\rho$ satisfying $\|\rho\|_{(2)} \leq 3/4$, where $S$ is the [[SwapOperator|swap operator]].
 +
<syntaxhighlight>
 +
>> cvx_begin sdp quiet
 +
  variable rho(4,4) hermitian;
 +
  minimize trace(rho*SwapOperator(2));
 +
  subject to
 +
      trace(rho) == 1;
 +
      rho >= 0;
 +
      KyFanNorm(rho,2) <= 3/4;
 +
  cvx_end
 +
  cvx_optval
 +
 
 +
cvx_optval =
 +
 
 +
  -0.2500
 +
 
 +
>> rho
 +
 
 +
rho =
 +
 
 +
  0.1250 + 0.0000i  -0.0000 + 0.0000i  -0.0000 + 0.0000i  -0.0000 + 0.0000i
 +
  -0.0000 - 0.0000i  0.3750 + 0.0000i  -0.2500 + 0.0000i  -0.0000 + 0.0000i
 +
  -0.0000 - 0.0000i  -0.2500 - 0.0000i  0.3750 + 0.0000i  -0.0000 + 0.0000i
 +
  -0.0000 - 0.0000i  -0.0000 - 0.0000i  -0.0000 - 0.0000i  0.1250 + 0.0000i
 +
</syntaxhighlight>
 +
 
 +
{{SourceCode|name=KyFanNorm}}

Latest revision as of 16:39, 24 December 2014

KyFanNorm
Computes the Ky Fan norm

Other toolboxes required none
Related functions kpNorm
SchattenNorm
TraceNorm
Function category Norms
Usable within CVX? yes (convex)

KyFanNorm is a function that computes the Ky Fan k-norm of an operator (i.e., the sum of its k largest singular values): \[\|X\|_{(k)} := \sum_{j=1}^k \sigma_j^{\downarrow}(X).\] This function works with both full and sparse matrices, and can be used in the objective function or constraints of a CVX optimization problem.

Syntax

  • NRM = KyFanNorm(X,K)

Argument descriptions

  • X: An operator to have its Ky Fan K-norm computed.
  • K: A positive integer.

Examples

Equals the operator norm when K = 1 (but faster!)

The Ky Fan 1-norm is just the operator norm, which is implemented in MATLAB by the norm function. However, the KyFanNorm function is typically much faster than the norm function:

>> X = rand(2500);
>> tic; KyFanNorm(X,1)
   toc

ans =

       1250.2

Elapsed time is 0.861377 seconds.

>> tic; norm(X)
   toc

ans =

       1250.2

Elapsed time is 4.288788 seconds.

Can be used with CVX

This function can be used directly in constraints or the objective function of CVX problems. The following code snippet computes the minimum value of $\mathrm{Tr}(S\rho)$ over all density matrices $\rho$ satisfying $\|\rho\|_{(2)} \leq 3/4$, where $S$ is the swap operator.

>> cvx_begin sdp quiet
   variable rho(4,4) hermitian;
   minimize trace(rho*SwapOperator(2));
   subject to
       trace(rho) == 1;
       rho >= 0;
       KyFanNorm(rho,2) <= 3/4;
   cvx_end
   cvx_optval

cvx_optval =

   -0.2500

>> rho

rho =

   0.1250 + 0.0000i  -0.0000 + 0.0000i  -0.0000 + 0.0000i  -0.0000 + 0.0000i
  -0.0000 - 0.0000i   0.3750 + 0.0000i  -0.2500 + 0.0000i  -0.0000 + 0.0000i
  -0.0000 - 0.0000i  -0.2500 - 0.0000i   0.3750 + 0.0000i  -0.0000 + 0.0000i
  -0.0000 - 0.0000i  -0.0000 - 0.0000i  -0.0000 - 0.0000i   0.1250 + 0.0000i

Source code

Click here to view this function's source code on github.