Skip to content

Commit

Permalink
silence tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jan 14, 2020
1 parent 8ded09f commit 8274b77
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions inst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2020-01-14 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* inst/ChangeLog, src/mtrx.c, tests/allier.R,
tests/allier.Rout.save, tests/merge.Rout.save, tests/stars.R,
tests/stars.Rout.save, tests/unproj.R, tests/unproj.Rout.save,
tests/windst.R, tests/windst.Rout.save: clean up tests

2020-01-10 Edzer Pebesma <edzer.pebesma@uni-muenster.de>

* inst/ChangeLog, tests/stars.R: tests
Expand Down
8 changes: 6 additions & 2 deletions src/mtrx.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* interface roughly follows meschach; implementation rewritten from scratch */

#include <string.h> /* memcpy, memset */
#include <math.h> /* fabs */

#include "R_ext/Lapack.h"

Expand All @@ -11,6 +12,9 @@
#include "debug.h"
#include "mtrx.h"

/* get rid of -0.000000 output: */
#define _zero_(x) (fabs(x) < 1.e-7 ? 0.0 : x)

/* 0. book keeping: initialisation, memory allocation, zero, copy, print */

void m_free(MAT *m) {
Expand Down Expand Up @@ -151,7 +155,7 @@ void m_logoutput(MAT * a) {
printlog("c(");
for (j = 0, tmp = 2; j < a->n; j++, tmp++) {
/* for each col in row: */
printlog("%9f", ME(a, i, j));
printlog("%9f", _zero_(ME(a, i, j)));
if (j + 1 < a->n)
printlog(", ");
else
Expand Down Expand Up @@ -180,7 +184,7 @@ void v_logoutput(VEC * x) {
}
printlog("c(");
for (i = 0, tmp = 0; i < x->dim; i++, tmp++) {
printlog("%9f", x->ve[i]);
printlog("%9f", _zero_(x->ve[i]));
if (i + 1 < x->dim)
printlog(", ");
}
Expand Down
6 changes: 3 additions & 3 deletions tests/merge.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ c( 0.305494, 1.081434) # row 2
# kriging weights:
Matrix: 4 by 2
rbind(
c( 0.500000, -0.000000), # row 1
c( 0.500000, 0.000000), # row 1
c( 0.500000, 0.000000), # row 2
c( 0.000000, 0.500000), # row 3
c(-0.000000, 0.500000) # row 4
c( 0.000000, 0.500000) # row 4
)


Expand All @@ -294,4 +294,4 @@ c(-0.000000, 0.500000) # row 4
>
> proc.time()
user system elapsed
0.529 0.037 0.556
0.484 0.028 0.502

0 comments on commit 8274b77

Please sign in to comment.