mat_stack1 Subroutine

public subroutine mat_stack1(op)

Arguments

Type IntentOptional Attributes Name
integer :: op

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: j
integer, public :: ll
integer, public :: location
integer, public :: ls
integer, public :: m
integer, public :: mn
integer, public :: n

Source Code

subroutine mat_stack1(op)

! ident_20="@(#) M_matrix mat_stack1(3f) Unary Operations"

integer           :: op
integer           :: i
integer           :: j
integer           :: location
integer           :: ll
integer           :: ls
integer           :: m
integer           :: mn
integer           :: n

   location = G_VAR_DATALOC(G_ARGUMENT_POINTER)
   m = G_VAR_ROWS(G_ARGUMENT_POINTER)
   n = G_VAR_COLS(G_ARGUMENT_POINTER)
   mn = m*n
   if (mn .eq. 0) then
   elseif (op .ne. quote) then                                 ! unary minus
      call mat_wrscal(MN,-1.0D0,GM_REALS(location),GM_IMAGS(location),1)
   else                                                        ! transpose
      ll = location + mn

      if(too_much_memory( ll+mn - G_VAR_DATALOC(G_TOP_OF_SAVED)) )return

      call mat_wcopy(MN,GM_REALS(location),GM_IMAGS(location),1,GM_REALS(ll),GM_IMAGS(ll),1)
      M = G_VAR_COLS(G_ARGUMENT_POINTER)
      N = G_VAR_ROWS(G_ARGUMENT_POINTER)
      G_VAR_ROWS(G_ARGUMENT_POINTER) = m
      G_VAR_COLS(G_ARGUMENT_POINTER) = n
      do i = 1, m
         do j = 1, n
            ls = location+mn+(j-1)+(i-1)*n
            ll = location+(i-1)+(j-1)*m
            GM_REALS(ll) = GM_REALS(ls)
            GM_IMAGS(ll) = -GM_IMAGS(ls)
         enddo
      enddo
   endif
end subroutine mat_stack1