# [R] eigenvalues of a circulant matrix

Huntsinger, Reid reid_huntsinger at merck.com
Tue May 3 00:24:15 CEST 2005

```The construction was

y<-x[c(109:1,2:108)]

so y is symmetric in the sense of the usual way of writing a function on
integers mod n as a vector with 1-based indexing. I.e., y[i+1] = y[n-(i+1)]
for i=0,1,...,n-1. So the assignment

Z <- toeplitz(y)

*does* create a symmetric circulant matrix. It is diagonalizable but does
not have distinct eigenvalues, hence the eigenspaces may be more than
one-dimensional, so you can't just pick a unit vector and call it "the"
eigenvector for that eigenvalue. You choose a basis for each eigenspace. R
detects the symmetry:

...
symmetric: if `TRUE', the matrix is assumed to be symmetric (or
Hermitian if complex) and only its lower triangle is used. If
`symmetric' is not specified, the matrix is inspected for
symmetry.

(from help(eigen))
and knows that computations can be done with real arithmetic.

As for why you get NaN, you should submit --along with your example--
details of your platform (machine, R version, how R was built and installed,
etc).

Reid Huntsinger

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
Ted.Harding at nessie.mcc.ac.uk
Sent: Monday, May 02, 2005 5:28 PM
To: r-help at stat.math.ethz.ch
Subject: Re: [R] eigenvalues of a circulant matrix

On 02-May-05 Ted Harding wrote:
> On 02-May-05 Rolf Turner wrote:
>> I just Googled around a bit and found definitions of Toeplitz and
>> circulant matrices as follows:
>> [...]
>> A circulant matrix is an n x n matrix whose rows are composed of
>> cyclically shifted versions of a length-n vector. For example, the
>> circulant matrix on the vector (1, 2, 3, 4)  is
>>
>>       4 1 2 3
>>       3 4 1 2
>>       2 3 4 1
>>       1 2 3 4
>>
>> So circulant matrices are a special case of Toeplitz matrices.
>> However a circulant matrix cannot be symmetric.
>
> I suspect the confusion may lie in what's meant by "cyclically
> shifted". In Rolf's example above, each row is shifted right by 1
> and the one that falls off the end is put at the beginning. This
> cannot be symmetric for general values in the fist row.
>
> However, if you shift left instead, then you get
>
>         4 1 2 3
>         1 2 3 4
>         2 3 4 1
>         3 4 1 2
>
> and this *is* symmetric (and indeed will always be so, for
> general values in the first row).

I just had a look at ?toeplitz

(We should have done that earlier!)

toeplitz                package:stats                R Documentation
Form Symmetric Toeplitz Matrix
*********

Description:
Forms a symmetric Toeplitz matrix given its first row.
*********
[...]
Examples:

x <- 1:5
toeplitz (x)

> x <- 1:5
>      toeplitz (x)
[,1] [,2] [,3] [,4] [,5]
[1,]    1    2    3    4    5
[2,]    2    1    2    3    4
[3,]    3    2    1    2    3
[4,]    4    3    2    1    2
[5,]    5    4    3    2    1

Since "Globe Trotter's" construction was

Y<-toeplitz(x)

it's not surprising what he got (and it *certainly* wasn't
a circulant!!!).

Everybody barking up the wring tree here!

Best wishes to all,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 02-May-05                                       Time: 22:27:32
------------------------------ XFMail ------------------------------

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help