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, ...], quantale: Quantale | 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:
|
quantale
|
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
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
end
¶
end(tensor: Tensor, contra_dims: tuple[int, ...], co_dims: tuple[int, ...], quantale: Quantale | 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:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Result with matched dimension pairs removed via meet. |
Source code in src/quivers/enriched/ends_coends.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |