On 01/11/2012 08:21 PM, Sébastien Brisard wrote: > Hi, Hi Sébastien,
> My problem is: how to do that? > 1. Extend RealLinearOperator? That would allow for compile time > checks. The problem is I've already defined > InvertibleRealLinearOperator. So how about operators which are both > invertible and transposable? > 2. Create an interface, say Transposable? But then, no compile time > check can be performed in > LSQR.RealVector solve(RealLinearOperator a, RealVector b) > (defined in AbstractIterativeLinearSolver). The only thing I can do is > test whether the specified operator implements the interface > Transposable. > 3. Add the method operateTranspose to RealLinearOperator, and allow > for UnsupportedOperationException. I could then add a method > boolean isTransposable() to RealLinearOperator. Again, no compile-time > check is possible. > > Do you have any thoughts? looking at the rationale behind RealLinearOperator I understand this class is used to calculate either: y = A x y = A^T x The specialized class InvertibleRealLinearOperator further allows for the calculation of: y = A^-1 x @Alt1: you ask about operators which are both invertible and transposable, but the two properties do not collide imho, at least as long as you do not want to calculate something like y = A^T^-1 x And in that case, wouldn't it be better to create a RealLinearOperator object with A^T as parameter? @Alt2: if the solve method relies on an operator to provide operateTranspose than it should be checked on compile time imho. Assuming that any matrix A should be transposable, I would opt for alternative 3 and provide the operateTranspose method. Do you have a case where an operator would not be transposable? Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org