Page 1 of 1

culaDeviceDsyevx returns wrong value!?!

PostPosted: Wed Sep 12, 2012 2:57 am
by mjadidi
I am trying to see the performance of different eigendecomposition on cula. At first I used culaDeviceDsyev and everything works fine.Now I tried to use the iterative method using culaDeviceDsyevx but I'm getting wrong answer.
let's say matrix "k" has eigenvalues vector(w) and eigenvectors (v) .so the equation k=U*diag(W)*U^-1 should hold , but it doesn't.The eigenvalues are ok in compare with culaDeviceDsyev. also I use python (Pycula). My code:

k_gpu=cula.cula_gpuarray_like(k_)
uplo='L'
evrange='A'
abstol=(2.2204460492503131e-16)*2
(m,n) = k_gpu.shape
assert m==n
lda = len(k_gpu)
jobz = 'V'
w = np.zeros(n,k_gpu.dtype)
w_gpu = cula.cula_gpuarray_like(w)
il=0
iu=0
vl=0
vu=0
m=ctypes.c_int(n)
z = np.zeros((lda,max(1,m.value)),k_gpu.dtype)
z_gpu = cula.cula_gpuarray_like(z)
ldz = len(z)
ifail=ctypes.c_int()

cula.culaDeviceDsyevx(jobz,evrange,uplo,n,k_gpu,lda,vl,vu,il,iu,abstol,m,w_gpu,z_gpu,ldz,ifail)

why it's happening ?

Thanks

Re: culaDeviceDsyevx returns wrong value!?!

PostPosted: Wed Sep 12, 2012 4:07 am
by mjadidi
I think I made a mistake. in the iterative method we can not check the correctness of value by np.dot(np.dot(v,np.diag(w)),np.transpose(v)) != k.

right?how can I check it? is culaDeviceDsyevx using Lanczos algorithm?

Re: culaDeviceDsyevx returns wrong value!?!

PostPosted: Wed Sep 12, 2012 5:32 am
by kyle
At first I used culaDeviceDsyev and everything works fine.Now I tried to use the iterative method using culaDeviceDsyevx but I'm getting wrong answer.

xSYEV and xSYEVX use the same algorithm under the hood if you are searching for all eigenvalues (range = 'A') so then answers should be the same. You might have a mistake in your wrapper code or perhaps there is an error in the 3rd party Pycula.

In the iterative method we can not check the correctness of value by np.dot(np.dot(v,np.diag(w)),np.transpose(v)) != k. right? How can I check it?

You can check the Eigendecomposition, A =V*diag(w)*inv(V). In your example, it looks like you are taking the transpose and not the inverse.

is culaDeviceDsyevx using Lanczos algorithm?

xSYEV uses a direct reduction to traditional form then QR iterations to find the Eigenpairs.

Re: culaDeviceDsyevx returns wrong value!?!

PostPosted: Thu Sep 13, 2012 2:20 am
by mjadidi
it was a wrapper bug! instead of returning the z value as eigenvectors it returns the w value!

Thanks