Matrix Approach to Petrov Classification