示例#1
0
int
gsl_linalg_QR_solve (const gsl_matrix * QR, const gsl_vector * tau, 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 != 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
    {
      /* Copy x <- b */

      gsl_vector_memcpy (x, b);

      /* Solve for x */

      gsl_linalg_QR_svx (QR, tau, x);

      return GSL_SUCCESS;
    }
}
示例#2
0
CAMLprim value ml_gsl_linalg_QR_svx(value QR, value TAU, value X)
{
  _DECLARE_MATRIX(QR);
  _DECLARE_VECTOR2(TAU, X);
  _CONVERT_MATRIX(QR);
  _CONVERT_VECTOR2(TAU, X);
  gsl_linalg_QR_svx(&m_QR, &v_TAU, &v_X);
  return Val_unit;
}
示例#3
0
 /**
  * C++ version of gsl_linalg_QR_svx().
  * @param QR A QR decomposition
  * @param tau A vector
  * @param x A vector
  * @return Error code on failure
  */
 inline int QR_svx( matrix const& QR, vector const& tau, vector& x ){
   return gsl_linalg_QR_svx( QR.get(), tau.get(), x.get() ); }