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

« back to all changes in this revision

Viewing changes to macros/m2sci/percent/%i2sci_r.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 [tree]=%i2sci_r(tree)
 
2
// Copyright INRIA
 
3
// M2SCI function
 
4
// Conversion function for Matlab insertion in row vectors (called by %i2sci())
 
5
// Input: tree = Matlab operation tree
 
6
// Output: tree = Scilab equivalent for tree
 
7
// V.C.
 
8
from=tree.operands($)
 
9
to=tree.operands(1)
 
10
ind=tree.operands(2)
 
11
 
 
12
if from.dims(1)==1 & from.dims(2)==1 then // Insert a scalar
 
13
elseif from.dims(1)==1 then // Insert a row vector
 
14
elseif from.dims(1)<>Unknown & from.dims(2)<>Unknown then // Insert a matrix with known sizes
 
15
  tree.operands($)=Funcall("matrix",1,Rhs(from,1,Operation("-",list(Cste(1)),list())))
 
16
else
 
17
  if ~isdefinedvar(from) then
 
18
    w=gettempvar()
 
19
    insert(Equal(list(w),from))
 
20
  else
 
21
    w=from
 
22
  end
 
23
  
 
24
  // from=from(:).'
 
25
  tmp=Operation("ext",list(w,Cste(":")),list())
 
26
  tmp=Operation(".''",list(tmp),list())
 
27
  
 
28
  tree.operands(4)=tmp
 
29
  tree.operands(3)=ind
 
30
  tree.operands(2)=Cste(1)
 
31
end
 
32
 
 
33
// Data inference
 
34
tree.out(1).dims=list(1,Unknown)
 
35
tree.out(1).type=to.type
 
36
endfunction
 
37
 
 
38