view examples/fortransub.f @ 18904:9addb5ad9426

bandwidth.m: Add new function. * NEWS: Announce new function. * scripts/linear-algebra/module.mk: New function added to the build system. * scripts/help/__unimplemented__.m: New function removed from unimplemented. * scripts/linear-algebra/isbanded.m: New function added as documentation reference. * scripts/linear-algebra/isdiag.m: New function added as documentation reference. * scripts/linear-algebra/istril.m: New function added as documentation reference. * scripts/linear-algebra/istriu.m: New function added as documentation reference. * scripts/linear-algebra/bandwidth.m: New function. * linalg.txi: Add bandwidth function to manual.
author Massimiliano Fasi <massimiliano.fasi@gmail.com>
date Tue, 08 Jul 2014 12:19:37 +0200
parents 4b32677b6229
children
line wrap: on
line source

      subroutine fortransub (n, a, s)
      implicit none
      character*(*) s
      real*8 a(*)
      integer*4 i, n, ioerr
      do i = 1, n
        if (a(i) .eq. 0d0) then
          call xstopx ('fortransub: divide by zero')
        else
          a(i) = 1d0 / a(i)
        endif
      enddo
      write (unit = s, fmt = '(a,i3,a,a)', iostat = ioerr)
     $       'There are ', n,
     $       ' values in the input vector', char(0)
      if (ioerr .ne. 0) then
        call xstopx ('fortransub: error writing string')
      endif
      return
      end