Skip to content

Commit

Permalink
better tests, fixed some pairwise bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
wrathematics committed Apr 23, 2016
1 parent fe6a99c commit 9450da1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 2 additions & 8 deletions src/dense_pairwise.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,13 @@ int coop_pcor_mat_inplace_pairwise(const int m, const int n, const double *restr
set_na_real(cor + (j + n*i));
continue;
}
else if (len == 2)
{
cor[i + n*j] = 1.;
cor[j + n*i] = 1.;
continue;
}

dlen = (double) len;
meanx /= dlen;
meany /= dlen;

sdx = 0;
sdy = 0;
sdx = 0.;
sdy = 0.;

SAFE_SIMD
for (k=0; k<m; k++)
Expand Down
5 changes: 3 additions & 2 deletions tests/dense_matrix_pairwise.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
library(coop)
set.seed(1234)

x = matrix(rnorm(9), 3)
x[2,1] = x[3,2] = NA
n <- 21
x = matrix(rnorm(n), 3)
x[sample(n, size=6)] = NA

t1 <- cov(x, use="pair")
t2 <- covar(x, use="pair")
Expand Down
6 changes: 6 additions & 0 deletions tests/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

for f in `ls *.R`;do
echo $f:
r $f
done

0 comments on commit 9450da1

Please sign in to comment.