% ACCURACY checks the accuracy of solving systems of equations
%
%  
%  [xsol,nrm,b]=accuracy(A,x)
%
%  INPUTS 
%  A-> A matrix of size n
%  x-> A column vector of length n
%
%  OUPUTS
%  xsol-> The solution from xsol=inv(A)*b, where b=A*x;
%  nrm -> The norm of (xsol - x )
%  b -> the vector b=A*x
%
%
%   Software written by Raf Vandebril
%   Raf.Vandebril-at-cs.kuleuven.be
%   Revision Date: 10/05/2010


function [xsol,nrm,b]=accuracysolution(A,x)
  
  % In this function you have now the variables 
  % A and x
  
    
  % COMPLETE: 
  % Construct b 
  b=A*x;
  
  % COMPLETE: 
  % Compute the vector xsol 
  xsol=inv(A)*b;
  
  % COMPLETE:
  % Compute the norm of xsol-x and store it in the variable nrm. 
  % The variable nrm measures the difference between x and xsol,
  % if they are equally accurate the value of nrm should be zero.
  nrm=norm(xsol-x)
