code: public static <S extends DMatrix>
  	boolean jacobianR( FunctionNtoM func , FunctionNtoMxN<S> jacobian ,
  								 double param[] , double tol ,  double differenceScale )
  	{
  		NumericalJacobianForward_DDRM numerical = new NumericalJacobianForward_DDRM(func,differenceScale);
  
  		if( numerical.getNumOfOutputsM() != jacobian.getNumOfOutputsM() )
  			throw new RuntimeException("M is not equal "+numerical.getNumOfOutputsM()+"  "+jacobian.getNumOfOutputsM());
  
  		if( numerical.getNumOfInputsN() != jacobian.getNumOfInputsN() )
  			throw new RuntimeException("N is not equal: "+numerical.getNumOfInputsN()+"  "+jacobian.getNumOfInputsN());
  
  		S found = jacobian.declareMatrixMxN();
  		DMatrixRMaj expected = new DMatrixRMaj(func.getNumOfOutputsM(),func.getNumOfInputsN());
  
  		jacobian.process(param, found);
  		numerical.process(param, expected);
  
  		checkJacobianShape((S) found, expected);
  
  		for( int y = 0; y < expected.numRows; y++ ) {
  			for( int x = 0; x < expected.numCols; x++ ) {
  				double f = found.get(y,x);
  				double e = expected.get(y,x);
  
  				double max = Math.max(Math.abs(f),Math.abs(e));
  				if( max == 0 ) {
  					max = 1;
  				}
  
  				double diff = Math.abs(f-e)/max;
  				if( diff > tol ) {
  					return false;
  				}
  			}
  		}
  		return true;
  	}
docs: Checks the jacobian using a relative error threshold.
  @param tol fractional difference