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

« back to all changes in this revision

Viewing changes to routines/integ/bnorm.f

  • 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
C/MEMBR ADD NAME=BNORM,SSI=0
 
2
      double precision function bnorm (n, a, nra, ml, mu, w)
 
3
clll. optimize
 
4
c-----------------------------------------------------------------------
 
5
c%purpose
 
6
c this function computes the norm of a banded n by n matrix,
 
7
c stored in the array a, that is consistent with the weighted max-norm
 
8
c on vectors, with weights stored in the array w.
 
9
c ml and mu are the lower and upper half-bandwidths of the matrix.
 
10
c nra is the first dimension of the a array, nra .ge. ml+mu+1.
 
11
c in terms of the matrix elements a(i,j), the norm is given by..
 
12
c   bnorm = max(i=1,...,n) ( w(i) * sum(j=1,...,n) abs(a(i,j))/w(j) )
 
13
c!
 
14
c-----------------------------------------------------------------------
 
15
      integer n, nra, ml, mu
 
16
      integer i, i1, jlo, jhi, j
 
17
      double precision a, w
 
18
      double precision an, sum
 
19
      dimension a(nra,n), w(n)
 
20
      an = 0.0d+0
 
21
      do 20 i = 1,n
 
22
        sum = 0.0d+0
 
23
        i1 = i + mu + 1
 
24
        jlo = max(i-ml,1)
 
25
        jhi = min(i+mu,n)
 
26
        do 10 j = jlo,jhi
 
27
 10       sum = sum + abs(a(i1-j,j))/w(j)
 
28
        an = max(an,sum*w(i))
 
29
 20     continue
 
30
      bnorm = an
 
31
      return
 
32
c----------------------- end of function bnorm -------------------------
 
33
      end