code: public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix2D X, DoubleMatrix2D B){
  		double residual = -Double.MAX_VALUE;
  		double niX = Algebra.DEFAULT.normInfinity(X);
  		double niB = Algebra.DEFAULT.normInfinity(B);
  		if(Double.compare(niX, 0.)==0 && Double.compare(niB, 0.)==0){
  			return 0;
  		}else{
  			double num = Algebra.DEFAULT.normInfinity(Algebra.DEFAULT.mult(A, X).assign(B,	Functions.minus));
  			double den = Algebra.DEFAULT.normInfinity(A) * niX + niB;
  			residual =  num / den;
  			//log.debug("scaled residual: " + residual);
  			
  			return residual;
  		}
  	}
docs: Calculate the scaled residual
  <br> ||Ax-b||_oo/( ||A||_oo . ||x||_oo + ||b||_oo ), with
  <br> ||x||_oo = max(||x[i]||)