# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
module compress
  use helix
  implicit none
  contains
  subroutine resize( aa, eps)
    real, optional, intent (in) :: eps
    type( filter) :: aa, bb
    logical, dimension( size( aa%lag)) :: keep
    if (present (eps)) then
      keep = ( abs( aa%flt) > eps)
    else
      keep = ( abs( aa%flt) > epsilon( aa%flt))
    end if
    call allocatehelix( bb, count( keep))
    bb%flt = pack( aa%flt, keep)
    bb%lag = pack( aa%lag, keep)
    call deallocatehelix( aa)
    aa = bb
  end subroutine
end module
