Skip to content

Commit

Permalink
🧩 [consolidate]: Simplify matrixLookup too.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolyp committed Oct 25, 2023
1 parent 7902759 commit c784f06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Primitive/Defs.purs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ matrixLookup = mkExists $ ForeignOp' { arity: 2, op': op, op: fwd, op_bwd: bwd }
fwd _ = throw "Matrix and pair of integers expected"

bwd :: OpBwd (Raw MatrixRep × (Int × Int))
bwd (((MatrixRep (vss × (i' × _) × (j' × _))) × (i × j)) × v) =
Matrix bot (matrixPut i j (const v) (MatrixRep (((<$>) botOf <$> vss) × (i' × bot) × (j' × bot))))
bwd ((r × (i × j)) × v) =
Matrix bot (matrixPut i j (const v) (botOf r))
: Constr bot cPair (Int bot i : Int bot j : Nil)
: Nil

Expand Down

0 comments on commit c784f06

Please sign in to comment.