int gsl_linalg_QRPT_solve (const gsl_matrix * QR, const gsl_vector * tau, const gsl_permutation * p, const gsl_vector * b, gsl_vector * x) { if (QR->size1 != QR->size2) { GSL_ERROR ("QR matrix must be square", GSL_ENOTSQR); } else if (QR->size1 != p->size) { GSL_ERROR ("matrix size must match permutation size", GSL_EBADLEN); } else if (QR->size1 != b->size) { GSL_ERROR ("matrix size must match b size", GSL_EBADLEN); } else if (QR->size2 != x->size) { GSL_ERROR ("matrix size must match solution size", GSL_EBADLEN); } else { gsl_vector_memcpy (x, b); gsl_linalg_QRPT_svx (QR, tau, p, x); return GSL_SUCCESS; } }
CAMLprim value ml_gsl_linalg_QRPT_svx(value QR, value TAU, value P, value X) { GSL_PERMUT_OF_BIGARRAY(P); _DECLARE_MATRIX(QR); _DECLARE_VECTOR2(TAU, X); _CONVERT_MATRIX(QR); _CONVERT_VECTOR2(TAU, X); gsl_linalg_QRPT_svx(&m_QR, &v_TAU, &perm_P, &v_X); return Val_unit; }
/** * C++ version of gsl_linalg_QRPT_svx(). * @param QR A QR decomposition matrix * @param tau A vector * @param p A permutation * @param x A vector * @return Error code on failure */ inline int QRPT_svx( matrix const& QR, vector const& tau, permutation const& p, vector& x ){ return gsl_linalg_QRPT_svx( QR.get(), tau.get(), p.get(), x.get() ); }