X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FLinear%2FVector.hs;h=42d47a39e58670136b5300dd1f83f007ce85fc2e;hb=04f56a8882bb0c574b603f8c3fed9481ea934f7f;hp=aa1568bec6c2ff3b8ed0baa724177349fb04e3bb;hpb=1f64a1a33b2636ef2e863a0b577c8d8d50233580;p=numerical-analysis.git diff --git a/src/Linear/Vector.hs b/src/Linear/Vector.hs index aa1568b..42d47a3 100644 --- a/src/Linear/Vector.hs +++ b/src/Linear/Vector.hs @@ -18,6 +18,7 @@ import Data.Vector.Fixed ( toList, ) import qualified Data.Vector.Fixed as V ( + (!), length, ) import Data.Vector.Fixed.Boxed @@ -27,17 +28,6 @@ type Vec4 = Vec N4 type Vec5 = Vec N5 --- | Unsafe indexing. --- --- Examples: --- --- >>> import Data.Vector.Fixed (mk2) --- >>> let v1 = mk2 1 2 :: Vec2 Int --- >>> v1 ! 1 --- 2 --- -(!) :: (Vector v a) => v a -> Int -> a -(!) v1 idx = (toList v1) !! idx -- | Safe indexing. -- @@ -53,7 +43,7 @@ type Vec5 = Vec N5 (!?) :: (Vector v a) => v a -> Int -> Maybe a (!?) v1 idx | idx < 0 || idx >= V.length v1 = Nothing - | otherwise = Just $ v1 ! idx + | otherwise = Just $ v1 V.! idx -- | Remove an element of the given vector.