Giant nonlinearities, optical bistability and the optical transistor in narrow-gap semiconductors