Exemplo n.º 1
0
CAMLprim value ml_gsl_linalg_HH_svx(value A, value X)
{
  _DECLARE_MATRIX(A);
  _DECLARE_VECTOR(X);
  _CONVERT_MATRIX(A);
  _CONVERT_VECTOR(X);
  gsl_linalg_HH_svx(&m_A, &v_X);
  return Val_unit;
}
Exemplo n.º 2
0
int
piv_ge_solver (matrix_t *eqs)
{
	
	int i=0,j=0;
	gsl_vector *v=gsl_vector_alloc(eqs->mat->size1);
	

	for(i=0;i<eqs->mat->size1;i++)
	  gsl_vector_set(v,i,gsl_matrix_get(eqs->mat,i,eqs->mat->size2-1));
	  matrix_t *a=make_matrix(eqs->mat->size1,eqs->mat->size2-1);
	for(j=0;j<eqs->mat->size1;j++)
	  for(i=0;i<eqs->mat->size2-1;i++)
	    gsl_matrix_set(a->mat,j,i,gsl_matrix_get(eqs->mat,j,i));
	

	gsl_linalg_HH_svx(a->mat,v);

	for(i=0;i<eqs->mat->size1;i++)
	  gsl_matrix_set(eqs->mat,i,eqs->mat->size2-1,gsl_vector_get(v,i));
	
	return 0;
}
Exemplo n.º 3
0
int
gsl_linalg_HH_solve (gsl_matrix * A, const gsl_vector * b, gsl_vector * x)
{
  if (A->size1 > A->size2)
    {
      /* System is underdetermined. */

      GSL_ERROR ("System is underdetermined", GSL_EINVAL);
    }
  else if (A->size2 != x->size)
    {
      GSL_ERROR ("matrix and vector sizes must be equal", GSL_EBADLEN);
    }
  else
    {
      int status ;

      gsl_vector_memcpy (x, b);

      status = gsl_linalg_HH_svx (A, x);
      
      return status ;
    }
}
Exemplo n.º 4
0
 /**
  * C++ version of gsl_linalg_HH_svx().
  * @param A A matrix
  * @param x A vector
  * @return Error code on failure
  */
 inline int HH_svx( matrix& A, vector& x ){ return gsl_linalg_HH_svx( A.get(), x.get() ); }