build_matrix_classrow and compress_matrix
Added required funtionality for plotting compressed matrix