[SciPy-User] linalg.iterative problem!
SungHwan Choi
sunghwanchoi91 at gmail.com
Tue Oct 9 22:06:21 EDT 2012
Hi
I have a trouble with iterative linear equation solver in sparse linalg
>>> A=np.random.rand(100,100)
>>> b=np.random.rand(100,1)
>>> x1,info=bicg(A,b)
>>> print info
0
>>> x,info=bicg(A,b,x0=x1)
>>> print info
0
Wheather setting guessing value or not, solutions should be the same if
both calculations were converged.
But x is ridiculous values
>>> x1
array([ -1.23619915e+00, 2.97586147e+00, -6.14648472e-01,
-1.60393960e+00, 1.27603461e+00, -6.71559072e-01,
-4.57949314e-04, -2.77060765e-01, -4.17339328e-01,
4.58723928e-01, 1.25520390e+00, -6.43505834e-01,
-2.50714182e+00, 1.64801812e+00, 3.22769225e-01,
-3.47764545e+00, -2.64155124e+00, 8.02161189e-01,
-2.04397410e-02, 1.78176386e+00, -2.30534938e+00,
2.03747784e-01, 4.25741370e-01, 8.92017739e-02,
7.92235549e-01, 2.05296800e+00, -5.07849138e-01,
2.39548767e+00, -6.75288110e-01, 5.40248358e-01,
-1.22652305e+00, 1.24128988e+00, 3.55832137e-01,
-4.94905114e-01, 1.89255642e+00, 1.13032169e+00,
-1.13126641e+00, -1.24107851e+00, -3.50610928e-01,
1.51242380e+00, 5.93313109e-02, -1.65542281e+00,
-1.31457525e+00, -2.07950912e+00, 2.03842426e+00,
-1.25129931e+00, -1.18204676e+00, -2.84095828e-01,
1.50420723e+00, -1.86947284e+00, 3.82634122e-01,
1.59583715e+00, 2.38088734e+00, -1.94456801e+00,
-3.91679300e+00, -5.82275859e-01, 6.37373111e-01,
1.50117747e+00, 3.16166509e-01, -4.80709301e-01,
2.44748482e-01, 8.46311114e-01, -3.50561001e-01,
1.17040825e+00, 8.48462084e-01, 2.26995940e+00,
-4.02400162e-01, 8.15964837e-02, -1.17082091e-01,
5.76520318e-01, 2.68571769e+00, -8.24618021e-01,
1.70237224e+00, -9.51878209e-01, -1.79056788e+00,
1.28023233e+00, -3.06323112e+00, 1.36928031e+00,
-5.32667426e-01, -8.76808999e-01, 5.04791986e+00,
1.02573111e+00, 2.91480759e-01, -1.65205205e+00,
2.01570733e+00, -8.58303160e-01, 1.00844953e+00,
-1.42026281e+00, -1.35743978e+00, -6.98618293e-01,
-9.64603408e-01, 4.94354222e-01, -1.56639931e+00,
-1.00424343e+00, 1.34539380e+00, 8.34746938e-01,
-1.42944790e-02, 4.11728888e-02, 8.48928870e-01,
-3.81714583e-01])
>>> x
array([ 5.54091698e-06, 1.01097308e-06, -1.90554231e-07,
4.72137778e-07, -1.59217304e-06, -2.63521296e-06,
1.82539010e-06, -3.29784996e-06, 2.11241995e-06,
3.34528259e-06, -1.48936133e-06, 4.64833156e-06,
2.72517397e-06, -8.68280493e-07, -1.48461475e-06,
1.31078987e-06, 1.96827837e-06, 2.43522800e-06,
-1.81519616e-09, 7.36595257e-07, -1.68678301e-06,
-2.36489475e-06, -9.48767026e-08, -4.19287423e-07,
-1.94382913e-06, -2.85541661e-06, -2.22431928e-06,
5.69426787e-07, -3.20549054e-06, -4.28991209e-06,
-2.66204912e-06, -5.41291369e-07, 1.40179165e-07,
-7.73036341e-08, -2.62207353e-06, 3.04217252e-07,
7.58099103e-06, 1.64647208e-07, -2.07367685e-06,
1.07293388e-06, -2.64252934e-06, 8.43832882e-07,
-2.09558797e-06, -2.38424059e-06, -2.01101471e-06,
1.14992748e-06, 1.75975671e-06, 3.47029359e-06,
-1.73474476e-06, 1.63282775e-06, 2.14847352e-06,
-1.06630511e-07, -3.71185399e-07, -6.19298483e-07,
-4.22283992e-07, 2.87057463e-06, 2.50493018e-07,
2.38959629e-07, 1.09429464e-06, 2.78931839e-06,
1.04950522e-06, 1.92574749e-06, 2.16166697e-06,
-1.49381992e-07, 2.57534472e-06, -1.80238481e-06,
-4.48006258e-07, -4.82004956e-06, -2.90858804e-06,
2.36872252e-06, -5.82462798e-06, 2.28721650e-06,
4.98778955e-06, 7.42277728e-07, 4.79308235e-06,
3.32154978e-06, 2.01826593e-06, 1.70133451e-06,
1.04876888e-06, -1.66519455e-06, -2.29374493e-06,
2.85916887e-06, -2.92097942e-06, 4.34734275e-07,
2.09635331e-06, -1.21218109e-06, -2.15483189e-06,
-2.62789759e-06, 5.97557810e-06, -8.16033223e-07,
5.59003423e-07, -1.27845573e-06, -2.81987257e-06,
-2.99137673e-06, -1.68537057e-06, -1.23698610e-06,
-1.26839543e-06, -6.37207587e-08, 3.99191552e-07,
-1.97820929e-06])
When I set x0, I always get some very small value as solution but I don't
know why it give us original solution
Please, help me if you have a piece of knowhow to this phenomena
Sincerely
Sunghwan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121010/69ddb568/attachment.html>
More information about the SciPy-User
mailing list