Convex $(0,1)$-Matrices and Their Epitopes

We investigate $(0,1)$-matrices that are {\em convex}, which means that the ones are consecutive in every row and column. These matrices occur in discrete tomography. The notion of ranked essential sets, known for permutation matrices, is extended to convex sets. We show a number of results for the class $\mc{C}(R,S)$ of convex matrices with given row and column sum vectors $R$ and $S$. Also, it is shown that the ranked essential set uniquely determines a matrix in $\mc{C}(R,S)$.


Introduction
Mathematical reconstruction problems arise in the area of image analysis, and discrete tomography ( [1,2,4,5]) is such a field where combinatorics plays a major role. A (0, 1)-matrix then represents an image with black-white pixels, and the row and column sums count the number of black pixels in that line. Within this framework convex matrices, i.e., those with consecutive ones, are interesting. In this paper we study several questions for such convex matrices. In particular, we study so-called ranked essential sets for convex matrices.
Example 1.2. This next example stresses that, not surprisingly, the ordering of the components of R and S is important for the nonemptiness of C(R, S). Let R = S = (2, 2, 1). Then we have the convex matrices Now let R = S = (2, 1, 2). Then, as is easily checked, C(R, S) = ∅. Note that the a matrix whose 1's form a Ferrers diagram (the maximal matrix of Ryser when R and S are nondecreasing) is convex.
As mentioned, it is an NP-complete problem to determine whether a class C(R, S) is nonempty, but a goal of this paper is to characterize this property in terms of R and S for certain subclasses of C m,n (R, S).
An epitope 1 of A(R, S) is any information that determines uniquely a matrix that is known to be in A(R, S). Trivially the positions of all but one of the 1's of an A ∈ A(R, S) is an epitope of A(R, S). But knowing the position of all but two 1's is not an epitope in general, as seen with R = (1, 1) = S and the matrices 1 0 0 1 and 0 1 1 0 .
In fact, any two matrices in A(R, S) can be obtained from one another by a sequence of interchanges which replace any 2 × 2 submatrix equal to one of these with the other.
Let m = n and R = S = (1, 1, . . . , 1). Then A(R, S) is the set P n of n × n permutation matrices. In [9] Fulton determined an epitope of P n called the ranked essential set obtained as follows. For each 1 of P ∈ P n shade (or delete) all the positions from the 1 and eastwards and from the 1 and southwards leaving the diagram of P . The essential set of P is the set of southeast corners of the connected components of the unshaded squares of the diagram. For example, if then, using the above description, we have P : where the essential set consists of the squares with a ⋆ which are then replaced by the number of 1's in the northwest submatrix they determine (equivalently, the rank of the northwest submatrix); recall that the shaded squares are considered deleted. Fulton shows that a permutation matrix is determined by these rank numbers and their locations, the ranked essential set, and that in general none of these can be omitted. For emphasis we remark that the ranked essential set determines P with the knowledge that P is an n × n permutation matrix, that is, an n × n (0, 1)-matrix with exactly one 1 in each row and column. The ranked essential set in (1) is given by {(2, 1; 0), (2, 4; 1), (5, 3; 2)} where the first two entries in each triple specify the location and the last entry specifies the corresponding rank. These triples determine the locations of the 1's of the permutation matrix P and thus the ranked essential set is an epitope for the classes A(R, S) when R = S = (1, 1, . . . , 1). In [8] an algorithm is given that determines a permutation matrix from its ranked essential set. We show that this algorithm works also for a collection of "convex matrices" which we call generalized polyominos. In [8] it is also shown that a permutation matrix is determined by the rank function on a subset of its essential set called its core where the core has size at most n. Thus the core is also an epitope for these classes. In [7] it is proved that the average size of the essential set of an n × n permutation matrix is asymptotic to n 2 36 . The only permutation matrix in P n with an empty essential set is the identity matrix. If the essential set has size more than n, then the permutation matrix itself is a more compact representation. Therefore, classes of permutation matrices with "small" ranked essential sets are interesting.
In [10] it is shown that bigrassmannians are characterized by having their essential sets of cardinality 1. In [8] it is shown that grassmannians are characterized by having a row-linear essential set and so we get again that bigrassmannians are characterized by having their essential sets of cardinality 1 (apply the transpose operation to get the permutation matrix corresponding to the inverse).
The remaining paper is organized as follows. Section 2 considers convex sets and extends the definition of ranked essential sets to that class. It is shown that the ranked essential set determines a matrix in C(R, S) uniquely, and an algorithm for doing this is given. Next, Section 3 is devoted to subclasses of C(R, S) and characterizations of when these classes are nonempty. Section 4 concerns interchanges that preserve convexity and A(R, S) classes with only convex matrices. Finally, in Section 5, we discuss a natural partial order on the class of m × n convex matrices.
Notation: By a line of a matrix, we mean either a row or a column. The k × l matrix of all 1's is denoted by J k,l , abbreviated to J k if l = k.
2 Convex (0, 1)-matrices and ranked essential sets We discuss convex matrices and introduce their ranked essential sets. A (0, 1)-matrix A is called connected provided that (i) it does not have any zero rows or zero columns, and (ii) every pair of 1's is connected by a rookwise path of either row adjacent or column adjacent 1's.
To say that a (0, 1)-matrix is connected is equivalent to saying that it is the biadjacency matrix of a connected bipartite graph, in particular, it does not have any isolated vertices. We now show that the essential set is an epitope of a polyomino in A(R, S). We refer to [2] for information about convex (0, 1)-matrices for these and the definitions to follow. A polyomino is a connected, convex (0, 1)-matrix 2 . A southeast source, abbreviated to SE-source, of a (0, 1)-matrix is a 1 such that every other 1 is reachable from it by a southeast rookwise path of row adjacent or column adjacent 1's. NE-sources, NW-sources, and SW-sources are define analogously. When such sources exist, they are clearly unique. The matrix A is directed provided it has a source of at least one of these types. Since under 90 degree rotations, a source of one type becomes a source of another type, without loss of generality one may assume that a source is a SE-source. If A is directed and does not have any zero rows or zero columns, then clearly A is connected. A connected (0, 1)-matrix A does not have zero rows or zero columns, and hence if A has a SE-source, it must be a 1 in position (1, 1).
The first convex matrix in Example 1.1 is neither connected nor directed; the second is a directed polyomino with a NW-source and a SW-source The following theorem is from [14] (see also [2]).
Theorem 2.1. A directed, convex matrix A in A(R, S) is uniquely determined by its source and can be reconstructed in O(mn) time. In particular, a polyomino known to be in a class A(R, S) which has a 1 in position (1, 1) (or (1, n) or (m, 1) or (m, n)) is uniquely determined.
Example 2.2. If the row and column sum vectors R and S do not have any zeros, then the only possibility for a source is a 1 in one of the corner positions, and each such 1 is a source. Let R = (1, 3, 4, 3, 1) and S = (1, 2, 4, 3, 2). Then the two matrices both belong to C(R, S) where A 1 does not have a source but A 2 has a NW-source. Thus A 2 is uniquely constructable from R and S and its source in position (5,5).
We can define the essential set and ranked essential set for any m × n (0, 1)matrix A as for permutation matrices: For each 1 of A shade (or cross out) its row to the east and its column to the south (including the 1 itself). This gives the diagram of A, defined as the set of unshaded positions. The essential set of A is the set of southeast corners of the connected components of the diagram of A. In each element of the essential set put the number of 1's in the leading submatrix it determines (that is, the number of 1's in northeast submatrix with the specified element of the essential set in its southeast corner). These corner positions and their numbers give the ranked essential set. Example 2.3. Consider the polyomino A 2 in Example 1.1 with row sum vector R = (5, 2, 2, 3, 3, 1) and column sum vector S = (2, 2, 5, 4, 1, 1, 1). Then its ranked essential set is easily computed to be {(3, 2; 0), (4, 1; 0)}. Any convex matrix in C(R, S) with this ranked essential set equals A 2 ; see below.
We define a Ferrers array F to be a left-justified array of positions where the number of positions in the rows form a nonincreasing vector U. Thus, F is uniquely defined by U, and we write F = F (U). Theorem 2.4. Let A be a polyomino of size m × n. Then the diagram of A is a Ferrers array F. Its ranked essential set consists of the positions of the lower right corners of F each filled with a 0. A polyomino A ∈ C m,n (R, S) is uniquely determined by its ranked essential set.
Proof. Let A = [a ij ]. Since every row and column contains a 1, there exist a smallest i and a smallest j such that a i1 = a 1j = 1. Also, as A is connected and convex, the leftmost 1 in the first i rows determine a northeast rookwise path P 1 from (i, 1) to (1, j) (possibly, it only consists of (1, 1)). There is also a smallest k such that a mk = 1 and a southeast rookwise path P 2 from (i, 1) to position (m, k). Clearly, the only positions in A that remain after crossing out the row to the east and column to the south of the 1's in P 1 ∪ P 2 are the positions northwest of the path P 1 , and these positions form a Ferrers array F and give the diagram of A. The lower right corners of F constitute the essential set of A, and the ranked essential set has 0's in all of these positions. Thus all the entries of A in the positions of the diagram F equal 0. Moreover, the essential set also determines the diagram F . Then each position in A adjacent to F in a row or column is a 1. Now with convexity, connectivity, and R and S, the remaining positions of A are determined.
Corollary 2.5. The ranked essential set is an epitope of a polyomino in A(R, S).
Corollary 2.6. The essential set of a polyomino A is empty if and only if A has a SE-source.
Proof. If the essential set of A is empty, then clearly A has a 1 in position (1, 1) and thus a SE-source. Conversely, assume that A has a SE-source which is necessarily a 1 in position (1, 1). Then the associate Ferrers array, that is, its essential set is empty.
Example 2.7. Below is the matrix A 2 from Example 1.1 and its ranked essential set (to the left); the diagram is the unshaded area constituting a Ferrers array F . The matrix A 2 is uniquely reconstructed by first putting zeros in all the positions in the Ferrers array, and then putting ones in all positions adjacent to F . The row and column sums then determine A 2 . Here R = (5, 2, 2, 3, 3, 1) and S = (2, 2, 5, 4, 1, 1, 1).
We define a generalized polyomino to be a convex m × n (0, 1)-matrix without zero rows or zero columns. Thus, in contrast to a polyomino, a generalized polyomino may not be connected. A generalized polyomino is obtained from some k × k permutation matrix by replacing each of its 1's by a polyomino. If the 1 in row i of P is replaced by the polyomino A i (1 ≤ i ≤ k), then we denote this generalized polyomino by P (A 1 , A 2 , . . . , A k ).
where unspecified entries equal 0.
Our generalized polyomino is an 8-connected (0, 1)-convex matrix as defined in [2], but without any zero rows or columns. In the lemma below, for ease of exposition and subsequent examples, we now consider the diagram of an m × n (0, 1)-matrix A to be an m × n array (rather than just a subset of positions of an array) whose unshaded positions are what we called previously the diagram of A; so the diagram is considered as an m × n array of positions some of which are unshaded. The following lemma is straightforward to verify. Lemma 2.9. The diagram of the generalized polyomino P (A 1 , A 2 , . . . , A k ) is obtained from the diagram of P by replacing its shaded zeros with appropriately sized shaded arrays, its unshaded zeros with appropriately unshaded arrays, and its ones with the corresponding diagram of the A i 's. its ranked essential set is as specified in  where the shaded X's are matrices of appropriate sizes with all other positions shaded.
Example 2.11. Consider the generalized polyomino P (A 1 , A 2 ), with P = I 2 , R = (2, 2, 2, 1, 1, 2), and S = (2, 2, 1, 4, 1) given by Bordering the matrix by its row sum vector and column sum vector for visual ease, we see that the essential set and ranked essential set are specified in  We show how A can be constructed from R, S, and the ranked essential set. Using convexity and the ranked essential set as determined above, it is not hard to first get  As another example, the generalized polyomino with specified ranked essential set given by We now extend the algorithm given in [8] (for permutation matrices) to generalized polyominoes. Let A be an m × n generalized polyomino in C(R, S). We use the entrywise partial order on positions defined by (i, j) ≤ (k, l) provided i ≤ k and j ≤ l.
Algorithm to reconstruct a generalized polyomino in C(R, S) from its ranked essential set 0. Input: The nonnegative, integral vectors R, S (with the same sum) and a candidate ranked essential set, i.e., some set (possibly empty) of positions of an m × n matrix E and a corresponding nonnegative number in each of these positions, and an m × n matrix A with all positions initially empty.
1. Alternate between applying the following steps below to E and A until either all entries of A have been determined, or some entry of E in a position of the essential set has become negative.
1a. For each position (i, j) in the essential set equal to 0, put a 0 in each position (k, l) with (k, l) ≤ (i, j) and then remove those positions from further consideration, including the positions of the essential set containing a 0.
1b. Put a 1 in a minimal (in the partial order) position (p, q) of A and decrease by 1 the remaining positions (u, v) of the essential set with (u, v) ≥ (p, q).
Repeat until all minimal positions have a 1. If a row or column has the correct sum, fill in the remaining positions of that row or column with zeros.
2. If some entry of E has become negative, the given set is not a ranked essential set of a generalized polyomino; otherwise, output A.
The following theorem generalizes Theorem 2.1.
Theorem 2.12. The function that maps a matrix in C m,n (R, S) into its ranked essential set is injective. Moreover, the algorithm above reconstructs A ∈ C m,n (R, S) from its ranked essential set in O(mn) time.
Proof. The proof is by induction on the number m + n of lines. Let f denote the function defined on C m,n (R, S) that maps a matrix A ∈ C m,n (R, S) into its ranked essential set f (A) = E.
Consider first the case when E is empty.
. Then a 11 = 1 (otherwise (1, 1) would be in the diagram and E would be nonempty), and the first row and column are determined by convexity (r 1 and s 1 ones, respectively, followed by zeros). Then the first r 1 columns and the first s 1 rows are also determined by convexity. We continue like this until A is partially determined, uniquely, as a direct sum A = A 1 ⊕ A 2 . Here A 2 has smaller size than A, and by induction it is uniquely determined by its ranked essential set, which must be empty. Therefore A is uniquely determined, i.e., |f −1 (E)| = 1, as desired. (We see that, in the case of an empty essential set of a generalized polyomino A, the corresponding permutation matrix P is an identity matrix.) Next, assume E is nonempty. Let (k, l) be a minimal element in the entrywise partial order of our ranked essential set and let r be its rank. We consider two cases, namely r ≥ 1 and r = 0.
If r ≥ 1, then a 11 = 1 and we can argue as in the previous paragraph and uniquely fill in ones and zeros by convexity. Note that each such 1 must be in some position (i, j) where i < k and j < l because any matrix A with E = f (A) has zeros in row k and column l up to position (k, l). Therefore A is a direct sum A = A 1 ⊕ A 2 and we are done by induction as in the previous paragraph. Note that the rank associated with each position of the essential set in the region occupied by A 2 is reduced by r.
Next, consider the case r = 0. Let F be the set of positions (i, j) ≤ (p, q) for some minimal position (p, q) in the minimal essential set with rank 0. Then F is the set of positions of a Ferrers array, and a ij = 0 for every (i, j) ∈ F and every A = [a ij ] ∈ f −1 (E). Next, all the positions adjacent to F are uniquely determined by convexity and line sums. Then A is a direct sum and we proceed by induction as above. This proves that the function f is injective, and the first part of the theorem holds.
The correctness of the algorithm is seen from the arguments above, because the uniquely determined parts of the matrix are given values as in the algorithm. So, if E = f (A) for some A ∈ C m,n (R, S), the algorithms computes A. If the algorithm stops and does not return any matrix in C m,n (R, S), no such matrix exists for the given set E. That the number of steps is O(mn) is clear from the algorithm.
Example 2.13. We apply the algorithm to the generalized polyomino P (A 1 , A 2 Note that we do not assume that P is known, only that we are dealing with a generalized polyomino with known row sum vector R = (2, 1, 1, 1, 2, 3, 1, 2) and known column sum vector S = (1, 2, 1, 3, 1, 3, 1, 1). The ranked essential set is calculated to be as specified in the initial matrix below; now it is convenient to shade the positions of the essential set E. To simplify things, we superimpose E on A, and when a position and rank of the ranked essential set has been fully taken into account, we remove its shading.
Concerning Theorem 2.12 the requirement that the row and column sums are known is essential. For instance, many different convex matrices have an empty essential set, e.g., the two matrices where the first has its ones in the first row, and the second has its ones in the first column. However, then the row and column sums do not coincide. Also, the algorithm can possibly be made more efficient in that as soon as one places a 1, then because of convexity, that row to the east, and that column to the south can be completed knowing R and S.

Subclasses and characterizations
The well-known Gale-Ryser theorem (see e.g. [3]) says that there is a (0, 1)-matrix A with given row sum vector R and column sum vector S if and only if S R * . Here denotes majorization order and R * is the conjugate of R. If one also requires that the matrix A is convex, the situation is much more complicated. In fact (see a previous remark), it is NP-complete to decide for given R and S if there is a convex (0, 1)-matrix with R and S as row and column sum vectors. The same is true for polyominos (obtained by adding the requirement of connectedness); see [15] for more on these complexity questions. With this background it is natural to ask if there are subclasses of C m,n (R, S) where it is possible to characterize when the class is nonempty. We study this question in this section.
First we consider the special case C m,n (R, S), where R = e, the all 1's vector of size m, and S = (s 1 , s 2 , . . . , s n ) is a nonnegative, integral vector. Proof. If C m,n (e, S) is nonempty, then j s j = i r i = m. Conversely, if this condition holds, construct the (0, 1)-matrix A = [a ij ] by a 11 = · · · = a s 1 ,1 = 1, a s 1 +1,2 = · · · = a s 1 +s 2 ,2 = 1 etc, while the other entries are zero. Then A ∈ C m,n (e, S).
Therefore, when R = e, convexity places no further restriction on the possible column sum vectors. Similar conclusions hold when S is the all ones vector.
Next, we consider R = ke = (k, k, . . . , k) for some natural number k ≥ 2. Here the situation is different, as the next example shows. If R = (3, 3, 3, 3, 3) and S = (4, 4, 3, 3, 1), such a permutation does not exist in this case, since there are three 1's in row 1 and three 1's in row 5, and so by convexity we must have a column of sum 5.
Let again R = ke = (k, k, . . . , k) and let A be a (0, 1)-matrix with row sum R. Then permuting rows of A does not have any effect on row or column sums, but it may affect convexity as Example 3.2 shows. We do have the following lemma. Proof. Since a convex matrix is also row convex, we only need to prove that if A m,n (R, S) contains a row convex matrix A, then there is also a convex matrix in that class. Let l i denote the position of the left-most 1 in row i of A (i ≤ m). Reorder rows in A according to increasing value of l i (i ≤ m), and let A ′ be the resulting matrix. Clearly A ′ is row-convex, and it has a staircase pattern, with k ones in every row. From this one can easily verify that it is also column convex. Thus A ′ ∈ C m,n (R, S), as desired.
Next, we consider the special case k = 2. The following result characterizes the possible column sums of convex m × n (0, 1)-matrices with two ones in every row.
Proof. Assume that the class C m,n (2e, S) is nonempty. Then j s j = i r i = 2m. Moreover, C m,n (2e, S) contains a matrix A with staircase pattern so the position of the leftmost 1 is weakly increasing by rows. Consequently there are nonnegative integers k 1 , k 2 , . . . , k n−1 such that the k 1 first rows has initial 1 in column 1, the next k 2 rows has initial 1 in column 2, etc. Since each row has two consecutive ones the column sums are given by where k 0 = k n = 0. Therefore k j = s j − k j−1 for each j and and in general k j is an alternating sign sum of s 1 , s 2 , . . . , s j Since all these numbers are nonnegative, we obtain (2). Conversely, assume n j=1 s j = 2m and (2) hold, and define k j (j ≤ n − 1) by (4). Then k j ≥ 0 (j ≤ n − 1) and, also, (3) holds. So, if we construct a staircase matrix A based on the k j 's as above, this matrix will be in C m,n (2e, S) as n j=1 s j = 2m, and the proof is complete. Example 3.5. Let k = 2 and S = (3, 2, 1). In Example 3.2 we saw that C 3,3 (2e, S) is empty. In fact, the inequalities in (2) are  Proof. Assume that m = pk and n = pl for an integer p. Then the matrix (direct sum) A = J k,l ⊕ J k,l ⊕ · · · ⊕ J k,l where J k,l occurs p times, lies in C m,n (ke, le). Next, assume that A = [a ij ] lies in C m,n (ke, le). Consider i minimal such that a i1 = 1. By convexity, a i1 = a i+1,1 = · · · = a i+k−1,1 = 1.
Therefore, again by convexity, the k×l submatrix of A containing rows i, i+1, . . . , i+ k − 1 and columns 1, 2, . . . , l equals J k,l . The remaining entries in these k rows, and in these l columns, are zero. So, deleting these k rows and l columns, we can repeat this argument. After identifying min{⌊m/k⌋, ⌊n/l⌋} such submatrices J k (that do not have any lines in common), we are left with a submatrix with either fewer rows than k or fewer columns than l. The only possibility is that there are no rows and no columns left, otherwise it would contradict that A ∈ C m,n (ke, le). We conclude that m/k = n/l must be an integer, as desired.
Moreover, from the proof above, we see that when m = pk, n = pl C m,n (ke, le) = {P ⊗ J k,l : P is a permutation matrix of order p} where ⊗ denotes Kronecker product. Thus, |C m,n (ke, le)| = p!.
We now consider a special, but natural, class of convex matrices. We define a Ferrers matrix to be a (0, 1)-matrix the positions of whose 1's form a Ferrers array. Let m 1 , m 2 , n 1 , n 2 be positive integers and consider a matrix where A 22 , A 12 , A 21 , A 11 are matrices obtained by rotation of some (possibly different) Ferrers matrices 0, 90, 180 and 270 degrees counter clockwise, respectively, where A 11 has size m 1 × n 1 and A 22 has size m 2 × n 2 , thereby determining the sizes of the other two matrices. We call A a Ferrers-convex matrix. Let R(A ij ) be the row sum vector and R ′ (A ij ) be the column sum vector of A ij (i, j ≤ 2). Then R ′ (A ij ) is the conjugate of R(A ij ), but with the components in the reverse order for A 11 and A 21 . Then clearly the row sum and column sum vectors of A are given by Lemma 3.8. Every Ferrers-convex matrix is convex and has unimodal row and column sum vectors.
Proof. Consider A as in (5). Then the ones in each row are consecutive since the ones in A 11 and A 21 are right-justified, and the ones in A 12 and A 22 are left-justified. Similarly, the ones are consecutively in each column. Thus, A is convex. Moreover, from the Ferrers property, the row sums are nondecreasing in the first m 1 rows, and nonincreasing in the last m 2 rows, so the row sum vector is unimodal. For similar reasons the column sum vector is unimodal.
Thus, Ferrers-convex matrices form a large class of convex matrices obtained from all possible partitions of four integers being the number of ones in each of the four submatrices in (5). Example 3.9. Let A n = [a ij ] be the (0, 1)-matrix of order n with 1's on the diagonal and superdiagonal, i.e., a ij = 1 when i ≤ j ≤ i+1 (i < n) and a nn = 1. For instance, Then, for each n, A n is connected, convex and unimodal, as R(A n ) = (2, 2, . . . , 2, 1) and S(A n ) = (1, 2, 2, . . . , 2). However, one can easily check that A n is not Ferrersconvex. Thus, a converse of Lemma 3.8 does not hold.
Even Ferrers-convex matrices are not uniquely determined by their row and column sum, as Example with R = (1, 2, 1) and S = (2, 2) shows.

Interchanges and convex-classes
We continue to investigate convex matrices, but now with a focus on interchanges and preservation of convexity.
Let J k,l as usual be the k × l all ones matrix. Let J 1 k,l be obtained from J k,l by replacing each of the ones in positions (1, 1) and (k, l) by a zero. Similarly, let J 2 k,l be obtained from J k,l by replacing each of the ones in positions (1, l) and (k, 1) by a zero. Note that an interchange in J 1 k,l involving the first and last row and column gives J 2 k,l .
Proposition 4.1. Let A ∈ C m,n be such that each row and column sum is at least 2. Then A permits an interchange into another matrix B in C m,n if and only if A has the form where (i) A 22 equals either J 1 k,l or J 2 k,l for some k, l, and (ii) the first and last row of A 21 and A 23 are zero, and (iii) the first and last column of A 12 and A 32 are zero.
Proof. Let A be as in (6) with the block matrices as stated in the theorem where A 22 = J 1 k,l . Then we may apply an interchange in A involving the first and last row and column of A 22 . The resulting matrix B is as A except that the block A 22 is replaced by J 2 k,l . The zeros described in conditions (ii) and (iii) assure that B is a convex matrix.
We shall prove the converse. In a convex matrix the ones in every line (row or column) are consecutive, and those positions form an interval. The following observation follows from the assumption that each line sum is at least 2.
• If an interchange in a convex matrix results in another convex matrix, then in each of the four modified lines the interval is changed by shifting the interval one position.
Assume now that A permits an interchange into another matrix B in C m,n . We can partition A as in (6)  . . , l +1} for some k < l (so, in particular, |I| = |I ′ |), we say that I ′ is a 1-shift of I, and vice versa. We also say that I, I ′ is a 1-shift pair. A similar notion applies to vertical intervals. All intervals are nonempty as there are no zero lines. The next result establishes very strong requirements on the structure of matrices in a convex-class, requiring m 2 pairwise comparisons of rows and n 2 pairwise comparisons of columns. Theorem 4.2. Assume that A(R, S) is a convex-class, and let A ∈ A(R, S). Let I and I ′ be horizontal intervals associated with different rows of A. Then (at least) one of the following holds: (i) |I| = |I ′ | = 1; (ii) I ⊆ I ′ or I ′ ⊆ I; (iii) I ′ is a 1-shift of I.
Similar properties hold for the vertical intervals. Moreover, every interchange in A(R, S) either takes place in two rows (or columns) with a single 1, or two rows (or columns) corresponding to a 1-shift pair.
Proof. First note that the conditions (i), (ii), and (iii) imply that if |I| = |I ′ | = 1 and I = I ′ , then I = {k} and I ′ = {k +1} for some k; also, if two horizontal intervals or two vertical intervals are disjoint, then they both contain exactly one element.
We assume that (i) and (ii) do not hold and prove (iii) holds. Let I = {i, i + 1, . . . , k} and I ′ = {i ′ , i ′ + 1, . . . , k ′ } where we may assume i < i ′ , since by symmetry, we may take i ≤ i ′ , and if i = i ′ , (ii) would be violated. Then k < k ′ , due to (ii). Moreover, A contains ones in the positions corresponding to i in I (that is, the row associated with I and column i) and to k ′ in I ′ (the row associated with I ′ and column k ′ ). Therefore we can make an interchange in A involving these two ones (as the other two positions involved contain zeros). Let A ′ be the resulting matrix. However, A ′ has consecutive ones in these two rows if and only if i ′ = i + 1 and k ′ = k + 1, i.e., when I ′ is a 1-shift of I. Here we used that at least one of the intervals I and I ′ contains more than one element. Thus (iii) holds. Clearly, a similar arguments applies to column intervals.
The last statement of the theorem follows from the first part as the two rows of the interchange cannot be of type (ii). Concerning the structure of convex-classes an interesting special case is when r i = n for some i; we then say that row i is full. Let A ∈ A(R, S). Then convexity implies that the full rows are consecutive, say in rows p, p + 1, . . . , p ′ and the remaining intervals above and below are nested: where I i is the interval associated with row i (i ≤ m). The previous theorem may be used to construct convex-classes, as the next example illustrates. The first and last rows each have only one 1 and they permit an interchange using columns 3 and 4. The ones involved in these interchanges are indicated in boldface. All these 4 matrices constructed from these interchanges are convex, and there are no other matrices in A(R, S), so this is a convex class. We now generalize this example and construct a family of convex-classes. This is done by selecting intervals (consecutive integers) with a certain property and then embedding these as the row intervals in a matrix.
Algorithm to construct a convex-class A(R, S) 1. Choose a 1-shift pair I 1 , I ′ 1 . 2. for i = 2, 3, . . . , k Choose a 1-shift pair I i , I ′ i such that 3. Construct the matrix A with 2k rows corresponding to these intervals: I 1 and I ′ 1 are the first and last row, I 2 and I ′ 2 are the second and second last row etc. Do this in such a way that A has no zero columns.
We obtain the following result. Proof. First, the constructed matrix is convex: it is clearly row-convex, and the condition I i ∩ I ′ i ⊇ I i−1 ∪ I ′ i−1 assures that it is also column-convex. Next, no interchange is possible for two rows when one interval is contained in the other. Therefore, the only possible interchanges are for each of the pairs I i , I ′ i (i ≤ k). Each of these gives a new convex matrix, due to mentioned intersection condition, and these interchanges are "independent", so that the class consists of 2 k matrices.
It would be of interest to characterize the pairs R, S for which there is a unique convex matrix in A(R, S), that is, for which |C(R, S)| = 1.

