As a part of the project I'm working on, the input matrix needs to be deflated, meaning split into 2 parts. These parts are the upper left and lower right portions of the original matrix, and certain operation needs to be performed there. When in the process of deflation(splitting) we encounter a 1x1` matrix, we should stop and print that matrix. Take a look at the following code:
The idea is to print out n(where n is the number of rows/columns of the input matrix) 1x1 matrices, but the code above sometimes reaches n print outs, but more frequently less than n printouts. Any idea why this happens? ThanksCode:void ImplicitQRdeflatedAll(Matrix Dmatrix, VecDouble& EigenValues) { if(Dmatrix.rowNo==1) { PrintMatrix(Dmatrix); return; } else { for(int i=1;i<=20;i++) { Dmatrix=forImplicitQR(Dmatrix); if(i%3==0) { int k=checkConvDominant(Dmatrix); if(k!=-1) { std::pair<Matrix, Matrix> myLRpair=deflate(Dmatrix, k); ImplicitQRdeflatedAll(myLRpair.first, EigenValues); ImplicitQRdeflatedAll(myLRpair.second, EigenValues); return; } } } } }



LinkBack URL
About LinkBacks


