SCM scm_inv_cdf_normal(SCM sm, SCM ssd, SCM sp) { SCM_ASSERT(gh_number_p(sm), sm, SCM_ARG1, "inv-cdf-normal"); SCM_ASSERT(gh_number_p(ssd), ssd, SCM_ARG2, "inv-cdf-normal"); SCM_ASSERT(gh_number_p(sp), sp, SCM_ARG3, "inv-cdf-normal"); double m = gh_scm2double(sm); double sd = gh_scm2double(ssd); double p = gh_scm2double(sp); double x = inv_normal_cdf(m,sd,p); return gh_double2scm(x); }
SCM scm_cdf_normal(SCM sm, SCM ssd, SCM sx) { SCM_ASSERT(gh_number_p(sm), sm, SCM_ARG1, "cdf-normal"); SCM_ASSERT(gh_number_p(ssd), ssd, SCM_ARG2, "cdf-normal"); SCM_ASSERT(gh_number_p(sx), sx, SCM_ARG3, "cdf-normal"); double m = gh_scm2double(sm); double sd = gh_scm2double(ssd); double x = gh_scm2double(sx); double p = normal_cdf(m,sd,x); return gh_double2scm(p); }
SCM scm_inv_cdf_chi_square(SCM sdf, SCM sp) { SCM_ASSERT(gh_exact_p(sdf), sdf, SCM_ARG1, "inv-cdf-chi-square"); SCM_ASSERT(gh_number_p(sp), sp, SCM_ARG2, "inv-cdf-chi-square"); int df = gh_scm2int(sdf); double p = gh_scm2double(sp); double x = inv_chi_square_cdf(df,p); return gh_double2scm(x); }
SCM scm_cdf_chi_square(SCM sdf, SCM sx) { SCM_ASSERT(gh_exact_p(sdf), sdf, SCM_ARG1, "cdf-chi-square"); SCM_ASSERT(gh_number_p(sx), sx, SCM_ARG2, "cdf-chi-square"); int df = gh_scm2int(sdf); double x = gh_scm2double(sx); double p = chi_square_cdf(df,x); return gh_double2scm(p); }
SCM scm_cdf_t(SCM sdf, SCM sx) { SCM_ASSERT(gh_exact_p(sdf), sdf, SCM_ARG1, "cdf-t"); SCM_ASSERT(gh_number_p(sx), sx, SCM_ARG2, "cdf-t"); int df = gh_scm2int(sdf); double x = gh_scm2double(sx); double p = t_cdf(df,x); return gh_double2scm(p); }
SCM scm_inv_cdf_F(SCM sdf1, SCM sdf2, SCM sp) { SCM_ASSERT(gh_exact_p(sdf1), sdf1, SCM_ARG1, "inv-cdf-F"); SCM_ASSERT(gh_exact_p(sdf2), sdf2, SCM_ARG2, "inv-cdf-F"); SCM_ASSERT(gh_number_p(sp), sp, SCM_ARG3, "inv-cdf-F"); int df1 = gh_scm2int(sdf1); int df2 = gh_scm2int(sdf1); double p = gh_scm2double(sp); double x = inv_F_cdf(df1,df2,p); return gh_double2scm(x); }
SCM scm_cdf_F(SCM sdf1, SCM sdf2, SCM sx) { SCM_ASSERT(gh_exact_p(sdf1), sdf1, SCM_ARG1, "cdf-F"); SCM_ASSERT(gh_exact_p(sdf2), sdf2, SCM_ARG2, "cdf-F"); SCM_ASSERT(gh_number_p(sx), sx, SCM_ARG3, "cdf-F"); int df1 = gh_scm2int(sdf1); int df2 = gh_scm2int(sdf1); double x = gh_scm2double(sx); double p = F_cdf(df1,df2,x); return gh_double2scm(p); }
SCM scm_cdf_neg_binomal(SCM sk, SCM sn, SCM sx) { SCM_ASSERT(gh_exact_p(sk), sk, SCM_ARG1, "cdf-neg-binomial"); SCM_ASSERT(gh_exact_p(sn), sn, SCM_ARG2, "cdf-neg-binomial"); SCM_ASSERT(gh_number_p(sx), sx, SCM_ARG3, "cdf-neg-binomial"); int k = gh_scm2int(sk); int n = gh_scm2int(sn); double x = gh_scm2double(sx); double p = neg_binomial_cdf(k,n,x); return gh_double2scm(p); }
int building_create_type(const char* name, SCM lst) { AList alist; while(!gh_null_p(lst)) { SCM key = gh_car(lst); if (gh_null_p(gh_cdr(lst))) { std::cout << "Missing argument to keyword!" << std::endl; } SCM value = gh_cadr(lst); if (gh_boolean_p(value)) { alist.set_bool(Guile::keyword2string(key), gh_scm2bool(value)); } else if (gh_number_p(value)) { alist.set_int(Guile::keyword2string(key), gh_scm2int(value)); } else if (gh_string_p(value)) { alist.set_string(Guile::keyword2string(key), Guile::scm2string(value)); } else { std::cout << "BuildingCommands: unknown argumnent type" << std::endl; } lst = gh_cddr(lst); } return BuildingTypeManager::current()->register_factory(new CustomBuildingFactory(name, alist)); }