Skip to content

Instantly share code, notes, and snippets.

@lune-sta
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save lune-sta/76a6cf2d2ca9170618d7 to your computer and use it in GitHub Desktop.

Select an option

Save lune-sta/76a6cf2d2ca9170618d7 to your computer and use it in GitHub Desktop.
(define v (flvector 0.0 1.0 2.0 3.0 4.0
0.1 1.1 2.1 3.1 4.1
0.2 1.2 2.2 3.2 4.2
0.3 1.3 2.3 3.3 4.3
0.4 1.4 2.4 3.4 4.4))
(fork-join 5 cg ()
(for ([i (in-range 5)])
(CGpipeline cg prev-value 0.0
(define idx (+ (* i 5) (CG-id cg)))
(define (fl-sqr v) (fl* v v))
(fl-sqr (fl+ (fl-vector-ref v idx)
prev-value)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment