I have implemented the newton method as follows to calculate inverse of a matrix(input in my case)and x0 being the initial guess matrix.But the value of the iteration is not stable.I suspect the problem is in assigning the right x0 matrix.?
while(error>1e-3)
{
xk=x0*2-x0*input*x0;
}