# Chains

ComputationalHomology.AbstractChainType
AbstractChain{C, R}

A chain is a formal linear combination of C-type elements in R-module.

Given a C-type element set $E$, we can construct a free R-module $M$ that has $E ⊆ M$ as a basis $M$, the module $M$ is the module of the formal linear combinations of elements of $E$, or free module over $E$, $R^{(E)}$, s.t. given a finite subset ${X_1, ..., X_n}$ of $E$, a formal linear combination of $X_1, ..., X_n$ is

$a_1 X_1 + ··· + a_n X_n$

where the $a_i$R.

source
ComputationalHomology.ChainType
Chain{IX<:Integer, R}

The chain of integer elements for R-module.

This chain implementation uses a dictionary for storing elements and coefficients.

source

Every chain implementation need to implement following interface functions.

Missing docstring.

Missing docstring for setindex!(::AbstractChain{C,R}, ::C, ::R) where {C,R}. Check Documenter's build log for details.

Base.getindexMethod
getindex(ch::AbstractChain{C,R}, e::C)

Returns a coefficient of the element e of the chain ch.

source
Base.push!Method
push!(ch:: AbstractChain{C,R}, e::Pair{C,R})

Add element with coefficient e to the chain ch. If the element is already in the chain then the coefficient value of e will be added to the chain element coefficient.

Use setindex! to reset an element coefficient in the chain.

source
Base.iterateMethod
iterate(ch::AbstractChain)

Return a element/coefficient iterator of the chain ch

source

There are additional function available after implementing the above interface.

Missing docstring.

Missing docstring for iszero(::AbstractChain). Check Documenter's build log for details.

Missing docstring.

Missing docstring for keytype(::AbstractChain). Check Documenter's build log for details.

Missing docstring.

Missing docstring for valtype(::AbstractChain). Check Documenter's build log for details.

Missing docstring.

Missing docstring for push!(::AbstractChain{C,R}, ::C, ::R) where {C,R}. Check Documenter's build log for details.

Missing docstring.

Missing docstring for push!(::AbstractChain{C,R}, ::Tuple{C,R}) where {C,R}. Check Documenter's build log for details.

Base.mapMethod
map(f, ch::AbstractChain)

Apply function f to every coefficient of the chain ch.

source
Missing docstring.

Missing docstring for map!(f, ::AbstractChain, ::AbstractChain). Check Documenter's build log for details.

Base.inMethod
in(e, ch::AbstractChain)

Check if the element e in the chain ch.

source
Base.append!Method
append!(a::AbstractChain, b::AbstractChain)

Perform mutable addition of the chain b to the chain a.

source
Base.:+Method
+(ch::AbstractChain{C,R}, e::Tuple{C,R})

Perform non-mutable addition of the element e with a coefficient to the chain ch.

source
Base.:+Method
+(ch::AbstractChain{C,R}, r::R)

Perform non-mutable addition of the coefficient r to every element of the chain ch.

source