ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Computing the matrix norm

Open gflegar opened this issue 6 years ago • 6 comments

Sometimes it is beneficial to have a method that computes the norm of a matrix (or liner operator). (Currently we only have a function which computes the column-wise dot product of two dense matrices - which is enough for use in Krylov solvers, but not necessarily in all scenarios).

There are a few questions though on how we implement this:

  1. There are multiple interesting norms (1, Frobenious, infinity, etc), do we want to support all of them? And how do we design the interface for that, multiple functions, one templated function, or one function with an extra parameter?
  2. For which kinds of linear operators does it makes sense to implement the norm in the first place? Probably not for solvers. For all of the matrices it is not extremely difficult (depending on the norm). For some preconditioners (e.g block-Jacobi) it is easy, but for others it's more involved (e.g. ILU-type). Do we add it as a virtual method to LinOp, do we create a new interface which is inherited by all operators implementing it (e.g. like we have for transpose), or do we just put that as non-virtual members of the concrete linear operators implementing those?

gflegar avatar Jun 18 '18 11:06 gflegar

It would definitely be a nice feature! Avoiding a lot matlab stuff.... For the ILU preconditioners that you take as example, the question is whether you want the norm of the complete preconditioner or only of a single factor. Then it boils down to the matrix norm, right?

hartwiganzt avatar Jun 18 '18 12:06 hartwiganzt

Ad 1. Maybe a function with an extra parameter, as done in xLANGE, e.g., https://github.com/Reference-LAPACK/lapack/blob/master/SRC/clange.f

venovako avatar Jun 18 '18 12:06 venovako

@hartwiganzt with "ILU preconditioner" I was talking about the linear operator U^-1 L^-1 (this is the actual operator that is applied at every iteration), so || U^-1 L^-1 ||, which is difficult.

gflegar avatar Jun 18 '18 14:06 gflegar

With the previous MRs #141 and related a function compute_norm2 was added for Dense matrices. We still miss a bunch of norms and this is only for Dense, but there is something.

tcojean avatar Oct 02 '18 08:10 tcojean

@tcojean #141 does something different - it computes the norm of each column of the matrix, so the result is a row-vector of norms. This issue is a feature request for computing the norm of the entire matrix, which should produce one value for the entire matrix.

gflegar avatar Oct 02 '18 09:10 gflegar

You are right, I should have read more carefully that this was for the whole matrix as a single entity. Maybe there is some common ground (in terms of interface?) for both though?

tcojean avatar Oct 02 '18 09:10 tcojean