implementing more nif functions
started implementing matrix functions