int main() { int n = 2; array double complex a[2][2] = {8, -3, -5, 9}; array double complex z[2][2] = {complex(1,2), -3, -5, 9}; array double complex t[n][n]; array double complex q[n][n]; schurdecomp(a, q, t); printf("Schur vectors q =\n%f\n", q); printf("Schur form t =\n%f\n", t); printf("q*t*q^H =\n%f\n", q*t*conj(transpose(q))); printf("q^H*q =\n%f\n", conj(transpose(q))*q); schurdecomp(z, q, t); printf("Schur vectors q =\n%f\n", q); printf("Schur form t =\n%f\n", t); printf("q*t*q^H =\n%f\n", q*t*conj(transpose(q))); printf("q^H*q =\n%f\n", conj(transpose(q))*q); }
Schur vectors q = complex(-0.661061,0.000000) complex(-0.750332,0.000000) complex(-0.750332,0.000000) complex(0.661061,0.000000) Schur form t = complex(4.594875,0.000000) complex(-2.000000,0.000000) complex(0.000000,0.000000) complex(12.405125,0.000000) q*t*q^H = complex(8.000000,0.000000) complex(-3.000000,0.000000) complex(-5.000000,0.000000) complex(9.000000,0.000000) q^H*q = complex(1.000000,0.000000) complex(-0.000000,0.000000) complex(-0.000000,0.000000) complex(1.000000,0.000000) Schur vectors q = complex(-0.874263,0.158241) complex(-0.452441,0.076946) complex(-0.458937,0.000000) complex(0.888419,0.009421) Schur form t = complex(-0.524869,1.723999) complex(-1.983020,1.403899) complex(0.000000,0.000000) complex(10.524869,0.276001) q*t*q^H = complex(1.000000,2.000000) complex(-3.000000,0.000000) complex(-5.000000,0.000000) complex(9.000000,0.000000) q^H*q = complex(1.000000,0.000000) complex(0.000000,-0.000000) complex(0.000000,0.000000) complex(1.000000,0.000000)