<< sign matrixoperations searchandsort >>

Scilab Help >> Elementary Functions > matrixoperations > sum

sum

配列要素の合計

呼び出し手順

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

引数

x

ブール(full or sparse), エンコードされた整数, 実数または複素数(full or sparse),多項式, または有理数の配列.

orientation

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

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

  • 正の整数値

outtype

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

y

スカラーまたは配列

説明

配列xの場合, y=sum(x)xの全要素の合計を スカラーyに返します.

y=sum(x,orientation) は, orientationで指定した次元方向の xの合計を yに返します.

outtype引数は合算の動作を指定します:

This function applies with identical rules to sparse matrices

A=[1,2;3,4];
sum(A)
sum(A,1)

I=uint8([2 95 103;254 9 0])
sum(I) //native evaluation
sum(I,"double")
sum(I,2,"double")

s=poly(0,"s");
P=[s,%i+s;s^2,1];
sum(P),
sum(P,2)

B=[%t %t %f %f];
sum(B) //evaluation in float
sum(B,"native") //similar to or(B)

参照


Report an issue
<< sign matrixoperations searchandsort >>