~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_std.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function [stk,txt,top]=sci_std()
2
 
// Copyright INRIA
3
 
txt=[]
4
 
if rhs==1 then
5
 
  [m,n]=checkdims(stk(top))
6
 
  if m==-1&n==-1 then
7
 
    x=stk(top)(1)
8
 
    set_infos([
9
 
         'mtlb_std('+x+') may be replaced by:'
10
 
         '   st_deviation('+x+') if '+x+' is a vector'
11
 
         '   st_deviation('+x+',1) if '+x+' is a matrix'],1)
12
 
    stk=list('mtlb_std('+x+')','0','?','?',stk(top)(5))
13
 
  elseif m==1|n==1 then  
14
 
    stk=list('st_deviation('+stk(top)(1)+')','0','1','1',stk(top)(5))
15
 
  else
16
 
    stk=list('st_deviation('+stk(top)(1)+',1)','0','1',stk(top)(4),stk(top)(5))
17
 
  end
18
 
elseif rhs==2 then // normalized by N
19
 
  s1=stk(top-1)
20
 
  if isname(s1(1)) then
21
 
    x=s1(1)
22
 
  else
23
 
    x=gettempvar()
24
 
    txt=[txt;x+' = '+s1(1)]
25
 
  end
26
 
  
27
 
  [m,n]=checkdims(stk(top))
28
 
  if m==-1&n==-1 then
29
 
    set_infos([
30
 
         'mtlb_std('+x+',1) may be replaced by:'
31
 
         '   st_deviation('+x+')*sqrt(1-1/('+x+') if '+x+' is a vector'
32
 
         '   st_deviation('+x+',1)*sqrt(1-1/size('+x+',1) if '+x+' is a matrix'],1)
33
 
    stk=list('mtlb_std('+x+',1)','0','?','?',s1(5))
34
 
  elseif m==1|n==1 then  
35
 
    stk=list('st_deviation('+x+')*sqrt(1-1/size('+x+',''*''))','0','1','1',s1(5))
36
 
  else
37
 
    stk=list('st_deviation('+x+',1)*sqrt(1-1/size('+x+',1))','0','1',s1(3),s1(5))
38
 
  end
39
 
else
40
 
  s3=stk(top)
41
 
  s2=stk(top-1)(1)
42
 
  s1=stk(top-2)
43
 
  if s3(1)=='1' then
44
 
    m='1';n=s1(3)
45
 
  elseif s3(1)=='2' then
46
 
    m=s1(2);n='1';
47
 
  else
48
 
    m='?';n='?'
49
 
  end
50
 
  if s2=='0' then
51
 
    stk=list('st_deviation('+s1(1)+','+s3(1)+')','0',m,n,s1(5))
52
 
  else
53
 
    if isname(s1(1)) then
54
 
      x=s1(1)
55
 
    else
56
 
      x=gettempvar()
57
 
      txt=[txt;x+' = '+s1(1)]
58
 
    end
59
 
    stk=list('st_deviation('+s1(1)+','+s3(1)+')*sqrt(1-1/size('+x+','+s3(1)+'))','0',m,n,s1(5))
60
 
  end
61
 
end
62
 
 
63
 
 
64
 
 
65