#
#	Copyright 1993, Center for Computer Vision and Visualization,
#	University of Florida.  All rights reserved.
#

#
# $Log: int-conv.desc,v $
# Revision 1.7  1994/02/24  18:25:47  thoth
# You can now convolve IntDDTemplates.
#
# Revision 1.6  1994/02/12  19:36:51  thoth
# Rehack of template operation specifications.
#
# Revision 1.5  1994/01/07  15:24:53  thoth
# Template reductions had wrong ring zeros.
#
# Revision 1.4  1993/11/17  18:41:07  thoth
# forward convolutions are now supported.
# template reductions are now supported.
#
# Revision 1.3  1993/09/27  15:54:56  thoth
# Make the xxxmax_product and xxxmin_product functions a little more robust.
#
# Revision 1.2  93/09/21  11:44:32  thoth
# remove cruft that belongs in double-convolutions.desc
# 
# Revision 1.1  93/09/15  13:04:31  thoth
# Initial revision
# 
# Revision 1.3  93/05/27  11:41:13  thoth
# Copyright Notices
# 
# Revision 1.2  93/05/18  21:44:57  thoth
# New more descriptive names for standard convolutions.
# 
# Revision 1.1  93/03/18  11:23:20  thoth
# Initial revision
# 

convolution linear_product T(int) T(int) T(int)
end

convolution linear_product zero=0 I(int) I(int) T(int)
init:	RTYPE	a = ZERO;
accum:	a += IVAL * TVAL;
final:	IRESULT = a;
end

convolution linear_product zero=0 I(int) T(int) I(int)
init:	RTYPE	a = ZERO;
accum:	a += IVAL * TVAL;
final:	IRESULT = a;
accvar:	IRESULT += IVAL * TVAL;
end

# we have to be careful doing the following transforms
# machine integers are NOT mathematical integers...

convolution addmax_product zero=-MAXINT I(int) I(int) T(int)
init:	RTYPE	a=ZERO;
accum:	register IBTYPE ival = IVAL; if (ival == ZERO) continue; RTYPE temp = IVAL+TVAL; if (temp > a) a = temp;
final:	IRESULT = a;
end

convolution addmax_product zero=-MAXINT I(int) T(int) I(int)
init:	RTYPE	a=ZERO;
accum:	register IBTYPE ival = IVAL; if (ival == ZERO) continue; RTYPE temp = IVAL+TVAL; if (temp > a) a = temp;
final:	IRESULT = a;
accvar:	RTYPE temp = IVAL + TVAL; if (temp > IRESULT) IRESULT = temp;
end

#

convolution addmin_product zero=MAXINT I(int) I(int) T(int)
init:	RTYPE	a=ZERO;
accum:	register IBTYPE ival = IVAL; if (ival == ZERO) continue; RTYPE temp = ival+TVAL; if (temp < a) a = temp;
accvar:	RTYPE temp = IVAL+TVAL; if (temp < a) a = temp;
final:	IRESULT = a;
end

convolution addmin_product zero=MAXINT I(int) T(int) I(int)
init:	RTYPE	a=ZERO;
accum:	register IBTYPE ival = IVAL; if (ival == ZERO) continue; RTYPE temp = ival+TVAL; if (temp < a) a = temp;
final:	IRESULT = a;
accvar:	RTYPE temp = IVAL + TVAL; if (temp < IRESULT) IRESULT = temp;
end

#

convolution multmax_product zero=-1 I(int) I(int) T(int)
init:	RTYPE	a=ZERO;
accum:	register IBTYPE	ival = IVAL; if (ival<0) continue; RTYPE temp = ival*TVAL; if (temp>a) a = temp;
accvar:	RTYPE temp = IVAL*TVAL; if (temp>a) a = temp;
final:	IRESULT = a;
end

convolution multmax_product zero=-1 I(int) T(int) I(int)
init:	RTYPE	a=ZERO;
accum:	register IBTYPE	ival = IVAL; if (ival<0) continue; RTYPE temp = ival*TVAL; if (temp>a) a = temp;
final:	IRESULT = a;
accvar:	RTYPE temp = IVAL * TVAL; if (temp > IRESULT) IRESULT = temp;
end

#

convolution multmin_product zero=-1 I(int) I(int) T(int)
init:	RTYPE	a=MAXINT;
accum:	register IBTYPE	ival = IVAL; if (ival<0) continue; RTYPE temp = ival*TVAL; if (temp<a) a = temp;
accvar:	RTYPE temp = IVAL*TVAL; if (temp<a) a = temp;
final:	IRESULT = a;
end

convolution multmin_product zero=-1 I(int) T(int) I(int)
init:	RTYPE	a=MAXINT;
accum:	register IBTYPE	ival = IVAL; if (ival<0) continue; RTYPE temp = ival*TVAL; if (temp<a) a = temp;
final:	IRESULT = a;
accvar:	if (IVAL ==ZERO) continue; RTYPE temp = IVAL * TVAL; if (temp < IRESULT) IRESULT = temp;
end

#
#

reduction sum zero=0 I(int) T(int)
accum:	IRESULT += TVAL;
end

reduction max zero=-MAXINT I(int) T(int)
accum:	if (TVAL>IRESULT) IRESULT = TVAL;
end

reduction min zero=MAXINT I(int) T(int)
accum:	if (TVAL<IRESULT) IRESULT = TVAL;
end


binary operator+ zero=0 gamma=sum T(int) T(int) T(int)
binary min zero=MAXINT gamma=min T(int) T(int) T(int)
binary max zero=-MAXINT gamma=max T(int) T(int) T(int)
# convolution linear_product zero=0 gamma=sum circle=product T(int) T(int) T(int)
