File: trianfml.sci

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (51 lines) | stat: -rw-r--r-- 1,262 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45
46
47
48
49
50
51
function [f,sexp]=trianfml(f,sexp)
// [f [,sexp]]=trianfml(f [,sexp])  Triangularization of the symbolic matrix
// f ; Triangularization is performed by elementary row operations;
// sexp is a set of common expressions stored by the algorithm.
//!
//
// Copyright INRIA
[lhs,rhs]=argn(0)
[mf,nf]=size(f)
f_tra=f
//
// row loop
// ------------------------------
//
for nli=1:mf
  // 
  [mf_tra,nf_tra]=size(f_tra)
  //recherche du pivot  dans la premiere colonne
  c1=f_tra(:,1);
  lc=length(c1);[lc,klc]=sort(lc);
  pivot='0';l=mf_tra+1;
  while (pivot=='0'&l>1),
  l=l-1; 
         if c1(klc(l))<>'0' then pivot=c1(klc(l)),end,
  end
 if pivot<>'0' then 
  l=klc(l)
  //
  if l<>1 then f_tra([1 l],:)=f_tra([l 1],:);c1([1 l])=c1([l 1]);end
  //
  for k=2:mf_tra,
      if c1(k)<>'0' then
        f_tra(k,:)=cmb_lin(pivot,f_tra(k,:),c1(k),f_tra(1,:))
        f_tra(k,1)='0'
        if rhs==2 then
          ns=prod(size(sexp)),
          for kl=2:nf_tra
            if length(f_tra(k,kl))>20 then
               ns=ns+1
               sexp(ns)=f_tra(k,kl)
               f_tra(k,kl)='%('+string(ns)+')'
            end;
          end;
        end;
      end;
  end;
  f(mf-mf_tra+1:mf,nf-nf_tra+1:nf)=f_tra
  f_tra=f_tra(2:mf_tra,2:nf_tra)
 end
end;
endfunction