MatLab versus Fortran
for k = 1:M
if ( v’*v <= tol*tol ), break, end
z = A*v;
t = c/(v’*z);
x=x+t*v ;
r=r-t*z ;
d=r’*r;
v=r+(d/c)*v ;
c=d ;
do k=1,M
if (dot_product(v,v)<tol*tol) exit
z = matmul(A,v)
t=c/ dot_product(v,z)
x=x+t*v
r=r-t*z
d=dot_product(r,r)
v=r+(d/c)*v
c=d