Using compressed matrix for encode