On Wed, 14 Dec 2011 13:41:12 -0600, "Pazzula, Dominic J " 
<dominic.j.pazz...@citi.com> wrote:
> The subset index seems to drop (or is exclusive of) the last value.  This can 
> be confusing if you are using range() to generate the array of indices.  
> Instead of needing the traditional range(start,end+1), you need to use 
> range(start,end+2) as the subset_dot() and the range() routine are exclusive 
> of the last value.
> 
> Is this behavior as intended?
> 
> import numpy as np
> import pycuda as cuda
> import pycuda.gpuarray
> import pycuda.autoinit
> 
> n = 3
> 
> a = np.array(range(0,n**2),ndmin=2)
> a = a.astype(np.float32)
> print a
> g_a = cuda.gpuarray.to_gpu(a)
> g_b = cuda.gpuarray.to_gpu(a)
> 
> subset = cuda.gpuarray.to_gpu(np.array(range(2,5)))
> 
> print "Subset Array", subset;
> x = cuda.gpuarray.subset_dot(subset,g_a,g_b)
> print "a[2:5] dot g[2:5]", x
> 
> ------
> [[ 0.  1.  2.  3.  4.  5.  6.  7.  8.]]
> Subset Array [2 3 4]
> a[2:5] dot g[2:5] 13.0

For the record: this is not the intended behavior. I'm debugging this,
but I haven't got very far yet.

Andreas

Attachment: pgp0SwtIQpZ01.pgp
Description: PGP signature

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to