public DoubleMatrix1D solve(DoubleMatrix1D b) {
		// if (b.size() != Math.max(m, n)) {
		// throw new
		// IllegalArgumentException("The size b must be equal to max(A.rows(), A.columns()).");
		// }
		if (!this.hasFullRank()) {
			log.error("Matrix is rank deficient: "
					+ ArrayUtils.toString(this.A.toArray()));
			throw new IllegalArgumentException("Matrix is rank deficient");
		}
		
		// with scaling, we must solve U.A.V.z = U.b, after that we have x = V.z
		if (this.rescaler != null) {
			// b = ALG.mult(this.U, b);
			b = ColtUtils.diagonalMatrixMult(this.U, b);
		}
		
		double[] bdata = b.toArray();
		double[] x = new double[this.n];
		System.arraycopy(bdata, 0, x, 0, bdata.length);

		if (m >= n) {
			double[] y = new double[S != null ? S.m2 : 1]; /* get workspace */
			Dcs_ipvec.cs_ipvec(S.pinv, x, y, m); /* y(0:m-1) = b(p(0:m-1) */
			for (int k = 0; k < n; k++) {
				/* apply Householder refl. to x */
				Dcs_happly.cs_happly(N.L, k, N.B[k], y);
			}
			Dcs_usolve.cs_usolve(N.U, y); /* y = R\y */
			Dcs_ipvec.cs_ipvec(S.q, y, x, n); /* x(q(0:n-1)) = y(0:n-1) */
		} else {
			double[] y = new double[S != null ? S.m2 : 1]; /* get workspace */
			Dcs_pvec.cs_pvec(S.q, x, y, m); /* y(q(0:m-1)) = b(0:m-1) */
			Dcs_utsolve.cs_utsolve(N.U, y); /* y = R'\y */
			for (int k = m - 1; k >= 0; k--) {
				/* apply Householder refl. to x */
				Dcs_happly.cs_happly(N.L, k, N.B[k], y);
			}
			Dcs_pvec.cs_pvec(S.pinv, y, x, n); /* x(0:n-1) = y(p(0:n-1)) */
		}
		// log.debug("x: " + ArrayUtils.toString(x));
		// log.debug("b: " + ArrayUtils.toString(b.toArray()));
		
		//return new DenseDoubleMatrix1D(x);
		
		if (this.rescaler != null) {
			// return ALG.mult(this.U, x);
			return ColtUtils.diagonalMatrixMult(this.V, F1.make(x));
		} else {
			return F1.make(x);
		}
	}
public DoubleMatrix1D solve ( DoubleMatrix1D b ) { if ( ! this . hasFullRank ( ) ) { log . error ( "Matrix is rank deficient: " + ArrayUtils . toString ( this . A . toArray ( ) ) ) ; throw new IllegalArgumentException ( "Matrix is rank deficient" ) ; } if ( this . rescaler != null ) { b = ColtUtils . diagonalMatrixMult ( this . U , b ) ; } double [ ] bdata = b . toArray ( ) ; double [ ] x = new double [ this . n ] ; System . arraycopy ( bdata , 0 , x , 0 , bdata . length ) ; if ( m >= n ) { double [ ] y = new double [ S != null ? S . m2 : 1 ] ; Dcs_ipvec . cs_ipvec ( S . pinv , x , y , m ) ; for ( int k = 0 ; k < n ; k ++ ) { Dcs_happly . cs_happly ( N . L , k , N . B [ k ] , y ) ; } Dcs_usolve . cs_usolve ( N . U , y ) ; Dcs_ipvec . cs_ipvec ( S . q , y , x , n ) ; } else { double [ ] y = new double [ S != null ? S . m2 : 1 ] ; Dcs_pvec . cs_pvec ( S . q , x , y , m ) ; Dcs_utsolve . cs_utsolve ( N . U , y ) ; for ( int k = m - 1 ; k >= 0 ; k -- ) { Dcs_happly . cs_happly ( N . L , k , N . B [ k ] , y ) ; } Dcs_pvec . cs_pvec ( S . pinv , y , x , n ) ; } if ( this . rescaler != null ) { return ColtUtils . diagonalMatrixMult ( this . V , F1 . make ( x ) ) ; } else { return F1 . make ( x ) ; } }
Solve a least-squares problem (min ||Ax-b||_2, where A is m-by-n (with m >=
n) or underdetermined system (Ax=b, where m < n).

@param b
right-hand side.
@exception IllegalArgumentException
if <tt>b.size() != max(A.rows(), A.columns())</tt>.
@exception IllegalArgumentException
if <tt>!this.hasFullRank()</tt> (<tt>A</tt> is rank
deficient).