JuliaMath / Yeppp.jl

Yeppp! bindings
Other
55 stars 14 forks source link

Support contiguous-memory 2D arrays #3

Closed hiccup7 closed 9 years ago

hiccup7 commented 9 years ago

I would like to use Yeppp on whole 2D arrays, which implies that their memory is contiguous throughout. The Yeppp C functions will support this since they use pointer and length arguments. Being new to Julia, I am not clear on how to type-restrict the 2D methods to throw an error if the 2D argument is non-contiguous, such as a 2D subarray.

One of the reasons Yeppp is important to me is that it has SIMD performance optimized for Intel Haswell CPUs, which use AVX2 instructions. Pure Julia code relies on LLVM v3.3 for released Julia builds, which doesn't support Haswell/AVX2 instructions. I hope Julia moves to LLVM v3.6 soon. I see that a PR is active on this: https://github.com/JuliaLang/julia/issues/10786

ViralBShah commented 9 years ago

The simplest solution is to implement the methods for Matrix for 2d, or Array for Nd, which are contiguous. The more general AbstractMatrix and AbstractArray may or may not be so.

Coming to think of it, for many of the functions, Vector can be safely replaced with Array in yeppp.jl.