列表之间的Python乘法

时间:2018-04-18 13:18:00

标签: python

我正在寻找一种有效的方法来执行以下操作:

我有:

List1 - 3D点<< List2 - 3D积分

indexList - 包含我希望与List1相乘的List2中元素的索引

在matlab中

我会像List1 * List2(:,indexList)

那样轻松地做到这一点

这在python中是如何工作的。

感谢您的时间!

1 个答案:

答案 0 :(得分:0)

感谢您的回复!所以...我有:

    List1 = [
[-1.53098, -1.13332, 2.835]
[-1.52104, -1.13332, 2.835]
[-1.5111, -1.13332, 2.83501]
[-1.48898, -1.12412, 2.81199]
[-1.47911, -1.12413, 2.812]
[-1.46925, -1.12412, 2.812]
[-1.45939, -1.12412, 2.81199]
[-1.44428, -1.1186, 2.7999]
[-1.42789, -1.11493, 2.789]
[-1.44149, -1.13332, 2.835]
[-1.43156, -1.13332, 2.835]]
and 
List2 = [-1.33225, -0.986204, 2.46702]
[-1.31448, -0.979411, 2.45001]
[-1.30361, -0.972953, 2.4359]
[-1.26995, -0.952186, 2.39274]
[-1.26135, -0.958618, 2.39801]
[-1.25294, -0.958618, 2.398]
[-1.23702, -0.951902, 2.37542]
[-1.22889, -0.94736, 2.37726]
[-1.21901, -0.951823, 2.381]
[-1.20253, -0.94543, 2.365]
[-1.18616, -0.939033, 2.34901]

现在索引List保存了与Element List1最短距离的点的索引示例: Indelist [0]告诉我List2 [Indelist [0]]中的点是List1 [0]的最近点。等。