let say I have a vector

- Code: Select all
`V[v0,v1,v2,...,vN]`

I want to convert it to the vector

- Code: Select all
`e(2*j*PI*V)`

Is there anything in MAGMA to address this operation?

Thanks much in advance,

/v

3 posts
• Page **1** of **1**

Hello,

let say I have a vector

I want to convert it to the vector

Is there anything in MAGMA to address this operation?

Thanks much in advance,

/v

let say I have a vector

- Code: Select all
`V[v0,v1,v2,...,vN]`

I want to convert it to the vector

- Code: Select all
`e(2*j*PI*V)`

Is there anything in MAGMA to address this operation?

Thanks much in advance,

/v

- Volodimir
**Posts:**10**Joined:**Fri Jun 29, 2018 2:52 pm

No, sorry.

If you want this on the GPU, a CUDA kernel would be fairly easy. Something like below (completely UNTESTED CODE). I'm not sure what you mean by "j"; here I assumed you meant the row index, starting from i = 0, where v is a column vector. Adjust as desired. Compile with nvcc CUDA compiler. I based this off the magma/magmablas/zaxpycp.cu code.

-mark

If you want this on the GPU, a CUDA kernel would be fairly easy. Something like below (completely UNTESTED CODE). I'm not sure what you mean by "j"; here I assumed you meant the row index, starting from i = 0, where v is a column vector. Adjust as desired. Compile with nvcc CUDA compiler. I based this off the magma/magmablas/zaxpycp.cu code.

- Code: Select all
`#include <magma_v2.h> // for magma_ceildiv`

#include <math_constants.h> // for CUDART_PI

__global__

void exponential_kernel( int n, double* v )

{

const int i = threadIdx.x + blockIdx.x*blockDim.x;

if (i < n) {

v[i] = exp( 2 * i * CUDART_PI * v[i] );

}

}

void exponential( int n, double* x, cudaStream_t stream )

{

const int nb = 32;

exponential_kernel<<< magma_ceildiv( n, nb ), nb, 0, stream >>>( n, x );

}

-mark

- mgates3
**Posts:**817**Joined:**Fri Jan 06, 2012 2:13 pm

thanks, will try to use.

Just for clarification - j - is "imaginary" 1.

/v

Just for clarification - j - is "imaginary" 1.

/v

- Volodimir
**Posts:**10**Joined:**Fri Jun 29, 2018 2:52 pm

3 posts
• Page **1** of **1**

Users browsing this forum: Google [Bot] and 2 guests