Trying to use hmatrix, to create a zero marix.
For some reason, when I try this on command line, it works:
buildMatrix 2 3 ((r,c) -> fromIntegral 0)
However, when I try to do the same thing in my code:
type Dim = (Int, Int)
buildFull :: Matrix Double -> Vector Int -> Vector Int -> Dim -> Int
buildFull matrix basic nonbasic (m, n) = do
-- Build mxn matrix of zeroes
let f = buildMatrix m n ((r,c) -> fromIntegral 0)
m
it fails:
Pivot.hs:23:17:
Ambiguous type variable `a0' in the constraints:
(Element a0) arising from a use of `buildMatrix'
at Pivot.hs:23:17-27
(Num a0) arising from a use of `fromIntegral' at Pivot.hs:23:44-55
Probable fix: add a type signature that fixes these type variable(s)
In the expression: buildMatrix m n ( (r, c) -> fromIntegral 0)
In an equation for `f':
f = buildMatrix m n ( (r, c) -> fromIntegral 0)
In the expression:
do { let f = buildMatrix m n ( (r, c) -> ...);
m }
Failed, modules loaded: none.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…