/** * Solves for x in Ax = b, where x is this vector (nx1), A is mxn, b is mx1, and A = * U*W*transpose(V); U,W,V must be precomputed and can be found by taking the singular value * decomposition (SVD) of A using the method SVD found in the GMatrix class. * * @param U The U matrix produced by the GMatrix method SVD * @param W The W matrix produced by the GMatrix method SVD * @param V The V matrix produced by the GMatrix method SVD * @param b The b vector in the linear equation Ax = b */ public final void SVDBackSolve(GMatrix U, GMatrix W, GMatrix V, GVector b) { if (!(U.nRow == b.getSize() && U.nRow == U.nCol && U.nRow == W.nRow)) { throw new MismatchedSizeException(VecMathI18N.getString("GVector15")); } if (!(W.nCol == values.length && W.nCol == V.nCol && W.nCol == V.nRow)) { throw new MismatchedSizeException(VecMathI18N.getString("GVector23")); } GMatrix tmp = new GMatrix(U.nRow, W.nCol); tmp.mul(U, V); tmp.mulTransposeRight(U, W); tmp.invert(); mul(tmp, b); }