Lp norm of a matrix

1k Views Asked by At

I need a small clarification regarding the $L_2$ norm of a matrix. On wikipedia, the $L_{p,q}$ norm, for $p=2, q=1$, is defined as:

$$||A||_{2,1}=\sum_{j=1}^n\left(\sum_{i=1}^m|a_{i,j}|^2\right)^{\frac12}$$

Suppose

$$A=\left(\begin{matrix}1&-2\\-3&4\end{matrix}\right)\Rightarrow$$ $$||A||_2=\left(|1|^2+|-3|^2\right)^{\frac12}+\left(|-2|^2+|4|^2\right)^{\frac12}=\\\sqrt{10}+\sqrt{20}\approx7.6344$$

But when I use Eigen with a simple test:

#include <iostream>
#include <Eigen/Dense>

int main()
{
  Eigen::MatrixXd m(2,2);
  m << 1, -2
      -3,  4;
  std::cout << m.lpNorm<2>() << '\n';
  return 0;
}

It outputs 5.47223, which is $\sqrt{30}$, as if the sqrt() encompasses the whole sums in the first formula.

My question: what is the correct formula for a generic $L_{p,q}$ norm of a matrix?