Activation functions can be applied to matrices.
Use matrices instead of vectors.
Fix some bugs.