可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: With using python library numpy, it is possible to use the function cumprod to evaluate cumulative products, e.g. a = np.array([1,2,3,4,2]) np.cumprod(a) gives array([ 1, 2, 6, 24, 48]) It is indeed possible to apply this function only along one axis. I would like to do the same with matrices (represented as numpy arrays), e.g. if I have S0 = np.array([[1, 0], [0, 1]]) Sx = np.array([[0, 1], [1, 0]]) Sy = np.array([[0, -1j], [1j, 0]]) Sz = np.array([[1, 0], [0, -1]]) and b = np.array([S0, Sx, Sy, Sz]) then I would like to have a cumprod