0
$\begingroup$

How do I create an $n \times n$ circulant matrix?

I couldn't make ToeplitzMatrix do it for me.

$\endgroup$
  • $\begingroup$ It's right there in the docs for ToeplitzMatrix, under Properties & Relations. Search the doc page for "circulant". $\endgroup$ – Michael E2 May 3 '16 at 18:10
  • $\begingroup$ @kglr beat me to it. :) $\endgroup$ – Michael E2 May 3 '16 at 18:19
6
$\begingroup$
cm = ToeplitzMatrix[{c0, c1, c2, c3}, RotateRight[Reverse[{c0, c1, c2, c3}]]];
cm  // MatrixForm

Mathematica graphics

$\endgroup$
  • $\begingroup$ And this method is the fastest... $\endgroup$ – BlacKow May 3 '16 at 18:52
4
$\begingroup$
Reverse /@ Partition[ {c1, c2, c3, c0}, 4, 1, {1, 1}, {c1, c2, c3, c0}]

enter image description here

Edit

or more simple :

Reverse /@ Partition[{c1, c2, c3, c0}, 4, 1, {1, 1}]
$\endgroup$
3
$\begingroup$

Do you really need to use ToeplitzMatrix?

What about following?

MatrixForm@Transpose@NestList[RotateRight, #, Length[#]-1] &@{1, 2, 3, 
  4}
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.