The unitarity of split-operator finite difference and finite-element methods: Applications to longitudinally varying semiconductor rib waveguides