Added matrix object to handle neurons better.

A little bit more flexibility for hopfield networks, etc.