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

« back to all changes in this revision

Viewing changes to routines/integ/vnorm.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=VNORM,SSI=0
 
2
      double precision function vnorm (n, v, w)
 
3
clll. optimize
 
4
c%purpose
 
5
c-----------------------------------------------------------------------
 
6
c this function routine computes the weighted root-mean-square norm
 
7
c of the vector of length n contained in the array v, with weights
 
8
c contained in the array w of length n..
 
9
c   vnorm = sqrt( (1/n) * sum( v(i)*w(i) )**2 )
 
10
c-----------------------------------------------------------------------
 
11
c!
 
12
      integer n,   i
 
13
      double precision v, w,   sum
 
14
      dimension v(n), w(n)
 
15
      sum = 0.0d+0
 
16
      do 10 i = 1,n
 
17
 10     sum = sum + (v(i)*w(i))**2
 
18
      vnorm = sqrt(sum/dble(n))
 
19
      return
 
20
c----------------------- end of function vnorm -------------------------
 
21
      end