add matrix and uniqelem