Improved way of getting zero weight matrices