csrot Subroutine

public subroutine csrot(n, cx, incx, cy, incy, c, s)

NAME

csrot(3f) - [BLAS:COMPLEX_BLAS_LEVEL1] Applies a real Given's rotation to complex vectors.

SYNOPSIS

 subroutine csrot( n, cx, incx, cy, incy, c, s )

   .. Scalar Arguments ..
   integer,intent(in)       :: incx, incy, n
   real,intent(in)          :: c, s
   ..
   .. Array Arguments ..
   complex,intent(inout)    :: cx( * ), cy( * )
   ..

DEFINITION

CSROT applies a plane rotation, where the cos and sin (c and s) are real and the vectors cx and cy are complex. jack dongarra, linpack, 3/11/78.

OPTIONS

N

       N is INTEGER
        On entry, N specifies the order of the vectors cx and cy.
        N must be at least zero.

CX

       CX is COMPLEX array, dimension at least
        ( 1 + ( N - 1 )*abs( INCX ) ).
        Before entry, the incremented array CX must contain the n
        element vector cx. On exit, CX is overwritten by the updated
        vector cx.

INCX

       INCX is INTEGER
        On entry, INCX specifies the increment for the elements of
        CX. INCX must not be zero.

CY

       CY is COMPLEX array, dimension at least
        ( 1 + ( N - 1 )*abs( INCY ) ).
        Before entry, the incremented array CY must contain the n
        element vector cy. On exit, CY is overwritten by the updated
        vector cy.

INCY

       INCY is INTEGER
        On entry, INCY specifies the increment for the elements of
        CY. INCY must not be zero.

C

       C is REAL
        On entry, C specifies the cosine, cos.

S

       S is REAL
        On entry, S specifies the sine, sin.

AUTHORS

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

date:December 2016

SEE ALSO

Online html documentation available at
http://www.netlib.org/lapack/explore-html/

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
complex, intent(inout) :: cx(*)
integer, intent(in) :: incx
complex, intent(inout) :: cy(*)
integer, intent(in) :: incy
real, intent(in) :: c
real, intent(in) :: s

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
complex, public :: ctemp
integer, public :: i
integer, public :: ix
integer, public :: iy

Source Code

       subroutine csrot( n, cx, incx, cy, incy, c, s )
      implicit none
!
!  -- Reference BLAS level1 routine (version 3.7.0) --
!  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
!  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
!     December 2016
!
!     .. Scalar Arguments ..
      integer,intent(in)       :: incx, incy, n
      real,intent(in)          :: c, s
!     ..
!     .. Array Arguments ..
      complex,intent(inout)    :: cx( * ), cy( * )
!     ..
!
!  =====================================================================
!
!     .. Local Scalars ..
      integer           i, ix, iy
      complex           ctemp
!     ..
!     .. Executable Statements ..
!
      if( n.le.0 ) return
      if( incx.eq.1 .and. incy.eq.1 ) then
!
!        code for both increments equal to 1
!
         do i = 1, n
            ctemp = c*cx( i ) + s*cy( i )
            cy( i ) = c*cy( i ) - s*cx( i )
            cx( i ) = ctemp
         enddo
      else
!
!        code for unequal increments or equal increments not equal
!          to 1
!
         ix = 1
         iy = 1
         if( incx.lt.0 ) ix = ( -n+1 )*incx + 1
         if( incy.lt.0 ) iy = ( -n+1 )*incy + 1
         do i = 1, n
            ctemp = c*cx( ix ) + s*cy( iy )
            cy( iy ) = c*cy( iy ) - s*cx( ix )
            cx( ix ) = ctemp
            ix = ix + incx
            iy = iy + incy
         enddo
      endif

      end subroutine csrot