Multiply several matrices in numpy

前端 未结 5 2202
借酒劲吻你
借酒劲吻你 2021-02-02 06:52

Suppose you have n square matrices A1,...,An. Is there anyway to multiply these matrices in a neat way? As far as I know dot in numpy accepts only two arguments. One obvious way

5条回答
  •  耶瑟儿~
    2021-02-02 07:17

    Resurrecting an old question with an update:

    As of November 13, 2014 there is now a np.linalg.multi_dot function which does exactly what you want. It also has the benefit of optimizing call order, though that isn't necessary in your case.

    Note that this available starting with numpy version 1.10.

提交回复
热议问题