存储在列表中的矩阵的乘法

Multiplication of matrices stored in lists

我正在努力将列表乘以 Python 中的矩阵。

我有两个列表(weightsreturns),我需要将它们相乘为:weights*TRANSPOSE(returns).

代码中的权重和 Return 是如何定义的? 您或许可以执行以下操作:

#This sums the entries
matrixProduct = 0
for i in range(len(Weights)):
    matrixProduct+= Weights[i]*Return[i]

#In case you meant to keep products of individual pairs of matrix entries (not sure from your notation):
matrixProduct = []
for i in range(len(Weights)):
    matrixProduct.append(Weights[i]*Return[i])