## culaDeviceDsyevx returns wrong value!?!

4 posts
• Page

**1**of**1**### culaDeviceDsyevx returns wrong value!?!

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

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

- mjadidi
**Posts:**15**Joined:**Wed Jun 20, 2012 2:58 am

### Re: culaDeviceDsyevx returns wrong value!?!

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?

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

- mjadidi
**Posts:**15**Joined:**Wed Jun 20, 2012 2:58 am

### Re: culaDeviceDsyevx returns wrong value!?!

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.

- kyle
- Administrator
**Posts:**301**Joined:**Fri Jun 12, 2009 7:47 pm

### Re: culaDeviceDsyevx returns wrong value!?!

it was a wrapper bug! instead of returning the z value as eigenvectors it returns the w value!

Thanks

Thanks

- mjadidi
**Posts:**15**Joined:**Wed Jun 20, 2012 2:58 am

4 posts
• Page

**1**of**1**### Who is online

Users browsing this forum: No registered users and 5 guests