consistent input of y as an array instead of matrix