I've implemented an algorithm that can calculate the cofactor-matrix of a matrix in $\mathcal{O}(n^5)$.
The algorithm just step-by-step iterates over the whole matrix ($\mathcal{O}(n^2)$) and for every $(i,j)$ in the matrix, it then calculates the determinant of the "sub-matrix" (leaving off row $i$ and column $j$) by using the bareiss algorithm in $\mathcal{O}(n^3)$.
Is there a faster way to do this?