eigenspace

(256000 kilobytes, 1000 milliseconds)

Submissions: 0 · Accepted: 0

Submit code

Statement

Eigenspace of a matrix

Work in \(\mathbb F_p\), where \(p=1\,000\,000\,007\). Given a square matrix
\(A\) and a scalar \(\lambda\), find a basis of the eigenspace

\[ E_\lambda=\{v:(A-\lambda I)v=0\}. \]

Input

The first line contains (n) and \(\lambda\). The next (n) lines contain
the (n\times n) matrix (A).

Output

Print the dimension (k), followed by (k) vectors of length (n). They must
be linearly independent and span (E_\lambda). If \(\lambda\) is not an
eigenvalue, print (0) and no vectors.

Constraints