Created
April 30, 2019 07:26
-
-
Save athas/370a58f0a8bb4f52d20c2206a0da98de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let interpretData [rows][cols] | |
(data: [rows][cols]f32): [][9]f32 = | |
let res = | |
unsafe | |
map (\flat -> | |
unsafe | |
let i = 1+flat / (cols-2) | |
let j = 1+flat % (cols-2) | |
in [data[i-1,j-1], data[i-1, j], data[i-1, j+1], | |
data[i,j-1], data[i, j], data[i, j+1], | |
data[i+1,j-1], data[i+1, j], data[i+1, j+1] | |
]) | |
(iota ((rows-2) * (cols-2))) | |
in res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment