Thread: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned matrix less than 10^-156 ?
Status: Pre-Alpha
Brought to you by:
nakatamaho
From: Gang Y. <ee...@gm...> - 2011-09-12 14:35:57
|
Dear Folks, Many thanks to Mpack. It is really helpful for computing ill-conditioned problems. Now I have a problem when I calculate the eigenvalues of an extremely ill-conditioned matrix, in a problem of control system research. The matrix is not very large, e.g., 30X30, but extremely ill-conditioned, i.e., having the largest eigenvalue ~10^-2 and the smallest eigenvalue > 10^-156. I found that the eigenvalue programme using GMP or MPFR can only compute eigenvalues <10^-156, or I will get some minus eigenvalues which is not wrong because the matrix is positive-definition. I use a 64-bit notebook. Any suggestions or comments? Thanks in advance. best, gang |
From: Tomonori K. <ju...@qu...> - 2011-09-12 15:43:53
|
Hi, Gang. I have tried to solve some eigenvalue problems using MPFR/GMP. Very ill-conditionded matrices such as Hilbert or Lotkin matrices, are too sensitive to keep their theoretical properties due to initial error or round-off error in computing process. In case of Hilbert matrix, it is theoretically positive definite but some of smallest eigenvalues can be minus due to initial error in approximated elements of Hilbert matrix. I recommend to know how sensitive your matrix is for such error by using variable precision of MPFR/GMP in order to solve your troubles. (2011/09/12 23:35), Gang Yan wrote: > Now I have a problem when I calculate the eigenvalues of an extremely > ill-conditioned matrix, in a problem of control system research. The matrix > is not very large, e.g., 30X30, but extremely ill-conditioned, i.e., having > the largest eigenvalue ~10^-2 and the smallest eigenvalue> 10^-156. I found > that the eigenvalue programme using GMP or MPFR can only compute eigenvalues > <10^-156, or I will get some minus eigenvalues which is not wrong because > the matrix is positive-definition. I use a 64-bit notebook. |
From: Gang Y. <ee...@gm...> - 2011-09-13 03:40:12
|
Hi, Tomonori, Thank you very much. Yes, for very ill-conditioned matrices, eigenvalues are very sensitive to round-off errors when computing with float-point. I think I can obtain the smallest eigenvalues if using higher precision arithmetic. best, gang On Mon, Sep 12, 2011 at 11:01 PM, Tomonori Kouya <ju...@qu...>wrote: > Hi, Gang. I have tried to solve some eigenvalue problems using MPFR/GMP. > > Very ill-conditionded matrices such as Hilbert or Lotkin matrices, are > too sensitive to keep their theoretical properties due to initial error > or round-off error in computing process. In case of Hilbert matrix, it > is theoretically positive definite but some of smallest eigenvalues can > be minus due to initial error in approximated elements of Hilbert matrix. > > I recommend to know how sensitive your matrix is for such error by using > variable precision of MPFR/GMP in order to solve your troubles. > > (2011/09/12 23:35), Gang Yan wrote: > > Now I have a problem when I calculate the eigenvalues of an extremely > > ill-conditioned matrix, in a problem of control system research. The > matrix > > is not very large, e.g., 30X30, but extremely ill-conditioned, i.e., > having > > the largest eigenvalue ~10^-2 and the smallest eigenvalue> 10^-156. I > found > > that the eigenvalue programme using GMP or MPFR can only compute > eigenvalues > > <10^-156, or I will get some minus eigenvalues which is not wrong because > > the matrix is positive-definition. I use a 64-bit notebook. > > > ------------------------------------------------------------------------------ > Doing More with Less: The Next Generation Virtual Desktop > What are the key obstacles that have prevented many mid-market businesses > from deploying virtual desktops? How do next-generation virtual desktops > provide companies an easier-to-deploy, easier-to-manage and more affordable > virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ > _______________________________________________ > Mplapack-devel mailing list > Mpl...@li... > https://lists.sourceforge.net/lists/listinfo/mplapack-devel > |
From: Gang Y. <ee...@gm...> - 2011-09-13 03:45:55
|
Hi, Maho, Gang, if you want to use MPACK, as Kouya-sensei wrote, please use > GMP or MPFR version (to enlarge your precision). > I published a tutorial in Japanese (sorry), and > I'll upload to the web page when I can publish my original one at the web. > In the mean time, if you can use GMP version and setting > MPACK_GMP_PRECISION environment variable to change pricision dynamically. > Yes, I used the GMP and MPFR version and tuned the precision variable from 256 to 2048, but the results are truncated at ~10^-156. When the eigenvalues are smaller than ~10^-156, they will become negative. How can I improve the precision beyond 10^-156? Thanks. > > Thanks > Nakata Maho > best, gang |
From: Gang Y. <ee...@gm...> - 2011-09-13 05:35:30
Attachments:
A20.dat
eigenvalue_mpfr.cpp
|
Many thanks, Maho. Attached please find the source code. A20.dat is the input matrix, eigenvalue_mpfr.cpp is the source code modified from your example code. Place the two files into the folder mpack-0.6.7/examples/mlapack/ and use commands "make" and "./eigenvalue_mpfr", it will show the results of the largest and smallest eigenvalues. It is shown that when the variable tt (a time variable in my program) is very small, the matrix will become extremely ill-conditioned, and the smallest eigenvalue will be less than 1e-156 and thus become negative. thanks, gang On Mon, Sep 12, 2011 at 11:53 PM, Maho NAKATA <ch...@ma...> wrote: > From: Gang Yan <ee...@gm...> > Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned > matrix less than 10^-156 ? > Date: Tue, 13 Sep 2011 11:45:47 +0800 > > > Hi, Maho, > > > > > > Gang, if you want to use MPACK, as Kouya-sensei wrote, please use > >> GMP or MPFR version (to enlarge your precision). > >> > > I published a tutorial in Japanese (sorry), and > >> I'll upload to the web page when I can publish my original one at the > web. > > > > > >> In the mean time, if you can use GMP version and setting > >> MPACK_GMP_PRECISION environment variable to change pricision > dynamically. > >> > > > > > > Yes, I used the GMP and MPFR version and tuned the precision variable > from > > 256 to 2048, but the results are truncated at ~10^-156. When the > eigenvalues > > are smaller than ~10^-156, they will become negative. How can I improve > the > > precision beyond 10^-156? Thanks. > > Hm, could you please check your inputs, so that not to include trancated > values. > or could you please send me your source codes. > > thanks > Nakata Maho > |
From: Gang Y. <ee...@gm...> - 2011-09-22 16:55:43
|
Hi Maho, Thanks so much. On Thu, Sep 22, 2011 at 10:41 PM, Maho NAKATA <ch...@ma...> wrote: > Hi Gang Yan, > > sorry for long delay. > > From: Gang Yan <ee...@gm...> > Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned > matrix less than 10^-156 ? > Date: Tue, 13 Sep 2011 01:35:22 -0400 > > > Many thanks, Maho. Attached please find the source code. > > > > A20.dat is the input matrix, eigenvalue_mpfr.cpp is the source code > modified > > from your example code. > ok, > > > Place the two files into the folder mpack-0.6.7/examples/mlapack/ and use > > commands "make" and "./eigenvalue_mpfr", it will show the results of > the > > largest and smallest eigenvalues. > done. > > > It is shown that when the variable tt (a time variable in my program) is > > very small, the matrix will become extremely ill-conditioned, and the > > smallest eigenvalue will be less than 1e-156 and thus become negative. > following output is correct wrong result? > The output is the same as mine. But it is wrong. Because the matrix is positive definite and all the eigenvalues should be positive, but ... > --- > OK > [ [ 1.644791426e1]; [ 1.722920009e1]; [ 1.747945946e1]; [ 1.766113939e1]; [ > 1.776131407e1]; [ 1.810655068e1]; [ 1.869304632e1]; [ 1.913033628e1]; [ > 1.941946805e1]; [ 1.992760133e1]; [ 2.000190806e1]; [ 2.041030420e1]; [ > 2.073058106e1]; [ 2.092543236e1]; [ 2.108105957e1]; [ 2.166945660e1]; [ > 2.212463197e1]; [ 2.255747777e1]; [ 2.281199141e1]; [ 2.583112709e1] ] > OK > 1.000000000e-4 9.980027172e-5 9.980027105e-5 -3.323972836e-158 > ~~~~~~~~~~~~~~~ > 2.000000000e-4 1.992021715e-4 1.992021662e-4 -8.891981975e-159 > ~~~~~~~~~~~~~~~ > 4.000000000e-4 3.968173357e-4 3.968172935e-4 -1.165480641e-159 > ~~~~~~~~~~~~~~~~ > 8.000000000e-4 7.873381119e-4 7.873377765e-4 3.018299932e-160 > 1.600000000e-3 1.549895802e-3 1.549893166e-3 -2.121601048e-158 > ~~~~~~~~~~~~~~~~ but the smallest eigenvalues as pointed out ~~~~~~~~~ are negative. So it is wrong. I think the program can only compute the eigenvalues which are larger than 1e-156 accurately. Do you think so? Or I am wrong for some reasons? Thanks. P.S., the mid two columns are the largest eigenvalues, they all are correct. 3.200000000e-3 3.003823837e-3 3.003803478e-3 5.848200770e-153 > 6.400000000e-3 5.647598950e-3 5.647447187e-3 3.014126150e-141 > 1.280000000e-2 1.002517109e-2 1.002411737e-2 1.456356388e-129 > 2.560000000e-2 1.606256118e-2 1.605621952e-2 6.184498678e-118 > 5.120000000e-2 2.193695924e-2 2.190825888e-2 2.028549225e-106 > 1.024000000e-1 2.495037779e-2 2.487359809e-2 3.969087087e-95 > 2.048000000e-1 2.545631687e-2 2.535104125e-2 2.761963837e-84 > 4.096000000e-1 2.546875365e-2 2.536157283e-2 2.427716249e-74 > 8.192000000e-1 2.546876239e-2 2.536157891e-2 3.411560868e-66 > 1.638400000 2.546876239e-2 2.536157891e-2 1.315185105e-61 > 3.276800000 2.546876239e-2 2.536157891e-2 2.514747138e-61 > 6.553600000 2.546876239e-2 2.536157891e-2 2.514747138e-61 > 1.310720000e1 2.546876239e-2 2.536157891e-2 2.514747138e-61 > 2.621440000e1 2.546876239e-2 2.536157891e-2 2.514747138e-61 > 5.242880000e1 2.546876239e-2 2.536157891e-2 2.514747138e-61 > --- > > thanks > -- Nakata Maho http://accc.riken.jp/maho/ , JA OOO > http://ja.openoffice.org/ > http://blog.goo.ne.jp/nakatamaho/ ,GPG: > http://accc.riken.jp/maho/maho.pgp.txt > best, gang |
From: Maho N. <ch...@ma...> - 2011-09-22 21:00:18
|
Hi Gang, From: Gang Yan <ee...@gm...> Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned matrix less than 10^-156 ? Date: Fri, 23 Sep 2011 00:55:35 +0800 > but the smallest eigenvalues as pointed out ~~~~~~~~~ are negative. So it > is wrong. I think the program can only compute the eigenvalues which are > larger than 1e-156 accurately. Do you think so? Or I am wrong for some > reasons? Thanks. in your case, you use > //initialization of MPFR > int default_prec = 4096; > mpfr_set_default_prec(default_prec); then, machine epsilon is approximately 7.458340731e-155 (*). In this case, relative errors of eigenvalues can be less accurate than 7.458340731e-155. you are doing something complicated in your program and I guess some rouding errors included. In my opinion, therefore, you found some small negative eigenvalues. (*) you can check this by inserting following code and rerun your program. mpreal a = Rlamch_mpfr("E"); mpfr_out_str(stdout, 10, 10, a, MPFR_RNDN); printf("\n"); Thanks, -- Nakata Maho http://accc.riken.jp/maho/ , JA OOO http://ja.openoffice.org/ http://blog.goo.ne.jp/nakatamaho/ ,GPG: http://accc.riken.jp/maho/maho.pgp.txt |
From: Gang Y. <ee...@gm...> - 2011-09-22 21:10:05
|
Hi Maho, On Fri, Sep 23, 2011 at 4:59 AM, Maho NAKATA <ch...@ma...> wrote: > Hi Gang, > > From: Gang Yan <ee...@gm...> > Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned > matrix less than 10^-156 ? > Date: Fri, 23 Sep 2011 00:55:35 +0800 > > > but the smallest eigenvalues as pointed out ~~~~~~~~~ are negative. So > it > > is wrong. I think the program can only compute the eigenvalues which are > > larger than 1e-156 accurately. Do you think so? Or I am wrong for some > > reasons? Thanks. > > in your case, you use > > > //initialization of MPFR > > int default_prec = 4096; > > mpfr_set_default_prec(default_prec); > > Yes. > then, machine epsilon is approximately 7.458340731e-155 (*). > In this case, relative errors of > eigenvalues can be less accurate than 7.458340731e-155. > you are doing something complicated in your program and > I guess some rouding errors included. In my opinion, > therefore, you found some small negative eigenvalues. > > (*) you can check this by inserting following code and rerun your > program. > mpreal a = Rlamch_mpfr("E"); > mpfr_out_str(stdout, 10, 10, a, MPFR_RNDN); > printf("\n"); > Thanks, > I will check it. Many thanks. > -- Nakata Maho http://accc.riken.jp/maho/ , JA OOO > http://ja.openoffice.org/ > http://blog.goo.ne.jp/nakatamaho/ ,GPG: > http://accc.riken.jp/maho/maho.pgp.txt > best, gang |
From: Maho N. <ch...@ma...> - 2011-09-22 14:41:40
|
Hi Gang Yan, sorry for long delay. From: Gang Yan <ee...@gm...> Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned matrix less than 10^-156 ? Date: Tue, 13 Sep 2011 01:35:22 -0400 > Many thanks, Maho. Attached please find the source code. > > A20.dat is the input matrix, eigenvalue_mpfr.cpp is the source code modified > from your example code. ok, > Place the two files into the folder mpack-0.6.7/examples/mlapack/ and use > commands "make" and "./eigenvalue_mpfr", it will show the results of the > largest and smallest eigenvalues. done. > It is shown that when the variable tt (a time variable in my program) is > very small, the matrix will become extremely ill-conditioned, and the > smallest eigenvalue will be less than 1e-156 and thus become negative. following output is correct wrong result? --- OK [ [ 1.644791426e1]; [ 1.722920009e1]; [ 1.747945946e1]; [ 1.766113939e1]; [ 1.776131407e1]; [ 1.810655068e1]; [ 1.869304632e1]; [ 1.913033628e1]; [ 1.941946805e1]; [ 1.992760133e1]; [ 2.000190806e1]; [ 2.041030420e1]; [ 2.073058106e1]; [ 2.092543236e1]; [ 2.108105957e1]; [ 2.166945660e1]; [ 2.212463197e1]; [ 2.255747777e1]; [ 2.281199141e1]; [ 2.583112709e1] ] OK 1.000000000e-4 9.980027172e-5 9.980027105e-5 -3.323972836e-158 2.000000000e-4 1.992021715e-4 1.992021662e-4 -8.891981975e-159 4.000000000e-4 3.968173357e-4 3.968172935e-4 -1.165480641e-159 8.000000000e-4 7.873381119e-4 7.873377765e-4 3.018299932e-160 1.600000000e-3 1.549895802e-3 1.549893166e-3 -2.121601048e-158 3.200000000e-3 3.003823837e-3 3.003803478e-3 5.848200770e-153 6.400000000e-3 5.647598950e-3 5.647447187e-3 3.014126150e-141 1.280000000e-2 1.002517109e-2 1.002411737e-2 1.456356388e-129 2.560000000e-2 1.606256118e-2 1.605621952e-2 6.184498678e-118 5.120000000e-2 2.193695924e-2 2.190825888e-2 2.028549225e-106 1.024000000e-1 2.495037779e-2 2.487359809e-2 3.969087087e-95 2.048000000e-1 2.545631687e-2 2.535104125e-2 2.761963837e-84 4.096000000e-1 2.546875365e-2 2.536157283e-2 2.427716249e-74 8.192000000e-1 2.546876239e-2 2.536157891e-2 3.411560868e-66 1.638400000 2.546876239e-2 2.536157891e-2 1.315185105e-61 3.276800000 2.546876239e-2 2.536157891e-2 2.514747138e-61 6.553600000 2.546876239e-2 2.536157891e-2 2.514747138e-61 1.310720000e1 2.546876239e-2 2.536157891e-2 2.514747138e-61 2.621440000e1 2.546876239e-2 2.536157891e-2 2.514747138e-61 5.242880000e1 2.546876239e-2 2.536157891e-2 2.514747138e-61 --- thanks -- Nakata Maho http://accc.riken.jp/maho/ , JA OOO http://ja.openoffice.org/ http://blog.goo.ne.jp/nakatamaho/ ,GPG: http://accc.riken.jp/maho/maho.pgp.txt |
From: Maho N. <ch...@ma...> - 2011-09-13 03:53:21
|
From: Gang Yan <ee...@gm...> Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned matrix less than 10^-156 ? Date: Tue, 13 Sep 2011 11:45:47 +0800 > Hi, Maho, > > > Gang, if you want to use MPACK, as Kouya-sensei wrote, please use >> GMP or MPFR version (to enlarge your precision). >> > I published a tutorial in Japanese (sorry), and >> I'll upload to the web page when I can publish my original one at the web. > > >> In the mean time, if you can use GMP version and setting >> MPACK_GMP_PRECISION environment variable to change pricision dynamically. >> > > > Yes, I used the GMP and MPFR version and tuned the precision variable from > 256 to 2048, but the results are truncated at ~10^-156. When the eigenvalues > are smaller than ~10^-156, they will become negative. How can I improve the > precision beyond 10^-156? Thanks. Hm, could you please check your inputs, so that not to include trancated values. or could you please send me your source codes. thanks Nakata Maho |
From: Maho N. <ch...@ma...> - 2011-09-12 18:56:59
|
Hi Gang and Kouya-sensei Gang, if you want to use MPACK, as Kouya-sensei wrote, please use GMP or MPFR version (to enlarge your precision). I published a tutorial in Japanese (sorry), and I'll upload to the web page when I can publish my original one at the web. In the mean time, if you can use GMP version and setting MPACK_GMP_PRECISION environment variable to change pricision dynamically. Thanks Nakata Maho From: Tomonori Kouya <ju...@qu...> Subject: Re: [Mplapack-devel] Can I compute eigenvalues of ill-conditioned matrix less than 10^-156 ? Date: Tue, 13 Sep 2011 00:01:53 +0900 > Hi, Gang. I have tried to solve some eigenvalue problems using MPFR/GMP. > > Very ill-conditionded matrices such as Hilbert or Lotkin matrices, are > too sensitive to keep their theoretical properties due to initial error > or round-off error in computing process. In case of Hilbert matrix, it > is theoretically positive definite but some of smallest eigenvalues can > be minus due to initial error in approximated elements of Hilbert matrix. > > I recommend to know how sensitive your matrix is for such error by using > variable precision of MPFR/GMP in order to solve your troubles. > > (2011/09/12 23:35), Gang Yan wrote: >> Now I have a problem when I calculate the eigenvalues of an extremely >> ill-conditioned matrix, in a problem of control system research. The matrix >> is not very large, e.g., 30X30, but extremely ill-conditioned, i.e., having >> the largest eigenvalue ~10^-2 and the smallest eigenvalue> 10^-156. I found >> that the eigenvalue programme using GMP or MPFR can only compute eigenvalues >> <10^-156, or I will get some minus eigenvalues which is not wrong because >> the matrix is positive-definition. I use a 64-bit notebook. > > ------------------------------------------------------------------------------ > Doing More with Less: The Next Generation Virtual Desktop > What are the key obstacles that have prevented many mid-market businesses > from deploying virtual desktops? How do next-generation virtual desktops > provide companies an easier-to-deploy, easier-to-manage and more affordable > virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ > _______________________________________________ > Mplapack-devel mailing list > Mpl...@li... > https://lists.sourceforge.net/lists/listinfo/mplapack-devel > |