p=[ 1 2 -1
    1 1 1
    0 1 -1];
pi=inv(p);
a1=p*diag([1 1 -1])*pi;
p2=[p(:,1)+p(:,2) p(:,1)-p(:,2) p(:,3)];
p2i=inv(p2);
disp(['diagonalize with different p'])
p2i*a1*p2
j2=diag([1 1 -1]);j2(1,2)=1;
a2=p*j2*pi;
disp(['find Jordan canonical form, i.e. pseudo-diagonalize for a2'])
[v,j]=jordan(a2)
