File: cumsum.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (39 lines) | stat: -rw-r--r-- 933 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

cumsum(1)                      Scilab Function                      cumsum(1)
NAME
  cumsum - cumulative sum

CALLING SEQUENCE
  y=cumsum(x)
  y=cumsum(x,'r') or y=cumsum(x,1)
  y=cumsum(x,'c') or y=cumsum(x,2)

PARAMETERS

  x         : vector or matrix (real or complex)

  y         : vector or matrix (real or complex)

DESCRIPTION
  For a vector or a matrix x, y=cumsum(x)  returns in y the cumulative sum of
  all the entries of x taken columnwise.

  y=cumsum(x,'c') (or, equivalently, y=cumsum(x,2)) returns in y the cumula-
  tive sum of the columns of x:  y(i,:)=cumsum(x(i,:))

  y=cumsum(x,'r') (or, equivalently, y=cumsum(x,1)) returns in y the cumula-
  tive sum of the rows of x:  y(:,i)=cumsum(x(:,i))

EXAMPLE
  A=[1,2;3,4];
  cumsum(A)
  cumsum(A,'r')
  cumsum(A,'c')
  a=rand(3,4)+%i;
  [m,n]=size(a);
  w=zeros(a);
  w(1,:)=a(1,:);
  for k=2:m;w(k,:)=w(k-1,:)+a(k,:);end;w-cumsum(a,'r')

SEE ALSO
  cumprod, sum