Useful math functions using eigen