scipy/scipy — pull request #4087 by larsmans (2014-10-19 23:02:21+00:00)
Title: Refactor and expand LinearOperator API

In light of recent problems with the `scipy.sparse.linalg.LinearOperator` API (#4073, #4074), I decided to clean up the code and expand it. Highlights of this PR:

* cleaner separation of API and implementation
* documentation on how to subclass `LinearOperator`
* added an `adjoint` method, with short-hand notation `A.T` borrowed from [PyOperators](https://pchanial.github.io/pyoperators/documentation/)
* some more unit tests
* mostly backwards compatible, except for existing subclasses (but I'm not sure if subclassing was ever advertised?)

The main low-light is that it takes some trickery to pull off the backward compat (`__new__`), but not too much.

Still to-do:

* make `adjoint` work whenever `rmatvec` is defined and vice-versa (this can get tricky...)
* prune away duplicate code in `scipy.sparse.linalg.matfuncs` and elsewhere.