-
-
-
-
//Normal version of the Ehrlich-Aberth method
+__device__
cuDoubleComplex FirstH_EA(int i, cuDoubleComplex *Z) {
cuDoubleComplex result;
//Log Exp version of the Ehrlich-Aberth method
+__device__
cuDoubleComplex NewH_EA(int i, cuDoubleComplex *Z) {
cuDoubleComplex result;
//kernels to update a root i
-cuDoubleComplex H_EA(int i, cuDoubleComplex *Z) {
- cuDoubleComplex c;
- //if the root needs to be updated
- if(!finished[i]) {
- //according to the module of the root
- if (Cmodule(Z[i])<=maxRadius)
- //selects the normal version
- c = FirstH_EA(i,Z);
- else
- //of the Log Exp version
- c = NewH_EA(i,Z);
- return c;
+__global__
+void Dev_EA(int i, cuDoubleComplex *Z, int* finished,
+ int size) {
+ int i= blockIdx.x*blockDim.x+ threadIdx.x;
+ if(i<size) {
+ //if the root needs to be updated
+ if(!finished[i]) {
+ //according to the module of the root
+ if (Cmodule(Z[i])<=maxRadius)
+ //selects the normal version
+ Z[i] = FirstH_EA(i,Z);
+ else
+ //of the Log Exp version
+ Z[i] = NewH_EA(i,Z);
+ return c;
+ }
}
- else return Z[i];
}