@@ -3,7 +3,9 @@ module Test.LinearAlgebra.Matrix (testMatrix) where
33import Prelude
44import Control.Monad.Eff (Eff)
55import Control.Monad.Eff.Console (log, CONSOLE)
6+import Data.Maybe (fromJust, isJust, isNothing)
67import Test.Assert (assert, ASSERT)
8+import Partial.Unsafe (unsafePartial)
79import LinearAlgebra.Matrix as M
810
911
@@ -11,8 +13,13 @@ testMatrix :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
1113testMatrix = do
1214
1315 log "Init Matrix test case data"
14− let z1 = M.zeros 5 4
16+ let z1 = unsafePartial $ fromJust $ M.zeros 5 4
17+ let z2 = unsafePartial $ fromJust $ M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
1518
16− log "Create zero matrix"
19+ log "Create matrix"
1720 assert $ z1.nrows == 5
1821 assert $ z1.ncols == 4
22+
23+ log "From Array"
24+ assert $ isNothing (M.fromArray 2 3 [1.0])
25+ assert $ isJust (M.fromArray 2 3 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])