INTERFACE PZProc; (* Miscellaneous functions and procedures *) TYPE LONG = LONGREAL; PROCEDURE Squeeze(x: LONG; epsilon, delta: LONG): LONG; (* Returns the "significant" value of "x" assuming it is contaminated by noise of absolute magnitude "epsilon" and relative magnitude "delta". I.e. the result is approximately "x/epsilon" when "ABS(x)" is small, and approximately "SGN(x)*log(ABS(x))/delta" when "ABS(x)" is large *) PROCEDURE Interpolate(t: LONG; t0, p0: LONG; t1, p1: LONG): LONG; (* Interpolates linearly the value at time "t" between values "p0" and "p1", assuming they have times "t0" and "t1". *) PROCEDURE CubicInterpolate( t: LONG; t0, p0: LONG; t1, p1: LONG; t2, p2: LONG; t3, p3: LONG; ): LONG; (* Interpolates cubically some function at time "t", assuming it has values "p0,..p3" at times "t0,..t3". *) PROCEDURE Mismatch( intgDiffSqr: LONG; (* Square difference, integrated over length *) length: LONG; (* Length of match *) maxDiffSqr: LONG; (* Maximum difference square *) ): LONG; <* UNUSED *> PROCEDURE OldMismatch( intgDiffSqr: LONG; (* Square difference, integrated over length *) length: LONG; (* Length of match *) fractality: LONG; (* Fractality exponent *) ): LONG; (* Computes a `mismatch measure' for the match between two segments (taken from two curves, two curvature graphs, or two symbolic curvature chains). The parameter "intgDiffSqr" must be the integral of some `difference' squared, over some measure of the extent of the match; and "length" must be that measure. The result is "sqrt(intgDiffSqr/length**fractality)". If "fractality = 1", this formula reduces to the root mean square difference bethween the matched values. If fractality is greater than 1, this formula favors longer matches over shorter ones, even if they have the same root mean square difference. *) PROCEDURE IntersectIntervals( aini, afin: CARDINAL; bini, bfin: CARDINAL; (*OUT*) VAR ini, fin: CARDINAL; ): BOOLEAN; (* Computes the intersection "[ini..fin]" of two index ranges "[aini..afin]" and "[bini..bfin]", taking into account that they have been reduced modulo some integer "m", and hence they may wrap around (i.e. "afin" may be less than "aini", and similarly for "bfin"/"bini".) Returns TRUE iff the intersection is non-empty. *) PROCEDURE JoinIntervals( aini, afin: CARDINAL; bini, bfin: CARDINAL; (*OUT*) VAR ini, fin: CARDINAL; ); (* Computes the join "[ini..fin]" of two simply overlapping index ranges "[aini..afin]" and "[bini..bfin]", taking into account that they have been reduced modulo some integer "m", and hence they may wrap around (i.e. "afin" may be less than "aini", and similarly for "bfin"/"bini".) *) END PZProc.