rot Subroutine

subroutine rot(n, a, b, cos, sin)

Arguments

Type IntentOptional AttributesName
integer :: n
real :: a
real :: b
real :: cos
real :: sin

Contents

Source Code

rot

Source Code

      subroutine rot(n,a,b,cos,sin)
      implicit double precision (a-h,o-z)
      dimension a(*),b(*)
      if (sin==0.D0) then
        if (cos>0.D0) then
          do i=1,n
            b(i)=-b(i)
          end do
        else
          do i=1,n
            a(i)=-a(i)
          end do
        end if
      else if (cos==0.D0) then
        if (sin>=0.D0) then
          do i=1,n
            z=a(i)
            a(i)=b(i)
            b(i)=z
          end do
        else
          do i=1,n
            z=a(i)
            a(i)=-b(i)
            b(i)=-z
          end do
        end if
      else
        do i=1,n
          z=a(i)
          a(i)=cos*z+sin*b(i)
          b(i)=sin*z-cos*b(i)
        end do
      end if
      end subroutine rot