<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>cumsum</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1993</DATE>
  <SHORT_DESCRIPTION name="cumsum"> cumulative sum</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>y=cumsum(x)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>y=cumsum(x,'r') or y=cumsum(x,1)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>y=cumsum(x,'c') or y=cumsum(x,2)  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>x</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: vector or matrix (real or complex)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>y</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: vector or matrix (real or complex)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P> For a vector or a matrix <VERB>x</VERB>, <VERB>y=cumsum(x)</VERB>  returns
      in <VERB>y</VERB> the cumulative sum of all the entries of <VERB>x</VERB>
      taken columnwise.</P> 

    <P><VERB>y=cumsum(x,'c')</VERB> (or, equivalently,
      <VERB>y=cumsum(x,2)</VERB>) returns in  <VERB>y</VERB> the cumulative sum 
      of the columns of <VERB>x</VERB>: <VERB> 	y(i,:)=cumsum(x(i,:))</VERB></P> 

    <P><VERB>y=cumsum(x,'r')</VERB> (or, equivalently,
      <VERB>y=cumsum(x,1)</VERB>) returns in <VERB>y</VERB> the cumulative sum
      of the rows of <VERB>x</VERB>: <VERB> y(:,i)=cumsum(x(:,i))</VERB></P>


    <P><VERB>y=cumsum(x,'m')</VERB>  is the cumulative sum along the first non
      singleton  dimension of <VERB>x</VERB> (for compatibility with Matlab).</P> 

  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
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')
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>cumprod</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>sum</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
