Browse Source

handle dummy2 flag

pull/5284/head
Martin Kroeker GitHub 1 year ago
parent
commit
1b716940e8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 42 additions and 8 deletions
  1. +42
    -8
      kernel/zarch/zscal.c

+ 42
- 8
kernel/zarch/zscal.c View File

@@ -208,7 +208,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,
BLASLONG n1 = n & -2;

if (da_i == 0.0) {
if (dummy2 == 0) {
while (j < n1) {

x[i] = 0.0;
@@ -228,6 +228,34 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,
j++;

}
} else {
while (j < n1) {
if (isnan(x[i]) || isinf(x[i]) || isnan(x[i+1])) {
x[i] = NAN;
x[i+1] = NAN;
} else {
x[i] = 0.0;
x[i+1] = 0.0;
}
if (isnan(x[i+inc_x]) || isinf(x[i+inc_x]) || isnan(x[i+inc_x+1])) {
x[i + inc_x] = NAN;
x[i + inc_x + 1] = NAN;
} else {
x[i + inc_x] = 0.;
x[i + inc_x + 1] = 0.;
}
i += 2 * inc_x;
i += 2;
}
while (j < n) {
if (isnan(x[i]) || isinf(x[i]) || isnan(x[i+1])) {
x[i] = NAN;
x[i+1] = NAN;
} else {
x[i] = 0.;
x[i+1] = 0.;
}
}

} else {

@@ -276,7 +304,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,

} else {

if (da_i == 0.0) {
if (da_i == 0.0 && dummy2) {
BLASLONG n1 = n & -2;

while (j < n1) {
@@ -335,12 +363,10 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,
alpha[1] = da_i;

if (da_r == 0.0)
if (da_i == 0)
if (da_i == 0 && dummy2 == 0)
zscal_kernel_8_zero(n1, x);
else
zscal_kernel_8(n1, da_r, da_i, x);
else if (da_i == 0 && da_r == da_r)
zscal_kernel_8_zero_i(n1, alpha, x);
else
zscal_kernel_8(n1, da_r, da_i, x);

@@ -354,7 +380,8 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,
double res= 0.0;
if (isnan(da_r)) res = da_r;
while (j < n) {

if (dummy2)
if (isnan(x[i]) || isnan(x[i+1])) res = NAN;
x[i] = res;
x[i + 1] = res;
i += 2;
@@ -381,7 +408,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,
x[i + 1] = da_i * x[i];
else
x[i + 1] = NAN;
if (x[i]==x[i])
if (!isnan(x[i]))
x[i] = temp0;
i += 2;
j++;
@@ -397,6 +424,13 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,
while (j < n) {

temp0 = da_r * x[i];
if (dummy2) {
if (isnan(x[i]) || isinf(x[i])) temp0 = NAN;
if (isnan(x[i + 1]) || isinf(x[i + 1]))
x[i + 1] = NAN;
else
x[i + 1] = da_r * x[i + 1];
}
x[i + 1] = da_r * x[i + 1];
x[i] = temp0;
i += 2;
@@ -410,7 +444,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i,

temp0 = da_r * x[i] - da_i * x[i + 1];
x[i + 1] = da_r * x[i + 1] + da_i * x[i];
x[i] = temp0;
if (!isnan(x[i])) x[i] = temp0;
i += 2;
j++;



Loading…
Cancel
Save