When you say enforce sparsity it suggests that the values of x are not fixed, and x is a parameter. But in Stan you cannot have discrete parameters.
Alternatively, if A, x and y are all data and transformed data, then is the question simply about how you can encode x sparsely? The sparse encoding would simply be to pass in a vector of the indices of x that are 1.