# directSum(Complex) -- direct sum of complexes

## Synopsis

• Function: directSum
• Usage:
D = C1 ++ C2
D = directSum(C1,C2,...)
D = directSum(name1 => C1, name2 => C2, ...)
• Inputs:
• Ci, ,
• Outputs:
• D, , the direct sum of the input complexes

## Description

The direct sum of two complexes is another complex.

 i1 : S = ZZ/101[a,b,c]; i2 : C1 = freeResolution coker vars S 1 3 3 1 o2 = S <-- S <-- S <-- S 0 1 2 3 o2 : Complex i3 : C1 ++ complex(S^13)[-2] 1 3 16 1 o3 = S <-- S <-- S <-- S 0 1 2 3 o3 : Complex i4 : C2 = complex (ideal(a,b,c)) o4 = image | a b c | 0 o4 : Complex i5 : C1 ++ C2 3 3 1 o5 = image | 1 0 0 0 | <-- S <-- S <-- S | 0 a b c | 1 2 3 0 o5 : Complex i6 : assert isWellDefined(C1 ++ C2)

The direct sum of a sequence of complexes can be computed as follows.

 i7 : C3 = directSum(C1,C2,C2[-2]) 3 1 o7 = image | 1 0 0 0 | <-- S <-- image {2} | 1 0 0 0 0 0 | <-- S | 0 a b c | {2} | 0 1 0 0 0 0 | 1 {2} | 0 0 1 0 0 0 | 3 0 {0} | 0 0 0 a b c | 2 o7 : Complex i8 : assert isWellDefined C3

The direct sum is an n-ary operator with projection and inclusion maps from each component satisfying appropriate identities.

 i9 : C4 = directSum(first => C1, second => C2) 3 3 1 o9 = image | 1 0 0 0 | <-- S <-- S <-- S | 0 a b c | 1 2 3 0 o9 : Complex i10 : C4_[first] -- inclusion map C1 --> C4 1 o10 = 0 : image | 1 0 0 0 | <------------- S : 0 | 0 a b c | {0} | 1 | {1} | 0 | {1} | 0 | {1} | 0 | 3 3 1 : S <----------------- S : 1 {1} | 1 0 0 | {1} | 0 1 0 | {1} | 0 0 1 | 3 3 2 : S <----------------- S : 2 {2} | 1 0 0 | {2} | 0 1 0 | {2} | 0 0 1 | 1 1 3 : S <------------- S : 3 {3} | 1 | o10 : ComplexMap i11 : C4^[first] -- projection map C4 --> C1 1 o11 = 0 : S <--------------- image | 1 0 0 0 | : 0 | 1 0 0 0 | | 0 a b c | 3 3 1 : S <----------------- S : 1 {1} | 1 0 0 | {1} | 0 1 0 | {1} | 0 0 1 | 3 3 2 : S <----------------- S : 2 {2} | 1 0 0 | {2} | 0 1 0 | {2} | 0 0 1 | 1 1 3 : S <------------- S : 3 {3} | 1 | o11 : ComplexMap i12 : C4^[first] * C4_[first] == 1 o12 = true i13 : C4^[second] * C4_[second] == 1 o13 = true i14 : C4^[first] * C4_[second] == 0 o14 = true i15 : C4^[second] * C4_[first] == 0 o15 = true i16 : C4_[first] * C4^[first] + C4_[second] * C4^[second] == 1 o16 = true

There are two short exact sequences associated to a direct sum.

 i17 : isShortExactSequence(C4^[first], C4_[second]) o17 = true i18 : isShortExactSequence(C4^[second], C4_[first]) o18 = true

Given a complex which is a direct sum, we obtain the component complexes and their names (indices) as follows.

 i19 : components C3 1 3 3 1 o19 = {S <-- S <-- S <-- S , image | a b c |, image | a b c |} 0 1 2 3 0 2 o19 : List i20 : indices C3 o20 = {0, 1, 2} o20 : List i21 : components C4 1 3 3 1 o21 = {S <-- S <-- S <-- S , image | a b c |} 0 1 2 3 0 o21 : List i22 : indices C4 o22 = {first, second} o22 : List