add matrix generator & update trace function