KpNorm: Difference between revisions
Uploaded v1.01 |
cvx-safe |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{Function | {{Function | ||
|name=kpNorm | |name=kpNorm | ||
|desc=Computes the | |desc=Computes the (k,p)-norm of a vector or matrix | ||
|rel=[[KyFanNorm]]<br />[[SchattenNorm]]<br />[[TraceNorm]] | |rel=[[kpNormDual]]<br />[[KyFanNorm]]<br />[[SchattenNorm]]<br />[[TraceNorm]] | ||
|upd= | |cat=[[List of functions#Norms|Norms]] | ||
| | |upd=June 24, 2015 | ||
<tt>'''kpNorm'''</tt> is a [[List of functions|function]] that computes the | |cvx=yes (convex)}} | ||
<tt>'''kpNorm'''</tt> is a [[List of functions|function]] that computes the (k,p)-norm of a vector or matrix, defined as follows: | |||
: <math>\|v\|_{k,p} := \left(\sum_{j=1}^k |v_j^{\downarrow}|^p \right)^{1/p}, \quad \|X\|_{k,p} := \left( \sum_{j=1}^k \sigma_j^{\downarrow}(X)^p \right)^{1/p}.</math> | |||
In the case of a vector, this is the p-norm of the vector's k largest (in magnitude) entries. In the case of a matrix, this is the p-norm of the vector of its k largest singular values. This norm generalizes many well-known norms including the vector p-norms, the operator norm (when k = 1), the trace norm (when p = 1 and k is the size of X), the Schatten p-norms (when k is the size of X), and the Ky Fan k-norms (when p = 1). It works with both full and sparse vectors and matrices. | |||
==Syntax== | ==Syntax== | ||
| Line 11: | Line 14: | ||
==Argument descriptions== | ==Argument descriptions== | ||
* <tt>X</tt>: | * <tt>X</tt>: A vector or matrix to have its (<tt>K</tt>,<tt>P</tt>)-norm computed. | ||
* <tt>K</tt>: A positive integer. | * <tt>K</tt>: A positive integer. | ||
* <tt>P</tt>: A real number ≥ 1, or <tt>Inf</tt>. | * <tt>P</tt>: A real number ≥ 1, or <tt>Inf</tt>. | ||
| Line 17: | Line 20: | ||
==Examples== | ==Examples== | ||
===Generalizes the operator, trace, Ky Fan, and Schatten norms=== | ===Generalizes the operator, trace, Ky Fan, and Schatten norms=== | ||
The (<tt>K</tt>,<tt>P</tt>)-norm is simply the usual | The (<tt>K</tt>,<tt>P</tt>)-norm of a matrix is simply the usual operator norm when <tt>K = 1</tt> or <tt>P = Inf</tt>: | ||
< | <syntaxhighlight> | ||
>> X = rand(3); | >> X = rand(3); | ||
>> [norm(X), kpNorm(X,1,Inf), kpNorm(X,2,Inf), kpNorm(X,3,Inf), kpNorm(X,1,5)] | >> [norm(X), kpNorm(X,1,Inf), kpNorm(X,2,Inf), kpNorm(X,3,Inf), kpNorm(X,1,5)] | ||
| Line 25: | Line 28: | ||
1.0673 1.0673 1.0673 1.0673 1.0673 | 1.0673 1.0673 1.0673 1.0673 1.0673 | ||
</ | </syntaxhighlight> | ||
When <tt>P = 1</tt> and <tt>K</tt> is the size of <tt>X</tt>, this norm reduces to the | When <tt>P = 1</tt> and <tt>K</tt> is the size of <tt>X</tt>, this norm reduces to the trace norm: | ||
< | <syntaxhighlight> | ||
>> [kpNorm(X,3,1), | >> [kpNorm(X,3,1), TraceNorm(X)] | ||
ans = | ans = | ||
1.6482 1.6482 | 1.6482 1.6482 | ||
</ | </syntaxhighlight> | ||
More generally, when <tt>P = 1</tt> this norm reduces to the | More generally, when <tt>P = 1</tt> this norm reduces to the Ky Fan <tt>K</tt>-norm: | ||
< | <syntaxhighlight> | ||
>> [kpNorm(X,2,1), | >> [kpNorm(X,2,1), KyFanNorm(X,2)] | ||
ans = | ans = | ||
1.5816 1.5816 | 1.5816 1.5816 | ||
</ | </syntaxhighlight> | ||
Similarly, when <tt>K = min(size(X))</tt> this norm reduces to the | Similarly, when <tt>K = min(size(X))</tt> this norm reduces to the Schatten <tt>P</tt>-norm: | ||
< | <syntaxhighlight> | ||
>> [kpNorm(X,3,4), | >> [kpNorm(X,3,4), SchattenNorm(X,4)] | ||
ans = | ans = | ||
1.0814 1.0814 | 1.0814 1.0814 | ||
</ | </syntaxhighlight> | ||
{{SourceCode|name=kpNorm}} | |||
Latest revision as of 18:56, 24 June 2015
| kpNorm | |
| Computes the (k,p)-norm of a vector or matrix | |
| Other toolboxes required | none |
|---|---|
| Related functions | kpNormDual KyFanNorm SchattenNorm TraceNorm |
| Function category | Norms |
| Usable within CVX? | yes (convex) |
kpNorm is a function that computes the (k,p)-norm of a vector or matrix, defined as follows:
- <math>\|v\|_{k,p} := \left(\sum_{j=1}^k |v_j^{\downarrow}|^p \right)^{1/p}, \quad \|X\|_{k,p} := \left( \sum_{j=1}^k \sigma_j^{\downarrow}(X)^p \right)^{1/p}.</math>
In the case of a vector, this is the p-norm of the vector's k largest (in magnitude) entries. In the case of a matrix, this is the p-norm of the vector of its k largest singular values. This norm generalizes many well-known norms including the vector p-norms, the operator norm (when k = 1), the trace norm (when p = 1 and k is the size of X), the Schatten p-norms (when k is the size of X), and the Ky Fan k-norms (when p = 1). It works with both full and sparse vectors and matrices.
Syntax
- NRM = kpNorm(X,K,P)
Argument descriptions
- X: A vector or matrix to have its (K,P)-norm computed.
- K: A positive integer.
- P: A real number ≥ 1, or Inf.
Examples
Generalizes the operator, trace, Ky Fan, and Schatten norms
The (K,P)-norm of a matrix is simply the usual operator norm when K = 1 or P = Inf:
>> X = rand(3);
>> [norm(X), kpNorm(X,1,Inf), kpNorm(X,2,Inf), kpNorm(X,3,Inf), kpNorm(X,1,5)]
ans =
1.0673 1.0673 1.0673 1.0673 1.0673When P = 1 and K is the size of X, this norm reduces to the trace norm:
>> [kpNorm(X,3,1), TraceNorm(X)]
ans =
1.6482 1.6482More generally, when P = 1 this norm reduces to the Ky Fan K-norm:
>> [kpNorm(X,2,1), KyFanNorm(X,2)]
ans =
1.5816 1.5816Similarly, when K = min(size(X)) this norm reduces to the Schatten P-norm:
>> [kpNorm(X,3,4), SchattenNorm(X,4)]
ans =
1.0814 1.0814Source code
Click here to view this function's source code on github.