evalUArrayExprOpt :: LinearSpaceOpt (UArray Int Int) Int -> LinearSpace (UArray Int Int) Int
evalUArrayExprOpt (LinearComb x) = Vector y where
  y=runSTUArray $ do
      let n= (snd  . bounds . getUArray . snd  . head) x
      tmp<-make (replicate n 0)
      let vs = map (\s -> (fst s,getUArray (snd s))) x
      forM_ [1..n] $ \i1 ->
        forM_ vs $ \i2 -> do
            val1<-readArray tmp i1
            let val2 = fst i2 * snd i2 ! i1
            writeArray tmp i1 (val1+val2)
      return tmp
evalUArrayExprOpt :: LinearSpaceOpt (UArray Int Int) Int -> LinearSpace (UArray Int Int) Int
evalUArrayExprOpt (LinearComb x) = Vector y where
  y=runSTUArray $ do
      let n= (snd  . bounds . getUArray . snd  . head) x
      tmp<-make (replicate n 0)
      let vs = map (\s -> (fst s,getUArray (snd s))) x
      forM_ [1..n] $ \i1 ->
        forM_ vs $ \i2 -> do
            val1<-readArray tmp i1
            let val2 = fst i2 * snd i2 ! i1
            writeArray tmp i1 (val1+val2)
      return tmp
evalUArrayExprOpt (LinearComb x) = Vector y where
  y=runSTUArray $ do
      let n= (snd  . bounds . getUArray . snd  . head) x
      tmp<-make (replicate n 0)
      let vs = map (\s -> (fst s,getUArray (snd s))) x
      forM_ [1..n] $ \i1 ->
        forM_ vs $ \i2 -> do
            val1<-readArray tmp i1
            let val2 = fst i2 * snd i2 ! i1
            writeArray tmp i1 (val1+val2)
      return tmp