[eigen] Re: Problem with conjugate gradient. |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
I have solved a system using Laspack using conjugate gradient and ILU preconditioner (tol. 1E-12) and it gives the following solution:[1] 0.096709627074711618 double[2] 0.041738859730487146 double[3] 0.00067511123237074346 double[4] -0.040388637958504281 double[5] -0.095359407662660600 double[6] 0.050941442361153874 double[7] 0.027508948358719330 double[8] 0.00067511042278063161 double[9] -0.026158728561469002 double[10] -0.049591224744352222 double[11] 0.028279326736092902 double[12] 0.016767643972775401 double[13] 0.00067510968097885340 double[14] -0.015417425476270046 double[15] -0.026929109622622786 double[16] 0.017154602993941025 double[17] 0.010635301124244559 double[18] 0.00067510921541819892 double[19] -0.0092850833115109520 double[20] -0.015804386045630902 double[21] 0.012553916220840610 double[22] 0.0079532300763286365 double[23] 0.00067510900276445361 double[24] -0.0066030125504719286 doubleI have attached A and b files and in Matlab the solution of x = A\b gives:0.09630.0411-0.0000-0.0411-0.09630.05020.0268-0.0000-0.0268-0.05020.02750.0161-0.0000-0.0161-0.02750.01640.0099-0.0000-0.0099-0.01640.01190.0073-0.0000-0.0073-0.0119In Eigen however the solution of the same system using ConjugateGradient and ILU preconditioner is:ConjugateGradient<SparseMatrix<Real>, Lower, IncompleteLUT<Real> > solver(A);solver.setTolerance(1E-12);x = solver.solve(b);x:0.5528650.4977420.4566080.4154740.3603510.5067620.4834250.4566080.4297910.4064540.4841560.4726780.4566080.4405380.4290600.4730550.4665510.4566080.4466650.4401610.4684640.4638730.4566080.4493430.444752This is very different from Matlab and Laspack. What am I doing wrong? Am I calling Eigen correctly?Please find in attachment the files to reproduce the solution. Steps:
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |