function [r, c, As, numIters, err] = buScaleSK2(A, maxIters, tol)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usage  [r, c, As, numIters, err] = buScaleSK2( A, NbIter, butol, Dr, Dc )
%        Dr and Dc are optional inputs.
% Scales the matrix 1./Dr*A*1/Dc with 1./DDr and 1./DDc to have 
% all rows and cols in the scaled matrix As to have 2-norm equal to 1
% 
% Implements P A Knights description of Sinkhorn-Knopp algorithm
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% by  Daniel Ruiz and Bora Ucar, 
% references: A symmetry preserving algorithm for matrix scaling
%             Daniel Ruiz and Bora Ucar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[c, r, numIters, err] = knight_sk2( A, maxIters, tol);

As = buScale(A, 1./r, 1./c);
