futhark literate. I wanted to do a similar interpretation of
u32in 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 literatedoes 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 literateI 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 [ ]( ), (f32, f32, f32)), tââ) -> bââ -> *acc [n](((f32, f32, f32), (f32, f32, f32)), tââ) Actual: (acc: *acc [ ]( ), (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 [*acc ([k](ft, f32))) ((i, j), jump) : (*acc ([ ]( ))) = 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)] potential box (coordinates:[ ]( )) associations = 191 let interaction [ ] (acc:
176 let associatedInteraction [_by_index 186 (replicate n zeroFT) addFT zeroFT 187 (map i64.i32 idx) fts) 188 in (addFTs (reduction ftIs) (reduction ftJs), f32.sum ps)] potential box (coordinates:[ ]( )) associations = 177 let interaction ((i, j), jump) = 178 let cI = coordinates[i] 179 let cJ = triadMap f32.i32 jump |> mvMult box |> translate coordinates[j] 180 let (ftI, ftJ, p) = particleInteraction potential cI cJ 181 in ((i, ftI), (j, ftJ), p) 182 let (ftIs, ftJs, ps) = map interaction associations |> unzip3 183 let reduction 184 = unzip 185 >-> (\(idx, fts) -> reduce
205 let associatedInteractionRed [n] 'a 'b (ne:b) (add: b-> b -> b)(potential: a -> a -> b) (co ordinates:[n]a) associations = 206 let interaction [k] (acc: *acc ([k]b)) (i, j) : (*acc ([k]b)) = 207 let cI = coordinates[i] 208 let cJ = coordinates[j] 209 let v = potential cI cJ 210 in write (write acc i v) j v 211 let fts = reduce_by_index_stream 212 (replicate n ne) 213 add 214 ne 215 interaction 216 |> unzip 217 in fts