Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Elementary Functions > matrixoperations > cumsum

cumsum

配列要素の累積和

呼び出し手順

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

引数

x

実数,複素数,論理値,多項式または有理数の配列

orientation

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

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

  • 正の整数値

outtype

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

y

スカラーまたは配列

説明

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

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

y(i) = \sum_{k=1}^i x(k)

  • orientation が 1 または "r" の場合:

    y(\mathbf{l},j) = \sum_{\mathbf{i}=1}^l x(\mathbf{i},j)

    または

    y(\mathbf{l},j,k,\ldots) = \sum_{\mathbf{i}=1}^l x(\mathbf{i},j,k,\ldots)

  • orientation が 2 または "c" の場合:

    y(i,\mathbf{l}) = \sum_{\mathbf{j}=1}^l x(i,{\mathbf{j})

    または

    y(i,\mathbf{l},k,\ldots) = \sum_{\mathbf{j}=1}^l x(i,\mathbf{j},k,\ldots)

  • orientation が n の場合:

    y(i_1,\ldots,i_{n-1},\mathbf{l},i_{n+1},\ldots) = \sum_{\mathbf{i_n}=1}^l x(i_1,\ldots,i_{n-1},\mathbf{i_n},i_{n+1},\ldots)

  • y=cumsum(x,"*")y=cumsum(x)と等価です.

  • y=cumsum(x,"m")y=cumsum(x,orientation) と等価です. ただし, orientationxの1より大きい最初の次元の添字です. このオプションはMatlabとの互換性のために使用されます.

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

  • float, 多項式 有理数の配列の場合, 評価は浮動小数点演算により 行われます. "double" または "native" オプションは等価です.

  • 整数の配列の場合,

    outtype="native"の時, 評価は整数演算(モジュロ 2^b, ただし b は使用されるビット数)で行われます,

    outtype="double"の時,評価は浮動小数点演算により 行われます.

    デフォルト値は outtype="native"です.

  • 論理値の配列の場合,

    outtype="native"の時,評価は論理値演算 (+ は | で置換)により行われます,

    outtype="double"の時,評価は 浮動小数点演算(%t は 1, %f は 0で置換)により行われます.

    デフォルト値はouttype="double"です.

This function applies with identical rules to sparse matrices

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)

参照

  • sum — 配列要素の合計
  • cumprod — 配列要素の累積積
Report an issue
<< cumprod matrixoperations kron .*. >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:53:19 CET 2020