CAMLprim value ml_gsl_linalg_LQ_unpack(value LQ, value TAU, value Q, value L) { _DECLARE_MATRIX3(LQ,Q,L); _DECLARE_VECTOR(TAU); _CONVERT_MATRIX3(LQ,Q,L); _CONVERT_VECTOR(TAU); gsl_linalg_LQ_unpack(&m_LQ, &v_TAU, &m_Q, &m_L); return Val_unit; }
int gsl_linalg_PTLQ_decomp2 (const gsl_matrix * A, gsl_matrix * q, gsl_matrix * r, gsl_vector * tau, gsl_permutation * p, int *signum, gsl_vector * norm) { const size_t N = A->size1; const size_t M = A->size2; if (q->size1 != M || q->size2 !=M) { GSL_ERROR ("q must be M x M", GSL_EBADLEN); } else if (r->size1 != N || r->size2 !=M) { GSL_ERROR ("r must be N x M", GSL_EBADLEN); } else if (tau->size != GSL_MIN (M, N)) { GSL_ERROR ("size of tau must be MIN(M,N)", GSL_EBADLEN); } else if (p->size != N) { GSL_ERROR ("permutation size must be N", GSL_EBADLEN); } else if (norm->size != N) { GSL_ERROR ("norm size must be N", GSL_EBADLEN); } gsl_matrix_memcpy (r, A); gsl_linalg_PTLQ_decomp (r, tau, p, signum, norm); /* FIXME: aliased arguments depends on behavior of unpack routine! */ gsl_linalg_LQ_unpack (r, tau, q, r); return GSL_SUCCESS; }
/** * C++ version of gsl_linalg_LQ_unpack(). * @param LQ A matrix * @param tau A vector * @param Q A matrix * @param L A matrix * @return Error code on failure */ inline int LQ_unpack( matrix const& LQ, vector const& tau, matrix& Q, matrix& L ){ return gsl_linalg_LQ_unpack( LQ.get(), tau.get(), Q.get(), L.get() ); }