GF2 Gaussian elimination
This commit is contained in:
29
test/GF2test.hs
Normal file
29
test/GF2test.hs
Normal file
@@ -0,0 +1,29 @@
|
||||
module GF2test (run) where
|
||||
|
||||
import LinearAlgebra.GF2
|
||||
( fromBools
|
||||
, gaussianEliminationIndices
|
||||
)
|
||||
|
||||
run :: IO ()
|
||||
run = do
|
||||
putStrLn "GF2 Gaussian elimination test"
|
||||
|
||||
let rowsBools =
|
||||
[ [True, False, True]
|
||||
, [False, True, True]
|
||||
, [True, True, False]
|
||||
, [True, True, True]
|
||||
]
|
||||
|
||||
nCols = length (head rowsBools)
|
||||
rowsBits = map fromBools rowsBools
|
||||
|
||||
let maybeIndices = gaussianEliminationIndices nCols rowsBits
|
||||
|
||||
case maybeIndices of
|
||||
Nothing -> putStrLn "No combination found."
|
||||
Just idxs -> putStrLn $ "Rows: " ++ show idxs
|
||||
|
||||
putStrLn "GF2 Test Done."
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
module Main (main) where
|
||||
|
||||
import GF2test (run)
|
||||
|
||||
main :: IO ()
|
||||
main = putStrLn "Test suite not yet implemented."
|
||||
main = do
|
||||
putStrLn "Running all tests"
|
||||
GF2test.run
|
||||
putStrLn "All tests done."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user