File: wrref.f

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 (59 lines) | stat: -rw-r--r-- 2,037 bytes parent folder | download | duplicates (4)
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
52
53
54
55
56
57
58
59
C/MEMBR ADD NAME=WRREF,SSI=0
c     Copyright INRIA
      subroutine wrref(ar,ai,lda,m,n,eps)
c!but
c     wrref calcule la forme echelon d'une matrice a coeff complexes
c!liste d'appel
c
c     subroutine wrref(ar,ai,lda,m,n,eps)
c     double precision ar(lda,n),ai(lda,n),eps
c     integer lda,m,n
c
c     ar,ai : tableaux contenant a l'appel les parties reelles et
c        complexes  de la matrice dont on veut determiner la forme
c        echelon, apres execution a contient la forme echelon
c     lda : nombre de ligne du tableau a dans le programme appelant
c     m : nombre de ligne de la matrice a
c     n : nombre de colonnes de a matrice a
c     eps : tolerance. les reels  inferieurs a 2*max(m,n)*eps*n1(a),
c           ou n1(a) est la norme 1 de a ,sont consideres comme nuls
c
c     si l'on veut la transformation appliquee,appeler wrref avec
c     la matrice obtenue en concatenant l'identite a la matrice a
c     en rajoutant des colonnes.
c!sous programmes appeles
c     iwamax wcopy wswap wscal wasum waxpy (blas.extensions)
c     dset (blas)
c     dble abs max (fortran)
c!
c!
      double precision ar(lda,*),ai(lda,*),eps,tol,tr,ti,wasum
      tol = 0.0d+0
      do 10 j = 1, n
         tol = max(tol,wasum(m,ar(1,j),ai(1,j),1))
   10 continue
      tol = eps*dble(2*max(m,n))*tol
      k = 1
      l = 1
   20 if (k.gt.m .or. l.gt.n) return
      i = iwamax(m-k+1,ar(k,l),ai(k,l),1) + k-1
      if (abs(ar(i,l))+abs(ai(i,l)) .gt. tol) go to 30
      call dset(m-k+1,0.0d+0,ar(k,l),1)
      call dset(m-k+1,0.0d+0,ai(k,l),1)
         l = l+1
         go to 20
   30 call wswap(n-l+1,ar(i,l),ai(i,l),lda,ar(k,l),ai(k,l),lda)
      call wdiv(1.0d+0,0.0d+0,ar(k,l),ai(k,l),tr,ti)
      call wscal(n-l+1,tr,ti,ar(k,l),ai(k,l),lda)
      ar(k,l) = 1.0d+0
      ai(k,l) = 0.0d+0
      do 40 i = 1, m
         tr = -ar(i,l)
         ti = -ai(i,l)
         if (i .ne. k) call waxpy(n-l+1,tr,ti,
     $                 ar(k,l),ai(k,l),lda,ar(i,l),ai(i,l),lda)
   40 continue
      k = k+1
      l = l+1
      go to 20
      end