Looks like the files did not go through again. In any case, here is the kinv: please cut and paste and save to a file: -1.16801E-03 -2.24310E-03 -1.16864E-03 -2.24634E-03 -1.17143E-03 -2.25358E-03 -1.17589E-03 -2.26484E-03 -1.18271E-03 -2.27983E-03 -1.19124E-03 -2.29896E-03 -1.20164E-03 -2.32206E-03 -1.21442E-03 -2.34911E-03 -1.22939E-03 -2.38073E-03 -1.24626E-03 -2.41702E-03 -1.26596E-03 -2.45828E-03 -1.28801E-03 -2.50458E-03 -1.31296E-03 -2.55646E-03 -1.34048E-03 -2.61444E-03 -1.37127E-03 -2.67887E-03 -1.40531E-03 -2.75026E-03 -1.44311E-03 -2.82930E-03 -1.48481E-03 -2.91652E-03 -1.53081E-03 -3.01281E-03 -1.58131E-03 -3.11930E-03 -1.63727E-03 -3.23708E-03 -1.69907E-03 -3.36712E-03 -1.76720E-03 -3.51113E-03 -1.84251E-03 -3.67073E-03 -1.92580E-03 -3.84787E-03 -2.01834E-03 -4.04507E-03 -2.12087E-03 -4.26509E-03 -2.23531E-03 -4.51127E-03 -2.36357E-03 -4.78743E-03 -2.50664E-03 -5.09847E-03 -2.66813E-03 -5.45027E-03 -2.85019E-03 -5.84987E-03 -3.05664E-03 -6.30596E-03 -3.29224E-03 -6.82972E-03 -3.56187E-03 -7.43448E-03 -3.87322E-03 -8.13766E-03 -4.23449E-03 -8.96182E-03 -4.65684E-03 -9.93567E-03 -5.15519E-03 -1.10980E-02 -5.74887E-03 -1.25006E-02 -6.46346E-03 -1.42143E-02 -7.33466E-03 -1.63391E-02 -8.41211E-03 -1.90180E-02 -9.76709E-03 -2.24632E-02 -1.15055E-02 -2.70006E-02 -1.37894E-02 -3.31497E-02 -1.68780E-02 -4.17865E-02 -2.12092E-02 -5.44795E-02 -2.75722E-02 -7.42814E-02 -3.75180E-02 -0.107820 -5.44778E-02 -0.171908 -8.74660E-02 -0.320830 -0.167792 -0.826079 -0.486405 -6.28085 19.4495 -6.28085 -0.486405 -0.826079 -0.167792 -0.320830 -8.74660E-02 -0.171908 -5.44778E-02 -0.107820 -3.75180E-02 -7.42816E-02 -2.75722E-02 -5.44795E-02 -2.12092E-02 -4.17865E-02 -1.68780E-02 -3.31495E-02 -1.37894E-02 -2.70004E-02 -1.15055E-02 -2.24632E-02 -9.76708E-03 -1.90179E-02 -8.41210E-03 -1.63391E-02 -7.33465E-03 -1.42142E-02 -6.46346E-03 -1.25005E-02 -5.74887E-03 -1.10979E-02 -5.15519E-03 -9.93565E-03 -4.65686E-03 -8.96166E-03 -4.23449E-03 -8.13766E-03 -3.87320E-03 -7.43444E-03 -3.56187E-03 -6.82968E-03 -3.29223E-03 -6.30590E-03 -3.05665E-03 -5.84988E-03 -2.85020E-03 -5.45026E-03 -2.66813E-03 -5.09848E-03 -2.50664E-03 -4.78742E-03 -2.36358E-03 -4.51160E-03 -2.23531E-03 -4.26516E-03 -2.12088E-03 -4.04506E-03 -2.01834E-03 -3.84791E-03 -1.92580E-03 -3.67066E-03 -1.84251E-03 -3.51094E-03 -1.76720E-03 -3.36700E-03 -1.69907E-03 -3.23702E-03 -1.63727E-03 -3.11926E-03 -1.58130E-03 -3.01269E-03 -1.53081E-03 -2.91633E-03 -1.48480E-03 -2.82912E-03 -1.44311E-03 -2.75018E-03 -1.40531E-03 -2.67891E-03 -1.37126E-03 -2.61459E-03 -1.34048E-03 -2.55652E-03 -1.31296E-03 -2.50461E-03 -1.28801E-03 -2.45833E-03 -1.26595E-03 -2.41717E-03 -1.24626E-03 -2.38063E-03 -1.22938E-03 -2.34904E-03 -1.21443E-03 -2.32207E-03 -1.20164E-03 -2.29903E-03 -1.19124E-03 -2.27985E-03 -1.18271E-03 -2.26497E-03 -1.17589E-03 -2.25364E-03 -1.17145E-03 -2.24634E-03 -1.16863E-03 -2.24284E-03 Thanks! --- Globe Trotter <itsme_410 at yahoo.com> wrote:> Date: Mon, 2 May 2005 19:51:24 -0700 (PDT) > From: Globe Trotter <itsme_410 at yahoo.com> > Subject: Re: [R] eigenvalues of a circulant matrix > To: r-help at stat.math.ethz.ch > > OK, here we go: > > I am submitting two attachments. The first is the datafile called kinv used > to > create my circulant matrix, using the following commands: > > > x<-scan("kinv") > y<-x[c(109:1,0:108)] > X=toeplitz(y) > eigen(X) > write(X,ncol=216,file="test.dat") > > reports the following columns full of NaN's: 18, 58, 194, 200. (Note that > eigen(X,symmetric=T) makes no difference and I get the same as above). > > The second attachment contains only the eigenvectors obtained on calling a > LAPACK routine directly (from C). The eigenvalues are essentially the same as > that obtained using R. Here, I use the LAPACK-recommended double precision > routine dspevd() routine for symmetric matrices in packed storage format. > Note > the absence of the NaN's....I would be happy to send my C programs to whoever > is interested. > > I am using > > :~> uname -a > Linux 2.6.11-1.14_FC3 #1 Thu Apr 7 19:23:49 EDT 2005 i686 i686 i386 GNU/Linux > > and R.2.0.1. > > Many thanks and best wishes! > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
I am not sure where your problem is, but I get these eigenvalues (no NaNs):> eigen(X)$values[1] 33.6609067 33.6609067 33.3657337 33.3657337 33.1688489 33.1688489 [7] 32.9120603 32.9120603 32.6971529 32.6971529 32.4486757 32.4486757 [13] 32.2266513 32.2266513 31.9811880 31.9811880 31.7549774 31.7549774 [19] 31.5106802 31.5106802 31.2814636 31.2814636 31.0374623 31.0374623 [25] 30.8058168 30.8058168 30.5616180 30.5616180 30.3278637 30.3278637 [31] 30.0831665 30.0831665 29.8474910 29.8474910 29.6020821 29.6020821 [37] 29.3645937 29.3645937 29.1183207 29.1183207 28.8790883 28.8790883 [43] 28.6318199 28.6318199 28.3908814 28.3908814 28.1425171 28.1425171 [49] 27.8998862 27.8998862 27.6503394 27.6503394 27.4060152 27.4060152 [55] 27.1552045 27.1552045 26.9091770 26.9091770 26.6570228 26.6570228 [61] 26.4092748 26.4092748 26.1557083 26.1557083 25.9062128 25.9062128 [67] 25.6511554 25.6511554 25.3998797 25.3998797 25.1432660 25.1432660 [73] 24.8901666 24.8901666 24.6319253 24.6319253 24.3769595 24.3769595 [79] 24.1170167 24.1170167 23.8601266 23.8601266 23.5984086 23.5984086 [85] 23.3395425 23.3395425 23.0759756 23.0759756 22.8150622 22.8150622 [91] 22.5495580 22.5495580 22.2865330 22.2865330 22.0190111 22.0190111 [97] 21.7537982 21.7537982 21.4841613 21.4841613 21.2166787 21.2166787 [103] 20.9448339 20.9448339 20.6749916 20.6749916 20.4008361 20.4008361 [109] 20.1285318 20.1285318 19.8519563 19.8519563 19.5770843 19.5770843 [115] 19.2979657 19.2979657 19.0204113 19.0204113 18.7386197 18.7386197 [121] 18.4582550 18.4582550 18.1736507 18.1736507 17.8903299 17.8903299 [127] 17.6027615 17.6027615 17.3163357 17.3163357 17.0256338 17.0256338 [133] 16.7359239 16.7359239 16.4419046 16.4419046 16.1487284 16.1487284 [139] 15.8511833 15.8511833 15.5543204 15.5543204 15.2530227 15.2530227 [145] 14.9522432 14.9522432 14.6469402 14.6469402 14.3419740 14.3419740 [151] 14.0323742 14.0323742 13.7229182 13.7229182 13.4087011 13.4087011 [157] 13.0944062 13.0944062 12.7751956 12.7751956 12.4556716 12.4556716 [163] 12.1310382 12.1310382 11.8058191 11.8058191 11.4752626 11.4752626 [169] 11.1438118 11.1438118 10.8067417 10.8067417 10.4684198 10.4684198 [175] 10.1241331 10.1241331 9.7781642 9.7781642 9.4258124 9.4258124 [181] 9.0712521 9.0712521 8.7097773 8.7097773 8.3454594 8.3454594 [187] 7.9735359 7.9735359 7.5979459 7.5979459 7.2138560 7.2138560 [193] 6.8250204 6.8250204 6.4264559 6.4264559 6.0216592 6.0216592 [199] 5.6053886 5.6053886 5.1807131 5.1807131 4.7419171 4.7419171 [205] 4.2912801 4.2912801 3.8221094 3.8221094 3.3349406 3.3349406 [211] 2.8206308 2.8206308 2.2746353 2.2746353 1.6787279 1.6787279 [217] 0.9988213 Again, what is the issue here? Janusz. On Mon, 2 May 2005, Globe Trotter wrote:> Looks like the files did not go through again. In any case, here is the kinv: > please cut and paste and save to a file: > > > > -1.16801E-03 -2.24310E-03 -1.16864E-03 -2.24634E-03 -1.17143E-03 > -2.25358E-03 -1.17589E-03 -2.26484E-03 -1.18271E-03 -2.27983E-03 > -1.19124E-03 -2.29896E-03 -1.20164E-03 -2.32206E-03 -1.21442E-03 > -2.34911E-03 -1.22939E-03 -2.38073E-03 -1.24626E-03 -2.41702E-03 > -1.26596E-03 -2.45828E-03 -1.28801E-03 -2.50458E-03 -1.31296E-03 > -2.55646E-03 -1.34048E-03 -2.61444E-03 -1.37127E-03 -2.67887E-03 > -1.40531E-03 -2.75026E-03 -1.44311E-03 -2.82930E-03 -1.48481E-03 > -2.91652E-03 -1.53081E-03 -3.01281E-03 -1.58131E-03 -3.11930E-03 > -1.63727E-03 -3.23708E-03 -1.69907E-03 -3.36712E-03 -1.76720E-03 > -3.51113E-03 -1.84251E-03 -3.67073E-03 -1.92580E-03 -3.84787E-03 > -2.01834E-03 -4.04507E-03 -2.12087E-03 -4.26509E-03 -2.23531E-03 > -4.51127E-03 -2.36357E-03 -4.78743E-03 -2.50664E-03 -5.09847E-03 > -2.66813E-03 -5.45027E-03 -2.85019E-03 -5.84987E-03 -3.05664E-03 > -6.30596E-03 -3.29224E-03 -6.82972E-03 -3.56187E-03 -7.43448E-03 > -3.87322E-03 -8.13766E-03 -4.23449E-03 -8.96182E-03 -4.65684E-03 > -9.93567E-03 -5.15519E-03 -1.10980E-02 -5.74887E-03 -1.25006E-02 > -6.46346E-03 -1.42143E-02 -7.33466E-03 -1.63391E-02 -8.41211E-03 > -1.90180E-02 -9.76709E-03 -2.24632E-02 -1.15055E-02 -2.70006E-02 > -1.37894E-02 -3.31497E-02 -1.68780E-02 -4.17865E-02 -2.12092E-02 > -5.44795E-02 -2.75722E-02 -7.42814E-02 -3.75180E-02 -0.107820 > -5.44778E-02 > -0.171908 -8.74660E-02 -0.320830 -0.167792 -0.826079 -0.486405 > -6.28085 > 19.4495 -6.28085 -0.486405 -0.826079 -0.167792 -0.320830 > -8.74660E-02 > -0.171908 -5.44778E-02 -0.107820 -3.75180E-02 -7.42816E-02 > -2.75722E-02 > -5.44795E-02 -2.12092E-02 -4.17865E-02 -1.68780E-02 -3.31495E-02 > -1.37894E-02 -2.70004E-02 -1.15055E-02 -2.24632E-02 -9.76708E-03 > -1.90179E-02 -8.41210E-03 -1.63391E-02 -7.33465E-03 -1.42142E-02 > -6.46346E-03 -1.25005E-02 -5.74887E-03 -1.10979E-02 -5.15519E-03 > -9.93565E-03 -4.65686E-03 -8.96166E-03 -4.23449E-03 -8.13766E-03 > -3.87320E-03 -7.43444E-03 -3.56187E-03 -6.82968E-03 -3.29223E-03 > -6.30590E-03 -3.05665E-03 -5.84988E-03 -2.85020E-03 -5.45026E-03 > -2.66813E-03 -5.09848E-03 -2.50664E-03 -4.78742E-03 -2.36358E-03 > -4.51160E-03 -2.23531E-03 -4.26516E-03 -2.12088E-03 -4.04506E-03 > -2.01834E-03 -3.84791E-03 -1.92580E-03 -3.67066E-03 -1.84251E-03 > -3.51094E-03 -1.76720E-03 -3.36700E-03 -1.69907E-03 -3.23702E-03 > -1.63727E-03 -3.11926E-03 -1.58130E-03 -3.01269E-03 -1.53081E-03 > -2.91633E-03 -1.48480E-03 -2.82912E-03 -1.44311E-03 -2.75018E-03 > -1.40531E-03 -2.67891E-03 -1.37126E-03 -2.61459E-03 -1.34048E-03 > -2.55652E-03 -1.31296E-03 -2.50461E-03 -1.28801E-03 -2.45833E-03 > -1.26595E-03 -2.41717E-03 -1.24626E-03 -2.38063E-03 -1.22938E-03 > -2.34904E-03 -1.21443E-03 -2.32207E-03 -1.20164E-03 -2.29903E-03 > -1.19124E-03 -2.27985E-03 -1.18271E-03 -2.26497E-03 -1.17589E-03 > -2.25364E-03 -1.17145E-03 -2.24634E-03 -1.16863E-03 -2.24284E-03 > > Thanks! > > > > --- Globe Trotter <itsme_410 at yahoo.com> wrote: > > Date: Mon, 2 May 2005 19:51:24 -0700 (PDT) > > From: Globe Trotter <itsme_410 at yahoo.com> > > Subject: Re: [R] eigenvalues of a circulant matrix > > To: r-help at stat.math.ethz.ch > > > > OK, here we go: > > > > I am submitting two attachments. The first is the datafile called kinv used > > to > > create my circulant matrix, using the following commands: > > > > > > x<-scan("kinv") > > y<-x[c(109:1,0:108)] > > X=toeplitz(y) > > eigen(X) > > write(X,ncol=216,file="test.dat") > > > > reports the following columns full of NaN's: 18, 58, 194, 200. (Note that > > eigen(X,symmetric=T) makes no difference and I get the same as above). > > > > The second attachment contains only the eigenvectors obtained on calling a > > LAPACK routine directly (from C). The eigenvalues are essentially the same as > > that obtained using R. Here, I use the LAPACK-recommended double precision > > routine dspevd() routine for symmetric matrices in packed storage format. > > Note > > the absence of the NaN's....I would be happy to send my C programs to whoever > > is interested. > > > > I am using > > > > :~> uname -a > > Linux 2.6.11-1.14_FC3 #1 Thu Apr 7 19:23:49 EDT 2005 i686 i686 i386 GNU/Linux > > > > and R.2.0.1. > > > > Many thanks and best wishes! > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
I think the statement of the problem and the questions asked need clarifying. Some aspects puzzleme. See below. On 03-May-05 Globe Trotter wrote:> Looks like the files did not go through again. In any case, > here is the kinv: > please cut and paste and save to a file: > > [data snipped] > > --- Globe Trotter <itsme_410 at yahoo.com> wrote: >> Date: Mon, 2 May 2005 19:51:24 -0700 (PDT) >> From: Globe Trotter <itsme_410 at yahoo.com> >> Subject: Re: [R] eigenvalues of a circulant matrix >> To: r-help at stat.math.ethz.ch >> >> OK, here we go: >> >> I am submitting two attachments. The first is the datafile >> called kinv used to create my circulant matrix, using the >> following commands: >> >> x<-scan("kinv") >> y<-x[c(109:1,0:108)] >> X=toeplitz(y) >> eigen(X) >> write(X,ncol=216,file="test.dat")Having cut&pasted from the data placed in the body of the message (omitted here) I get 216 numbers. Having put these in a vector x (in my own way): length(x) ##[1] 216 Question 1: ==========Is this correct? Or has there been a problem with your posting of the data? If it is correct, given that you seem to only use x[1:109], was there some point in giving the rest? Question 2: ==========Next, using your command: y<-x[c(109:1,0:108)] I now get length(y) ##[1] 217 (as expected). The "0" in "0:108" seems to have been ignored (again as expected), so this is equivalent to y<-x[c(109:1,1:108)] Is this as intended? If so, why use "0:108" instead of "1:108"? Check: y[1] ##[1] 19.4495 x[109] ##[1] 19.4495 y[109] ##[1] -0.00116801 x[1] ##[1] -0.00116801 y[110] ##[1] -0.00116801 x[1] ##[1] -0.00116801 y[217] ##[1] -6.28085 x[108] ##[1] -6.28085 Can you confirm that this is as intended? Comment 3: =========You next command X=toeplitz(y): No apparent problems, it gives a symmetric result: which(X != t(X)) ## numeric(0) with 217 rows and columns: dim(X) ##[1] 217 217 and looks circulant: X[(1:5),(1:5)] [,1] [,2] [,3] [,4] [,5] [1,] 19.449500 -6.280850 -0.486405 -0.826079 -0.167792 [2,] -6.280850 19.449500 -6.280850 -0.486405 -0.826079 [3,] -0.486405 -6.280850 19.449500 -6.280850 -0.486405 [4,] -0.826079 -0.486405 -6.280850 19.449500 -6.280850 [5,] -0.167792 -0.826079 -0.486405 -6.280850 19.449500 Question 4: ==========Your next command, "eigen(X)", would simply output the results to screen and does not assign to anything. Your next command "write(X,ncol=216,file="test.dat")" as it stands will write the toeplitz matrix X, constructed by your command "X<-toeplitz(y)" to file, but with 216 columns instead of 217. However, the result consists simply of numbers, and there is nothing like "NA" or "NaN" in the file which I get. Nor are there any NAs or NaNs in X itself, of course. But, when you yourself did "write(X,ncol=216,file="test.dat")", perhaps the "X" in this command was different from the "X" which is the toeplitz matrix. So, was it the result of an assignment from "eigen(X)" and, if so, which component or components? Question/Comment 5: ==================So I have tried Z<-eigen(X). First of all, I get no problems with NAs or NaNs: which(is.na(Z$values)) ##numeric(0) which(is.nan(Z$values)) ##numeric(0) which(is.na(Z$vectors)) ##numeric(0) which(is.nan(Z$vectors)) ##numeric(0) Next, trying various options for wirting to file: write(Z,ncol=216,file="test.dat") simply does not work (not a writable structure), while write(Z$values,ncol=216,file="test.dat") produces simply a set of numbers, no NAs of NaNs, and likewise write(Z$vectors,ncol=216,file="test.dat") (the only occurrences of non-numeric characters are "e", as in "e-05").>> reports the following columns full of NaN's: 18, 58, 194, 200. >> (Note that eigen(X,symmetric=T) makes no difference and I get >> the same as above).Therefore I find myself completely unable to reproduce your problem. However, for the various reasons stated in detail above, I am not at all sure that what you wrote as the statement of what you did in fact corresponds to what you really did! I even wonder whether Question 6: ==========Was the file "test.dat" the result of your "write" command? Or was it left over from a previous activity, the "write" from this session having failed to execute for some reason? (In which case the NaNs would have nothing to do with the results of "eigen(X)").>> The second attachment contains only the eigenvectors >> obtained on calling a LAPACK routine directly (from C). >> The eigenvalues are essentially the same as that obtained >> using R. Here, I use the LAPACK-recommended double >> precision routine dspevd() routine for symmetric matrices >> in packed storage format. >> Note the absence of the NaN's....I would be happy to send >> my C programs to whoever is interested.Well, I didn't get any NaNs in R either -- quite consistent with your C program! Please clarify according to the questions above. Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 03-May-05 Time: 12:06:57 ------------------------------ XFMail ------------------------------