diff --git a/README.md b/README.md index ea6a828..e1d0c66 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,30 @@ The wrapper is currently compliant with ArrayFire 3.4 API (and higher). If you f ## Example -TODO +Sample code: + +``` +local af = require('arrayfire') +af.info() +a = af.Array{1, 2, 3, 4} +af.print(a) +``` + +Sample output: + +``` +ArrayFire v3.5.0 (CUDA, 64-bit Linux, build 06e605b0) +Platform: CUDA Toolkit 8, Driver: 378.13 +[0] GeForce GTX 950, 1996 MB, CUDA Compute 5.2 + +ArrayFire Array +[4 1 1 1] +1.0000 +2.0000 +3.0000 +4.0000 + +``` ## Documentation diff --git a/arrayfire/util.lua b/arrayfire/util.lua index 44a7cbc..9b9e43c 100644 --- a/arrayfire/util.lua +++ b/arrayfire/util.lua @@ -29,5 +29,5 @@ funcs[34] = [[ af.lib.cdef(funcs) af.print = function(arr) - af.clib.af_print_array(arr:get()) + af.clib.af_print_array_gen(ffi.cast("char *", "ArrayFire Array"), arr:get(), 4) end