ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 1 is different from 3)

You are transposing a Matrix with 3 rows and 1 column to a Matrix with 3 columns and 1 row. Then you are multplying it with a similar Matrix (also 3 columns 1 row) which is incorrect mathematically. So you can either remove the transpose function or define your R Matrix as 1 row 3 columns and then transpose it. Check this for further information.