avoid storing extra (Bernoulli) matrix - but do the Bernoulli conversion only when writing the matrix