comp.lang.ada
 help / color / mirror / Atom feed
From: "James Van Buskirk" <torsop@ix.netcom.com>
Subject: Re: F9X twister & ADA (was: n-dim'l vectors)
Date: 2000/04/10
Date: 2000-04-11T04:08:19+00:00	[thread overview]
Message-ID: <8cu8fj$eet$1@nntp9.atl.mindspring.net> (raw)
In-Reply-To: 38F28A85.53809F39@sdynamix.com


bv wrote in message <38F28A85.53809F39@sdynamix.com>...

> vector function normalize(v)
> external vector
> vector u,v
>        real norm


>        vni = 1/norm(v)
> do i=1,len(v)
>    u(i) = v(i)*vni
> enddo
>        return u
>        end


>**      somewhere in your code  (sans interfaces & modules)
>        vector u,v, normalize
>                .
>                .
>                .
>        u = normalize(v)

module simple_1d_vector_stuff
   contains
      function normalize(v)
         real, intent(in) :: v(:)
         real normalize(size(v))
         real norm

         if(size(v) == 0) stop 'Can''t normalize zero length vector'
         norm = sqrt(dot_product(v,v)) ! OK for complex version, too
         if(norm == 0) stop 'Can''t normalize the zero vector'
         normalize = v/norm

      end function normalize
end module simple_1d_vector_stuff

**      somewhere in your code
        use simple_1d_vector_stuff
        integer, parameter :: vector_length = 3
        real u(vector_length),v(vector_length)
                .
                .
                .
        u = normalize(v)







  reply	other threads:[~2000-04-10  0:00 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8cctts$ujr$1@nnrp1.deja.com>
     [not found] ` <38EA0440.1ECBC158@ncep.noaa.gov>
2000-04-06  0:00   ` F9X twister & ADA (was: n-dim'l vectors) bv
2000-04-06  0:00     ` Richard Maine
2000-04-07  0:00       ` Brian Rogoff
2000-04-08  0:00         ` Dick Hendrickson
2000-04-08  0:00           ` Richard Maine
2000-04-09  0:00             ` Gary Scott
2000-04-09  0:00               ` Richard Maine
2000-04-09  0:00           ` Geoff Bull
2000-04-09  0:00             ` Dick Hendrickson
2000-04-09  0:00               ` Robert Dewar
2000-04-09  0:00                 ` Gordon Sande
2000-04-09  0:00                   ` James Giles
2000-04-10  0:00                 ` tmoran
2000-04-15  0:00                 ` Aidan Skinner
2000-04-17  0:00                   ` Robert I. Eachus
2000-04-16  0:00                 ` Ken Garlington
2000-04-12  0:00               ` Robert I. Eachus
2000-04-10  0:00       ` bv
2000-04-10  0:00         ` James Van Buskirk [this message]
2000-04-11  0:00         ` James Giles
2000-04-11  0:00           ` Geoff Bull
2000-04-11  0:00             ` James Giles
2000-04-11  0:00               ` Larry Kilgallen
2000-04-11  0:00                 ` James Giles
2000-04-11  0:00                   ` Larry Kilgallen
2000-04-12  0:00                   ` Robert A Duff
2000-04-12  0:00               ` Geoff Bull
2000-04-12  0:00                 ` James Giles
2000-04-12  0:00                   ` Geoff Bull
2000-04-12  0:00                     ` James Giles
2000-04-12  0:00                       ` Geoff Bull
2000-04-12  0:00                         ` James Giles
2000-04-13  0:00                           ` Geoff Bull
2000-04-13  0:00                             ` James Giles
2000-04-14  0:00                               ` Geoff Bull
2000-04-13  0:00                             ` Debugging (was: F9X twister & ADA) James Giles
2000-04-12  0:00                         ` F9X twister & ADA (was: n-dim'l vectors) Marin D. Condic
2000-04-12  0:00                           ` James Giles
2000-04-12  0:00                           ` James Giles
2000-04-11  0:00           ` Dale Stanbrough
2000-04-11  0:00             ` James Giles
2000-04-12  0:00               ` Robert A Duff
2000-04-14  0:00           ` bv
2000-04-07  0:00     ` Erik Edelmann
2000-04-07  0:00       ` Robert Dewar
2000-04-07  0:00         ` Erik Edelmann
2000-04-07  0:00     ` Paul van Delst
2000-04-10  0:00       ` bv
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox