Library report examples
26 Nov
2001
26 Nov
'01
2:02 p.m.
Hi guys, The library report defines -- Diagonal of a square matrix diag :: (Ix a) => Array (a,a) b -> Array a b diag x = ixmap (l,u) (\i->(i,i)) x where ((l,l'),(u,u')) | l == l' && u == u' = bounds x but ghc, hugs and nhc98 all loop (trying to get and test the value of l I believe). I am also curious why, for example, row :: (Ix a, Ix b) => a -> Array (a,b) c -> Array b c row i x = ixmap (l',u') (\j->(i,j)) x where ((l,l'),(u,u')) = bounds x isn't written as row :: (Ix a, Ix b) => a -> Array (a,b) c -> Array b c row i x = ixmap (l,u) (\j->(i,j)) x where ((_,l),(_,u)) = bounds x ~~~ ~~~ ~~~ Thanks Ian
9044
Age (days ago)
9044
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ian Lynagh