Displaying 6 results from an estimated 6 matches for "have_na".
2005 Oct 12
1
Using matprod from array.c
...t; /* array.c says need for dgemm */
/* following copied from array.c */
static void matprod(double *x, int nrx, int ncx,
double *y, int nry, int ncy, double *z)
{
char *transa = "N", *transb = "N";
int i, j, k;
double one = 1.0, zero = 0.0, sum;
Rboolean have_na = FALSE;
if (nrx > 0 && ncx > 0 && nry > 0 && ncy > 0) {
/* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582
* The test is only O(n) here
*/
for (i = 0; i < nrx*ncx; i++)
if (ISNAN(x[i])) {have_na = TRUE; break;}
if (!have_na)...
2017 Jan 07
2
accelerating matrix multiply
...lapsed
2710.154?? 20.999?? 58.398
The NaN checking code is not being vectorized because of the early exit when NaN is detected:
/* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582
* The test is only O(n) here.
*/
for (R_xlen_t i = 0; i < NRX*ncx; i++)
if (ISNAN(x[i])) {have_na = TRUE; break;}
if (!have_na)
for (R_xlen_t i = 0; i < NRY*ncy; i++)
if (ISNAN(y[i])) {have_na = TRUE; break;}
I tried deleting the 'break'. By inspecting the asm code, I verified that the loop was not being vectorized before, but now is vectorized. Total time goes down:
system...
2017 Jan 11
2
accelerating matrix multiply
...The NaN checking code is not being vectorized because of the early
> exit when NaN is detected:
>
> /* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582
> * The test is only O(n) here.
> */
> for (R_xlen_t i = 0; i < NRX*ncx; i++)
> if (ISNAN(x[i])) {have_na = TRUE; break;}
> if (!have_na)
> for (R_xlen_t i = 0; i < NRY*ncy; i++)
> if (ISNAN(y[i])) {have_na = TRUE; break;}
>
> I tried deleting the 'break'. By inspecting the asm code, I verified
> that the loop was not being vectorized before, but now is vectorized...
2017 Jan 10
0
accelerating matrix multiply
...The NaN checking code is not being vectorized because of the
> early exit when NaN is detected:
>
> /* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582
> * The test is only O(n) here.
> */
> for (R_xlen_t i = 0; i < NRX*ncx; i++)
> if (ISNAN(x[i])) {have_na = TRUE; break;}
> if (!have_na)
> for (R_xlen_t i = 0; i < NRY*ncy; i++)
> if (ISNAN(y[i])) {have_na = TRUE; break;}
>
> I tried deleting the 'break'. By inspecting the asm code, I
> verified that the loop was not being vectorized before, but
> now is vector...
2017 Jan 16
1
accelerating matrix multiply
...t being vectorized because of the early
>> exit when NaN is detected:
>>
>> /* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582
>> * The test is only O(n) here.
>> */
>> for (R_xlen_t i = 0; i < NRX*ncx; i++)
>> if (ISNAN(x[i])) {have_na = TRUE; break;}
>> if (!have_na)
>> for (R_xlen_t i = 0; i < NRY*ncy; i++)
>> if (ISNAN(y[i])) {have_na = TRUE; break;}
>>
>> I tried deleting the 'break'. By inspecting the asm code, I verified
>> that the loop was not being vectorized before...
2017 Jan 16
0
accelerating matrix multiply
...ot being vectorized because of the early
>> exit when NaN is detected:
>>
>> /* Don't trust the BLAS to handle NA/NaNs correctly: PR#4582
>> * The test is only O(n) here.
>> */
>> for (R_xlen_t i = 0; i < NRX*ncx; i++)
>> if (ISNAN(x[i])) {have_na = TRUE; break;}
>> if (!have_na)
>> for (R_xlen_t i = 0; i < NRY*ncy; i++)
>> if (ISNAN(y[i])) {have_na = TRUE; break;}
>>
>> I tried deleting the 'break'. By inspecting the asm code, I verified
>> that the loop was not being vectorized before,...