module identity_mod
!
  use adj_mod

  implicit none
  integer, private				:: n1,n2

  contains

  subroutine identity_init(n1_in,n2_in)	
    integer			:: n1_in, n2_in
    n1 = n1_in
    n2 = n2_in
  end subroutine identity_init

  function identity_lop ( adj, add, xx, yy) result(stat)
    integer            :: stat 
    logical,intent(in) :: adj,add 
    real,dimension(:)  :: xx,yy 
    call adjnull (adj,add,xx,yy )
    call identity_lop2(adj,add,xx,yy )
    stat=0
  end function identity_lop

  subroutine identity_lop2(adj,add,xx,yy)
    logical,intent(in)   :: adj,add 
    real, dimension (:)  :: xx,yy
    integer i, j       
  
    do j = 1, n1*n2
	if ( adj) then
		xx(j)=xx(j)+yy(j)
	else
		yy(j)=yy(j)+xx(j)
	end if
    end do

  end subroutine identity_lop2

end module identity_mod
