module lin_mod
  use adj_mod
  real, private  :: o1,d1

  contains 
 
  subroutine linear_init(o,d)
    real :: o,d
    o1=o; d1=d
  end subroutine
   
  integer function linear_op(adj,add,model,data)
    logical,intent(in) :: adj,add
    real :: model(:),data(:)
    integer :: i

    call adjnull(adj,add,model,data)
    do i=1,size(data)
      if(.not. adj) then
         data(i)=data(i)+model(1)
         data(i)=data(i)+model(2)*(o1+d1*(i-1))
      else
         model(1)=model(1)+data(i)
         model(2)=model(2)+data(i)*(o1+d1*(i-1))
      end if
    end do 
  end function




end module
