From: Michael Orlitzky Date: Fri, 7 Feb 2014 23:46:51 +0000 (-0500) Subject: Rename matmap to map2. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=b64e8d2a0ef24e880265b9ba4997c3d4eb995570;p=numerical-analysis.git Rename matmap to map2. --- diff --git a/src/Integration/Gaussian.hs b/src/Integration/Gaussian.hs index 8fcca4f..38214a0 100644 --- a/src/Integration/Gaussian.hs +++ b/src/Integration/Gaussian.hs @@ -28,7 +28,7 @@ import Linear.Matrix ( construct, fromList, identity_matrix, - matmap, + map2, row', transpose ) import Linear.QR ( eigenvectors_symmetric ) @@ -123,7 +123,7 @@ nodes_and_weights iterations = -- 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 @@ -212,5 +212,5 @@ gaussian' f nodes weights = -- want. norm_p (1::Int) weighted_values where - function_values = matmap f nodes + function_values = map2 f nodes weighted_values = colzipwith (*) weights function_values diff --git a/src/Linear/Matrix.hs b/src/Linear/Matrix.hs index 6603302..054bb6e 100644 --- a/src/Linear/Matrix.hs +++ b/src/Linear/Matrix.hs @@ -816,11 +816,11 @@ colzipwith f c1 c2 = -- 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