more exo fixes.
This commit is contained in:
parent
72cc5bc317
commit
c04f04d078
2
C/exo.c
2
C/exo.c
@ -381,6 +381,8 @@ Yap_ExoLookup(PredEntry *ap USES_REGS)
|
|||||||
}
|
}
|
||||||
if (count) {
|
if (count) {
|
||||||
yamop *code = LOOKUP(i, arity, j0, LOCAL_ibnds);
|
yamop *code = LOOKUP(i, arity, j0, LOCAL_ibnds);
|
||||||
|
if (code == FAILCODE)
|
||||||
|
return code;
|
||||||
if (i->is_udi)
|
if (i->is_udi)
|
||||||
return ((CEnterExoIndex)i->udi_first)(i PASS_REGS);
|
return ((CEnterExoIndex)i->udi_first)(i PASS_REGS);
|
||||||
else return code;
|
else return code;
|
||||||
|
@ -90,7 +90,7 @@ compare(const BITS32 *ip, Int j USES_REGS) {
|
|||||||
BITS32 *sorted0, *sorted;
|
BITS32 *sorted0, *sorted;
|
||||||
|
|
||||||
/* be conservative */
|
/* be conservative */
|
||||||
sz = sizeof(BITS32)*(it->ntrys+it->nentries);
|
sz = sizeof(BITS32)*(2*it->ntrys+it->nentries);
|
||||||
/* allocate space */
|
/* allocate space */
|
||||||
if (!(it->udi_data = malloc(sz)))
|
if (!(it->udi_data = malloc(sz)))
|
||||||
return;
|
return;
|
||||||
|
@ -176,7 +176,8 @@ typedef struct index_t {
|
|||||||
BITS32 *links;
|
BITS32 *links;
|
||||||
size_t size;
|
size_t size;
|
||||||
yamop *code;
|
yamop *code;
|
||||||
void *udi_data, *udi_first, *udi_next;
|
BITS32 *udi_data;
|
||||||
|
void *udi_first, *udi_next;
|
||||||
UInt udi_arg;
|
UInt udi_arg;
|
||||||
} Index_t;
|
} Index_t;
|
||||||
|
|
||||||
|
@ -9095,11 +9095,11 @@ This package assumes you use UDI exo-indexing, that is:
|
|||||||
@end example
|
@end example
|
||||||
It is designed to optimise the following type of queries:
|
It is designed to optimise the following type of queries:
|
||||||
@example
|
@example
|
||||||
?- max(X, diagnoses(X, 9, Y)).
|
?- max(X, diagnoses(X, 9, Y), X).
|
||||||
|
|
||||||
?- min(X, diagnoses(X, 9, 36211117)).
|
?- min(X, diagnoses(X, 9, 36211117), X).
|
||||||
|
|
||||||
?- X #< Y, min(X, diagnoses(9, X, 36211117)), diagnoses(Y, 9, _).
|
?- X #< Y, min(X, diagnoses(X, 9, 36211117), X ), diagnoses(Y, 9, _).
|
||||||
@end example
|
@end example
|
||||||
The first argument gives the time, the second the patient, and the
|
The first argument gives the time, the second the patient, and the
|
||||||
third the condition code. The first query should find the last time
|
third the condition code. The first query should find the last time
|
||||||
|
@ -89,6 +89,19 @@ X #=< Y :-
|
|||||||
X =< Y
|
X =< Y
|
||||||
).
|
).
|
||||||
|
|
||||||
|
X #= Y :-
|
||||||
|
( var(X) -> insert_atts(X, i(Y-1,Y+1,_))
|
||||||
|
;
|
||||||
|
( var(Y) -> insert_atts(Y, i(X-1,X+1,_) ) ;
|
||||||
|
true
|
||||||
|
)
|
||||||
|
;
|
||||||
|
var(Y) -> insert_atts(Y, i(X-1,X+Y,_))
|
||||||
|
;
|
||||||
|
X =:= Y
|
||||||
|
).
|
||||||
|
|
||||||
|
|
||||||
attribute_goals(X) -->
|
attribute_goals(X) -->
|
||||||
{ get_attr(X, exo_interval, Op) },
|
{ get_attr(X, exo_interval, Op) },
|
||||||
( { Op = max } -> [max(X)] ;
|
( { Op = max } -> [max(X)] ;
|
||||||
|
Reference in New Issue
Block a user