Adding Matrix code to libsam. Now using gradle to manage build process