diff --git a/config.h.in b/config.h.in index aa93e9828..6b6575a85 100755 --- a/config.h.in +++ b/config.h.in @@ -83,6 +83,7 @@ #undef HAVE_READLINE_READLINE_H #undef HAVE_READLINE_HISTORY_H #undef HAVE_REGEX_H +#undef HAVE_RINTERFACE_H #undef HAVE_SIGINFO_H #undef HAVE_SIGNAL_H #undef HAVE_STDARG_H diff --git a/configure b/configure index c9aae1e93..c2e3eef13 100755 --- a/configure +++ b/configure @@ -7296,6 +7296,149 @@ test -n "$REXE" || REXE=""none"" ;; esac fi + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $REAL_INCLUDES" + +for ac_header in Rinterface.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + CFLAGS="$OLD_CFLAGS" else REAL_TARGET="dummy" ENABLE_REAL="@# " diff --git a/configure.in b/configure.in index 33721243e..cc39944e0 100755 --- a/configure.in +++ b/configure.in @@ -806,6 +806,10 @@ elif test -e "$srcdir"/packages/real/Makefile.in ; then ;; esac fi + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $REAL_INCLUDES" + AC_CHECK_HEADERS(Rinterface.h) + CFLAGS="$OLD_CFLAGS" else REAL_TARGET="dummy" ENABLE_REAL="@# " diff --git a/packages/CLPBN/clpbn/horus_ground.yap b/packages/CLPBN/clpbn/horus_ground.yap index 3c500ae62..7de683f09 100644 --- a/packages/CLPBN/clpbn/horus_ground.yap +++ b/packages/CLPBN/clpbn/horus_ground.yap @@ -52,22 +52,21 @@ call_horus_ground_solver(QueryVars, QueryKeys, AllKeys, Factors, Evidence, Output) :- - call_horus_ground_solver_for_probabilities(QueryKeys, AllKeys, Factors, Evidence, Solutions), + call_horus_ground_solver_for_probabilities([QueryKeys], AllKeys, Factors, Evidence, Solutions), clpbn_bind_vals([QueryVars], Solutions, Output). call_horus_ground_solver_for_probabilities(QueryKeys, _AllKeys, Factors, Evidence, Solutions) :- attributes:all_attvars(AVars), keys(AVars, AllKeys), -writeln(AllKeys), b_hash_new(Hash0), keys_to_ids(AllKeys, 0, Id1, Hash0, Hash1), get_factors_type(Factors, Type), evidence_to_ids(Evidence, Hash1, Hash2, Id1, Id2, EvidenceIds), factors_to_ids(Factors, Hash2, Hash, Id2, _, FactorIds), - writeln(queryKeys:QueryKeys), writeln(''), - writeln(type:Type), writeln(''), - writeln(allKeys:AllKeys), writeln(''), - sort(AllKeys,SKeys),writeln(allSortedKeys:SKeys), writeln(''), + %% writeln(queryKeys:QueryKeys), writeln(''), + %% writeln(type:Type), writeln(''), + %% writeln(allKeys:AllKeys), writeln(''), + sort(AllKeys,SKeys), %% writeln(allSortedKeys:SKeys), writeln(''), keys_to_ids(SKeys, 0, _, Hash0, Hash), % writeln(factors:Factors), writeln(''), % writeln(factorIds:FactorIds), writeln(''), @@ -95,7 +94,7 @@ run_solver(ground(Network,Hash), QueryKeys, Solutions) :- list_of_keys_to_ids(QueryKeys, Hash, _, _, _, QueryIds), %writeln(queryKeys:QueryKeys), writeln(''), %writeln(queryIds:QueryIds), writeln(''), - cpp_run_ground_solver(Network, [QueryIds], Solutions). + cpp_run_ground_solver(Network, QueryIds, Solutions). keys_to_ids([], Id, Id, Hash, Hash). @@ -167,10 +166,9 @@ finalize_horus_ground_solver(bp(Network, _)) :- % % init_horus_ground_solver(QueryVars, _AllVars, _, horus(GKeys, Keys, Factors, Evidence)) :- - trace, generate_networks(QueryVars, GKeys, [], Keys, [], Factors, [], Evidence), writeln(qvs:QueryVars), - writeln(Keys), !. + writeln(Keys), writeln(Factors), !. % % as you add query vars the network grows diff --git a/packages/CLPBN/learning/em.yap b/packages/CLPBN/learning/em.yap index 7a3196d92..0e2bb3efe 100644 --- a/packages/CLPBN/learning/em.yap +++ b/packages/CLPBN/learning/em.yap @@ -117,8 +117,6 @@ ltables([Id-T|Tables], [Key-LTable|FTables]) :- matrix_to_list(T,LTable), get_dist_key(Id, Key), ltables(Tables, FTables). - - % collect the different dists we are going to learn next. different_dists(AllVars, AllDists, AllInfo, MargVars) :- diff --git a/packages/real b/packages/real index d85532895..0acc05197 160000 --- a/packages/real +++ b/packages/real @@ -1 +1 @@ -Subproject commit d85532895fd1db2f83a1f496af41d233beb8ae53 +Subproject commit 0acc051973932430e71e4f57c8c92c7d6cd114a8