Skip to content

Instantly share code, notes, and snippets.

@klapaucius
Created January 22, 2013 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klapaucius/4595047 to your computer and use it in GitHub Desktop.
Save klapaucius/4595047 to your computer and use it in GitHub Desktop.
$wbfStep :: EdgeVec -> CostVec -> Vector Dist
$wbfStep =
\ (w :: EdgeVec) (w1 :: CostVec) ->
let { Vector ipv ipv1 ipv2 ~ _ <- w1 `cast` ... } in
let { V_3 ipv3 ipv4 ipv5 ipv6 ~ _ <- w `cast` ... } in
let { Vector rb _ rb2 ~ _ <- ipv4 `cast` ... } in
let { Vector rb3 _ rb5 ~ _ <- ipv5 `cast` ... } in
let { Vector rb6 _ rb8 ~ _ <- ipv6 `cast` ... } in
runSTRep
(\ (@ s) (s :: State# s) ->
case >=# ipv1 0 of _ {
False -> (lvl3 ipv1) `cast` ...;
True ->
let { (# s'#, arr# #) ~ _
<- newByteArray# (*# ipv1 4) (s `cast` ...)
} in
letrec {
$s$wa :: Int# -> State# s -> (# State# s, () #)
$s$wa =
\ (sc :: Int#) (sc1 :: State# s) ->
case >=# sc ipv3 of _ {
False ->
let { __DEFAULT ~ wild6 <- indexIntArray# rb5 (+# rb3 sc) } in
let { (# s1#, x# #) ~ _
<- readIntArray# arr# wild6 (sc1 `cast` ...)
} in
let { __DEFAULT ~ wild8 <- indexIntArray# rb2 (+# rb sc) } in
case indexIntArray# ipv2 (+# ipv wild8) of wild9 {
__DEFAULT ->
let { __DEFAULT ~ wild10 <- indexIntArray# rb8 (+# rb6 sc) } in
let {
y1 :: Int#
y1 = +# wild9 wild10 } in
case <=# x# y1 of _ {
False ->
let { __DEFAULT ~ s1
<- (writeIntArray# arr# wild6 y1 s1#) `cast` ...
} in
$s$wa (+# sc 1) s1;
True ->
let { __DEFAULT ~ s1
<- (writeIntArray# arr# wild6 x# s1#) `cast` ...
} in
$s$wa (+# sc 1) s1
};
2147483647 ->
let { __DEFAULT ~ s1
<- (writeIntArray# arr# wild6 x# s1#) `cast` ...
} in
$s$wa (+# sc 1) s1
};
True -> (# sc1, () #)
}; } in
let { (# new_s1, _ #) ~ _
<- $s$wa
0
((copyByteArray# ipv2 (*# ipv 4) arr# 0 (*# ipv1 4) s'#)
`cast` ...)
} in
let { (# s'#1, arr'# #) ~ _
<- unsafeFreezeByteArray# arr# (new_s1 `cast` ...)
} in
(# s'#1 `cast` ..., (Vector 0 ipv1 arr'#) `cast` ... #)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment