How using "dot" (or "matmul") function for iterative multiplication in Python
<p>I need obtain a "W" matrix of multiples matrix multiplications (all multiplications result in column vectors).</p>

<pre><code>from numpy import matrix
from numpy import transpose
from numpy import matmul
from numpy import dot

# Iterative matrix multiplication
def iterativeMultiplication(X, Y):
    W = [] # Matrix of matricial products
    X = matrix(X) # same number of rows
    Y = matrix(Y) # same number of rows
    h = 0
    while (h &lt; X.shape[1]):
        W.append([])
        W[h] = dot(transpose(X), Y) # using "dot" function
        h += 1
    return W
</code></pre>

<p>But, unexpectedly, I obtain a list of objects with their respective data types.</p>

<pre><code>X = [[0., 0., 1.], [1.,0.,0.], [2.,2.,2.], [2.,5.,4.]]
Y = [[-0.2], [1.1], [5.9], [12.3]] # Edit Y column 
iterativeMultiplication( X, Y )
</code></pre>

<p>Results in:</p>

<pre><code>[array([[37.5],[73.3],[60.8]]), 
array([[37.5],[73.3],[60.8]]),
array([[37.5],[73.3],[60.8]])]
</code></pre>

<p>I need any method for obtain only the numerical values for the matrix conversion.</p>

<pre><code>W = matrix(W) # Results in error
</code></pre>

<p>It is the same using "matmul" function. Thx for your time.</p>