<p dir="auto">If the output of this product is a matrix, should it not be a column vector matrix rather than a row vector matrix?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; matrix([[1, 2], [3, 4]]).dot(array([5, 6]))
matrix([[17, 39]])"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; matrix([[1, 2], [3, 4]]).dot(array([5, 6]))
matrix([[17, 39]])
</code></pre></div>
<p dir="auto">This seems like a bug, although I do not have extensive knowledge of the behavior of <code class="notranslate">numpy.matrix</code> and this has probably already been discussed extensively.</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/2057" rel="nofollow">http://projects.scipy.org/numpy/ticket/2057</a> on 2012-02-17 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pv/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pv">@pv</a>, assigned to unknown.</em></p>
<p dir="auto"><a href="http://permalink.gmane.org/gmane.comp.python.scientific.user/31095" rel="nofollow">http://permalink.gmane.org/gmane.comp.python.scientific.user/31095</a></p>
<p dir="auto">Consider this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
x = np.arange(5)
I = np.asmatrix(np.identity(5))
print np.dot(I, x).shape
# -&gt; (1, 5)"><pre class="notranslate"><code class="notranslate">import numpy as np
x = np.arange(5)
I = np.asmatrix(np.identity(5))
print np.dot(I, x).shape
# -&gt; (1, 5)
</code></pre></div>
<p dir="auto">while <code class="notranslate">(5, 1)</code> would be what is expected based on usual linear algebra rules.</p>
<p dir="auto">It might also be a mistake to return a matrix from mixed matrix--array computations.</p>