attempting matrix encoding