File: array.fut

package info (click to toggle)
haskell-futhark 0.25.32-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,236 kB
  • sloc: haskell: 100,484; ansic: 12,100; python: 3,440; yacc: 785; sh: 561; javascript: 558; lisp: 399; makefile: 277
file content (14 lines) | stat: -rw-r--r-- 387 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Library with entry points that accept and return
-- array inputs and outputs

entry sum1d (xs : []i32) : i32 = i32.sum xs

entry sum2d (xss : [][]i64) : i64 =
  let row_sums = map i64.sum xss
  in i64.sum row_sums

entry replicate1d (n : i64) (x : f32) : []f32 = replicate n x

entry replicate2d (n: i64) (m : i64) (x : f32) : [][]f32 =
  let row = replicate m x
  in replicate n row