累積連乘

B = cumprod(A)返回數組不同程度的累積連乘的結果。

如果A是一個向量,將返回一個包含A各元素累積連乘的結果的向量,元素個數與原向量相同。

如果A是一個矩陣,將返回一個和A同樣大小的,包含A每一列向量累積連乘的結果的矩陣。

如果A是一個多維向量,cumprod(A)只對第一個nonsingleton(非單點)的維度上有效。

基本介紹

  • 中文名:累積連乘
  • 外文名:cumprod
  • 套用領域:數學、邏輯學
  • 性質:矩陣運算
英文概述,中文翻譯,

英文概述

累積連乘(cumprod )
矩陣的運算
matlab中的算法描述如下:
B = cumprod(A) returns the cumulative product along different dimensions of an array.
If A is a vector, cumprod(A) returns a vector containing the cumulative product of the elements of A.
If A is a matrix, cumprod(A) returns a matrix the same size as A containing the cumulative products for each column of A.
If A is a multidimensional array, cumprod(A) works on the first nonsingleton dimension.
B = cumprod(A,dim) returns the cumulative product of the elements along the dimension of A specified by scalar dim. For example,
cumprod(A,1) increments the first (row) index, thus working along the rows of A.

中文翻譯

matlab中給出的例子如下:
輸入:cumprod(1:5)
返回:ans =
1 2 6 24 120
輸入:A = [1 2 3; 4 5 6];
cumprod(A)
返回:ans =
1 2 3
4 10 18
再輸入:cumprod(A,2)
返回:ans =
1 2 6
4 20 120

相關詞條

熱門詞條

聯絡我們