Linear decoder exercise from http://ufldl.stanford.edu/