{'fraction_non_alphanumeric': 0.05429011118924593, 'fraction_numerical': 0.009427135883246196, 'mean_word_length': 3.3183698618079394, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 105, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Matrices of optimal tree-depth and a row-invariant parameterized algorithm for integer programming

A long line of research on fixed parameter tractability of integer programming culminated with showing that integer programs with n variables and a constraint matrix with dual tree-depth d and largest entry D are solvable in time g(d,D)poly(n) for some function g. However, the dual tree-depth of a constraint matrix is not preserved by row operations, i.e., a given integer program can be equivalent to another with a smaller dual tree-depth, and thus does not reflect its geometric structure. We prove that the minimum dual tree-depth of a row-equivalent matrix is equal to the branch-depth of the matroid defined by the columns of the matrix. We design a fixed parameter algorithm for computing branch-depth of matroids represented over a finite field and a fixed parameter algorithm for computing a row-equivalent matrix with minimum dual tree-depth. Finally, we use these results to obtain an algorithm for integer programming running in time g(d*,D)poly(n) where d* is the branch-depth of the constraint matrix; the branch-depth cannot be replaced by the more permissive notion of branch-width.


Introduction
Our main results concerning integer programming can be summarized as follows (we state the results formally in the next subsection).
• The branch-depth of a matrix A is equal to the minimum dual tree-depth of a matrix row-equivalent to A (Theorem 1).
• There exists a fixed parameter algorithm for computing a matrix of minimum dual tree-depth that is row-equivalent to the input matrix and whose entry complexity stays bounded (Theorem 35).
• Integer programming is fixed parameter tractable when parameterized by the branch-depth and the entry complexity of the constraint matrix (Corollary 4).
Existing hardness results imply that the parameterization by both branch-depth and entry complexity in Corollary 4 is necessary unless FPT = W [1], i.e., it is not sufficient to parameterize only by one of the two parameters. In particular, integer programming is W[1]-hard when parameterized by tree-depth only [19,34] and NP-hard for instances with bounded coefficients and dual tree-width (even dual path-width) bounded by two [13, Lemma 102] (also cf. [19,35]). The latter also implies that integer programming is NP-hard when the branch-width and the entry complexity of input instances are bounded (also cf. [16]). On the positive side, Cunningham and Geelen [8] (also cf. [37] for detailed proofs and implementation) provided a slicewise pseudopolynomial algorithm for non-negative matrices with bounded branch-width, i.e., the problem belongs to the complexity class XP for unary encoding of input. Finally, since the algorithm given in Corollary 4 is parameterized by the branch-depth of the vector matroid formed by the columns of the matrix A, it is natural to ask whether the tractability also holds in the setting dual to this one, i.e., when the branch-depth of the vector matroid formed by the rows of A is bounded. This hope is dismissed in Proposition 16. The algorithm from Theorem 35 is based on the following algorithmic result on matroid branch-depth, which we believe to be of independent interest.
• There exists a fixed parameter algorithm for computing an optimal branchdepth decomposition of a matroid represented over a finite field for the parameterization by the branch-depth and the order of the field (Theorem 31).
To apply this result, we show that every matroid represented by rational vectors that has bounded branch-depth is isomorphic to a matroid representable over a finite field (Lemma 34), where the order of the field depends on the branch-depth and the entry complexity of the rational vectors. We would like to point out that the algorithm from Theorem 31 is fully combinatorial, similarly to the recent algorithm for computing the branch-width of matroids represented over a finite field by Jeong, Kim and Oum [30], which extends the classical algorithm for tree-width by Bodlaender and Kloks [4], and unlike the older algorithm by Hliněný and Oum [28,29], which relies on an exponential upper bound on the size of excluded minors for branch-width by Geelen et al. [21] and needs to precompute the list of excluded minors. While it would likely be possible to follow a similar path in the setting of branch-depth, we chose the more challenging route of designing a fully combinatorial algorithm, i.e., one that is based on an explicit dynamic programming procedure. The benefit of a fully combinatorial approach is that the hidden constants are better, which is of importance to applications including those in model checking [20,[25][26][27]; in particular, Hliněný [25][26][27] (in the analogy of Courcelle's result [7] for graphs) proved that monadic second order model checking is fixed parameter tractable for matroids with bounded branch-width represented over finite fields.

Statement of integer programming results
To state our integer programming results precisely, we first need to fix some notation. Vectors throughout our exposition will be written in the bold font. We consider the general integer programming problem in standard form: where A ∈ Z m×n is an integer m × n matrix, b ∈ Z m , l, u ∈ (Z ∪ {±∞}) n , and f : Z n → Z is a separable convex function, i.e., f (x) = n i=1 f i (x i ) where f i : Z → Z are convex functions. In particular, each f i (x i ) can be a linear function of x i . Integer programming is well-known to be NP-hard even when f is a constant function and either the entries of A are 0 and +1 (by a reduction from the Vertex Cover problem) or m = 1 (by a reduction from the Subset Sum problem).
We next demonstrate the previously mentioned drawback of parameterizing integer programs by tree-depth. The tree-depth of a graph G is the minimum depth of a rooted forest on the same vertex set such that the two end-vertices of every edge of G are in ancestor-descendant relation. The dual tree-depth of a matrix A is the tree-depth of the graph with vertices corresponding to the rows of A and with two vertices being adjacent if the corresponding rows have a non-zero entry in the same column. We define the branch-depth, which require definitions from matroid theory, and primal tree-depth of a matrix, in Section 2. Consider the following matrices A and A ′ . The dual tree-depth of the matrix A is equal to its number of rows while the dual tree-depth of A ′ is two; the graphs from the definition of the dual tree-depth are a complete graph and a star, respectively. We remark that the branch-depth of both matrices is two. Since the matrices A and A ′ are row-equivalent, the integer programs determined by them ought to be of the same computational difficulty. More precisely, consider the following matrix B: Since A ′ = BA, it is possible to replace an integer program of the form (1) with an integer program with a constraint matrix A ′ = BA, right hand side b ′ = Bb, and bounds l ′ = l and u ′ = u, and solve this new instance of IP, which has dual tree-depth two and the same set of feasible solutions.
In Section 4, we first observe that the branch-depth of a matrix A is at most its dual tree-depth, and prove that the branch-depth of a matrix A is actually equal to the minimum dual tree-depth of a matrix A ′ that is row-equivalent to A. Theorem 1. Let A be a matrix over a (finite or infinite) field F. The branchdepth of A is equal to the minimum dual tree-depth of any matrix A ′ that is row-equivalent to A.
We use the tools developed to prove Theorem 1 together with existing results on matroid branch-depth to obtain an algorithm that given a matrix A of small branch-depth outputs a matrix B that transforms A to a row-equivalent matrix with small dual tree-depth. The entry complexity of a matrix A, denoted by ec(A), is the maximum length of the binary encoding of an entry A ij (the length of binary encoding a rational number r = p/q with p and q being coprime is ⌈log 2 (|p| + 1)⌉ + ⌈(log 2 |q| + 1)⌉). An algorithm is called fixed parameter if its running time for an instance of size n is bounded by f (k)poly(n) where f : N → N is a computable function and k is a parameter determined by the instance. Theorem 2. There exists an algorithm with running time polynomial in ec(A), n and m that for an input m × n integer matrix A and an integer d either • outputs that the branch-depth of A is larger than d, or • outputs an invertible rational matrix B ∈ Q m×m such that the dual treedepth of BA is at most 4 d and the entry complexity of BA is O(d2 2d ec(A)).  Table 1: Comparison of algorithms presented in Theorems 2 and 3. The first line describes the dependence on the parameter d, the second and the third the treedepth and the entry complexity of the constraint matrix output by the algorithm, and the last line time needed to solve the instance by the algorithm of Eisenbrand et al. [13].
However, we go further and design a fixed parameter algorithm for computing the branch-depth of a vector matroid (Theorem 35) and use this algorithm to prove the following strengthening of Theorem 2.
Theorem 3. There exists a fixed parameter algorithm parameterized by d and e with running time polynomial in n and m that for an input m×n integer matrix A with entry complexity at most e and an integer d either • outputs that the branch-depth of A is larger than d, or • outputs an invertible rational matrix B ∈ Q m×m such that the dual treedepth of BA is equal to the branch-depth of A and the entry complexity of BA is O(d 2 2 2d ec(A)).
While the algorithm in Theorem 2 runs in polynomial time, the output matrix can have dual tree-depth (single) exponential in the minimum possible tree-depth; on the other hand, the running time of the algorithm from Theorem 3 is triple exponential in d but it always outputs a row-equivalent matrix with the minimum possible tree-depth. Also see Table 1 for a comparison of the algorithms from Theorems 2 and 3.
As explained above, Theorems 2 and 3 allow us to perform row operations to obtain an equivalent integer program with small dual tree-depth from an integer program with small branch-depth. The function g depends on which of the theorems is used to find the matrix B as displayed in Table 1. A proof of the corollary using Theorem 2 is presented in Section 5; a proof using Theorem 3 is completely the same except that the obtained matrix A ′ has dual tree-depth at most d and its entry complexity is as given in Table 1.

Corollary 4.
Integer programming is fixed parameter tractable when parameterized by branch-depth and entry complexity, i.e., an integer program given as in (1) can be solved in time polynomial in g(bd(A), ec(A)), n, ec(b), ec(l) and ec(u), where bd(A) is the branch-depth of the matrix A and g : N 2 → N is a computable function.
We remark that the results of [13,35] give a strongly fixed parameter algorithm, i.e., an algorithm whose number of arithmetic operations does not depend on the size of the numbers involved, if the objective function f is a linear function, and so the algorithm from Corollary 4 is strongly polynomial in g(bd(A), ec(A)) and n when the objective function is linear.
We note that the dependence of g on ec(A) and bd(A) is double and triple exponential, respectively, regardless whether we use Theorem 2 or Theorem 3 to prove Corollary 4. However, a rather pessimistic estimate on the entry complexity of the integer matrix A ′′ was used in the proof of Corollary 4 and it is likely that the constraint matrix with a row-equivalent matrix with a significantly smaller dual tree-depth likely outweighs the increase of the entry complexity since the parameter dependence in the algorithm of [13], which is a refined version of the algorithm from [35],

Structure of the paper
We now briefly describe how the paper is organized. In Section 2, we introduce notation used in this paper, in particular the notions of (dual) tree-depth and branch-depth of matrices, and provide the relevant background on matroids. We also give the definition of an extended depth-decomposition, which is a depthdecomposition of a matroid enhanced with information on the structure of subspaces represented by branches of the decomposition. Section 3 is devoted to proving a structural result on matroids, which establishes the existence of extended depth-decompositions with optimal depth. The results of Section 3 are used to prove that the branch-depth of a matrix is equal to the minimum treedepth of a row-equivalent matrix in Section 4. We next apply these results in Section 5 to prove Theorem 2 and Corollary 4, which implies that integer programming is fixed parameter tractable when parameterized by the branch-depth and the entry complexity of the constraint matrix.
The rest of the paper is devoted to computing optimal branch-depth of matroids and matrices. As a preparation for proofs of our main results, we develop additional tools to manipulate depth-decompositions of vector matroids in Section 6. These tools are used in Section 7 to construct a dynamic programming algorithm for computing optimal branch-depth decompositions of matroids represented over finite fields. Finally, in Section 8, we use the algorithm from Section 7 to design a fixed parameter algorithm for computing optimal branchdepth decompositions of matroids represented over rationals and for computing row-equivalent matrices with optimal branch-depth (Theorem 35).

Notation
In this section, we fix the notation used throughout the paper, present the notions of graph tree-depth and matroid branch-depth, and include relevant results concerning them that we will need later. To avoid our presentation becoming cumbersome through adding or subtracting one at various places, we define the depth of a rooted tree to be the maximum number of edges on a path from the root to a leaf, and define the height of a rooted tree to be the maximum number of vertices on a path from the root to a leaf, i.e., the height of a rooted tree is always equal to its depth plus one. The height of a rooted forest F is the maximum height of a rooted tree in F . The depth of a vertex in a rooted tree is the number of edges on the path from the root to that particular vertex; in particular, the depth of the root is zero. The closure cl(F ) of a rooted forest F is the graph obtained by adding edges from each vertex to all its descendants. Finally, the tree-depth td(G) of a graph G is the minimum height of a rooted forest F such that the closure cl(F ) of the rooted forest F contains G as a subgraph. It can be shown that the path-width of a graph G is at most its tree-depth td(G) minus one, and in particular, the tree-width of G is at most its tree-depth minus one (see e.g. [9] for the definitions of path-width and tree-width). As [32] is one of our main references, we would like to highlight that the tree-depth as used in [32] is equal to the minimum depth of a rooted tree T such that G ⊆ cl(T ); however, we here follow the definition of tree-depth that is standard.
The primal graph of an m × n matrix A is the graph G P (A) with vertices {1, . . . , n}, i.e., its vertices one-to-one correspond to the columns of A, where vertices i and j are adjacent if A contains a row whose i-th and j-th entries are non-zero. The primal tree-depth td P (A) of a matrix A is the tree-depth of its primal graph. Analogously, the dual graph of A is the graph G D (A) with vertices {1, . . . , m}, i.e., its vertices one-to-one correspond to the rows of A, where vertices i and j are adjacent if A contains a column whose i-th and j-th entries are non-zero. Note that the dual graph G D (A) is isomorphic to the primal graph of the matrix transpose A T . Finally, the dual tree-depth of A, which is denoted by td D (A), is the tree-depth of the dual graph G D (A).
Before introducing the notion of the branch-depth of a matroid, we review basic definitions from matroid theory. A detailed introduction to matroid theory can be found in one of the standard textbooks on the topic, e.g. [38], but we include a brief overview of relevant concepts for completeness. A matroid M is a pair (X, I), where I is a non-empty hereditary collection of subsets of X that satisfies the augmentation axiom. More specifically, the collection I is hereditary if I contains all subsets of X ′ for every X ′ ∈ I, and the augmentation axiom asserts that for all X ′ ∈ I and X ′′ ∈ I with |X ′ | < |X ′′ |, there exists an element x ∈ X ′′ \ X ′ such that X ′ ∪ {x} ∈ I. The sets contained in I are referred to as independent. The rank r(X ′ ) of a set X ′ ⊆ X is the maximum size of an independent subset of X ′ ; the rank r(M) of a matroid M = (X, I) is the rank of X and an independent set of size r(M) is a basis of M. A circuit is a set X ′ ⊆ X such that X ′ is not independent but every proper subset of X ′ is. Two elements x and x ′ of X are said to be parallel if r({x}) = r({x ′ }) = r({x, x ′ }) = 1, and an element x is a loop if r({x}) = 0.
Two particular examples of matroids are graphic matroids and vector matroids. If G is a graph, then the pair (E(G), I) where I contains all acyclic subsets of edges of G is a matroid and is denoted by M(G); matroids of this kind are called graphic matroids. If X is a set of vectors of a vector space and I contains all subsets of X that are linearly independent, then the pair (X, I) is a matroid; matroids of this kind are vector matroids. In the setting of vector matroids, the rank of X ′ ⊆ X is the dimension of the linear hull of X ′ . If (X, I) is a vector matroid, we write L (X ′ ) for the linear hull of the vectors contained in X ′ ⊆ X and abuse the notation by writing dim X ′ for dim L (X ′ ).
In what follows, we will need a notion of a quotient of a vector space, which we now recall. If A is a vector space and K a subspace of A, the quotient space A/K is a vector space of dimension dim A − dim K obtained from A by considering cosets of A given by K and inheriting addition and scalar multiplication from A; see e.g. [22] for further details. One can show that for every subspace K of A, there exists a subspace B of A with dimension dim A−dim K such that each coset contains a single vector from B, i.e., every vector w of A can be uniquely expressed as the sum of a vector w B of B and a vector w K of K. We call the vector w B the quotient of w by K. Note that the quotient of a vector is not uniquely defined by K, however, it becomes uniquely defined when the subspace B, which intersects each coset at a single vector, is fixed.
If M = (X, I) is a matroid and X ′ ⊆ X, then the restriction of M to X ′ , which is denoted by M [X ′ ], is the matroid (X ′ , I ∩ 2 X ′ ). The contraction of M by X ′ , which is denoted by M/X ′ , is the matroid with the elements X \ X ′ such that a set X ′′ ⊆ X \X ′ is independent in M/X ′ if and only if r(X ′′ ∪X ′ ) = |X ′′ |+r(X ′ ). Analogously, if M = (X, I) is a vector matroid and K a subspace of the linear hull of X, then the matroid M/K obtained by contracting along the subspace K is the matroid whose elements are the vectors of X, with a subset X ′ ⊆ X being independent in M/K if X ′ is linearly independent in the quotient space L (X) /K. Note that if X ′ ⊆ X, then M/X ′ is the matroid obtained by contracting along the linear hull of X ′ and then restricting to the subset X \ X ′ .
A matroid M is said to be connected if every two (distinct) non-loop elements of M are contained in a circuit. A set X ′ ⊆ X of a matroid is a component of M if it is an inclusion-wise maximal subset of X such that the matroid M [X ′ ] is connected and X ′ is loop-free. Equivalently, X ′ is a component of M if it is an inclusion-wise minimal non-empty subset of X such that r(X ′ ) + r(X \ X ′ ) = r(M). If M is a vector matroid with rank at least one, then M is connected if and only if M has no loops and there do not exist two vector spaces A and B such that A ∩ B contains the zero vector only, both A and B contains a non-loop element of M and every element of M is contained in A or B.
Since several algorithms presented in this paper work with matroids, we must fix the way that the time complexity of algorithms involving matroids is measured. All algorithms that we present work with vector matroids and we assume that matroids are given by their vector representation. It is then possible to use standard linear algebra algorithms to determine which subsets of the elements of such matroids are independent. Hence, we say that an algorithm is polynomialtime if its running time is polynomial in the number of elements of the matroid and the complexity of its vector representation. We remark that some of the algorithms that we use, in particular the one in Theorem 8, are also polynomial in the more demanding setting when matroids are given by the independence oracle, which we do not consider here.
A depth-decomposition of a matroid M = (X, I) is a pair (T, f ), where T is a rooted tree and f is a mapping from X to the leaves of T such that the number of edges of T is the rank of M and the following holds for every subset X ′ ⊆ X: the rank of X ′ is at most the number of edges contained in paths from the root to the vertices f (x), x ∈ X ′ . The branch-depth bd(M) of a matroid M is the smallest depth of a tree T that forms a depth-decomposition of M. For example, if M = (X, I) is a matroid of rank r, T is a path with r edges rooted at one of its end vertices, and f is a mapping such that f (x) is equal to the (non-root) leaf of T for all x ∈ X, then the pair (T, f ) is a depth-decomposition of M. In particular, the branch-depth of any matroid M is well-defined and is at most the rank of M. We remark that the notion of matroid branch-depth given here is the one defined in [32]; another matroid parameter, which is also called branchdepth but is different from the one that we use here, is defined in [10]. Finally, the branch-depth bd(A) of a matrix A is the branch-depth of the vector matroid formed by the columns of A. Since the vector matroid formed by the columns of a matrix A and the vector matroid formed by the columns of any matrix row-equivalent to A are the same, the branch-depth of A is invariant under row operations.
Similarly to the relation between tree-depth of graphs and long paths, branchdepth is related to the existence of long circuits in a matroid [32,Proposition 3.4]. Kardoš et al. [32] also established the following relations between the treedepth of a graph G and the branch-depth of the associated matroid M(G). It is worth noting that Proposition 7 does not hold without the assumption on 2connectivity of a graph G: the tree-depth of an n-vertex path is ⌊log 2 n⌋, however, its matroid is formed by n − 1 independent elements, i.e, its branch-depth is one. Proposition 6. For any graph G, the branch-depth of the graphic matroid M(G) is at most the tree-depth of the graph G decreased by one. Proposition 7. For any 2-connected graph G, the branch-depth of the graphic matroid M(G) is at least 1 2 log 2 (td(G) − 1). Further properties of depth-decompositions and the branch-depth of matroids can be found in [32].
An extended depth-decomposition of a vector matroid M = (X, I) is a triple (T, f, g) such that (T, f ) is a depth-decomposition of M and g is a bijective mapping from the non-root vertices of T to a basis of the linear hull of X that satisfies that every element x ∈ X is contained in the linear hull of the g-image of the non-root vertices on the path from f (x) to the root of T . Note that gimages need not be elements of M in general; if all g-images are elements of the matroid M, we say that an extended depth-decomposition (T, f, g) is principal. Kardoš et al. [32,Corollary 3.17] designed an algorithm that outputs an approximation of an optimal depth-decomposition, which is a principal extended depth-decomposition; we state the result here for the case of vector matroids.
Theorem 8. There exists a polynomial-time algorithm that given a vector matroid M and an integer d, either outputs that the branch-depth of M is larger than d or outputs a principal extended depth-decomposition of M of depth at most 4 d .
If (T, f, g) is an extended depth-decomposition and u is a vertex of T , then K u is the linear hull of the g-images of the vertices on the path from u to the root of T ; in particular, if u is the root, then K u contains the zero vector only. It will always be clear from the context for which extended depth-decomposition of M the spaces K u are defined, in particular, the vertex u determines which rooted tree T is considered.
A branch of a rooted tree T is a subtree S rooted at a vertex u of T such that u has at least two children, and the subtree S contains exactly u, one child u ′ of u, and all descendants of u ′ . In particular, a rooted tree has a branch if and only if it has a vertex with at least two children. A branch S is primary if every ancestor of the root of S has exactly one child. Every rooted tree T that is not a rooted path has at least two primary branches and all primary branches are rooted at the same vertex. Let (T, f ) be a depth-decomposition of a matroid M. We write S for the set of elements of the matroid M mapped by f to the leaves of S and S for the number of edges of S. Let S be a branch of T and S 1 , . . . , S k be the other branches with the same root. The branch S is at capacity if where X is the set of all elements of the matroid M (see Figure 1 for an illustration). Note that if S is primary, then the left side of the equality is r( S) and the right side is h + S , where h is the depth of the root of S. In particular, a primary branch S is at capacity if and only if the rank of S is equal to the sum of S and h, i.e., if and only if the rank inequality from the definition of a depth-decomposition holds with equality for the set S. Finally, if (T, f, g) is an extended depth-decomposition of M, we say that a branch S rooted at a vertex u is solid if the matroid (M/K u ) S after removal of its loops is connected, and that (T, f, g) is solid if all of its branches are; again, an illustration can be found in Figure 1.

Optimal extended depth-decompositions
The goal of this section is to show that every vector matroid has an extended depth-decomposition with depth equal to its branch-depth. To do so, we start with showing that branches rooted at the root of a decomposition tree are always at capacity.

Lemma 9.
Let (T, f ) be a depth-decomposition of a vector matroid M. If T has a branch S rooted at the root of T , then S is at capacity.
Proof. Suppose that a branch S rooted at the root of T is not at capacity. This implies that dim S < S . Let X ′ be the set of elements of M that are not contained in S. By the definition of a depth-decomposition, dim X ′ is at most r(M) − S . However, the submodularity of the dimension implies that dim S ∪ X ′ < r(M), which is impossible.
The following lemma is a core of our argument that every matroid has a depthdecomposition of optimal depth such that each primary branch is at capacity. An illustration of the operation described in the statement of the lemma is given in Figure 2.
Lemma 10. Let (T, f ) be a depth-decomposition of a vector matroid M. Assume that T contains a primary branch S that is not at capacity. Let u be the root of S, and let T ′ be the rooted tree obtained from T by changing the root of S to be the parent of u. Then, (T ′ , f ) is a depth-decomposition of M.
Proof. By Lemma 9, u has a parent and thus T ′ is well-defined. Let X be the set of elements of M and fix a subset X ′ of X. We need to show that dim X ′ is at most the number e 0 of edges on the paths in T ′ from the vertices in the f -image of X ′ to the root. If X ′ contains an element of X \ S, then the number of such edges is the same in the trees T and T ′ and the inequality follows from the fact that (T, f ) is a depth-decomposition of M. Hence, we will assume that X ′ is a subset of S. Observe that collectively the primary branches of T different from S contain r(M) − h − S edges, where h is the depth of u. We derive using the fact that (T, f ) is a depth-decomposition the following: This implies that dim X ′ is at most where the inequality follows using that S is not at capacity, i.e., dim S < h+ S .
We can now show that every matroid has a depth-decomposition of optimal depth such that each primary branch is at capacity. We state the next two lemmas and the theorem that follows them for an arbitrary depth-decomposition (T, f ), i.e., a depth-decomposition of not necessarily optimal depth, since we will need to apply the algorithmic arguments used in their proofs for arbitrary depthdecompositions later.
Lemma 11. Let (T, f ) be a depth-decomposition of a vector matroid M = (X, I) of depth d. There exists a depth-decomposition of M of depth at most d such that every primary branch is at capacity.
Proof. If T is a rooted path, then the lemma holds vacuously. Suppose that T is not a rooted path. If all primary branches of (T, f ) are at capacity, then we are done. If not, we consider a primary branch of T that is not at capacity and apply Lemma 10 to obtain a depth-decomposition (T ′ , f ). If all primary branches of (T ′ , f ) are at capacity, then we are done. If not, we consider a primary branch of T ′ that is not at capacity and iterate the process. Note that at each iteration, the sum of the lengths of the paths from the leaves to the root decreases, so the process eventually stops with a depth-decomposition such that all its primary branches are at capacity. Now we analyze depth-decompositions whose primary branches are at capacity.
Lemma 12. Let (T, f ) be a depth-decomposition of a vector matroid M = (X, I) such that T is not a rooted path and each primary branch of T is at capacity. Let S 1 , . . . , S k be the primary branches of T , and let A 1 , . . . , A k be the linear hulls of S 1 , . . . , S k , respectively. Further, let h be the depth of the common root of We conclude that dim A i ∩ A j = h. This implies that the first inequality in the expression above holds with equality, so where the last step follows by the same argument above with indices i and j swapped. Since the left hand side of (2) is independent of the choice of j and the right hand side is independent of the choice of i, it must hold that A i ∩ A j is independent of the choice of both i and j. This intersection forms the required space K of dimension h.
We are now ready to prove the main theorem of this section. Proof. The proof proceeds by induction on the rank of M. If T is a rooted path, we assign elements of a basis of L (X) to the non-root vertices of T arbitrarily, i.e., we choose g to be any bijection to a basis of L (X), which yields an extended depth-decomposition (T, f, g) of M. Note that if the rank of M is one, then T is the one-edge rooted path, i.e., this case covers the base of the induction in particular.
We assume that T is not a rooted path for the rest of the proof. By Lemma 11, we can assume that all primary branches of T are at capacity. Let S 1 , . . . , S k be the primary branches of T , and let h ≥ 0 be the depth of the common root of S 1 , . . . , S k . By Lemma 12, there exists a subspace K of dimension h such that the intersection of linear hulls of S i and S j is K for all 1 ≤ i < j ≤ k; let b 1 , . . . , b h be an arbitrary basis of K.
We define M i , i = 1, . . . , k, to be the matroid such that the elements of M i are S i and X ′ ⊆ S i is independent if and only if the elements X ′ ∪ {b 1 , . . . , b h } are linearly independent. In particular, the rank of The matroid M i can be viewed as obtained by taking the vector matroid with the elements S i ∪{b 1 , . . . , b h } and contracting the elements b 1 , . . . , b h . In particular, M i is a vector matroid, and the vector representation of M i can be obtained from S i by taking quotients by K. Note that the rank of M i is dim S i ∪ K −h, i.e., its rank is smaller than the rank of M and we will be able to eventually apply induction to it.
Let f i be the restriction of f to S i . We claim that (S i , f i ) is a depthdecomposition of M i . Let X ′ be a subset of S i , and let e i be the number of edges contained in the union of paths from the elements We apply induction to each matroid M i and its depth-decomposition i is at most the depth of S i . Let T ′ be a rooted tree obtained from a rooted path of length h by identifying its non-root end with the roots of S ′ 1 , . . . , S ′ k . Observe that the depth of T ′ does not exceed the depth of T . Further, let f ′ be the unique function from X to the leaves of T such that the restriction of f ′ to the elements of M i is f ′ i . Finally, let g be any function from the non-root vertices of T such that the h non-root vertices of the path from the root are mapped by g to the vectors b 1 , . . . , b h by g and We claim that (T ′ , f ′ , g) is an extended depth-decomposition of M. We first verify that, for every x ∈ X, f ′ (x) is contained in the linear hull of the g-image of the non-root vertices on the path from f ′ (x) to the root. Fix x ∈ X and let i be such that x is contained in the linear hull of K and the g i -images of the non-root vertices on the path from f ′ (x) = f i (x) to the root of S ′ i . Hence, x is contained in the linear hull of the g-image of the non-root vertices on the path from f ′ (x) to the root of T ′ .
Consider now an arbitrary subset X ′ ⊆ X. We have already established that all elements of X ′ are contained in the linear hull of the g-image of the non-root vertices on the paths from f ′ (x), x ∈ X ′ , to the root of T ′ . Since the dimension of this linear hull is at most the number of non-root vertices on such paths, which is equal to the number of edges on the paths, it follows that (T ′ , f ′ ) is a depth-decomposition of M.

Optimal tree-depth of a matrix
In this section, we relate the optimal dual tree-depth of a matrix A to its branchdepth. We start with showing that the branch-depth of a matrix A is at most its dual tree-depth.
Proof. We assume without loss of generality that the rows of the matrix A are linearly independent. Indeed, deleting a row of A that can be expressed as a linear combination of other rows of A does not change the structure of the matroid formed by the columns of A. In particular, the branch-depth of A is preserved by deleting such a row, and the deletion cannot increase the tree-depth of the dual graph G D (A) (the dual graph of the new matrix is a subgraph of the original dual graph and the tree-depth is monotone under taking subgraphs).
Let X be the set of rows of the matrix A and Y the set of its columns. Further, let T be a rooted forest of height td D (A) with the vertex set X such that its closure contains the dual graph G D (A) as a subgraph. Consider the rooted tree T ′ obtained from T by adding a new vertex w, making w adjacent to the roots of all trees in T and also making w to be the root of T ′ . Since the rows of A are linearly independent, the number of edges of T ′ is equal to the row rank of A, which is the same as its column rank. In particular, the number of edges of T ′ is the rank of the vector matroid formed by the columns of A.
We next define a function f : Y → V (T ′ ) such that the pair (T ′ , f ) is a depth-decomposition of the vector matroid formed by the columns of A. Let y be a column of A, and observe that all rows x such that the entry in the row x and the column y is non-zero form a complete subgraph of the dual graph G D (A). Hence they must lie on some path from a leaf to the root of T ′ ; set f (y) to be any such leaf.
Since the depth of T ′ is td D (A) (the height of T ′ is td D (A) + 1), the proof will be completed by showing that (T ′ , f ) is a depth-decomposition of the vector matroid formed by the columns of A. Consider a subset Y ′ ⊆ Y of columns of A and let X ′ be the set of rows (vertices of the dual graph) on the path from f (y) for some y ∈ Y ′ to the root of T ′ . Note that |X ′ | is equal to the number of edges contained in such paths. The definition of f yields that every column y ∈ Y ′ has non-zero entries only in the rows x such that x ∈ X ′ . Hence, the rank of Y ′ is at most |X ′ |. It follows that the pair (T ′ , f ) is a depth-decomposition of the vector matroid formed by the columns of A.
We next prove the main theorem of this section.
Theorem 15. Let A be an m × n matrix of rank m, let M be the vector matroid formed by columns of A, and let (T, f, g) be an extended depth-decomposition of M. Further, let is at most the depth of the tree T .
Proof. Let F be the rooted forest obtained from T by removing the root and The definition of an extended depth-decomposition yields that the j-th column is a linear combination of the g-image of the non-root vertices on the path from v to the root of T . In particular, the path contains the two vertices of T mapped by g to w i and w i ′ ; these two vertices are associated with the i-th and i ′ -th rows of A ′ . Hence, the vertices associated with the i-th and i ′ -th rows are adjacent in cl(F ). We conclude that G D (A ′ ) is a subgraph of cl(F ).
We are now ready to prove Theorem 1.
Proof of Theorem 1. Let td * D (A) be the smallest dual tree-depth of a matrix that is row-equivalent to A. By Proposition 14, it holds that bd(A) ≤ td * D (A). We now prove the other inequality. We can assume without loss of generality that the rank of A is equal to the number of its rows; if this is not the case, we can apply the following arguments to the matrix A restricted to a maximal linearly independent set of rows and then use row operations to make all entries of the remaining rows to be equal to zero. Since rows with all entries equal to zero correspond to isolated vertices in the dual graph, their presence does not affect the dual tree-depth of the matrix.
Let M be the vector matroid formed by the columns of A. By Theorem 13, the matroid M has an extended depth-decomposition (T, f, g) with depth bd(A) = bd(M). Let A ′ be the matrix from the statement of Theorem 15. Note that

Algorithms for integer programming
The main purpose of this section is to combine Theorem 1 with the existing approximation algorithm for branch-depth (Theorem 8) to obtain an approximation algorithm for computing a row-equivalent matrix with small dual tree-depth (if it exists).
Proof of Theorem 2. Let A be an m × n matrix. Without loss of generality, we can assume that the rows of A are linearly independent, i.e., the rank of A is m. This also implies that the rank of the column space of A is m, in particular, n ≥ m. We apply the approximation algorithm described in Theorem 8 to the vector matroid M formed by the columns of the matrix A, and obtain an extended depth-decomposition (T, f, g) of M. If the depth of T is larger than 4 d , then the branch-depth of A is larger than d; we report this and stop. Let B g be the matrix with the columns formed by the vectors in Im(g) and let B = B −1 g . Note that the matrix A ′ from the statement of Theorem 15 is equal to BA. By Theorem 15, the dual tree-depth of A ′ is at most 4 d .
We will next show that the entry complexity of A ′ is at most O(d · 4 d · ec(A)). Note that the classical implementation of the Gaussian elimination in strongly polynomial time by Edmonds [12] yields that the entry complexity of the matrix B is O(m log m · ec(A)) and this estimate is not sufficient to bound the entry complexity of A ′ in the way that we need. Let x be a column of A, and let W be the set of indices i, 1 ≤ i ≤ m, such that the i-th column of B g is g(v) for some non-root vertex v on the path from f (x) to the root of T . Note that |W | ≤ 4 d since the depth T is at most 4 d . Since the column x is a linear combination of the g-images of non-root vertices on the path from f (x) to the root of T , the i-th entry of the column of A ′ that corresponds to x is zero if i ∈ W . The remaining |W | entries of this column of A ′ form a solution of the following system of at most 4 d linear equations: the system is given by a matrix obtained from B g by restricting B g to the columns with indices in W and to |W | rows such that the resulting matrix has rank |W |, and the right hand side of the system is formed by the entries of the column x in A corresponding to these |W | rows. It follows (using Cramer's rule for solving systems of linear equations involving determinants) that a solution of this system has entry complexity at most O(log(4 d )! · ec(A)) = O(d · 4 d · ec(A)). Hence, the entry complexity of the matrix A ′ = BA, after dividing the numerator and the denominator of each entry by their greatest common divisor, is O(d · 4 d · ec(A)).
As explained in Section 1, Theorem 2 yields Corollary 4, which asserts that integer programming is fixed parameter tractable when parameterized by the branch-depth and the entry complexity of the constraint matrix.
Proof of Corollary 4 using Theorem 2. Consider an integer program as in (1) that has branch-depth at most d. We apply the algorithm from Theorem 2 to obtain a rational matrix B such that the instance with A ′ = BA, b ′ = Bb, l ′ = l and u ′ = u has dual tree-depth D at most 4 d in case of Theorem 2.
To apply the algorithm from [13], we need to transform the matrix A ′ into an integer matrix. We do so by multiplying each row by the least common multiple of the denominators of the fractions in this row. Since all denominators are integers between 1 and 2 ec(A ′ ) , the value of this least common multiple is at most 2 ec(A ′ )2 ec(A ′ ) . Hence, the entry complexity of the resulting integer matrix A ′′ is O ec(A ′ )2 ec(A ′ ) . Since the dependence of the algorithm from [13] on the entry complexity ec(A ′′ ) and the dual tree-depth D of A ′′ is 2 (ec(A ′′ )+D)D2 D , we obtain that the running time of the resulting algorithm depends on ec(A) and d as given in Table 1.
We complement Corollary 4 by showing that integer programming is not fixed parameter tractable when parameterized by the "primal" branch-depth.

Proposition 16.
Integer programming is NP-hard for instances with constraint matrices A satisfying bd(A T ) = 1 and ec(A) = 1, i.e., for instances such that the vector matroid formed by rows of the constraint matrix has branch-depth one.
Proof. An integer program as in (1) such that the rows of the matrix A are not linearly independent is equivalent to an integer program with a matrix A ′ obtained from A by a restriction to a maximal linearly independent set of rows unless the rank of the matrix A with the column b added is larger than the rank of A; in the latter case, the integer program is infeasible. Hence, it is possible in polynomial time to either determine that the input integer program is infeasible or to find an equivalent integer program such that the rows of the constraint matrix are linearly independent and the matrix is a submatrix of the original constraint matrix. However, the branch-depth of the matroid formed by rows of such a (non-zero) matrix is one. Since integer programming is already NP-hard for instances such that all the entries of the constraint matrix are 0 or ±1, cf. [13, Proposition 101, part 2], the proposition follows.

Structure of extended depth-decompositions
In this section, we present structural results on extended depth-decompositions that we need to design a fixed parameter algorithm to compute a depth-decomposition of a vector matroid with an optimal depth. We start with the following lemma, which can be viewed as a generalization of Lemma 12; indeed, if the set U in the statement contains only the common root of the primary branches, then the statement of the lemma is the same as that of Lemma 12.
Lemma 17. Let (T, f ) be a depth-decomposition of a vector matroid M and let U be a set of vertices of T such that every vertex contained in U has at least two Figure 3: Notation used in the proof of Lemma 17.
children and every ancestor u ′ of a vertex in U such that u ′ has at least two children is also contained in U. Assume that every branch of T rooted at a vertex from U is at capacity. Then, every vertex u ∈ U can be associated with a subspace L u of the linear hull of the elements of M such that the dimension of L u is the depth of u and the following holds. Let S 1 , . . . , S k be all branches rooted at u. If each ancestor of u has a single child, let L 0 be the vector space containing the zero vector only; otherwise, let u ′ be the nearest ancestor of u with at least two children, and let L 0 be the space L u ′ . It holds that Proof. We proceed by induction on the size of U. If U is empty, the lemma vacuously holds. Suppose that |U| = 1 and let u be the only vertex contained in U. By the assumption of the lemma, every branch rooted at u is primary. Hence, the statement of the lemma is implied by Lemma 12 and the fact that each branch rooted at u is at capacity. Suppose that |U| ≥ 2, and let u be any vertex of U with no descendant in U. Apply induction to the set U \ {u} to get subspaces L u ′ , u ′ ∈ U \ {u}, with properties given in the statement of the lemma. Let S 1 , . . . , S k be all branches rooted at u, and let A 1 , . . . , A k be the linear hulls of S 1 , . . . , S k , respectively. Further, let u 1 , . . . , u ℓ be all the vertices with at least two children on the path from the parent of u to the root (in this order), and let h 1 , . . . , h ℓ , be the depth of u 1 , . . . , u ℓ , respectively. See Figure 3 for an illustration of the notation. Note that {u 1 , . . . , u ℓ } ⊆ U; the choice of u implies that ℓ ≥ 1. Let S ′ i , i = 1, . . . , ℓ, be the branch rooted at u i that contains u and A ′ i be the linear hull of the elements assigned to leaves of the branches rooted at u i different from S ′ i . Note that S ′ 1 = S 1 ∪ · · · ∪ S k .
Set L i = L u i for i = 1, . . . , ℓ and also set L ℓ+1 to be the vector space containing the zero vector only. Note that L ℓ+1 ⊆ L ℓ ⊆ · · · ⊆ L 1 and the dimension of L i is h i for i = 1, . . . , ℓ; the space L 1 is the vector space L 0 from the statement of the lemma with respect to u. The following holds by the induction assumption for every i = 1, . . . , ℓ: if R is a branch rooted at the vertex u i , then and if R ′ is another branch rooted at the vertex u i , then The identity (3) for i = 1 and R = S ′ 1 yields that Using (4) iteratively for i = ℓ, . . . , 1, we obtain the following; the iterative argument uses that Let A ′ be the linear hull of A ′ i ∪ · · · ∪ A ′ ℓ . The relations (5) and (6) yield for i = 1 the following.
Now we obtain using (6) that This implies for i = 1 that The lemma requires establishing the existence of a vector space L u such that for all 1 ≤ i < j ≤ k and such that the dimension of L u is dim L 1 + h, where h is the distance between u and u 1 . Since every branch rooted at u is at capacity, we obtain using (7.1) that for every i = 1, . . . , k. Since every A i is a subspace of L S ′ 1 , we derive from (5.1), (6.1), and (8) that Since (T, f ) is a depth-decomposition, it holds that for all J ⊆ {1, . . . , k}, and analogously to the proof of (9), we derive from (10) We now obtain using (9) and (11) for J = {i, j} that for all 1 ≤ i < j ≤ k. On the other hand, it holds using (3.1), (9) and (11) applied for J = {1, . . . , k} \ {i} that We conclude that equality always holds in (12). Hence, there exists a subspace L u of dimension dim L 1 + h such that Using Lemma 17, we prove the following.
Lemma 18. Let (T, f ) be a depth-decomposition of a vector matroid M, u 1 a vertex of T with at least 2 children, and u 2 , . . . , u k all ancestors of u 1 with at least two children (listed in the increasing distance from u 1 ). Assume that every branch rooted at one the vertices u 1 , . . . , u k is at capacity, and let L 1 be the space L u 1 from the statement of Lemma 17 applied with U = {u 1 , . . . , u k }. Further, let S 1 be any branch rooted at u 1 and f 1 the restriction of f to S 1 .
The pair (S 1 , f 1 ) is a depth-decomposition of the vector matroid (M/L 1 ) S 1 and a branch of (S 1 , f 1 ) is at capacity if and only if it is at capacity in (T, f ). In Proof. Let X be the set of elements of M, let A 1 be the linear hull of S 1 , and let A ′ 1 be the linear hull of X \ S 1 . By Lemma 17, it holds that It follows that the matroids (M/L 1 ) S 1 and (M/A ′ 1 ) S 1 are the same. In addition, since all branches rooted at u 1 , . . . , u k are at capacity, it also holds that dim A ′ 1 = dim M − S 1 by (7.1). Instead of verifying that (S 1 , f 1 ) is a depth-decomposition of (M/L 1 ) S 1 , we verify that (S 1 , f 1 ) is a depth-decomposition of (M/A ′ 1 ) S 1 , which is equivalent since the two matroids are the same. Let X ′ be any subset of S 1 and let e be the number of edges on the paths from the f 1 -image of X ′ to the root of S 1 . Since (T, f ) is a depth decomposition of the matroid M, we obtain that Since the rank of the set , we obtain that the rank of X ′ in (M/A ′ 1 ) S 1 is at most e as desired. Hence, (S 1 , f 1 ) is a depth-decomposition of (M/L 1 ) S 1 .
Let S be a branch of S 1 rooted at a vertex u, let X ′ be the elements assigned to the leaves of the other branches rooted at u, and let e ′ be the number of edges contained in the other branches rooted at u. The branch S is at capacity in the depth-decomposition (S 1 , f 1 ) of the matroid (M/L 1 ) S 1 if and only if the rank of S 1 \ X ′ in the matroid (M/L 1 ) S 1 is S 1 − e ′ . The rank of the set The latter holds if and only if S is at capacity in the depth-decomposition (T, f ) of the matroid M.
It remains to prove the last part of the lemma. We proceed by induction of k. The base case is k = 1, i.e., the case when the branch S 1 is primary. Let (S ′ 1 , f ′ 1 ) be another depth-decomposition of the matroid (M/L 1 ) S 1 , and let (T ′ , f ′ ) be obtained as described in the statement of the lemma. Denote by S 2 , . . . , S ℓ the remaining branches rooted at u 1 . Let X ′ be any subset of the elements of M, let e i , i = 1, . . . , ℓ, be the number of edges on the paths from the vertices in the f ′ -image of X ′ ∩ S i to u 1 , and let f i , i ≥ 2 be the restriction of f to S i .
Similarly, as (S i , f i ) is a depth-decomposition of the matroid (M/L 1 ) S i by the already proven part of this lemma, we obtain that Using (14) and (15), we infer that Since the choice of X ′ was arbitrary, (T ′ , f ′ ) is a depth-decomposition of M. The inductive step proceeds as follows. Let k ≥ 2, let S 2 be the branch rooted at u 2 in T containing S 1 , let S ′ 2 be the branch rooted at u 2 in T ′ containing S ′ 1 , and let f 2 and f ′ 2 be the restrictions of f and f ′ , respectively, to the elements of S 2 = S ′ 2 . Finally, let L 2 be the space L u 2 from the statement of Lemma 17 applied with U = {u 1 , . . . , u k }. By the already proven part of the lemma, (S 2 , f 2 ) is a depth-decomposition of the matroid (M/L 2 ) S 2 . By the base of the induction, which we have already proven, (S ′ 2 , f ′ 2 ) is also a depth-decomposition of the matroid (M/L 2 ) S 2 . We now apply the induction to the vertex u 2 of T with replacing the branch S 2 with S ′ 2 in T , and conclude that (T ′ , f ′ ) is a depthdecomposition of the matroid M.
We next extend Lemma 10 to all branches.

Lemma 19.
Let (T, f ) be a depth-decomposition of a vector matroid M, and S 0 a branch of T rooted at a vertex u 0 such that S 0 is not at capacity. Suppose that every branch rooted at an ancestor of u 0 is at capacity. Let T ′ be the rooted tree obtained from T by changing the root of S 0 to be the parent of u 0 . Then, (T ′ , f ) is a depth-decomposition of M.
Proof. If S 0 is primary, we apply Lemma 10. Hence, we can assume that S 0 is not primary. Let U be the set of ancestors of u 0 that have at least two children; note that U is non-empty since the branch S 0 is not primary. We next apply Lemma 17 to get subspaces L u , u ∈ U, with properties described in the statement of the lemma. Let u 1 be the vertex of U nearest to u 0 , L 1 the vector space L u 1 , S 1 the branch rooted at u 1 that contains u 0 , and f 1 the function f restricted to the leaves of S 1 . By Lemma 18, (S 1 , f 1 ) is a depth-decomposition of the matroid (M/L 1 ) S 1 and the branch S 0 is not at capacity in (M/L 1 ) S 1 .
Let S ′ 1 be the rooted tree obtained from S 1 by changing the root of S 0 to be the parent of u 0 . Since the branch S 0 is primary in the depth-decomposition (S 1 , f 1 ), we obtain that (S ′ 1 , f 1 ) is a depth-decomposition of the matroid (M/L 1 ) S 1 by Lemma 10. The fact that (T ′ , f ) is a depth-decomposition of M now follows from Lemma 18.
We are now ready to present one of the main results of this section.
Theorem 20. There exists a polynomial time algorithm that, given a vector matroid M and a depth-decomposition (T, f ) of M, outputs an extended depthdecomposition (T ′ , f ′ , g) of M such that the depth of T ′ is at most the depth of T and every branch of T ′ is at capacity.
Proof. The algorithm first modifies (T, f ) to a depth-decomposition (T ′ , f ′ ) such that every branch of T ′ is at capacity. This is done iteratively as follows. At each iteration, the algorithm searches in the increasing order given by the distance from the root for a vertex u with at least two children such that a branch rooted at u is not at capacity. The depth-decomposition is then modified by changing the root of the branch that is not at capacity to the parent of u (note that u cannot be the root of the whole tree by Lemma 9). Lemma 19 implies that the new tree is again a depth-decomposition of M. This finishes the iteration and the algorithm starts a new iteration (again searching in the order given by the distance from the root). Note that the number of leaves is preserved and at each iteration the sum of the distances of the leaves to the root of the tree decreases. Since T has r(M) edges, it has at most r(M) leaves and each leaf is at distance at most r(M) from the root. It follows that the algorithm stops after at most r(M) 2 iterations producing a depth-decomposition (T ′ , f ′ ) of M such that every branch of T ′ is at capacity. Since the depth of the tree is never increased by the algorithm, the depth of T ′ is at most the depth of T . We next construct the function g. Let U be the set containing the root of T ′ and all vertices of (T ′ , f ′ ) with at least two children, and let L u be the vector spaces as described in Lemma 17 while setting L u to be the space containing the zero vector only for the root u of T ′ . Observe that the spaces L u , u ∈ U, can be algorithmically constructed. Indeed, if u ∈ U and the space L u ′ has already been constructed for the nearest ancestor u ′ of u contained in U, then L u is the intersection of the linear hulls of S 1 ∪ L u ′ and S 2 ∪ L u ′ where S 1 and S 2 are any two branches rooted at u.
The function g is defined for the vertices of T ′ in the order based on their distance from the root. Let v be a vertex of T ′ and assume that g has been defined for all ancestors of v (except the root). We distinguish two cases. The first case is that v has at least two descendants that are leaves. If v has at least two children, then let u be the vertex v itself, and let u be the nearest descendant of v contained in U otherwise. We set g(v) to be any vector of L u that is linearly independent of the g-image of the vertices on the path from the parent of v to the root. Since the dimension of L u is the depth of u, which is at least the depth of v, such a vector always exists. The other case is that v and all its descendants have at most one child. If v is a leaf, let v ′ be the vertex v itself. Otherwise, let v ′ be the only leaf descendant of v. We set g(v) to be any vector in the f ′preimage of v ′ that is linearly independent of the g-image of the vertices on the path from the parent of v to the root. Since the branch S containing v that is rooted at the nearest ancestor u of v contained in U is a depth-decomposition of the matroid (M/L u ) S (see Lemma 18), such a vector always exists. Note that the function g can be algorithmically constructed.
We now verify that (T ′ , f ′ , g) is an extended depth-decomposition of the matroid M. Observe that for every vertex u ∈ U, L u contains all spaces L u ′ for ancestors u ′ of u contained in U. Hence, the g-image of the vertices on the path from u to the root form a basis of L u for every u ∈ U. In particular, K u = L u for every u ∈ U. Let v be a leaf of T ′ and u its nearest ancestor contained in U. By Lemma 18, the branch S rooted at u containing v together with the restriction of f ′ to S is a depth-decomposition of the matroid (M/L u ) S . Note that the branch S is actually a path rooted at u. This implies that the g-image of the vertices on the path from v to the child of u contained in S form a basis of the linear hull of the f ′ -preimage of v quotiened by L u . Since the g-image of the vertices on the path from u to the root form a basis of K u = L u , we conclude that every vector in the f ′ -preimage of v is contained in the linear hull of the g-image of the vertices on the path from v to the root of T ′ .
We obtain the following two statements as corollaries of Theorem 20.  Proof. Let (T ′ , f ′ , g) be the extended depth-decomposition of M constructed in Theorem 20. Since T ′ was obtained from T by rerooting some of the branches, the vertices of T and T ′ are in one-to-one correspondence. In particular, the roots of T and T ′ are the same vertex, the functions f and f ′ are identical, and g is a well-defined function from the non-root vertices of T . Further, notice that any vertex on a given root-to-leaf path in T ′ is also on the path from the root to the corresponding leaf in T . Since (T ′ , f ′ , g) is an extended depth decomposition, any element x of M is contained in the linear hull of the g-image of the vertices on the path in T ′ from f (x) to the root, and thus (T, f, g) is an extended depth decomposition as well.
We conclude this section with a theorem that asserts that every vector matroid has a depth-decomposition of minimum depth such that every branch is both at capacity and solid. Before we can state and prove the theorem, we need three auxiliary lemmas. Proof. Let X 1 , . . . , X k be the elements of M contained in M 1 , . . . , M k , respectively. Since M 1 , . . . , M k are components of M, the rank of M is the sum of the ranks of M 1 , . . . , M k . In particular, the number of edges of T is the rank of M. Since every vertex x ∈ X i can be expressed as a linear combination of the g i -image of the vertices on the path from f i (x) to the root of T i , it is also a linear combination of the g-image of the vertices on the path from f (x) to the root of T . In particular, the linear hull of the g-image of all non-root vertices of T is equal to the linear hull of X 1 ∪ · · · ∪ X k . This implies that the vectors in the g-image of all non-root vertices of T are linearly independent. Let X ′ be any set of vertices of M. Since any vector in X ′ can be expressed as a linear combination of the g-image of the non-root vertices on the paths from f (X ′ ) to the root, the dimension of the linear hull of X ′ is at most the number of such vertices, which is equal to the number of edges on the paths. It follows that (T, f, g) is an extended depth-decomposition of M.
Lemma 24. Let (T, f, g) be an extended depth-decomposition of a vector matroid M, and let u be a vertex with at least two children. If S is a branch rooted at u, then S is a union of some components and loops of M/K u .
Proof. Let X be all the vectors of M, A their linear hull, and A S the linear hull of the g-images of the non-root vertices of S. Since the vectors of Im(g) form a basis of the vector space A and every element x of the matroid M is a linear combination of the vectors in the g-image of the vertices on the path from f (x) to the root, A S is a subset of the linear hull of S and the linear hull of S is a subset of the linear hull of A S ∪ K u . Since the dimension of A S is S , we obtain that Along the same lines, we obtain that Since the rank of M/K u is dim X − dim K u , the rank of S in M/K u is S , and the rank of Proof. Since the rank of the matroid (M/K u ) S is equal to dim S ∪ K u − dim K u = S , the trees T ′ and S have the same number of edges. This implies that the trees T and T ′′ also have the same number of edges. In order to establish that (T ′′ , f ′′ , g ′′ ) is an extended depth-decomposition of M, it is now enough to verify that every element x of the matroid M is a linear combination of the g ′′ -image of the vertices on the path from f ′′ (x) to the root. If this is the case, then the g ′′ -image of all non-root vertices of T ′′ form a basis of the vector space generated by the elements of M, and the rank of any subset X ′ of the elements of M is at most the number of non-root vertices on the paths from the f ′′ -image of X ′ to the root, which is equal to the number of edges on such paths. Let x be any element of the matroid M. If x ∈ S, then f (x) = f ′′ (x) and the g-image of the vertices on the path from f (x) = f ′′ (x) to the root is the same as the g ′′ -image, in particular, x is a linear combination of the g ′′ -image of the vertices on this path. Hence, we need to analyze the case when x ∈ S. In this case, the path from f ′′ (x) to the root contains all vertices on the path from u to the root of T ′′ , which implies that the linear hull of the g ′′ -image of the vertices on the path from f ′′ (x) to the root of T ′′ contains K u . Since (T ′ , f ′ , g ′ ) is an extended depth-decomposition of the matroid (M/K u ) S , x is contained in the linear hull of the union of K u and the g ′ -image of the vertices on the path from f ′ (x) to the root of T ′ . Hence, x is contained in the linear hull of the g ′′image of the vertices on the path from f ′′ (x) to the root of T ′′ . We conclude that (T ′′ , f ′′ , g ′′ ) is an extended depth-decomposition of M.
We are now ready to prove the final theorem of this section.
Theorem 26. Every vector matroid M has an extended depth-decomposition (T, f, g) of depth bd(M) such that every branch of T is both at capacity and solid.
Proof. We start with a depth-decomposition (T, f, g) of M with depth td(M) and modify it iteratively as follows. At each iteration, we first apply Theorem 20 to obtain a depth-decomposition such that every branch is at capacity. If every branch is solid, we stop. If there is a branch S that is not solid, we proceed as follows. Since S is not solid, the matroid (M/K u ) S is not connected, where u is the root of S. Let M 1 , . . . , M k be the components of the matroid (M/K u ) S and let X u be the set containing all loops of the matroid (M/K u ) S . Let (S i , f i , g i ) be an extended depth-decomposition of M i , i = 1, . . . , k, with depth bd(M i ). Since the branch-depth bd(M i ) of M i is at most the branch-depth of (M/K u ) S (as the branch-depth is a minor-monotone parameter), the depth of each of the trees S 1 , . . . , S k is at most the depth of S. By Lemmas 23 and 25, it is possible to replace the branch S with the branches S 1 , . . . , S k rooted at the root of S while assigning the elements of X u to arbitrary leaves of the branches S 1 , . . . , S k . Note that the depth of the new rooted tree does not exceed the depth of the original rooted tree. In this way, we obtain a new extended depth-decomposition of M, and we proceed to the next iteration.
We need to argue that the procedure described above eventually finishes. Let a i be the sum of the degrees of the vertices at distance i from the root. During the iterations, the rooted tree T is modified by the algorithm presented in Theorem 20 and by the procedure described in the first paragraph. The algorithm presented in Theorem 20 selects a branch that is not at capacity and reroots it to the parent of its root. Hence, there always exists i 0 such that a 0 , . . . , a i 0 −1 are preserved and a i 0 has increased by one. Similarly, in the procedure described in the first paragraph, the degree of the vertex u has increased while the degrees of all vertices with distance to the root smaller than u have not changed, in particular, there exists i 0 such that a 0 , . . . , a i 0 −1 are preserved and a i 0 has increased. We conclude that the vector (a 0 , . . . , a bd(M ) ) lexicographically increases at each modification of the tree T . Since the sum of the degrees of the vertices at distance i from the root is bounded by the rank r of M, which is the total number

Algorithm for finite fields
In this section, we design a fixed parameter algorithm for computing a depthdecomposition of a vector matroid over a fixed finite field. To do so, we need to introduce additional notation. Let (T, f, g) be an extended depth-decomposition of a vector matroid M, and let r be the rank of M. Let u 0 , . . . , u 2r be a depth-first-search transversal of the tree T (see Figure 4 for an illustration). For i ∈ {0, . . . , 2r}, we define A i to be the linear hull of K u i and the f -preimage of the leaves among the vertices u 0 , . . . , u i . Similarly, we define B i to be the linear hull of K u i and the f -preimage of the leaves among the vertices u i , . . . , u 2r . The sequence (u i , A i , B i ) i∈{0,...,2r} is called a transversal sequence for (T, f, g). Note that A i ∩ B i = K u i by the fact that Im(g) is a basis of the linear hull of elements of M. If (T, f, g) is principal and (T ′ , f ′ , g ′ ) is another extended depthdecomposition of M, we say that a branch S of T ′ is i-crossed if S contains the g-image of a vertex on the path from u i to the root of T .  Let X be the set of elements of M. By the definition of an extended depthdecomposition, the sets X ∩ A i and X ∩ B i are unions of components and loops of the matroid M/K u i . Since S is not i-crossed, the leaf f ′ (g(v ′ )) for every vertex v ′ on the path from u i to the root of T is contained in V . It follows that g(v ′ ) is contained in C, and so K u i is a subspace of C. Hence, every component of the matroid M/K u i is a union of components and loops of the matroid M/C. In particular, each of the sets X ∩ A i and X ∩ B i is a union of components and loops of the matroid M/C. Since S is the union of a component of M/C and possibly some vectors from K v , it must hold that S is a subset of the union of X ∩ A i and K v or the union of X ∩ B i and K v . The lemma follows.
We will design a dynamic programming algorithm, which will construct an optimal depth-decomposition of a vector matroid M using the information on the structure of M captured by an extended depth-decomposition of M produced by an approximation algorithm given in Theorem 8. The depth-decomposition will be constructed iteratively for elements of M in the order that the leaves corresponding to them appear in the transversal sequence of the depth-decomposition produced by the approximation algorithm. Since it would not be feasible to store all possible "partial" depth-decompositions, we need a more succinct way of representing an already constructed part of a depth-decomposition, which we now formally introduce.
Let T 0 be a rooted tree; we say that a mapping h from the non-root vertices to vectors is k-matchable for some k ∈ N if there exists a surjective mapping g from {1, . . . , k} to the leaves of T 0 such that for every j = 1, . . . , k, the linear hull of the h-image of the vertices on the path from g(j) to the root contains the j-th unit vector. A frontier is a tuple (T 0 , d, a, b, h) such that T 0 is a rooted tree, d, a, and b are non-negative integers that sum to the number of edges of T 0 (in particular, T 0 has at most d leaves), and h is a mapping from the non-root vertices of T 0 to F d+a+b such that Im(h) is a basis of F d+a+b and h is d-matchable. We will refer the middle a coordinates of h-images as A-coordinates and to the last b coordinates as B-coordinates.
Let (T, f, g) be a principal extended depth-decomposition of a vector matroid M with rank r over a field F, (u i , A i , B i ) i∈{0,...,2r} a transversal sequence for (T, f, g), and (T ′ , f ′ , g ′ ) another extended depth-decomposition of a matroid M. The i-frontier of (T ′ , f ′ , g ′ ) with respect to (T, f, g) and (u i , A i , B i ) i∈{0,...,2r} is the frontier (T 0 , d, a, b, h) obtained as described below; see Figure 5 for an illustration.
• The integer d is the depth of u i in T .
• T 0 is the rooted subtree of T ′ formed by the paths from the root of T ′ to the f ′ -images of v u 1 , . . . , v u d , where v u 1 , . . . , v u d are the g-images of the vertices on the path from the root of T to u i (in this order).
• The integers a and b are the smallest integers for that there exists an adimensional subspace L A of A i and a b-dimensional subspace L B of B i such • Finally, h is a mapping from the non-root vertices of T 0 to F d+a+b that satisfies the following: be a basis of L B . The value h(v) for a non-root vertex v of T 0 is equal to the coordinates of g ′ (v) with respect to the (linearly independent) vec- Note that we use i both as an index for the transversal sequence and as an index of the frontier in order to emphasize the link between the two indices. To see that ifrontiers are indeed frontiers, observe first that K u i is the linear hull of v u 1 , . . . , v u d . Since K u i = A i ∩ B i and K u i is contained in the linear hull of the g ′ -images of the vertices of T 0 , the subspaces L A ⊆ A i and L B ⊆ B i are uniquely determined and the dimension of the linear hull of the g ′ -images of the vertices of T 0 is equal to d + a+ b. Since g ′ is a bijection from the non-root vertices of T to a basis of the linear hull of elements of M, the number of edges of T 0 must be d + a + b. Finally, since T 0 contains the f ′ -images of v u 1 , . . . , v u d , the function h is d-matchable. The following lemma justifies the definition of an i-frontier. Informally speaking, the lemma says that an i-frontier splits an extended depth-decomposition into a left and a right side, and that two depth-decompositions with the same i-frontier can be glued together on it, taking one side from each decomposition; also see Figure 6 for an illustration. In this way, the i-frontier contains all information that needs to be stored when iteratively constructing a depth-decomposition of M in a dynamic way for the elements of contained in A 0 , A 1 , . . . , A 2r .
Lemma 28. Let (T, f, g) be a principal extended depth-decomposition of a vector matroid M with rank r, let (u i , A i , B i ) i∈{0,...,2r} be a transversal sequence for (T, f, g), and let (T ′ , f ′ , g ′ ) and (T ′′ , f ′′ , g ′′ ) be two solid extended depthdecompositions of M. Suppose that i ∈ {0, . . . , 2r} is such that the i-frontiers of (T ′ , f ′ , g ′ ) and (T ′′ , f ′′ , g ′′ ) with respect to (T, f, g) and (u i , A i , B i ) i∈{0,...,2r} are the same. Let T 0 be the rooted tree of the i-frontier, which we identify with the corresponding subtrees of T ′ and T ′′ . Further, let K A be the linear hull of the g ′image of the vertices of T 0 , let K B be the linear hull of the g ′′ -image of the vertices of T 0 , and set C A = K A ∩ A i and C B = K B ∩ B i . Obtain T ′ A from T ′ by removing all branches S with S ⊆ B i ∪ K A that are not i-crossed, T ′′ B from T ′′ by removing all branches S with S ⊆ A i ∪ K B that are not i-crossed, and T ′′′ by gluing T ′ A and T ′′ B together on the vertices of T 0 (note that both T ′ A and T ′′ B contain T 0 ). Finally, let f ′′′ be a function from the elements of M to the leaves of T ′′′ defined as follows.
. If x ∈ C A , then let f ′′′ (x) be any leaf u of T 0 such that x is contained in the linear hull of the g ′ -image of the vertices on the path from u to the root. Finally, if x ∈ C B \ C A , then let f ′′′ (x) be any leaf u of T 0 such that x is contained in the linear hull of the g ′′ -image of the vertices on the path from u to the root. Then, (T ′′′ , f ′′′ ) is a depth-decomposition of M.
Proof. We first verify that f ′′′ is well-defined. Consider an element x of M and suppose that x ∈ A i \ C A . Since the space C A is the intersection of A i and K A , the element x does not belong to K A and so f ′ (x) is not contained in T 0 , i.e., f ′ (x) is contained in a branch of T ′ that is not i-crossed. Consider a maximal such branch S. Lemma 27 yields that S ⊆ A i ∪ K A or S ⊆ B i ∪ K A , and since x ∈ A i \ K A and A i ∩ B i = K u i ⊆ K A , it follows that S B i ∪ K A . Hence, the branch S is contained in T ′ A and f ′′′ (x) is well-defined. The case that x ∈ B i \ C B is symmetric.
The next case that we analyze is that x ∈ C A . Since C A ⊆ K A and the g ′image of T 0 is a basis of K A , the element x can be uniquely expressed as a linear combination of the elements of the g ′ -image of T 0 . Moreover, as (T ′ , f ′ , g ′ ) is an extended depth-decomposition of M, the g ′ -preimage of the basis elements with non-zero coefficients in this linear combination is contained in the path from f ′ (x) to the root of T ′ . Hence, this preimage is contained in a path from the root of T 0 to one of its leaves, say u. This implies that x ∈ K u in T ′ , so f ′′′ (x) can be set to be u. The final case is that x ∈ C B \ C A . Since x ∈ C B , the argument above yields that there exists a leaf u of T 0 such that x ∈ K u in T ′′ , and so f ′′′ (x) can be set to be u.
For completeness, we check that the sets The remaining pairs are disjoint by definition, so indeed f ′′′ is a well-defined function.
We next verify that the number of edges of T ′′′ is the rank of M, which is Let (T 0 , d, a, b, h) be the common i-frontier of (T ′ , f ′ , g ′ ) and (T ′′ , f ′′ , g ′′ ). Observe Hence, A i is contained in the linear hull of the g ′ -image of T ′ A and the dimension of this linear hull is dim A i + b. Since Im(g ′ ) is a basis, the number of edges of T ′ A is dim A i + b. A symmetric argument yields that the number of edges of T ′′ B is dim B i + a. The tree T 0 has d + a + b edges since (T 0 , d, a, b, h) is a frontier, so T ′′′ has To finish the proof of the lemma, we need to show that (T ′′′ , f ′′′ ) is a depthdecomposition of M. To do so, we define a function g ′′′ such that (T ′′′ , f ′′′ , g ′′′ ) is an extended depth-decomposition of M. Let u be a non-root vertex of T ′′′ . If u is a non-root vertex of a branch S of T ′ with S ⊆ A i ∪ K A that is not i-crossed, we set g ′′′ (u) to be any nonzero vector of A i such that g ′ (u) − g ′′′ (u) ∈ K A , i.e., the vectors g ′ (u) and g ′′′ (u) are the same in the space quotioned by K A . Similarly, if u is a non-root vertex of a branch S of T ′′ with S ⊆ B i ∪K B that is not i-crossed, we set g ′′′ (u) to be any nonzero vector of B i such that g ′′ (u)−g ′′′ (u) ∈ K B . It remains to define the mapping g ′′′ for non-root vertices of the tree T 0 . Let let K ′ u , K ′′ u and K ′′′ u be the spaces K u defined for trees T ′ , T ′′ and T ′′′ ; we need to make this distinction here since the spaces K ′ u , K ′′ u and K ′′′ u may differ. Observe that for every non-root vertex u of T 0 , the intersection of K ′ u and A i is the same as the intersection of K ′′′ u and A i . The choice of g ′′′ for the vertices of It remains to show that every element x of M is a linear combination of the g ′′′ -image of the vertices on the path from f ′′′ (x) to the root in T ′′′ . Fix an element x of M. If x ∈ A i \ C A , let u be the vertex f ′′′ (x) = f ′ (x) and observe that x belongs to T ′ A (as we have already established that f ′′′ (x) is well-defined).
follows that x is contained in the linear hull of the g ′′′ -image of the vertices on the path from f ′′′ (x) to the root. If x ∈ C A , the vertex f ′′′ (x) is a leaf of T 0 such that x ∈ K ′ u (as we have already established that x is contained in the linear hull of the g ′′′ -image of the vertices on the path from f ′′′ (x) to the root in T ′′′ . The cases x ∈ B i and x ∈ C B \ C A follow the same line of reasoning.
To prove the main result of this section, we will need the following auxiliary lemma.
Lemma 29. Let (T, f, g) be a principal extended depth-decomposition of a vector matroid M with rank r, (u i , A i , B i ) i∈{0,...,2r} a transversal sequence for (T, f, g), and (T ′ , f ′ , g ′ ) a solid extended depth-decomposition of M. The following holds for every i ∈ {0, . . . , 2r}. Let T 0 be the rooted tree of the i-frontier, K the linear hull of the g ′ -image of the vertices of T 0 , T A the rooted tree obtained from T ′ by removing all branches S with S ⊆ B i ∪K that are not i-crossed, g A the restriction of g ′ to T A , and M A the vector matroid obtained from the restriction of M to the elements of A i by adding the g ′ -image of the vertices of T 0 (note that parallel elements may be added to M A by this operation). There exists a function f A from the elements of M A to the leaves of T A such that the triple (T A , f A , g A ) is an extended depth-decomposition of M A .
Proof. We define f A as follows. If x is contained in the restriction of M to the elements of A i and f ′ (x) is a leaf of T A , we set f A (x) to f ′ (x). If x is contained in the restriction of M to the elements of A i but f ′ (x) is not a leaf of T A , we set f A (x) to any leaf u such that x ∈ K u . Finally, if x is not contained in A i , then x = g ′ (v) for a vertex v of T 0 and we set f A (x) to any leaf descended from v.
We need to argue that f A (x) is well-defined for every element x of M A . This is clear unless x is contained in the restriction of M to the elements of A i and f ′ (x) is not a leaf of T A . In such a case, Lemma 27 implies that f ′ (x) is a leaf of a branch S with S ⊆ B i ∪ K. It follows that the element x is contained in Since the g ′ -image of T 0 is a basis of K, the element x can be uniquely expressed as a linear combination of the elements of the g ′ -image of T 0 . Moreover, as (T ′ , f ′ , g ′ ) is an extended depth-decomposition of M, the g ′ -preimage of the basis elements with non-zero coefficients in this linear combination is contained in the path from f ′ (x) to the root of T ′ . The subpath of this path containing the preimage is also contained in T 0 , and so T 0 contains a path from one of its leaves, say u, to its root such that the preimage is also contained in this path. It follows that x ∈ K u and f A (x) can be set to u.
To complete the proof, we need to show that (T A , f A , g A ) is an extended depth-decomposition of the matroid M A . Observe that for every leaf u of T A , the g-image and g A -image of the vertices on the path from u to the root are the same. Hence, the space K u is the same with respect to g and g A and it follows that x ∈ K f A (x) for every element x of M A . Finally, since M A contains all elements of A i and a basis of K and the g A -image of the vertices of T A is a basis of the linear hull of A i ∪ K, the number of edges of T A is the rank of M A . It follows that (T A , f A , g A ) is an extended depth-decomposition of the matroid M A .
Before stating the main result of this section, we need to establish that the number of frontiers for any fixed d is bounded. Proof. We first show that there are at most d 2k−1 rooted trees T with k leaves and depth at most d. Such a tree can be encoded as follows: enumerate the k leaves of T in the depth-first-search order. Let d 1 be the depth of the first leaf, and for i = 2, . . . , k, let d i be the depth of the i-th leaf and m i be the number of edges shared by the paths from the root to the (i − 1)-th and i-th leaves. Note that the numbers d 1 , . . . , d k and m 2 , . . . , m k determine the tree T . Since each d i is a positive integer that is at most d and each m i is a non-negative integer that is at most d − 1, it follows that there are at most d 2k−1 rooted trees T with k leaves and depth at most d. Summing over all the choices k = 1, . . . , D, we obtain that there are at most d 2D rooted trees with at most D leaves and depth at most d.
Fix a tree T with at most D leaves and depth at most d, and let m be the number of edges of T . Note that m ≤ dD, and D +a+b = m if (T, D, a, b, h) is to be a frontier. Hence, the integers a and b can be chosen in at most m ≤ dD ways, and the mapping h can be chosen in at most |F| m 2 ≤ |F| (dD) 2 ways (although some of these choices would not yield a frontier). It follows that the number of choices of a, b, and h, when T is fixed (which determines d), is at most dD|F| (dD) 2 . We conclude that for a fixed D, the number of frontiers (T, D, a, b, h) such that the depth T is at most d does not exceed d 2D+1 D|F| (dD) 2 .
We are now ready to prove the main theorem of this section.
Theorem 31. For the parameterization by a positive integer d and a prime power q, there exists a fixed parameter algorithm that for a vector matroid M over the q-element field either outputs that bd(M) is larger than d, or outputs an extended depth-decomposition of M with depth at most d.
Proof. We first apply the algorithm from Theorem 8. The algorithm either outputs that the branch-depth of M is larger than d or outputs a principal extended depth-decomposition of M with depth at most 4 d . If the former applies, we stop and report that the branch-depth of M is larger than d. Otherwise, let (T, f, g) be the principal extended depth-decomposition returned by the algorithm.
Let r be the rank of the matroid M, (u i , A i , B i ) i∈{0,...,2r} a transversal sequence for (T, f, g), and d i the depth of u i in T . For i = 0, . . . , 2r, the algorithm iteratively computes the list of all frontiers (T 0 , d i , a, b, h) with depth at most d for which the following hold: • there exists a vector matroid M ′ with rank dim A i + b such that the linear hull of its elements is contained in L (A i ∪ B i ), • M ′ contains the restriction of M to the elements of A i , • the matroid M ′ has an extended depth-decomposition (T A , f A , g A ) with depth at most d, and • (T 0 , d i , a, b, h) is yielded by the procedure for creating i-frontiers performed on (T A , f A , g A ) with respect to (T, f, g) and (u i , A i , B ′ i ), where B ′ i is intersection of the linear hull of the elements of M ′ and B i . (Note that we cannot formally take i-frontiers of (T A , f A , g A ) since (T, f, g) is not a depthdecomposition of M ′ .) If the branch-depth of M is at most d, then M has a solid extended depthdecomposition with depth bd(M) by Theorem 26 and the list is non-empty for every i = 0, . . . , 2r by Lemma 29. By Lemma 30, the size of the list computed in the i-th iteration does not exceed d 2d i +1 d i |F| (dd i ) 2 , and is therefore bounded by a function of d and |F| only (since d i ≤ 4 d for every i). We emphasize that (T 0 , d i , a, b, h) is not required to be an i-frontier of M ′ with respect to a principal depth-decomposition of M ′ .
We now describe the iterations of the algorithm in detail. For i = 0, the list of frontiers contains a single element (R, 0, 0, 0, h), where R is the rooted tree that contains the root only and h is the null function. Hence, assume that i > 0 and we have already computed the list for i − 1. The iteration of the algorithm differs according to whether u i is the parent or a child of u i−1 .
We start with the case where u i is the parent of u i−1 . Then the depth of u i−1 is d i + 1, and the following is performed for every frontier (T 0 , d i + 1, a, b, h) in the list from the previous iteration: • If h is d i -matchable, we add (T 0 , d i , a + 1, b, h ′ ) to the list for the i-th iteration, where h ′ is a mapping from the non-root vertices of T 0 obtained from h by changing the (d i + 1)-th coordinate into an A-coordinate and applying an invertible linear transformation to the a + 1 A-coordinates, i.e., we fix such a linear transformation L and set h ′ (v) = L(h(v)) for all vertices v of T 0 .
• For every leaf v of T 0 such that the linear hull of the h-image of the vertices from v to the root contains the (d i + 1)-th unit vector, we proceed as follows. Let T ′ 0 be the tree obtained by removing the path from v to the first ancestor with at least two children, or to the root if there is no such ancestor. Let c be the number of edges on this path, and let h ′ be the restriction of h to the non-root vertices of T ′ 0 . If h ′ is d i -matchable and the linear hull of Im(h ′ ) restricted to the last b coordinates has dimension b, we add (T ′ 0 , d i , a + 1 − c, b, h ′′ ) to the list for the i-th iteration, where h ′′ is a mapping from the non-root vertices of T ′ 0 to F d i +a+1−c+b obtained from h ′ by changing the (d i + 1)-th coordinate into an A-coordinate and applying any full rank linear transformation L : F a+1 → F a+1−c to its a+1 A-coordinates.
We next describe the case that u i is a child of u i−1 ; note that d i = d i−1 + 1 in this case. Let X i be the set of d i -dimensional vectors that formed by d i coordinates of the elements of M contained in K u i , expressed with respect to the basis formed by the g-image of the vertices on the path from the root of T to u i (in this order). The following is performed for every frontier (T 0 , d i − 1, a, b, h) in the list from the previous iteration: • For every invertible linear transformation L of the B-coordinates of h and every leaf v of T 0 such that the linear hull of the L(h)-image of the vertices on the path from v to the root contains the (d i −1+a+b)-th unit vector, we proceed as follows. Let h ′ be the mapping obtained from L(h) by changing the last coordinate into a new d i -th coordinate. If for every x ∈ X i there exists a vertex v ′ of T 0 such that x is contained in the linear hull of the h ′image of the vertices on the path from v ′ to the root of T 0 restricted to the first d i coordinates, we add (T 0 , d i , a, b − 1, h ′ ) to the list for the i-th iteration.
• For every rooted tree T ′ 0 obtained from T 0 by adding a new leaf v joined by a path with c ≥ 1 edges to T 0 in a way that the depth of T ′ 0 is at most d, we proceed as follows. Let h ′ be the mapping obtained from h by adding new c zero B-coordinates and extending it to each vertex on the newly added path by mapping the vertex to one of the unit vector for the new coordinates in a way that the dimension of of the h ′ -image is d i + a + b + c − 1. We next consider all invertible linear transformations L of the b + c B-coordinates such that the L(h ′ )-image of the vertices on the path from v to the root contains the (d i + a + b + c − 1)-th unit vector, and, for each such L, we obtain the mapping h ′′ from L(h ′ ) by turning the last coordinate into a new d i -th coordinate. If for every x ∈ X i there exists a vertex v ′ of T ′ 0 such that x is contained in the linear hull of the h ′′ -image of the vertices on the path from v ′ to the root of T ′ 0 restricted to the first d i coordinates, we add (T ′ 0 , d i , a, b + c − 1, h ′′ ) to the list for the i-th iteration.
The inspection of the steps of the algorithm yields that if (T 0 , d i , a, b, h) is added to the list in the i-th iteration, then h is d i -matchable and the dimension of the himage is d i + a + b. Hence, the computed list of frontiers in the i-th iteration contains exactly the frontiers described at the beginning of the proof. As we have already argued, if the branch-depth of M is at most d, the list of frontiers is non-empty in all iterations. In particular, if the list becomes empty, we stop and report that the branch-depth of M exceeds d. Hence, we assume that the list is non-empty in all iterations. If the final list is non-empty, it contains a single element (T 2r , d 2r , a 2r , b 2r , h 2r ) = (R, 0, 0, 0, h) where R is the rooted tree that contains the root only and h is the null mapping. We now define (T i , d i , a i , b i , h i ) for all i = 0, . . . , 2r by tracing back the lists of frontiers We now establish the existence of a mapping f M such that (T M 2r , f M , g M 2r ) is an extended depth-decomposition of M. Let x be an element of M and let i be the smallest index such that x ∈ K u i . It follows that u i−1 is the parent of u i and can also be constructed algorithmically. Finally, observe that the number of iterations in the algorithm is twice the rank of M, the size of the list computed in each iteration is bounded by a function of d and q only, and that the number of steps needed for each element of these lists to be processed is bounded by a function of d and q times a polynomial in the size of M. Specifically, each list has at most d 2 2d+1 +1 4 d q (d4 d ) 2 = q 2 O(d) elements and the number of steps needed to process each of their elements is bounded by a polynomial in the size of M times q (d4 d ) 2 = q 2 O(d) . Hence the presented algorithm is a fixed parameter algorithm for parameterization by d and q.
Theorems 20 and 31 yield the following corollary.
Corollary 32. For the parameterization by a positive integer d and a prime power q, there exists a fixed parameter algorithm that for a vector matroid M over the q-element field either outputs that bd(M) is larger than d, or computes bd(M) and outputs an extended depth-decomposition with this depth such that every branch is at capacity.

Algorithm for rational matrices
In this section, we adopt the algorithm presented in Section 7 to matroids over rationals. We start with an auxiliary lemma on linear combinations appearing in extended depth-decompositions. We remark that the bound of 2 2d−1 in Lemma 33 can be replaced with d · 2 d−1 using a slightly more careful analysis.
Lemma 33. Let M be a vector matroid and (T, f ) a depth-decomposition of M with depth d such that every branch is at capacity. There exists a mapping g such that (T, f, g) is an extended depth-decomposition of M and every element of Im(g) is a linear combination of at most 2 2d−1 elements of M.
Proof. We show that it is possible to choose a mapping g in such a way that the g-image of a vertex at depth i > 0 is a linear combination of at most 2 d+i−1 elements of M. Let u 0 , . . . , u k be the vertices on the path from the root of T to a leaf, in that order. Let i 0 < · · · < i ℓ be the sequence of indices such that i 0 = 0, i ℓ = k, and u i 1 , . . . , u i ℓ−1 are exactly the vertices among u 1 , . . . , u k−1 that have at least two children. By Lemma 17, each K u i j , j = 0, . . . , ℓ, is the same for any function g such that (T, f, g) is an extended depth-decomposition of M. Let L j be this space, which has dimension i j and is determined by the choice of T and f only, and note that the elements g(u i j−1 +1 ), . . . , g(u i j ) always form a basis of L j /L j−1 . We will establish that it is possible to choose these elements in such a way that g(u i ), i = 1, . . . , k, is a linear combination of at most 2 d+i−1 elements of M.
Suppose that we have already fixed g(u 1 ), . . . , g(u i−1 ), and let j be the smallest index such that i ≤ i j . Note that dim L j > i − 1. If i j = k, then L j /L j−1 is the linear hull of the elements in f −1 (u k ) quotioned by L j−1 and so we choose g(u i ) to be any element of f −1 (u k ) that is linearly independent of g(u 1 ), . . . , g(u i−1 ). Hence, we assume that i j < k in the rest of the proof.
Let K be the linear hull of g(u 1 ), . . . , g(u i−1 ), and let C be the at most (1 + . . . + 2 i−1 )2 d−1 = (2 i − 1)2 d−1 elements of M appearing in the linear combinations used to express g(u 1 ), . . . , g(u i−1 ). Consider any two branches rooted at u i j and let A and B be the f -preimages of the leaves of the two branches. By Lemma 17, L j is the intersection of the linear hulls of A ∪ L j−1 and B ∪ L j−1 . Since the linear hulls of A ∪ L j−1 and A ∪ K are the same, and the linear hulls of B ∪ L j−1 and B ∪ K are the same, L j is also the intersection of the linear hulls of A ∪ K and B ∪ K. Since the dimension of L j is larger than dim K = i − 1, K is a proper subspace of L j and so the matroid (M/K)[A ∪ B] contains a circuit X such that both X ∩A and X ∩B are non-empty. Hence, L j \K contains a nonzero element w that is a linear combination of the elements of (X ∩A) ∪K ⊆ (X ∩A) ∪L (C) and also a linear combination of the elements of (X ∩ B) ∪ K ⊆ (X ∩ B) ∪ L (C). By Proposition 5, every circuit of M contains at most 2 d elements, and since every circuit of M/K is a subset of a circuit of M, we can by symmetry assume that |X ∩A| ≤ 2 d−1 . Hence, w is a linear combination of at most 2 d+i−1 elements of M contained in (X ∩ A) ∪ C and we can set g(u i ) to be the vector w.
The next lemma allows us to convert a representation of a matroid with small branch-depth over the rational numbers to a representation of an isomorphic matroid over a finite field.

Lemma 34. There exists an algorithm such that
• the input of the algorithm is an integer d ≥ 1 and a matroid M represented over Q such that all entries of the vectors in the representation are integers between −K and +K, • the running time of the algorithm is polynomial in the number of elements of M and log K, and • the algorithm either outputs that the branch-depth of M is larger than d or computes a matroid M ′ represented over F q for some q ≤ K 2 4 d+1 2 2 2 d+2 , along with an isomorphism between M and M ′ .
Proof. We describe how the algorithm from the statement of the lemma proceeds. First, the algorithm from Theorem 8 is invoked for the input matroid M and an integer d. If the algorithm outputs that the branch-depth of M is larger than d, then we stop and report this. Otherwise, we obtain a principal depthdecomposition (T, f, g) of M with depth at most 4 d . For each element x ∈ M, we compute its representation x ′ with respect to the basis Im(g). Note that all entries of the vector x ′ are zero except for those that correspond to the g-image of the vertices on the path from f (x) to the root. Hence, computing the entries of x ′ requires solving a system of at most 4 d equations with integer coefficients between −K and +K, which implies that the fractions appearing as the entries of x ′ have both numerator and denominator at most (K4 d ) 4 d by Cramer's Rule. We define ϕ(x) to be the integer vector obtained from x ′ by multiplying all its entries by the least common multiple of the denominators of the fractions that form the entries of x ′ . Since the vector x ′ has at most 4 d non-zero entries, all entries of ϕ(x) are between −K ′ and K ′ where K ′ = (K4 d ) 4 2d .
Let q be any prime larger than (2K ′ 2 4 d ) 2 4 d and consider the vector matroid M ′ over F q formed by the vectors Im(ϕ). Note that there exists such a prime q that is at most 2 · (2K ′ 2 4 d ) 2 4 d ≤ K 2 4 d+1 2 2 2 d+2 . Observe that (T, f ′ , g ′ ) is a depthdecomposition of M ′ where f ′ (ϕ(x)) is set to f (x) and g ′ (v) is the unit vector whose non-zero coordinate corresponds to g(v). Indeed, the only non-zero coordinates of the vector ϕ(x) are those corresponding to the g-images of the vertices on the path from f (x) to the root. We conclude the branch-depth of M ′ is at most 4 d .
It is well-known that if a set of integer vectors is linearly dependent over Q, then it is linearly dependent over any finite field; in particular, if X is a linearly dependent set of elements of M, then ϕ(X) is linearly dependent over F q . On the other hand, the choice of q yields that if X is an independent set of at most 2 4 d elements of M, then ϕ(X) is independent over F q . Since the branch-depths of both M and M ′ are at most 4 d , neither M nor M ′ has a circuit with more than 2 4 d elements by Proposition 5. Hence, the matroids M and M ′ have the same set of circuits. It follows that the matroids M and M ′ are isomorphic and ϕ is an isomorphism between them.
Using Lemmas 33 and 34, we prove the main theorem of this section.
Theorem 35. For the parameterization by positive integers d and K, there exists a fixed parameter algorithm that, for a vector matroid M over Q such that the entries of all vectors in M are between −K and +K, either outputs that bd(M) is larger than d, or computes bd(M) and outputs an extended depthdecomposition (T, f, g) of M with depth bd(M). Moreover, the entry complexity of the vectors in Im(g) is bounded by a function of d and K.
Proof. Fix integers d and K. We first run the algorithm from Lemma 34 that either outputs that the branch-depth of M is larger than d or outputs a matroid M ′ with a representation over F q for q ≤ K 2 4 d+1 2 2 2 d+2 that is isomorphic to M and an isomorphism ϕ between M and M ′ . Hence, we can use the algorithm from Corollary 32 to decide whether the branch-depth of M ′ is at most d, and if so, to construct a depth-decomposition (T, f ′ ) of depth bd(M ′ ) such that every branch of T is at capacity. If the branch-depth of M ′ exceeds d, then the branch-depth of M also exceeds d, so we stop and report this. Otherwise, (T, f ) is a depthdecomposition of depth bd(M) = bd(M ′ ) where f is obtained from f ′ using the isomorphism between M and M ′ , i.e., f (x) = f ′ (ϕ(x)) for every element x of M. We now use the procedure described in the proof of Lemma 33 to compute a function g such that (T, f, g) is an extended depth-decomposition of M. Since computations given in the proof of Lemma 33 involve solving systems of equations with at most 2 2d−1 variables, the entry complexity of the vectors in Im(g) is bounded by O(d2 2d log K).

Theorem 35 implies Theorem 3 as follows.
Proof of Theorem 3. Let M be the matroid formed by columns of A. The algorithm from Theorem 35 either reports that bd(A) > d or outputs an extended depth-decomposition (T, f, g) of M with branch-depth bd(A) such that the entry complexity of Im(g) is bounded by a function of d and K. Let A ′ be the matrix from Theorem 15. Since each element x of the matroid M is a linear combination of at most bd(A) ≤ d elements from Im(g), which are those forming the g-image of the vertices on the path from f (x) to the root of T , each entry of the matrix A ′ can be obtained by solving a system of at most d linear equations where the entry complexity of the coefficients and the right hand side is bounded by O(d2 2d log K). Hence, the entry complexity of A ′ is bounded by O(d 2 2 2d log K).