<< cumprod matrixoperations kron .*. >>

Scilab Help >> Elementary Functions > matrixoperations > cumsum

cumsum

配列要素の累積和

呼び出し手順

y = cumsum(x)
y = cumsum(x, outtype)
y = cumsum(x, orientation)
y = cumsum(x, orientation, outtype)

引数

x

実数,複素数,論理値,多項式または有理数の配列. Hypermatrices or sparse boolean or numerical matrices are supported as well.

orientation

以下のどちらかを指定します

  • 文字列で,指定可能な値は "*", "r", "c" または "m"

  • a positive integer 1 ≤ orientation ≤ ndims(x): the index of the dimension along which the cumulative sum must be computed. 1 and "r", and 2 and "c", are equivalent. 正の整数値

outtype

文字列で,指定可能な値は "native" または "double".

y

Array of size equal to that of x.

説明

xは配列の場合,y = cumsum(x) は, xの全要素の累積和を スカラーyに返します:

y = cumsum(x, orientation)orientationにより指定された次元方向の x の累積和をyに返します:

y(i) = ∑u=1→i x(u)

outtype引数は総和の動作を指定します:

When the input x is sparse, please keep in mind that the density of the result y will be almost always close to 100%.

A = [1,2;3,4];
cumsum(A)
cumsum(A,1)
I = uint8([2 95 103 ; 254 9 0])
cumsum(I)   // native evaluation
cumsum(I,"double")
cumsum(I,2,"double")
s = poly(0,"s");
P = [s, %i+s ; s^2, 1];
cumsum(P),
cumsum(P,2)
B = [%t %t %f %f];
cumsum(B)          // evaluation in float
cumsum(B,"native") // similar to or(B)

参照


Report an issue
<< cumprod matrixoperations kron .*. >>