Fix indexMaybe and add more utility functions
This commit is contained in:
parent
de66efe75b
commit
b0d48eaf00
3 changed files with 46 additions and 12 deletions
|
|
@ -105,7 +105,5 @@ hconcat = concat 1
|
|||
|
||||
export
|
||||
kronecker : Num a => Vector m a -> Vector n a -> Matrix m n a
|
||||
kronecker a b = rewrite dimEq a in rewrite dimEq b in
|
||||
fromFunction [dim a, dim b]
|
||||
(\[i,j] => Vector.index (rewrite dimEq a in i) a *
|
||||
Vector.index (rewrite dimEq b in j) b)
|
||||
kronecker a b with (viewShape a, viewShape b)
|
||||
_ | (Shape [m], Shape [n]) = fromFunction [m,n] (\[i,j] => index i a * index j b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue