# [Scipy-tickets] [SciPy] #1189: Define operations on LinearOperator instances

SciPy Trac scipy-tickets@scipy....
Wed Jun 2 08:31:19 CDT 2010

```#1189: Define operations on LinearOperator instances
------------------------------------------------+---------------------------
Reporter:  barbey                              |       Owner:  wnbell
Type:  enhancement                         |      Status:  needs_review
Priority:  normal                              |   Milestone:  0.8.0
Component:  scipy.sparse.linalg                 |     Version:  0.7.0
Keywords:  LinearOperator, sparse, operations  |
------------------------------------------------+---------------------------

Comment(by barbey):

I did some work on "__mul__" to define the multiplication of two
LinearOperator (which is a functional combination). But I preserve its
behavior on vectors and two-dimensional arrays. So, for instance, it will
not break the functions in iterative.py.

In the new patch, I factored out some of the code in "__rmul__". It was
indeed possible but not when multiplying with objects that are not
LinearOperator  (since multiplication on matrices is not commutative).

I also added a __pow__ method for positive integers.

I added a separate patch for the transpose as you required.

And another patch for a method which outputs the equivalent dense matrix.
This method is very computer intensive since I basically apply the
operator to each vector of the canonic basis ( [1, 0, ...], [0, 1, 0,
...], etc ...). But I don't know about any other method. However this can
be useful for instance in this context :

A is a LinearOperator of a very rectangular shape. I want to know the
determinant of A.T * A. Since, A is very rectangular, A.T * A is small, so
I can do np.det((A.T * A).dense()) in a very reasonable time.

I will take a look on tests soon.

Any other suggestion is always welcome.

--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1189#comment:5>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
```