fixed assertion in gradient test
createCostFn accepts/returns a column vector

Also fixed the logit function gradient.