module row_ncnhconest  
! non-causal non-stationary convolution, for a row operator. Adjoint is the filter.
  use ncnhconest1
  use ncnhconest2
  use row_mod

  implicit none

    integer, private :: size_coeffs,size_coeffs1
	real,private     :: mu
  contains

  subroutine row_ncnhconest_init (x_in,y_in,aa_in,bb_in,nhmax1_in,&
       & nhmax2_in,size_coeffs1_in,size_coeffs2_in,mu_in)

    real, dimension(:), pointer   :: x_in,y_in 
    type(nfilter)                 :: aa_in,bb_in 
    integer                       :: nhmax1_in,nhmax2_in 
    integer                       :: size_coeffs1_in 
    integer                       :: size_coeffs2_in 
	real                          :: mu_in

    call ncnhconest1_init(x_in,aa_in,nhmax1_in)
    call ncnhconest2_init(y_in,bb_in,nhmax2_in)

    size_coeffs1=size_coeffs1_in
    size_coeffs=size_coeffs1_in+size_coeffs2_in
    mu=mu_in

  end subroutine

  function row_ncnhconest_lop ( adj, add, a, y) result(stat)
    integer            :: stat 
    logical,intent(in) :: adj,add 
    real,dimension(:)  :: a,y 
    call adjnull1 (adj,add,a,y )

	call row2(ncnhconest1_lop,ncnhconest2_lop,adj,add,a(1:size_coeffs1),&
		& a(size_coeffs1+1:size_coeffs),y,mu)
	stat=1

  end function row_ncnhconest_lop

  subroutine row_ncnhconest_close()

  end subroutine row_ncnhconest_close

end module row_ncnhconest
