inline bool inv(const mat&A, mat &out){ out = A.inverse(); return true; }
inline mat inv(const mat&A){ return A.inverse(); }