<p dir="auto">See title. Given a matrix <code class="notranslate">A</code>, this works:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="aslinearoperator(A).H"><pre class="notranslate"><code class="notranslate">aslinearoperator(A).H
</code></pre></div>
<p dir="auto">but this not:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="aslinearoperator(A).T"><pre class="notranslate"><code class="notranslate">aslinearoperator(A).T
</code></pre></div>
<p dir="auto">This seems like a basic oversight; is there a reason?</p>
<p dir="auto">As far as I understand, <code class="notranslate">sparse.LinearOperator</code> creates some instance of <code class="notranslate">CustomLinearOperator</code> when it is called by <code class="notranslate">aslinearoperator()</code> or when passed <code class="notranslate">matvec=</code>.<br>
But neither <code class="notranslate">CustomLinearOperator</code>, nor, e.g., <code class="notranslate">SumLinearOperator</code> have <code class="notranslate">transpose()</code>.</p>
<p dir="auto">And the <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html" rel="nofollow">docs</a> do not say much about how <code class="notranslate">transpose()</code> should be used or implemented.</p>
<h3 dir="auto">Reproducing code example:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
import scipy as sp
import scipy.sparse.linalg as sla


dim = 8
shp = (dim, dim)

I = np.eye(*shp)

x0 = -sp.pi
xf = sp.pi
x = np.linspace(x0, xf, dim, endpoint=False)
# this is a vector representation of an operator with diagonal matrix
ref = (1-np.exp(-x))**2


def mv(y):
    # multiply this diag matrix by vector
    vv = ref
    return vv*y


LO = sla.LinearOperator(shp, matvec=mv)
(LO+LO).T

# not ever if a matrix was passed
M = sla.aslinearoperator(I)
M.transpose()"><pre class="notranslate"><code class="notranslate">import numpy as np
import scipy as sp
import scipy.sparse.linalg as sla


dim = 8
shp = (dim, dim)

I = np.eye(*shp)

x0 = -sp.pi
xf = sp.pi
x = np.linspace(x0, xf, dim, endpoint=False)
# this is a vector representation of an operator with diagonal matrix
ref = (1-np.exp(-x))**2


def mv(y):
    # multiply this diag matrix by vector
    vv = ref
    return vv*y


LO = sla.LinearOperator(shp, matvec=mv)
(LO+LO).T

# not ever if a matrix was passed
M = sla.aslinearoperator(I)
M.transpose()
</code></pre></div>
<h3 dir="auto">Error message:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'_CustomLinearOperator' object has no attribute '_transpose'"><pre class="notranslate"><code class="notranslate">'_CustomLinearOperator' object has no attribute '_transpose'
</code></pre></div>
<h3 dir="auto">Scipy/Numpy/Python version information:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="1.0.0 1.14.0 sys.version_info(major=3, minor=6, micro=4, releaselevel='final', serial=0)"><pre class="notranslate"><code class="notranslate">1.0.0 1.14.0 sys.version_info(major=3, minor=6, micro=4, releaselevel='final', serial=0)
</code></pre></div>