Haven't tested it well enough, but I wrote a cofactor method (which gets a cofactor of a specific element in the matrix) and it seems to be working correctly