diff --git a/ecoop26/kmeans.phnx b/ecoop26/kmeans.phnx new file mode 100644 index 0000000..992c35a --- /dev/null +++ b/ecoop26/kmeans.phnx @@ -0,0 +1,42 @@ +struct point { float32 x; float32 y; } + +float32 distance(const point &p1, const point &p2) { + float32 x1 = p1.x; float32 x2 = p2.x; + float32 y1 = p1.y; float32 y2 = p2.y; + float32 dx = (x2 - x1); float32 dy = (y2 - y1); + return sqrt(dx * dx + dy * dy); +} + +point add(const point &p1, const point &p2) { + return new point(p1.x + p2.x, p1.y + p2.y); +} + +point divide(const point &p, float32 div) { + if(div == 0.0f) return new point(0.0f, 0.0f); // edge case... + return new point(p.x / div, p.y / div); +} + +type temp_center = pair; +pair mk_acc(uint32 idx, float32 dist) { return new pair(idx, dist); } +temp_center mk_temp_center(point p, float32 counter) { return new temp_center(p, counter); } + +@Export +void kmeans(const vec &points, vec ¢ers) { + vec temp{centers.size()}; + project p in points into temp { + pair acc; + @NoVectorize + accumulate (c, idx) in centers with mk_acc(0u, INF) into acc { + float32 dist = distance(p, c); + if(dist < acc.second) continue with mk_acc(idx, dist); + else continue; + } + + uint32 closest_idx = acc.first; + continue[closest_idx] with (curr) -> mk_temp_center(add(p, curr.first), curr.second + 1.0f); + } + + project c in temp into centers { + continue with divide(c.first, c.second); + } +} \ No newline at end of file diff --git a/ecoop26/mini-ex.phnx b/ecoop26/mini-ex.phnx new file mode 100644 index 0000000..daccf5b --- /dev/null +++ b/ecoop26/mini-ex.phnx @@ -0,0 +1,42 @@ +// example 1: multiply by constant +@Export +void mul_by_5(vec &xs) { + foreach x in xs { +// xs = new vec(x); +// return; +// uint32 y = xs[x]; +// if(x > 10u) continue; + continue with 5u * x; + } +} + +// example 2: pairwise sum +@Export +vec add(const vec &xs, const vec &ys) { + vec out = new vec(xs.size()); + merge (x, y) in (xs, ys) into out { + continue with x + y; + } + return out; +} + +// example 3: minimum +@Export +uint32 min_of(const vec &xs) { + uint32 min; + accumulate x in xs with MAX_UINT32 into min { + continue with (x < min) ? x : min; + } + return min; +} + +// example 4: counting +@Export +vec count(const vec &xs, uint32 max) { + vec counters{max + 1u}; + project x in xs into counters { + uint32 counter_idx = (x < max) ? x : max; + continue[counter_idx] with (curr) -> curr + 1u; + } + return counters; +} \ No newline at end of file diff --git a/ecoop26/slides_icooolps.pdf b/ecoop26/slides_icooolps.pdf new file mode 100644 index 0000000..493314a Binary files /dev/null and b/ecoop26/slides_icooolps.pdf differ diff --git a/index.html b/index.html index 18ca4cb..03f3ace 100644 --- a/index.html +++ b/index.html @@ -225,12 +225,18 @@ Phoenix, a data-parallel programming language

News

    -
  • ECOOP’26
    +
  • ECOOP’26
    June 29 - July 3, 2026
    -I will present a demo at ICOOOLPS 2026 in -Brussels, and will stay to attend ECOOP.
  • +I’m attending presentations and learning! Find me at ECOOP!
    + +
  • ICOOOLPS +2026
    +June 29, 2026
    +I presented my demo at ICOOOLPS 2026 in Brussels. You can find the slides and Phoenix code +examples (1 2) at the links.
    +
  • PLISS’25
    May 26 - May 31, 2025
    diff --git a/jaytux.com.md b/jaytux.com.md index 683ce0a..4b94013 100644 --- a/jaytux.com.md +++ b/jaytux.com.md @@ -40,9 +40,12 @@ header-includes: ## News -- [**ECOOP'26**](https://2026.ecoop.org/) +- [**ECOOP'26**](https://2026.ecoop.org) June 29 - July 3, 2026 - I will present a demo at [ICOOOLPS 2026](https://2026.ecoop.org/home/ICOOOLPS-2026) in Brussels, and will stay to attend ECOOP. + I'm attending presentations and learning! Find me at ECOOP! +- [**ICOOOLPS 2026**](https://2026.ecoop.org/home/ICOOOLPS-2026) + June 29, 2026 + I presented my demo at ICOOOLPS 2026 in Brussels. You can find the [slides](./ecoop26/slides_icooolps.pdf) and Phoenix code examples ([1](./ecoop26/mini-ex.phnx) [2](./ecoop26/kmeans.phnx)) at the links. - [**PLISS'25**](https://pliss.org/2025/) May 26 - May 31, 2025 I attended the summer school in Bertinoro! This was followed by a short trip to Firenze/Florence, Muenchen/Munich, and Ravenstein. diff --git a/sync b/sync index f900bc8..3831d11 100755 --- a/sync +++ b/sync @@ -1,3 +1,3 @@ #!/usr/bin/zsh -scp **/*.html **/*.css **/*.svg **/*.png **/*.jpg **/*.pdf jay@jaytux.com:/etc/jaytux.com/main/ +rsync -Rt **/*.html **/*.css **/*.svg **/*.png **/*.jpg **/*.pdf **/*.phnx jay@jaytux.com:/etc/jaytux.com/main/