Matrix / Vector multiplication fails
I want to obtain the following matrix/vector multiplication
> A=[[2.36,2.68,6.78,20.37,2.34],
> [4.14,2.64,7.2,18.47,4.21],
> [4.98,3.68,10.91,19.90,4.20],
> [8.8,5.73,19.43,29.03,8.09],
> [13.51,12.64,24.44,27.59,13.93],
> [21.64,18.49,29.15,38.01,20.19],
> [30.57,30.57,38.04,34.14,23.47],
> [40.51,40.51,39.36,20.93,36.27],
> [42.42,42.42,43.80,23.52,48.13],
> [34.82,34.82,55.19,28.7,41.39],
> [22.25,22.25,52.15,32.81,32.81],
> [31.86,31.86,51.49,37.36,48.86]];
>
> M = transpose(matrix(A));
> show(M)
> io=vector(RR,[1. for i in range(len(M.rows()))]);
> show(io)
> nr=M.nrows() (1/nr)*M*io
and I have the following error
"unsupported operand parent(s) for *: 'Full MatrixSpace of 5 by 12 dense matrices over Real Field with 53 bits of precision' and 'Vector space of dimension 5 over Real Field with 53 bits of precision'". I don't understand where is the problem. Dimensions are correct and matrix and vector are defined on the same field and there is no problem with the following code.
A = matrix([[1.12,2.34],[3.24,4.53]]);
b = vector([1,1]);
show(A*b)
show(b*A)
Btw, you can use
M.nrows()
instead oflen(M.rows())
, andio = vector(RR,[1.]*M.nrows())
.