Sparse matrices in the input layer now supported

Also solved a bug in the SGD mini-batch. n_batch was used instead of batch_size