public void factorize() throws Exception {
		m = A.rows();
		n = A.columns();
		
		if(this.rescaler != null){
			double[] cn_00_original = null;
			double[] cn_2_original = null;
			double[] cn_00_scaled = null;
			double[] cn_2_scaled = null;
			if(log.isDebugEnabled()){
				cn_00_original = ColtUtils.getConditionNumberRange(new Array2DRowRealMatrix(A.toArray()), Integer.MAX_VALUE);
				log.debug("cn_00_original Q before scaling: " + ArrayUtils.toString(cn_00_original));
				cn_2_original = ColtUtils.getConditionNumberRange(new Array2DRowRealMatrix(A.toArray()), 2);
				log.debug("cn_2_original Q before scaling : " + ArrayUtils.toString(cn_2_original));
			}
			//scaling the A matrix, we have:
			//A1 = U.A.V[T]  
			DoubleMatrix1D[] UV = rescaler.getMatrixScalingFactors(A);
			this.U = UV[0];
			this.V = UV[1];
			if(log.isDebugEnabled()){
				boolean checkOK = rescaler.checkScaling(A, U, V);
				if(!checkOK){
					log.warn("Scaling failed (checkScaling = false)");
				}
			}
			this.A = (SparseDoubleMatrix2D) ColtUtils.diagonalMatrixMult(U, A, V);
			if(log.isDebugEnabled()){
				cn_00_scaled = ColtUtils.getConditionNumberRange(new Array2DRowRealMatrix(A.toArray()), Integer.MAX_VALUE);
				log.debug("cn_00_scaled Q after scaling : " + ArrayUtils.toString(cn_00_scaled));
				cn_2_scaled = ColtUtils.getConditionNumberRange(new Array2DRowRealMatrix(A.toArray()), 2);
				log.debug("cn_2_scaled Q after scaling  : " + ArrayUtils.toString(cn_2_scaled));
				
				if(cn_00_original[0] < cn_00_scaled[0] || cn_2_original[0] < cn_2_scaled[0]){
					log.warn("Problematic scaling");
					//throw new RuntimeException("Scaling failed");
				}
			}
		}
		
		Dcs dcs;
		if (m >= n) {
			dcs = ColtUtils.matrixToDcs(A);
		} else {
			dcs = ColtUtils.matrixToDcs((SparseDoubleMatrix2D) ALG.transpose(A));
		}
		S = Dcs_sqr.cs_sqr(order, dcs, true);
		if (S == null) {
			throw new IllegalArgumentException("Exception occured in cs_sqr()");
		}
		N = Dcs_qr.cs_qr(dcs, S);
		if (N == null) {
			throw new IllegalArgumentException("Exception occured in cs_qr()");
		}
	}
public void factorize ( ) throws Exception { m = A . rows ( ) ; n = A . columns ( ) ; if ( this . rescaler != null ) { double [ ] cn_00_original = null ; double [ ] cn_2_original = null ; double [ ] cn_00_scaled = null ; double [ ] cn_2_scaled = null ; if ( log . isDebugEnabled ( ) ) { cn_00_original = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , Integer . MAX_VALUE ) ; log . debug ( "cn_00_original Q before scaling: " + ArrayUtils . toString ( cn_00_original ) ) ; cn_2_original = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , 2 ) ; log . debug ( "cn_2_original Q before scaling : " + ArrayUtils . toString ( cn_2_original ) ) ; } DoubleMatrix1D [ ] UV = rescaler . getMatrixScalingFactors ( A ) ; this . U = UV [ 0 ] ; this . V = UV [ 1 ] ; if ( log . isDebugEnabled ( ) ) { boolean checkOK = rescaler . checkScaling ( A , U , V ) ; if ( ! checkOK ) { log . warn ( "Scaling failed (checkScaling = false)" ) ; } } this . A = ( SparseDoubleMatrix2D ) ColtUtils . diagonalMatrixMult ( U , A , V ) ; if ( log . isDebugEnabled ( ) ) { cn_00_scaled = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , Integer . MAX_VALUE ) ; log . debug ( "cn_00_scaled Q after scaling : " + ArrayUtils . toString ( cn_00_scaled ) ) ; cn_2_scaled = ColtUtils . getConditionNumberRange ( new Array2DRowRealMatrix ( A . toArray ( ) ) , 2 ) ; log . debug ( "cn_2_scaled Q after scaling  : " + ArrayUtils . toString ( cn_2_scaled ) ) ; if ( cn_00_original [ 0 ] < cn_00_scaled [ 0 ] || cn_2_original [ 0 ] < cn_2_scaled [ 0 ] ) { log . warn ( "Problematic scaling" ) ; } } } Dcs dcs ; if ( m >= n ) { dcs = ColtUtils . matrixToDcs ( A ) ; } else { dcs = ColtUtils . matrixToDcs ( ( SparseDoubleMatrix2D ) ALG . transpose ( A ) ) ; } S = Dcs_sqr . cs_sqr ( order , dcs , true ) ; if ( S == null ) { throw new IllegalArgumentException ( "Exception occured in cs_sqr()" ) ; } N = Dcs_qr . cs_qr ( dcs , S ) ; if ( N == null ) { throw new IllegalArgumentException ( "Exception occured in cs_qr()" ) ; } }
Constructs and returns a new QR decomposition object; computed by
Householder reflections; If m < n then then the QR of A' is computed. The
decomposed matrices can be retrieved via instance methods of the returned
decomposition object.

@param A
A rectangular matrix.
@param order
ordering option (0 to 3); 0: natural ordering, 1: amd(A+A'), 2:
amd(S'*S), 3: amd(A'*A)
@throws IllegalArgumentException
if <tt>A</tt> is not sparse
@throws IllegalArgumentException
if <tt>order</tt> is not in [0,3]