Analysis of a Dynamical System Modeling Lasers and Applications for Optical Neural Networks