@@ -1,16 +1,28 @@
1module LinearAlgebra.Matrix
1module LinearAlgebra.Matrix
6-- | Dense Matrix implementation
11-- | Dense Matrix implementation
7type Matrix a =
12type Matrix a =
8 { nrows :: Int
13 { nrows :: Int
9 , ncols :: Int
14 , ncols :: Int
10− , data :: Array a
15+ , values :: Array a
14−-- -- | Create Matrix from array of values
19+-- | Create array of given dimmension containing replicated value
15−-- fromArray :: ∀ a. Array a -> Int -> Int -> Maybe (Matrix a)
20+replicate :: ∀ a. Int -> Int -> a -> Matrix a
16−-- fromArray ds rows cols | length ds
21+replicate r c v = {nrows: r, ncols: c, values: vs}
23+ vs = A.replicate (r * c) v
26+-- | Create array of given dimmension with all values set to 0
27+zeros :: Int -> Int -> Matrix Number
28+zeros r c = replicate r c 0.0