construct,
fromList,
identity_matrix,
- matmap,
+ map2,
row',
transpose )
import Linear.QR ( eigenvectors_symmetric )
-- Square it and multiply by 2; see the Golub-Welsch paper for
-- this magic.
- weights_row = matmap (\x -> (fromInteger 2)*x^2) first_components
+ weights_row = map2 (\x -> (fromInteger 2)*x^2) first_components
weights = transpose $ weights_row
-- want.
norm_p (1::Int) weighted_values
where
- function_values = matmap f nodes
+ function_values = map2 f nodes
weighted_values = colzipwith (*) weights function_values
-- Examples:
--
-- >>> let m = fromList [[1,2],[3,4]] :: Mat2 Int
--- >>> matmap (^2) m
+-- >>> map2 (^2) m
-- ((1,4),(9,16))
--
-matmap :: (a -> b) -> Mat m n a -> Mat m n b
-matmap f (Mat rows) =
+map2 :: (a -> b) -> Mat m n a -> Mat m n b
+map2 f (Mat rows) =
Mat $ V.map g rows
where
g = V.map f