A Partially Ordered Set
Consider the partially ordered set (C m,n , ≤) of all m × n convex matrices with the entrywise partial order. Starting with a connected matrix C ∈ C m,n , we can sequentially change 0's to 1's, one 0 at a time, in such a way that we obtain J m,n with all intermediary matrices convex. If C is not connected, then by applying this procedure to each connected component of C, we can first arrive at a convex matrix of the form P (J m 1 ,n 1 , . . . , J mp,np ) for some p × p permutation matrix P , and then sequentially change 0's to 1's with all resulting matrices convex and arrive at J m,n . In a similar way, starting with any convex matrix A ∈ C m,n , we can sequentially change 1's to 0's and arrive at the zero matrix O m,n with all intermediary matrices convex.
It follows that maximal chains in (C m,n , ≤) have length mn (i.e., contain (mn+1) matrices) and every C ∈ C m,n belongs to a maximal chain. Also if C 1 and C 2 are in C m,n , then C 2 covers C 1 provided C 1 ≤ C 2 and the number of 1's in C 2 is one more than the number of 1's in C 1 . If C 1 , C 2 ∈ C m,n , then the intersection C 1 ∧ C 2 of C 1 and C 2 is the m × n (0, 1)-matrix C 1 ∧ C 2 which has 1's in exactly those places where both C 1 and C 2 have 1's.
Lemma 5.1. If C 1 , C 2 ∈ C m,n , then C 1 ∧ C 2 ∈ C m,n and C 1 ∧ C 2 is the meet (i.e., GLB) of C 1 and C 2 in C m,n .
Proof. Suppose, e.g., there are two 1's in a row of C 1 ∧ C 2 . Then in between these 1's there are only 1's in C 1 and C 2 . It follows that C 1 ∧ C 2 is a convex matrix and is the meet of C 1 and C 2 .
Theorem 5.2. The partially ordered set (C m,n , ≤) is a lattice.
Proof. Since C m,n is a finite set with a meet, then every two convex matrices C 1 and C 2 in C m,n have a join C 1 ∨ C 2 (i.e., LUB), namely the meet of all the matrices X ∈ C m,n with C 1 , C 2 ≤ X.
Let A be an arbitrary (0, 1)-matrix of size m×n. We define the convex hull A c of A to be the meet of all the convex sets C in (C m,n , ≤) such that A ≤ C. The convex hull A c of A is obtained by replacing every 0 between two 1's with a 1, repeatedly, until one obtains a convex matrix.
Example 5.3. A matrix A and its convex closure A c are illustrated below: The essential set of a convex matrix was defined relative to the southeast (SE) and so it is more appropriately called the SE-essential set. It could just as well have been defined relative to the other three possible directions: the SW-essential set, NE-essential set, and NW-essential set. For a convex matrix C ∈ C m,n , let E(A) be the union of these four essential sets. A specific one of these essential sets is empty exactly when there is a 1 in the oppositely directed corner. Thus E(C) = ∅ if and only if there is a 1 in each of the four corners of C, and since C is convex, if and only if C = J m,n .
We have the following theorem.
Theorem 5.4. Let C ∈ C(m, n). Then C ′ ∈ C m,n covers C in (C m,n , ≤) if and only if C ′ is obtained from C by replacing the 0 in some position of E(C) with a 1. In particular, the number of convex matrices in C m,n that cover C equals |E(C)|.

Proof.
A position belongs to E(C) if and only if it is occupied by a 0, and there is a 1 opposite it in the two positions S and E, N and E, N and W, or S and W. These are exactly the positions corresponding to the four essential sets.
where a denotes a position in the SE-essential set, b denotes a position in the NEessential set, and c denotes a position in the NW-essential set. The SW-essential set is empty. Then it is easy to check that these positions in E(C) are those and only those positions in which a 1 can be inserted to get a convex set.
It is natural to ask whether (C m,n , ≤) is a distributive lattice, that is, whether That this need not hold is already seen with the simple example