module Bench.Vector.Algo.ListRank where import Data.Vector.Unboxed as V listRank :: Int -> Vector Int {-# NOINLINE listRank #-} listRank :: Int -> Vector Int listRank Int n = Vector Int -> Vector Int -> Vector Int forall {c}. (Unbox c, Num c) => Vector Int -> Vector c -> Vector c pointer_jump Vector Int xs Vector Int val where xs :: Vector Int xs = Int 0 Int -> Vector Int -> Vector Int forall a. Unbox a => a -> Vector a -> Vector a `V.cons` Int -> Int -> Vector Int forall a. (Unbox a, Enum a) => a -> a -> Vector a V.enumFromTo Int 0 (Int nInt -> Int -> Int forall a. Num a => a -> a -> a -Int 2) val :: Vector Int val = (Int -> Int -> Int) -> Vector Int -> Vector Int -> Vector Int forall a b c. (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c V.zipWith (\Int i Int j -> if Int i Int -> Int -> Bool forall a. Eq a => a -> a -> Bool == Int j then Int 0 else Int 1) Vector Int xs (Int -> Int -> Vector Int forall a. (Unbox a, Enum a) => a -> a -> Vector a V.enumFromTo Int 0 (Int nInt -> Int -> Int forall a. Num a => a -> a -> a -Int 1)) pointer_jump :: Vector Int -> Vector c -> Vector c pointer_jump Vector Int pt Vector c val | Vector Int npt Vector Int -> Vector Int -> Bool forall a. Eq a => a -> a -> Bool == Vector Int pt = Vector c val | Bool otherwise = Vector Int -> Vector c -> Vector c pointer_jump Vector Int npt Vector c nval where npt :: Vector Int npt = Vector Int -> Vector Int -> Vector Int forall a. Unbox a => Vector a -> Vector Int -> Vector a V.backpermute Vector Int pt Vector Int pt nval :: Vector c nval = (c -> c -> c) -> Vector c -> Vector c -> Vector c forall a b c. (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c V.zipWith c -> c -> c forall a. Num a => a -> a -> a (+) Vector c val (Vector c -> Vector Int -> Vector c forall a. Unbox a => Vector a -> Vector Int -> Vector a V.backpermute Vector c val Vector Int pt)