~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_cumsum.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [stk,txt,top]=sci_cumsum()
 
2
// Copyright INRIA
 
3
txt=[]
 
4
if stk(top-rhs+1)(5)=='4' then 
 
5
  v='bool2s('+stk(top-rhs+1)(1)+')',
 
6
else 
 
7
  v=stk(top-rhs+1)(1),
 
8
end 
 
9
if rhs==1 then
 
10
  [m,n]=checkdims(stk(top))
 
11
  x=stk(top)(1)
 
12
  if m==-1&n==-1 then
 
13
    set_infos([
 
14
        'mtlb_cumsum('+x+') may be replaced by '
 
15
        'cumsum('+x+')'+' if '+x+'is a vector'
 
16
        'cumsum('+x+',1)'+' if '+x+'is a matrix'],1)
 
17
    stk=list('mtlb_cumsum('+x+')','0','?','?','1')
 
18
  elseif m==1|n==1 then
 
19
    stk=list('cumsum('+x+')','0','1','1','1')
 
20
  else
 
21
    stk=list('cumsum('+x+',1)','0','1',stk(top)(4),'1')
 
22
  end
 
23
else
 
24
  if stk(top)(1)=='1' then
 
25
    stk=list('cumsum('+v+',1)','0','1',stk(top-1)(4),stk(top-1)(5))
 
26
  elseif stk(top)(1)=='2' then  
 
27
    stk=list('cumsum('+v+',2)','0',stk(top-1)(3),'1',stk(top-1)(5))
 
28
  else  
 
29
    x=stk(top)(1)
 
30
    stk=list('cumsum('+v+','+x+')','0','?','?',stk(top-1)(5))
 
31
  end
 
32
  top=top-1
 
33
end
 
34
 
 
35