futhark literate
. I wanted to do a similar interpretation of []u32
in Haskell, but the library I used read the pixel values in big-endian order. This was of course easy to fix, but is this behaviour hardware dependent?
futhark literate
does the same. I actually didn't give it any thought, and it probably isn't documented.
rgbargba...
and since I don't think about endianness that often this gave me some rather confusing results...
I think I've encountered this before but wasn't bothered enough to report it. Unless it is by design for some reason, I think I've found a parsing error, that I assume would be relatively easy to fix.
let a = 0i32
-- |> id
commenting the second line results in a parsing error, this appears to be the case for the |>
operator in particular, not +
for example. I find it annoying when I comment a filter
for example. A second --
removes the error.
futhark literate
I think it could actually be pretty good for general engineering students.
I am a bit confused by this error:
Cannot apply "reduce_by_index_stream" to "interaction" (invalid type).
Expected: *acc [n](((f32, f32, f32), (f32, f32, f32)), tââ) -> bââ
-> *acc [n](((f32, f32, f32), (f32, f32, f32)), tââ)
Actual: (acc: *acc [kââ](((f32, f32, f32), (f32, f32, f32)), f32)) -> ((i64,
i64),
(i32,
i32,
i32))
-> *acc [kââ](((f32, f32, f32), (f32, f32, f32)), f32)
Would consume variable "potential", which is not allowed.
from the code
let associatedInteraction [n] potential box (coordinates:[n](v3,quaternion)) associations =
191 let interaction [k] (acc: *acc ([k](ft, f32))) ((i, j), jump) : (*acc ([k](ft, f32)))
=
192 let cI = coordinates[i]
193 let cJ = triadMap f32.i32 jump |> mvMult box |> translate coordinates[j]
194 let (ftI, ftJ, p) = particleInteraction potential cI cJ
195 in write (write acc i (ftI, 0)) j (ftJ, p)
196 let ne = (zeroFT, 0)
197 let (fts, ps) = reduce_by_index_stream
198 (replicate n ne)
199 (\(ft1, p1) (ft2, p2) -> (addFT ft1 ft2, p1 + p2))
200 ne
201 interaction
202 |> unzip
203 in (fts, f32.sum ps)