Matrix multiplication in coordinates: definition #
The product C = A B of two n × n matrices, as a map with 2 n² inputs and n² outputs.
The input coordinates are Fin (n * n + n * n): the entry A i j of the first factor sits at
matMulLeft n i j, among the first n * n coordinates, and the entry B j k of the second
factor at matMulRight n j k, among the last n * n. The output C i k sits at
matMulOutput n i k. Pairs of indices are numbered row by row through finProdFinEquiv.
matMul n zis the product read from the inputz: outputC i kis∑ j, A i j * B j k.matMulInput A Bis the input holding the two matricesAandB.matMulTermA n s,matMulTermB n sandmatMulTermC out: the wires of a circuit withsgates and output wiresoutcarrying the entriesA i j,B j kandC i k, indexed by pairs of indices. These are the terminals.
The input coordinate of the entry A i j of the first factor.
Equations
- Algebraic.Cutwidth.MultiOutput.matMulLeft n i j = Fin.castAdd (n * n) (finProdFinEquiv (i, j))
Instances For
The input coordinate of the entry B j k of the second factor.
Equations
- Algebraic.Cutwidth.MultiOutput.matMulRight n j k = Fin.natAdd (n * n) (finProdFinEquiv (j, k))
Instances For
The output coordinate of the entry C i k of the product.
Equations
Instances For
Matrix multiplication in coordinates. The output C i k is ∑ j, A i j * B j k, where
A i j = z (matMulLeft n i j) and B j k = z (matMulRight n j k).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The wire of the input A i j.
Equations
Instances For
The wire of the input B j k.
Equations
Instances For
The wire carrying the output C i k, among the output wires out.
Equations
- Algebraic.Cutwidth.MultiOutput.matMulTermC out q = out (Algebraic.Cutwidth.MultiOutput.matMulOutput n q.1 q.2)