Simplices
AbstractSimplex
SimplicialSets.AbstractSimplex
— TypeAbstractSimplex <: Any
This is the supertype of all types representing simplices.
SymbolicSimplex
SimplicialSets.SymbolicSimplex
— TypeSymbolicSimplex{L<:Union{Symbol,Char}} <: AbstractSimplex
SymbolicSimplex(label, w::AbstractVector{<:Integer})
SymbolicSimplex(label, n::Integer)
This type represents "symbolic simplices" that are given by a label and a weakly increasing sequence of non-negative integers enumerating the vertices. Such a simplex is degenerate if any integer is repeated.
The label can be of type Symbol
or Char
. The vertex numbers must be between 0
and 31
, and the dimension cannot be larger than 24
. If an integer n
is passed as a second argument to the constructor, then the vertices are 0:n
.
SimplicialSets.vertices
— Functionvertices(x::SymbolicSimplex) -> Vector{Int}
Return the vertices of x
as a vector.
ProductSimplex
SimplicialSets.ProductSimplex
— TypeProductSimplex{T<:Tuple{Vararg{AbstractSimplex}}} <: AbstractSimplex
ProductSimplex{T}{t::Tuple{Vararg{AbstractSimplex}} [; dim::Integer]}
ProductSimplex(t::Tuple{Vararg{AbstractSimplex}} [; dim::Integer])
ProductSimplex(xs::AbstractSimplex... [; dim::Integer])
A type representing an element in the product of simplicial sets. Empty products are allowed. The component simplices must all be of the same dimension. They may be given as a tuple or as individual arguments.
In the case of the empty product, the keyword argument dim
is required to determine the dimension of the resulting simplex. Otherwise dim
is optional, but if present, it must be correct.
See also Tuple(x::ProductSimplex)
.
Examples
julia> x, y = SymbolicSimplex(:x, 2), SymbolicSimplex(:y, 2)
(x[0,1,2], y[0,1,2])
julia> z = ProductSimplex(x, y)
(x[0,1,2],y[0,1,2])
julia> w = ProductSimplex(dim = 2)
()
julia> dim(w)
2
julia> ProductSimplex(x, y; dim = 1)
ERROR: dimensions of simplices do not match
[...]
Core.Tuple
— MethodTuple(x::ProductSimplex{T}) where T <: Tuple{Vararg{AbstractSimplex}} -> T
Return the tuple of component simplices of x
.
Base.length
— Methodlength(x::ProductSimplex) -> Int
Return the number of components (or factors) of x
.
LinearCombinations.cat
— FunctionSimplicialSets.cat(x::ProductSimplex...) -> ProductSimplex
Return the product simplex that is the concatenation of the simplices given as arguments.
This function is linear. Also note that it is overloaded from the package LinearCombinations
, not from Base
. If one wants to use the short form cat
, then one needs to import the function via using
or import
.
See also flatten
.
Example
julia> using SimplicialSets: cat # or: using LinearCombinations: cat
julia> u = ProductSimplex(SymbolicSimplex(:x, 2), SymbolicSimplex(:y, 2))
(x[0,1],y[0,1])
julia> v = ProductSimplex(SymbolicSimplex(:z, 2), SymbolicSimplex(:w, 2))
(z[0,1],w[0,1])
julia> cat(u, v)
(x[0,1],y[0,1],z[0,1],w[0,1])
LinearCombinations.flatten
— FunctionSimplicialSets.flatten(x::ProductSimplex) -> ProductSimplex
Return the product simplex that is obtained by recursively flattening all product simplices appearing within x
.
This function is linear. Also note that it is overloaded from the package LinearCombinations
.
See also LinearCombinations.Regroup
, SimplicialSets.cat
.
Examples
julia> using SimplicialSets: flatten # or: using LinearCombinations: flatten
julia> u = ProductSimplex(SymbolicSimplex(:x, 2), SymbolicSimplex(:y, 2))
(x[0,1],y[0,1])
julia> v = ProductSimplex(SymbolicSimplex(:z, 2), SymbolicSimplex(:w, 2))
(z[0,1],w[0,1])
julia> flatten(ProductSimplex(u, v))
(x[0,1],y[0,1],z[0,1],w[0,1])
julia> flatten(ProductSimplex(ProductSimplex(u, v), u))
(x[0,1],y[0,1],z[0,1],w[0,1],x[0,1],y[0,1])
LinearCombinations.swap
— Constantswap(z::ProductSimplex{Tuple{S,T}}) where {S <: AbstractSimplex, T <: AbstractSimplex} -> ProductSimplex{Tuple{T,S}}
Swap the two components of the ProductSimplex
z
and return the resulting ProductSimplex
.
This function is linear. Also note that it is overloaded from the package LinearCombinations
.
See also LinearCombinations.Regroup
.
LinearCombinations.Regroup
— Type(rg::LinearCombinations.Regroup)(z::ProductSimplex) -> ProductSimplex
Apply the Regroup
element rg
to z
and return the result. This allows to permute and restructure the components of a product simplex in an arbitrary way (without dropping any component).
This functions is linear and supports the keyword arguments coefftype
, addto
, coeff
and is_filtered
as described for @linear
.
See LinearCombinations.@linear
, LinearCombinations.regroup
, swap
, flatten
.
Example
julia> using LinearCombinations
julia> rg = regroup(:( ((1, 2), 3) ), :( (2, (3, 1)) ))
Regroup{((1, 2), 3),(2, (3, 1))}
julia> x, y, z = SymbolicSimplex(:x, 2), SymbolicSimplex(:y, 2), SymbolicSimplex(:z, 2)
(x[0,1,2], y[0,1,2], z[0,1,2])
julia> w = ProductSimplex(ProductSimplex(x, y), z)
((x[0,1,2],y[0,1,2]),z[0,1,2])
julia> rg(w)
(y[0,1,2],(z[0,1,2],x[0,1,2]))
BarSimplex
SimplicialSets.BarSimplex
— TypeBarSimplex{T} <: AbstractSimplex
BarSimplex(iter; op::Union{typeof(*),typeof(+)} = *) -> BarSimplex
A type representing simplices in a simplicial bar construction. If T
is a subtype of AbstractSimplex
, then it is assumed to be a simplicial group; otherwise T
is assumed to be a multiplicative discrete group.
The constructor accepts an iterator over the components of the bar simplex. The optional keyword op
indicates whether the group is multiplicative (default) or additive.
Iterating over a BarSimplex
means iterating over its components.
See also AddToMul
.
Examples
julia> using SimplicialSets: d, s
julia> b = BarSimplex([Lattice(1, 2), Lattice(3, 4)]; op = +)
[(1, 2),(3, 4)]
julia> d(b, 0)
[(3, 4)]
julia> d(b, 1)
[(4, 6)]
julia> s(b, 1)
[(1, 2),(0, 0),(3, 4)]
julia> collect(b)
2-element Vector{AddToMul{Lattice{2}}}:
(1, 2)
(3, 4)
julia> b1 = BarSimplex([Lattice(1, 2)]; op = +)
[(1, 2)]
julia> b0 = BarSimplex(Lattice{2}[]; op = +)
[]
julia> c = BarSimplex([b0, b1])
[[],[(1, 2)]]
julia> s(c, 1)
[[],[(0, 0)],[(0, 0),(1, 2)]]
Base.length
— Methodlength(x::BarSimplex) -> Int
The length of a BarSimplex
is the number of its components.
See also Tuple(::BarSimplex)
.
Base.one
— Methodone(x::BarSimplex{T}, n::Integer = dim(x)) where T -> BarSimplex{T}
Return the identity element in the group of n
-simplices in the simplicial bar construction containing x
. Here T
is assumed to be a commutative (simplicial) group.
Base.isone
— Methodisone(x::BarSimplex{T}) where T -> Bool
Return true
if x
is the identity element in the group of bar simplices of dimension equal to the dimension of x
. Here T
is assumed to be a commutative (simplicial) group.
Base.:*
— Method*(x::BarSimplex{T}...) where T -> BarSimplex{T}
Return the product of the given simplices, which must all have the same dimension. Here T
is assumed to be a commutative (simplicial) group.
Base.inv
— Methodinv(x::BarSimplex{T}) where T -> BarSimplex{T}
Return the inverse element of x
in the group of n
-simplices in the simplicial bar construction containing that simplex. Here T
is assumed to be a commutative (simplicial) group.
Base.:/
— Method/(x::BarSimplex{T}, y::BarSimplex{T}) where T -> BarSimplex{T}
Return the quotient of the x
by y
in the commutative group of n
-simplices in the simplicial bar construction, where n
is the common dimension of x
and y
. Here T
is assumed to be a commutative (simplicial) group.
Base.:^
— Method^(x::BarSimplex{T}, n::Integer) where T -> BarSimplex{T}
Return the n
-th power of the simplex x
. Here T
is assumed to be a commutative (simplicial) group.
LoopGroupSimplex
SimplicialSets.LoopGroupGenerator
— TypeSimplicalSets.LoopGroupGenerator{T <: AbstractSimplex}
This type represents multiplicative generators of the loop group of the simplicial set with simplices of type T
. An element of type LoopGroupGenerator{T}
is a pair of a simplex gen
of type T
and Bool
value inv
. The latter indicates whether this element represents generator corresponding to gen
(inv == false
) or its inverse (inv == true
).
Examples
julia> using SimplicialSets: LoopGroupGenerator
julia> x = SymbolicSimplex(:x, 2)
x[0,1,2]
julia> LoopGroupGenerator(x, false)
x[0,1,2]
julia> LoopGroupGenerator(x, true)
x[0,1,2]⁻¹
SimplicialSets.LoopGroupSimplex
— TypeLoopGroupSimplex{T<:AbstractSimplex} <: AbstractSimplex
LoopGroupSimplex(x::T) where T <: AbstractSimplex
This type represents simplices in the Kan loop groups of the simplicial set with elements of type T
. The latter simplicial set is assume to be reduced, meaning that it contains a single simplex of dimension 0
.
The constructor returns the simplex in the loop group determined by the simplex x
, which must be of strictly positive dimension.
Iterating over a LoopGroupSimplex{T}
yields its components, which are of type LoopGroupGenerator{T}
.
See also SimplicialSets.LoopGroupGenerator
.
Examples
julia> using SimplicialSets: s, d
julia> x = SymbolicSimplex(:x, 2); y = LoopGroupSimplex(x)
⟨x[0,1,2]⟩
julia> d(y, 1), d(y, 0)
(⟨x[0,1]⟩, ⟨x[1,2]⁻¹,x[0,2]⟩)
julia> LoopGroupSimplex(s(x, 0))
⟨⟩
Base.length
— Methodlength(x::LoopGroupSimplex) -> Int
The length of a LoopGroupSimplex
is the number of its components.
Base.isone
— Methodisone(x::LoopGroupSimplex{T}) where T -> Bool
Return true
if x
is the identity element in the loop group simplices of dimension equal to the dimension of x
.
Base.inv
— MethodBase.inv(g::L) where L <: LoopGroupSimplex -> L
Return the inverse of the simplex g
in the loop group.
Example
julia> g, h = LoopGroupSimplex(SymbolicSimplex(:x, 2)), LoopGroupSimplex(SymbolicSimplex(:y, 2))
(⟨x[0,1,2]⟩, ⟨y[0,1,2]⟩)
julia> inv(g*h)
⟨y[0,1,2]⁻¹,x[0,1,2]⁻¹⟩
SimplicialSets.mul!
— FunctionSimplicialSets.mul!(g::L, hs::L...) where L <: LoopGroupSimplex
Multiply the simplex g
from the right by the simplices given as other arguments in-place and return g
.
Example
julia> g = LoopGroupSimplex(SymbolicSimplex(:x, 2))
⟨x[0,1,2]⟩
julia> h = LoopGroupSimplex(SymbolicSimplex(:y, 2))
⟨y[0,1,2]⟩
julia> SimplicialSets.mul!(g, h)
⟨x[0,1,2],y[0,1,2]⟩
julia> g
⟨x[0,1,2],y[0,1,2]⟩
Base.:*
— Method*(g::L...) where L <: LoopGroupSimplex -> L
Multiply the given simplices in the loop group. At least one simplex must be given, and they must all have the same dimension.
See also SimplicialSets.mul!
.
Example
julia> g = LoopGroupSimplex(SymbolicSimplex(:x, 2))
⟨x[0,1,2]⟩
julia> h = LoopGroupSimplex(SymbolicSimplex(:y, 2))
⟨y[0,1,2]⟩
julia> g*h
⟨x[0,1,2],y[0,1,2]⟩
Other simplices
SimplicialSets.IntervalSimplex
— TypeIntervalSimplex <: AbstractSimplex
IntervalSimplex(p::Int, q::Int)
IntervalSimplex()
A type representing simplices in a simplicial interval (a 1-simplex). An n
-simplex in a simplicial interval is determined by two non-negative integers p
and q
such that p+q-1
equals n
.
The first constructor above returns the p+q-1
-simplex with p
vertices equal to 0
and q
vertices equal to 1
. The second constructor is a short form for SimplicialInterval(1, 1)
and returns the unique non-degenerate 1
-simplex.
SimplicialSets.OppositeSimplex
— TypeOppositeSimplex{T<:AbstractSimplex} <: AbstractSimplex
OppositeSimplex(x)
is the 'opposite' simplex to x
in the sense that i
-th face operator corresponds to the (n-i)
-th face operator for x
, and likewise for degeneracy operators.
The functions *
, \
, inv
and one
with argument(s) of type OppositeSimplex
work on the underlying simplices.
Note that the linear extension of OppositeSimplex
would not be a chain map from the chain complex of the simplicial set containing the terms x
to the opposite simplicial set. For this purpose there is the function opposite
.
See also opposite
.
Examples
julia> using SimplicialSets: d, s
julia> x = SymbolicSimplex(:x, 3)
x[0,1,2,3]
julia> y = OppositeSimplex(x)
OppositeSimplex(x[0,1,2,3])
julia> d(y, 1)
OppositeSimplex(x[0,1,3])
julia> s(y, 1)
OppositeSimplex(x[0,1,2,2,3])
julia> z = OppositeSimplex(LoopGroupSimplex(x))
OppositeSimplex(⟨x[0,1,2,3]⟩)
julia> inv(z)
OppositeSimplex(⟨x[0,1,2,3]⁻¹⟩)
SimplicialSets.opposite
— Functionopposite(x::T) where T <: AbstractSimplex -> OppositeSimplex
opposite(x::T) where {S, T <: OppositeSimplex{S}} -> S
opposite(x::T) where T <: ProductSimplex -> ProductSimplex
Return an "interpreted version" of the opposite simplex of x
:
- If
x
is already anOppositeSimplex
, return the underlying simplex. - If
x
is aProductSimplex
, applyopposite
to the components and return the correspondingProductSimplex
. - In all other cases, return
OppositeSimplex(x)
.
See also OppositeSimplex
, opposite(::AbstractTensor)
, opposite(::AbstractLinear)
.
opposite(t::AbstractTensor) -> Tensor
Apply opposite
to the components of t
and return their tensor product.
See also opposite(::AbstractSimplex)
, opposite(::AbstractLinear)
.
opposite(a::AbstractLinear{T,R}) -> Linear
Apply opposite
to the terms in a
and return a linear combination of them. If the degree of a term x
is congruent to 1
or 2
mod 4
, then it is transformed to -opposite(x)
and otherwise to opposite(x)
.
Note that this function is not the linear extension of opposite(x::AbstractSimplex)
or OppositeSimplex
. The signs are chosen such that this function is a chain map from the chain complex of the simplicial set containing the terms x
to the opposite simplicial set.
See also opposite(::AbstractSimplex)
, opposite(::AbstractTensor)
.
Examples
julia> using LinearCombinations; using LinearCombinations: diff
julia> a = Linear(SymbolicSimplex(:x, 1) => 2)
2*x[0,1]
julia> b = opposite(a)
-2*OppositeSimplex(x[0,1])
julia> diff(b) == opposite(diff(a))
true
julia> c = Linear(OppositeSimplex(y) => c for (y, c) in a)
2*OppositeSimplex(x[0,1])
julia> diff(c) == opposite(diff(a))
false