]> gitweb.michael.orlitzky.com - numerical-analysis.git/blobdiff - src/Linear/Vector.hs
Update numeric-prelude and fixed-vector.
[numerical-analysis.git] / src / Linear / Vector.hs
index aa1568bec6c2ff3b8ed0baa724177349fb04e3bb..42d47a39e58670136b5300dd1f83f007ce85fc2e 100644 (file)
@@ -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.