better matrix inversion function
added tests/num.cpp