The direct sum of M and N is a matroid with ground set equal to the disjoint union of the ground sets of M and N, and bases equal to the union of bases of M and N.




The elements of the ground set of the direct sum will receive placeholders to ensure disjointness (as evidenced by the elements of S being ordered pairs above). As this method is binary, repeated applications of this function will result in nested placeholders. Since the bases are stored as indices, the bases of M will not change, but those of N will be shifted up by the size of the ground set of M.