-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
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
Binary file added
BIN
+8.54 KB
examples/plot-histogram-img/f119313ba60a76bac264ae2e9fa48901-plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- # Plotting a histogram | ||
|
||
-- This can be done by computing a histogram in Futhark and then using | ||
-- a box plot. Here we produce some arbitrary values, discretised aong | ||
-- *k* bins. | ||
|
||
def plot k n : ([]i64,[]i32) = | ||
let vs = iota n |> map (f64.i64 >-> f64.cos >-> (+1) >-> (*(f64.i64 k/2)) >-> i64.f64) | ||
in (iota k, | ||
hist (+) 0 k vs (replicate n 1)) | ||
|
||
-- > :gnuplot {data=plot 100 10000}; | ||
-- set xrange [0:100]; | ||
-- set style fill solid 1.0 | ||
-- plot data with boxes | ||
|
||
|
||
-- ## See also | ||
-- | ||
-- [Gnuplots built-in support for histograms](http://gnuplot.info/docs_6.1/loc5256.html). | ||
-- | ||
-- [Generalised histograms.](histogram.html). |