%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dim=100; t=1;
A =zeros(dim); 
for i = 1:dim-1;
    A(i,i)= -2; A(i,i+1)= 1; A(i+1,i)=1;
end
A(dim,dim)=-2; A(1,dim)=1; A(dim,1)=1;
 A=A/4;

C=randn(dim);
% A=(C+C')/2;
B=(C-C')/2;
H=A+1i*B;

E0=expm(-1i*t*H);
E1=expmC(-1i*t*H);
% Maximum error
norm(H,1)
HE=max(max(abs(E0-E1)))

S0=expm(-1i*t*A);
S1=cosmsinmC(-1i*t*A);
% Maximum error
norm(A,1)
max(max(abs(S0-S1)))
max(max(abs(real(S0)-real(S1))))
max(max(abs(imag(S0)-imag(S1))))

