示例#1
0
CAMLprim value ml_gsl_multimin_fdfminimizer_minimum(value ox, value odx, value og, value T)
{
  gsl_multimin_fdfminimizer *t=GSLMULTIMINFDFMINIMIZER_VAL(T);
  if(Is_block(ox)) {
      value x=Unoption(ox);
      _DECLARE_VECTOR(x);
      _CONVERT_VECTOR(x);
      gsl_vector_memcpy(&v_x,  
			gsl_multimin_fdfminimizer_x(t));
  }
  if(Is_block(odx)) {
      value dx=Unoption(odx);
      _DECLARE_VECTOR(dx);
      _CONVERT_VECTOR(dx);
      gsl_vector_memcpy(&v_dx,  
			gsl_multimin_fdfminimizer_dx(t));
  }
  if(Is_block(og)) {
      value g=Unoption(og);
      _DECLARE_VECTOR(g);
      _CONVERT_VECTOR(g);
      gsl_vector_memcpy(&v_g,  
			gsl_multimin_fdfminimizer_gradient(t));
  }
  return copy_double(gsl_multimin_fdfminimizer_minimum(t));
}
示例#2
0
CAMLprim value ml_gsl_multiroot_fdfsolver_get_state(value S, value ox, value of, 
					   value oj, value odx, value unit)
{
  gsl_multiroot_fdfsolver *s=GSLMULTIROOTFDFSOLVER_VAL(S);
  if(Is_block(ox)) {
      value x=Unoption(ox);
      _DECLARE_VECTOR(x);
      _CONVERT_VECTOR(x);
      gsl_vector_memcpy(&v_x,  s->x);
  }
  if(Is_block(of)) {
      value f=Unoption(of);
      _DECLARE_VECTOR(f);
      _CONVERT_VECTOR(f);
      gsl_vector_memcpy(&v_f,  s->f);
  }
  if(Is_block(odx)) {
      value dx=Unoption(odx);
      _DECLARE_VECTOR(dx);
      _CONVERT_VECTOR(dx);
      gsl_vector_memcpy(&v_dx,  s->dx);
  }
  if(Is_block(oj)) {
      value j=Unoption(oj);
      _DECLARE_MATRIX(j);
      _CONVERT_MATRIX(j);
      gsl_matrix_memcpy(&m_j,  s->J);
  }
  return Val_unit;
}
示例#3
0
CAMLprim value ml_gsl_blas_sscal(value alpha, value X)
{
    _DECLARE_VECTOR(X);
    _CONVERT_VECTOR(X);
    gsl_blas_sscal(Double_val(alpha), &v_X);
    return Val_unit;
}
示例#4
0
文件: mlgsl_bspline.c 项目: ptrf/LCDE
CAMLprim value ml_gsl_bspline_knots (value b, value w)
{
  _DECLARE_VECTOR(b);
  _CONVERT_VECTOR(b);
  gsl_bspline_knots(&v_b, Bspline_val(w));
  return Val_unit;
}
示例#5
0
文件: mlgsl_bspline.c 项目: ptrf/LCDE
CAMLprim value ml_gsl_bspline_eval (value x, value B, value w)
{
  _DECLARE_VECTOR(B);
  _CONVERT_VECTOR(B);
  gsl_bspline_eval(Double_val(x), &v_B, Bspline_val(w));
  return Val_unit;
}
示例#6
0
CAMLprim value ml_gsl_multifit_linear_svd(value wo, value x, value y, 
					  value tol, value c, value cov, 
					  value ws)
{
  size_t rank;
  double chisq;
  _DECLARE_MATRIX2(x,cov);
  _DECLARE_VECTOR2(y,c);
  _CONVERT_MATRIX2(x,cov);
  _CONVERT_VECTOR2(y,c);
  if(wo == Val_none)
    gsl_multifit_linear_svd(&m_x, &v_y, 
			    Double_val(tol), &rank,
			    &v_c, &m_cov, 
			    &chisq, MultifitWS_val(ws));
  else {
    value w=Field(wo, 0);
    _DECLARE_VECTOR(w);
    _CONVERT_VECTOR(w);
    gsl_multifit_wlinear_svd(&m_x, &v_w, &v_y, 
			     Double_val(tol), &rank,
			     &v_c, &m_cov, 
			     &chisq, MultifitWS_val(ws));
  }
  {
    CAMLparam0();
    CAMLlocal2(r, v_chisq);
    v_chisq = copy_double (chisq);
    r = alloc_small (2, 0);
    Field (r, 0) = Val_long (rank);
    Field (r, 1) = v_chisq;
    CAMLreturn(r);
  }
}
示例#7
0
文件: mlgsl_sort.c 项目: ptrf/LCDE
CAMLprim value
ml_gsl_sort_vector_largest (value dest, value v)
{
  _DECLARE_VECTOR(v);
  _CONVERT_VECTOR(v);
  gsl_sort_vector_largest (Double_array_val (dest), Double_array_length (dest), &v_v);
  return Val_unit;
}
示例#8
0
文件: mlgsl_sort.c 项目: ptrf/LCDE
CAMLprim value
ml_gsl_sort_vector (value v)
{
  _DECLARE_VECTOR(v);
  _CONVERT_VECTOR(v);
  gsl_sort_vector (&v_v);
  return Val_unit;
}
示例#9
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;
}
示例#10
0
CAMLprim value ml_gsl_linalg_cholesky_decomp_unit(value CHO, value D)
{
  _DECLARE_MATRIX(CHO);
  _DECLARE_VECTOR(D);
  _CONVERT_MATRIX(CHO);
  _CONVERT_VECTOR(D);
  gsl_linalg_cholesky_decomp_unit(&m_CHO, &v_D);
  return Val_unit;
}
示例#11
0
CAMLprim value ml_gsl_linalg_cholesky_svx(value CHO, value X)
{
  _DECLARE_MATRIX(CHO);
  _DECLARE_VECTOR(X);
  _CONVERT_MATRIX(CHO);
  _CONVERT_VECTOR(X);
  gsl_linalg_cholesky_svx(&m_CHO, &v_X);
  return Val_unit;
}
示例#12
0
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;
}
示例#13
0
CAMLprim value ml_gsl_linalg_LQ_Lsvx_T(value LQ, value X)
{
  _DECLARE_MATRIX(LQ);
  _DECLARE_VECTOR(X);
  _CONVERT_MATRIX(LQ);
  _CONVERT_VECTOR(X);
  gsl_linalg_LQ_Lsvx_T(&m_LQ, &v_X);
  return Val_unit;
}
示例#14
0
文件: mlgsl_sort.c 项目: ptrf/LCDE
CAMLprim value
ml_gsl_sort_vector_largest_index (value p, value v)
{
  GSL_PERMUT_OF_BIGARRAY(p);
  _DECLARE_VECTOR(v);
  _CONVERT_VECTOR(v);
  gsl_sort_vector_largest_index (perm_p.data, perm_p.size, &v_v);
  return Val_unit;
}
示例#15
0
/* Tridiagonal Decomposition of Real Symmetric Matrices */
CAMLprim value ml_gsl_linalg_symmtd_decomp(value A, value TAU)
{
  _DECLARE_MATRIX(A);
  _DECLARE_VECTOR(TAU);
  _CONVERT_MATRIX(A);
  _CONVERT_VECTOR(TAU);
  gsl_linalg_symmtd_decomp(&m_A, &v_TAU);
  return Val_unit;
}
示例#16
0
CAMLprim value ml_gsl_linalg_QR_Rsvx(value QR, value X)
{
  _DECLARE_MATRIX(QR);
  _DECLARE_VECTOR(X);
  _CONVERT_MATRIX(QR);
  _CONVERT_VECTOR(X);
  gsl_linalg_QR_Rsvx(&m_QR, &v_X);
  return Val_unit;
}
示例#17
0
CAMLprim value ml_gsl_linalg_SV_decomp_jacobi(value A, value V, value S)
{
  _DECLARE_MATRIX2(A, V);
  _DECLARE_VECTOR(S);
  _CONVERT_MATRIX2(A, V);
  _CONVERT_VECTOR(S);
  gsl_linalg_SV_decomp_jacobi(&m_A, &m_V, &v_S);
  return Val_unit;
}
示例#18
0
CAMLprim value ml_gsl_linalg_QR_unpack(value QR, value TAU, value Q, value R)
{
  _DECLARE_MATRIX3(QR, Q, R);
  _DECLARE_VECTOR(TAU);
  _CONVERT_MATRIX3(QR, Q, R);
  _CONVERT_VECTOR(TAU);
  gsl_linalg_QR_unpack(&m_QR, &v_TAU, &m_Q, &m_R);
  return Val_unit;
}
示例#19
0
CAMLprim value ml_gsl_multiroot_fdfsolver_root(value S, value r)
{
  CAMLparam2(S,r);
  gsl_vector *root;
  _DECLARE_VECTOR(r);
  _CONVERT_VECTOR(r);
  root=gsl_multiroot_fdfsolver_root(GSLMULTIROOTFDFSOLVER_VAL(S));
  gsl_vector_memcpy(&v_r, root);
  CAMLreturn(Val_unit);
}
示例#20
0
CAMLprim value ml_gsl_linalg_LU_svx(value LU, value P, value X)
{
  GSL_PERMUT_OF_BIGARRAY(P);
  _DECLARE_MATRIX(LU);
  _DECLARE_VECTOR(X);
  _CONVERT_MATRIX(LU);
  _CONVERT_VECTOR(X);
  gsl_linalg_LU_svx(&m_LU, &perm_P, &v_X);
  return Val_unit;
}
示例#21
0
CAMLprim value ml_gsl_linalg_PTLQ_Lsvx_T (value LQ, value P, value X)
{
  _DECLARE_MATRIX(LQ);
  _DECLARE_VECTOR(X);
  GSL_PERMUT_OF_BIGARRAY(P);
  _CONVERT_MATRIX(LQ);
  _CONVERT_VECTOR(X);
  gsl_linalg_PTLQ_Lsvx_T (&m_LQ, &perm_P, &v_X);
  return Val_unit;
}
示例#22
0
CAMLprim value ml_gsl_linalg_QRPT_Rsvx(value QR, value P, value X)
{
  GSL_PERMUT_OF_BIGARRAY(P);
  _DECLARE_MATRIX(QR);
  _DECLARE_VECTOR(X);
  _CONVERT_MATRIX(QR);
  _CONVERT_VECTOR(X);
  gsl_linalg_QRPT_Rsvx(&m_QR, &perm_P, &v_X);
  return Val_unit;
}
示例#23
0
CAMLprim value ml_gsl_blas_ssyr(value uplo ,value alpha, value X, value A)
{
    _DECLARE_MATRIX(A);
    _DECLARE_VECTOR(X);
    _CONVERT_MATRIX(A);
    _CONVERT_VECTOR(X);
    gsl_blas_ssyr(CBLAS_UPLO_val(uplo), Double_val(alpha),
                  &v_X, &m_A);
    return Val_unit;
}
示例#24
0
CAMLprim value ml_gsl_blas_strsv(value uplo, value transa, value diag,
                                 value A, value X)
{
    _DECLARE_MATRIX(A);
    _DECLARE_VECTOR(X);
    _CONVERT_MATRIX(A);
    _CONVERT_VECTOR(X);
    gsl_blas_strsv(CBLAS_UPLO_val(uplo), CBLAS_TRANS_val(transa),
                   CBLAS_DIAG_val(diag), &m_A, &v_X);
    return Val_unit;
}
示例#25
0
CAMLprim value ml_gsl_multimin_fminimizer_minimum(value ox, value T)
{
  gsl_multimin_fminimizer *t=GSLMULTIMINFMINIMIZER_VAL(T);
  if(Is_block(ox)) {
      value x=Unoption(ox);
      _DECLARE_VECTOR(x);
      _CONVERT_VECTOR(x);
      gsl_vector_memcpy(&v_x, gsl_multimin_fminimizer_x(t));
  }
  return copy_double(gsl_multimin_fminimizer_minimum(t));
}
示例#26
0
CAMLprim value ml_gsl_multiroot_fsolver_set(value S, value fun, value X)
{
  CAMLparam2(S, X);
  struct callback_params *p=CALLBACKPARAMS_VAL(S);
  _DECLARE_VECTOR(X);
  _CONVERT_VECTOR(X);
  p->closure = fun;
  if(v_X.size != p->gslfun.mrf.n)
    GSL_ERROR("wrong number of dimensions for function", GSL_EBADLEN);
  gsl_multiroot_fsolver_set(GSLMULTIROOTSOLVER_VAL(S), &(p->gslfun.mrf), &v_X);
  CAMLreturn(Val_unit);
}
示例#27
0
CAMLprim value ml_gsl_multimin_fdfminimizer_set(value S, value fun, value X,
				       value step, value tol)
{
  CAMLparam2(S, X);
  struct callback_params *p=CALLBACKPARAMS_VAL(S);
  _DECLARE_VECTOR(X);
  _CONVERT_VECTOR(X);
  p->closure = fun;
  gsl_multimin_fdfminimizer_set(GSLMULTIMINFDFMINIMIZER_VAL(S), 
				&(p->gslfun.mmfdf), &v_X,
				Double_val(step), Double_val(tol));
  CAMLreturn(Val_unit);
}
示例#28
0
CAMLprim value ml_gsl_multifit_linear(value wo, value x, value y, 
				      value c, value cov, value ws)
{
  double chisq;
  _DECLARE_MATRIX2(x,cov);
  _DECLARE_VECTOR2(y,c);
  _CONVERT_MATRIX2(x,cov);
  _CONVERT_VECTOR2(y,c);
  if(wo == Val_none)
    gsl_multifit_linear(&m_x, &v_y, &v_c, &m_cov, 
			&chisq, MultifitWS_val(ws));
  else {
    value w=Field(wo, 0);
    _DECLARE_VECTOR(w);
    _CONVERT_VECTOR(w);
    gsl_multifit_wlinear(&m_x, &v_w, &v_y, &v_c, &m_cov, 
			 &chisq, MultifitWS_val(ws));
  }
  return copy_double(chisq);
}
示例#29
0
CAMLprim value ml_gsl_blas_isamax(value X)
{
    _DECLARE_VECTOR(X);
    _CONVERT_VECTOR(X);
    return Val_int(gsl_blas_isamax(&v_X));
}
示例#30
0
CAMLprim value ml_gsl_blas_sasum(value X)
{
    _DECLARE_VECTOR(X);
    _CONVERT_VECTOR(X);
    return copy_double(gsl_blas_sasum(&v_X));
}