The direct sum of M and N has ground set equal to the disjoint union of those of M and N, and bases equal to the union of bases of M and N.
i1 : S = uniformMatroid(2,3) ++ uniformMatroid(1,3) o1 = a matroid of rank 3 on 6 elements o1 : Matroid |
i2 : peek S o2 = Matroid{bases => {set {0, 1, 3}, set {0, 1, 4}, set {0, 1, 5}, set {0, 2, 3}, set {0, 2, 4}, set {0, 2, 5}, set {1, 2, 3}, set {1, 2, 4}, set {1, 2, 5}}} cache => CacheTable{...2...} groundSet => set {0, 1, 2, 3, 4, 5} rank => 3 |
i3 : S_* o3 = {(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1)} o3 : List |
i4 : (S ++ uniformMatroid(1, 3))_* o4 = {((0, 0), 0), ((1, 0), 0), ((2, 0), 0), ((0, 1), 0), ((1, 1), 0), ((2, 1), 0), (0, 1), (1, 1), (2, 1)} o4 : List |
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.