Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: slice/slices, mapslices #187

Open
ngphuoc opened this issue Dec 6, 2017 · 8 comments
Open

Feature request: slice/slices, mapslices #187

ngphuoc opened this issue Dec 6, 2017 · 8 comments

Comments

@ngphuoc
Copy link

ngphuoc commented Dec 6, 2017

Could we have this feature in julia: http://arrayfire.org/docs/group__array__mem__slice.htm? And does it allow mapslices into AFArray?

@ghost
Copy link

ghost commented Dec 7, 2017

That's just an alias to indexing, so slice(a, i) = a[:, :, i]

@ngphuoc
Copy link
Author

ngphuoc commented Dec 7, 2017

Thanks. In that case, could you support create_seq(::Base.Slice{Base.OneTo{Int64}})? Then mapslices should work!

@ghost
Copy link

ghost commented Dec 7, 2017

I don't think that's enough to support mapslices :(

@ngphuoc
Copy link
Author

ngphuoc commented Dec 7, 2017

Thanks, I've added mapslices to the title. Is it likely to be supported in the near future? It seems useful.

@ngphuoc ngphuoc changed the title Feature request: slice/slices Feature request: slice/slices, mapslices Dec 7, 2017
@ngphuoc
Copy link
Author

ngphuoc commented Apr 4, 2018

Can current ArrayFire.jl do similarly to the following C++ code snippet?

int n = 8, int m = 8;   // dimensions
int t = 10;             // number of different matricies
array A = randu(m,n,t); // many matricies
array B = randu(m,n);   // one matrix
array C = zeros(m,n,t); // destination

// multiply C=A*B for all A, at the same time
gfor (array i, A.dims(2)) {
   C(span,span,i) = matmul(A(span,span,i), B);
}

print( A );
print( B );
print( C );

ref: https://stackoverflow.com/questions/13051326/multiplying-hundreds-of-matrices-using-cuda

@ghost
Copy link

ghost commented Apr 4, 2018

a = rand(AFArray, 3, 3, 9)
b = rand(AFArray, 3, 3, 9)
a * b

Would do 9 matrix multiplies of 3x3 slices

@ngphuoc
Copy link
Author

ngphuoc commented Apr 4, 2018

Many thanks!

@ghost
Copy link

ghost commented Apr 4, 2018

You might need the latest version of ArrayFire for this to work, was only added recently arrayfire/arrayfire#1898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant