commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastien Brisard" <>
Subject [math] Exceptions for matrix operations
Date Mon, 09 May 2011 07:24:47 GMT
Dear all,
I'm currently trying to integrate my implementation of iterative linear
solvers in the commons-math architecture. Among other things, I want to reuse
as many existing exceptions as possible. I've come accross the following
1. naming the parameters in the constructor of NonSquareMatrixException
"wrong" and "expected" is somewhat misleading. They should really be called
something like "rowDimension", "columnDimension". If you agree on this, I can
easily submit a patch.
2. NonSymmetricMatrixException. Looking at the constructor for this exception,
it is assumed that the only way to check for symmetry of matrix A is by
comparing A[i, j] and A[j, i]. Another commonly encountered case is the
comparison of the vectors A.x and x'.A, where ' stands for the transpose. In
this case, it is not really possible (or even desirable) to locate the exact
coefficient of matrix A which led to failure. What's the best way to handle
  2.1 Create a new type of exception? I think it is a messy solution
  2.2 Add new constructors to the existing exception ? But then, the getters
getRow() and getColumn() would not always be meaningful.
3. Same remark goes to NonPositiveDefiniteMatrixException. We *should* be able
to raise such an exception when a calculation leads to x'.A.x < 0. Again, it
is neither possible, nor desirable to locate the coefficient which is

I do not really see a satisfactory solution for points 2 and 3. Any ideas?

Best regards,

Sebastien Brisard

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message