  Given a field $F$, a scalar $\lambda\in F$ and a matrix $A\in F^{n\times n}$,
the twisted centralizer code $C_F(A,\lambda):=\{B\in F^{n\times n}\mid
AB-\lambda BA=0\}$ is a linear code of length $n^2$. When $A$ is cyclic and
$\lambda\ne0$ we prove that $\dim
C_F(A,\lambda)=\mathrm{deg}(\gcd(c_A(t),\lambda^n c_A(\lambda^{-1}t)))$ where
$c_A(t)$ denotes the characteristic polynomial of $A$. We also show how
$C_F(A,\lambda)$ decomposes, and we estimate the probability that
$C_F(A,\lambda)$ is nonzero when $|F|$ is finite. Finally, we prove $\dim
C_F(A,\lambda)\leqslant n^2/2$ for $\lambda\not\in\{0,1\}$ and `almost all'
matrices $A$.
