Compiling Futhark operations... Compilation complete. ╔═══════════════════════════════════════════════════════════════╗ ║ FUTHARK-J BRIDGE DEMONSTRATION ║ ╚═══════════════════════════════════════════════════════════════╝ ┌───────────────────────────────────────────────────────────────┐ │ 1. Basic Array Transformations │ └───────────────────────────────────────────────────────────────┘ Input: 1 2 3 4 5 Double: Futhark: 2 4 6 8 10 J: 2 4 6 8 10 Match: 1 Square: Futhark: 1 4 9 16 25 J: 1 4 9 16 25 Match: 1 Cube: Futhark: 1 8 27 64 125 J: 1 8 27 64 125 Match: 1 ┌───────────────────────────────────────────────────────────────┐ │ 2. Scalar Reductions │ └───────────────────────────────────────────────────────────────┘ Input: 1 2 3 4 5 Sum: Futhark: 15 J: 15 Match: 1 Product: Futhark: 120 J: 120 Match: 1 Mean: Futhark: 3 J: 3 Match: 1 Min: Futhark: 1 J: 1 Match: 1 Max: Futhark: 5 J: 5 Match: 1 ┌───────────────────────────────────────────────────────────────┐ │ 3. Statistical Functions │ └───────────────────────────────────────────────────────────────┘ Input: 2 4 4 4 5 5 7 9 Variance: Futhark: 4 J: 4 Match: 1 Std Dev: Futhark: 2 J: 2 Match: 1 ┌───────────────────────────────────────────────────────────────┐ │ 4. Array-Returning Operations │ └───────────────────────────────────────────────────────────────┘ Normalize input: 10 20 30 40 50 Normalize: Futhark: 0 0.25 0.5 0.75 1 J: 0 0.25 0.5 0.75 1 Match: 1 Cumsum input: 1 2 3 4 5 Cumsum: Futhark: 1 3 6 10 15 J: 1 3 6 10 15 Match: 1 Running max input: 3 1 4 1 5 9 2 6 RunMax: Futhark: 3 3 4 4 5 9 9 9 J: 3 3 4 4 5 9 9 9 Match: 1 Softmax input: 1 2 3 4 5 Softmax: Futhark: 0.0116562 0.0316849 0.0861285 0.234122 0.636409 J: 0.0116562 0.0316849 0.0861285 0.234122 0.636409 Match: 1 Z-Score input: 10 20 30 40 50 Z-Score: Futhark: _1.41421 _0.707107 0 0.707107 1.41421 J: _1.41421 _0.707107 0 0.707107 1.41421 Match: 1 ┌───────────────────────────────────────────────────────────────┐ │ 5. Performance Comparison │ └───────────────────────────────────────────────────────────────┘ Testing on large arrays to show parallel performance... StdDev n= 100000: Futhark 0.00084s J 0.00037s Ratio 0.44x StdDev n= 500000: Futhark 0.00307s J 0.00178s Ratio 0.58x StdDev n= 1000000: Futhark 0.00967s J 0.01701s Ratio 1.76x StdDev n= 2000000: Futhark 0.03956s J 0.01803s Ratio 0.46x ┌───────────────────────────────────────────────────────────────┐ │ 6. Seamless Data Flow: J ↔ Futhark │ └───────────────────────────────────────────────────────────────┘ Chaining J and Futhark operations: [J input] 100 200 300 400 500 [Futhark normalize] 0 0.25 0.5 0.75 1 [J scale *100] 0 25 50 75 100 [Futhark square] 0 625 2500 5625 10000 [J floor] 0 625 2500 5625 10000 [Futhark cumsum] 0 625 3125 8750 18750 Data flows seamlessly between J and Futhark! ┌───────────────────────────────────────────────────────────────┐ │ 7. Scalar Input Functions (v1.6.0) │ └───────────────────────────────────────────────────────────────┘ Scalar input, array output: f_factors 12: 2 2 3 J q: 12: 2 2 3 f_factors 100: 2 2 5 5 J q: 100: 2 2 5 5 f_factors 12345: 3 5 823 Scalar input, scalar output: f_fib 10: 55 J fib 10: 55 f_fib 20: 6765 J fib 20: 6765 ╔═══════════════════════════════════════════════════════════════╗ ║ DEMONSTRATION COMPLETE ║ ╚═══════════════════════════════════════════════════════════════╝ Available Futhark verbs: f_double, f_square, f_cube f_sum, f_product, f_min, f_max, f_mean f_variance, f_stddev f_normalize, f_cumsum, f_runmax f_softmax, f_zscore f_factors, f_fib (v1.6.0 scalar input) Usage: result =. f_double 1 2 3 4 5 result =. f_factors 12345