Open bicycle1885 opened 8 years ago
It would be possible to write a multi-dimensional array wrapper around these libraries, but the underlying frameworks (Accelerate, Yeppp, VML) do not support multi-dimensional arrays - i.e. write a wrapper that iterates over each row or column of the multi-dimensional array and calls Vectorize.exp(K)
on it.
I am always looking for PR's if this is a feature that you were interested in implementing!
It should be possible to use it directly, since we store arrays contiguously (so the libraries would just see it as a vector).
Simon is right - I have pushed a commit to master that allows for multi-dimensional arrays (the previous X::Vector{$T}
on function arguments resulted in a type error). However, due to some idiosyncracies with how I handled allocating return memory, some functions may not preserve array shape i.e.
julia> arr = [1.0 2; 3 4]
2×2 Array{Float64,2}:
1.0 2.0
3.0 4.0
julia> using Vectorize
julia> Vectorize.Accelerate.exp(arr) # correct allocation of return array
2×2 Array{Float64,2}:
2.71828 7.38906
20.0855 54.5982
julia> Vectorize.exp(arr) # incorrect allocation of return array
4-element Array{Float64,1}:
2.71828
20.0855
7.38906
54.5982
This should be a small and easy fix that I will try and get done soon - if it's a pressing issue, you are welcome to give it a crack yourself. This line gives an example of what needs to be changed for some functions.
That's great. This is not in urgent need, but if you're reluctant to do that I'm happy to create a pull request.
I'm not reluctant at all! I'm always happy to add new features to this package - it just may take me a couple of days to find the time to locate all the offending instances and write a multi-dimensional test-suite (the current test-suite is 1D only).
However, I am always happy to accept PR's for any part of this project!
Thank you! I can wait for your work; I can use map!(exp, array)
but vectorizing it will improve the performance of my application ~10% as a whole.
Hi,
I'm interested in accelerating computation of the RBF kernel using this library.
The function looks like this:
I'd like to replace
map!(exp, K)
withVectorize.exp(K)
but it doesn't accept multi-dimensional arrays (Matrix{Float64}
, in this case).Is that possible to support multi-dimensional arrays?