incr_set prlevel 1
if #0=4 START
incr_set prlevel -1
;;; Usage:
;;;   <check_exact w v1 v2 flag
;;; Checks whether the complex given by the triple (w,v1,v2)
;;; is acyclic.  If it is, then the flag is set to 0, other-
;;; wise it is set to the step in the resolution where exact-
;;; ness fails
;;;
incr_set prlevel 1
jump END
;;; Parameters: (w,v1,v2) a matrix of arrays
;;;
;;; The Array of Matrices Data Type:
;;;
;;; An array of matrices is a triple (M,v1,v2) of matrices.
;;; The first coordinate is a direct sum of matrices such
;;; that the upper left hand corner is thought of as the
;;; first matrix, and so on.
;;;
;;; The second coordinate is an n by 0 matrix whose row
;;; degrees give the ranks of the free modules which are
;;; the sources of the maps.
;;;
;;; The third coordinate is an n by 0 matrix whose row de-
;;; grees give the ranks of the free modules which are the
;;; targets of the maps.
;;;
;;; Output values: flag set to 0 if the complex
;;;                     is exact, to the step at
;;;                     which exactness fails
;;;                     otherwise.
; created ... 3/25/92
START:

int @i 0
nrows #2 @length

LOOP1:
	int @i @i+1
	if @i>@length EXACT
	row_degree #2 @i @ranka
	row_degree #3 @i+1 @rankb
	if @ranka>@rankb NOTCOMPLEX
	if @ranka<@rankb NOTCOMPLEX
	<homology_of_array #1 #2 #3 @i @H
	<is_zero @H @flag
	if @flag=0 LOOP1

int #4 @i
jump CLEANUP

NOTCOMPLEX:
	shout echo not a complex
	jump CLEANUP
EXACT:
	int #4 0
CLEANUP:

kill @i @flag @H @length @ranka @rankb

END:
incr_set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;

<2byn 1 2 0 2 1 0 2 0 M I
<eagon_northcott M w v1 v2
<check_exact w v1 v2 flag
type flag
