Ends and Coends¶
End and coend computations in enriched categories.
ends_coends
¶
Ends and coends: general contraction principles for V-enriched categories.
The coend ∫^X F(X,X) computes the join (existential) over the diagonal of matched contravariant/covariant dimensions. The end ∫_X F(X,X) computes the meet (universal) over the diagonal.
These generalize composition (coend over shared object) and the hom in the functor category (end over all objects).
coend
¶
coend(tensor: Tensor, contra_dims: tuple[int, ...], co_dims: tuple[int, ...], algebra: Algebra | None = None) -> Tensor
Compute coend ∫^X F(X,X) via diagonal extraction and join.
For each matched pair (contra_dims[i], co_dims[i]), restricts the tensor to the diagonal (where the contravariant and covariant indices agree) and then joins (existential quantification) over those matched dimensions.
| PARAMETER | DESCRIPTION |
|---|---|
tensor
|
The input tensor representing a bifunctor F(X, Y) with both contravariant and covariant occurrences of X.
TYPE:
|
contra_dims
|
Dimension indices for the contravariant occurrences of X.
TYPE:
|
co_dims
|
Dimension indices for the covariant occurrences of X. Must be same length as contra_dims, with matching sizes.
TYPE:
|
algebra
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Result with matched dimension pairs removed via join. |
Source code in src/quivers/enriched/ends_coends.py
end
¶
end(tensor: Tensor, contra_dims: tuple[int, ...], co_dims: tuple[int, ...], algebra: Algebra | None = None) -> Tensor
Compute end ∫_X F(X,X) via diagonal extraction and meet.
Dual to coend: restricts to diagonal and applies meet (universal quantification) over matched dimensions.
| PARAMETER | DESCRIPTION |
|---|---|
tensor
|
The input tensor.
TYPE:
|
contra_dims
|
Dimension indices for contravariant occurrences.
TYPE:
|
co_dims
|
Dimension indices for covariant occurrences.
TYPE:
|
algebra
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Result with matched dimension pairs removed via meet. |