12 #include <cuComplex.h> 20 __device__ __constant__ cuDoubleComplex
poles[
N_RA];
21 __device__ __constant__ cuDoubleComplex
res[
N_RA];
29 double *poles_r = (
double *) calloc (
N_RA,
sizeof(
double));
30 double *poles_i = (
double *) calloc (
N_RA,
sizeof(
double));
31 double *res_r = (
double *) calloc (
N_RA,
sizeof(
double));
32 double *res_i = (
double *) calloc (
N_RA,
sizeof(
double));
34 cf (
N_RA, poles_r, poles_i, res_r, res_i);
36 cuDoubleComplex polesHost[
N_RA];
37 cuDoubleComplex resHost[
N_RA];
39 for (
int i = 0; i <
N_RA; ++i)
41 polesHost[i] = make_cuDoubleComplex(poles_r[i], poles_i[i]);
42 resHost[i] = make_cuDoubleComplex(res_r[i], res_i[i]);
52 cudaErrorCheck( cudaMemcpyToSymbol (
poles, polesHost,
N_RA *
sizeof(cuDoubleComplex), 0, cudaMemcpyHostToDevice) );
53 cudaErrorCheck( cudaMemcpyToSymbol (
res, resHost,
N_RA *
sizeof(cuDoubleComplex), 0, cudaMemcpyHostToDevice) );
void cf(int n, double *poles_r, double *poles_i, double *res_r, double *res_i)
Function that calculates the poles and residuals of best rational (partial fraction) approximant to t...
Defines some simple macros to simplify GPU indexing.
void find_poles_and_residuals()
get poles and residues for rational approximant to matrix exponential
__device__ __constant__ cuDoubleComplex res[N_RA]
__device__ __constant__ cuDoubleComplex poles[N_RA]
#define cudaErrorCheck(ans)
A file generated by Scons that specifies various options to the solvers.
Header definition for rational approximation to matrix exponential.