Skip to content

Commit

Permalink
Replace helper function and fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
KubEF committed Nov 11, 2023
1 parent 9c00075 commit 26534c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 0 additions & 2 deletions bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import Criterion.Main (defaultMain)
import Data.List (unfoldr)
import GHC.Word
import GenQuadTreeTH (zipWithBinFunc4)
import GenTH
import Helpers
import Matrix
import ParseMTX
import QuadTree
import System.Random
Expand Down
2 changes: 1 addition & 1 deletion src/GenTH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module GenTH where

import ListTH
import MatrixMapNTH
import MatrixMapNTH ()

-- $(genMaps 10)

Expand Down
8 changes: 8 additions & 0 deletions src/Helpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ isPowOf2 k = logBase 2 size == truncated
size = fromIntegral k :: Double
truncated = toEnum (truncate $ logBase 2 size) :: Double

readSpecDouble :: String -> Double
readSpecDouble a
| head a == '.' = read ('0' : a)
| head a == '-' && (a !! 1) == '.' = read ("-0" ++ tail a)
| head a == 'e' = read ('1' : a)
| head a == '-' && (a !! 1) == 'e' = read ("-1" ++ tail a)
| otherwise = read a

takeFst :: (a, b, c) -> a
takeFst (a, _, _) = a

Expand Down
8 changes: 1 addition & 7 deletions src/ParseMTX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ import System.IO

data MtxSparseFormat a = Mtx {values :: [(Int, Int, a)], linesCount :: Int, columnCount :: Int} deriving (Show)

readSpecDouble :: String -> Double
readSpecDouble a
| head a == '.' = read ('0' : a)
| head a == '-' && (a !! 1) == '.' = read ("-0" ++ tail a)
| head a == 'e' = read ('1' : a)
| head a == '-' && (a !! 1) == 'e' = read ("-1" ++ tail a)
| otherwise = read a


generateVoid :: (Num a) => (Int, Int, c) -> [[a]]
generateVoid (mLines, columns, _) = replicate mLines (replicate columns 0)
Expand Down

0 comments on commit 26534c9

Please sign in to comment.