[Rcpp-commits] r3672 - in pkg/RcppCNPy: . tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jul 6 15:08:18 CEST 2012
Author: edd
Date: 2012-07-06 15:08:17 +0200 (Fri, 06 Jul 2012)
New Revision: 3672
Added:
pkg/RcppCNPy/tests/
pkg/RcppCNPy/tests/createFiles.py
pkg/RcppCNPy/tests/fmat.npy
pkg/RcppCNPy/tests/fmat.npy.gz
pkg/RcppCNPy/tests/fvec.npy
pkg/RcppCNPy/tests/imat.npy
pkg/RcppCNPy/tests/ivec.npy
pkg/RcppCNPy/tests/loadFiles.R
pkg/RcppCNPy/tests/loadFiles.Rout.save
pkg/RcppCNPy/tests/loadFiles.py
Log:
add tests/
Added: pkg/RcppCNPy/tests/createFiles.py
===================================================================
--- pkg/RcppCNPy/tests/createFiles.py (rev 0)
+++ pkg/RcppCNPy/tests/createFiles.py 2012-07-06 13:08:17 UTC (rev 3672)
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import os
+import numpy as np
+
+# simple float and integer arrays
+np.save("fmat.npy", np.arange(12).reshape(3,4) * 1.1)
+np.save("imat.npy", np.arange(12).reshape(3,4))
+
+# simple float and integer vectors
+np.save("fvec.npy", np.arange(5) * 1.1)
+np.save("ivec.npy", np.arange(5))
Property changes on: pkg/RcppCNPy/tests/createFiles.py
___________________________________________________________________
Added: svn:executable
+ *
Added: pkg/RcppCNPy/tests/fmat.npy
===================================================================
(Binary files differ)
Property changes on: pkg/RcppCNPy/tests/fmat.npy
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/RcppCNPy/tests/fmat.npy.gz
===================================================================
(Binary files differ)
Property changes on: pkg/RcppCNPy/tests/fmat.npy.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/RcppCNPy/tests/fvec.npy
===================================================================
(Binary files differ)
Property changes on: pkg/RcppCNPy/tests/fvec.npy
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/RcppCNPy/tests/imat.npy
===================================================================
(Binary files differ)
Property changes on: pkg/RcppCNPy/tests/imat.npy
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/RcppCNPy/tests/ivec.npy
===================================================================
(Binary files differ)
Property changes on: pkg/RcppCNPy/tests/ivec.npy
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/RcppCNPy/tests/loadFiles.R
===================================================================
--- pkg/RcppCNPy/tests/loadFiles.R (rev 0)
+++ pkg/RcppCNPy/tests/loadFiles.R 2012-07-06 13:08:17 UTC (rev 3672)
@@ -0,0 +1,24 @@
+#!/usr/bin/Rscript
+
+library(RcppCNPy)
+
+fmat <- npyLoad("fmat.npy")
+fmat
+stopifnot(all.equal(fmat, t(matrix(seq(0,11) * 1.1, 4, 3))))
+
+fmat <- npyLoad("fmat.npy.gz")
+fmat
+stopifnot(all.equal(fmat, t(matrix(seq(0,11) * 1.1, 4, 3))))
+
+#imat <- npyLoad("imat.npy", "integer")
+#imat
+#stopifnot(all.equal(imat, t(matrix(seq(0,11), 4, 3))))
+
+fvec <- npyLoad("fvec.npy")
+fvec
+stopifnot(all.equal(fvec, seq(0,4) * 1.1))
+
+#ivec <- npyLoad("ivec.npy", "integer")
+#ivec
+#stopifnot(all.equal(ivec, seq(0,4)))
+
Property changes on: pkg/RcppCNPy/tests/loadFiles.R
___________________________________________________________________
Added: svn:executable
+ *
Added: pkg/RcppCNPy/tests/loadFiles.Rout.save
===================================================================
--- pkg/RcppCNPy/tests/loadFiles.Rout.save (rev 0)
+++ pkg/RcppCNPy/tests/loadFiles.Rout.save 2012-07-06 13:08:17 UTC (rev 3672)
@@ -0,0 +1,56 @@
+
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
+Copyright (C) 2012 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+Platform: x86_64-pc-linux-gnu (64-bit)
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+> #!/usr/bin/Rscript
+>
+> library(RcppCNPy)
+Loading required package: Rcpp
+>
+> fmat <- npyLoad("fmat.npy")
+> fmat
+ [,1] [,2] [,3] [,4]
+[1,] 0.0 1.1 2.2 3.3
+[2,] 4.4 5.5 6.6 7.7
+[3,] 8.8 9.9 11.0 12.1
+> stopifnot(all.equal(fmat, t(matrix(seq(0,11) * 1.1, 4, 3))))
+>
+> fmat <- npyLoad("fmat.npy.gz")
+> fmat
+ [,1] [,2] [,3] [,4]
+[1,] 0.0 1.1 2.2 3.3
+[2,] 4.4 5.5 6.6 7.7
+[3,] 8.8 9.9 11.0 12.1
+> stopifnot(all.equal(fmat, t(matrix(seq(0,11) * 1.1, 4, 3))))
+>
+> #imat <- npyLoad("imat.npy", "integer")
+> #imat
+> #stopifnot(all.equal(imat, t(matrix(seq(0,11), 4, 3))))
+>
+> fvec <- npyLoad("fvec.npy")
+> fvec
+[1] 0.0 1.1 2.2 3.3 4.4
+> stopifnot(all.equal(fvec, seq(0,4) * 1.1))
+>
+> #ivec <- npyLoad("ivec.npy", "integer")
+> #ivec
+> #stopifnot(all.equal(ivec, seq(0,4)))
+>
+>
+> proc.time()
+ user system elapsed
+ 0.596 0.024 0.460
Added: pkg/RcppCNPy/tests/loadFiles.py
===================================================================
--- pkg/RcppCNPy/tests/loadFiles.py (rev 0)
+++ pkg/RcppCNPy/tests/loadFiles.py 2012-07-06 13:08:17 UTC (rev 3672)
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import os
+import numpy as np
+
+# simple float and integer arrays
+print np.load("fmat.npy")
+print np.load("imat.npy")
+
+# simple float and integer vectors
+print np.load("fvec.npy")
+print np.load("ivec.npy")
Property changes on: pkg/RcppCNPy/tests/loadFiles.py
___________________________________________________________________
Added: svn:executable
+ *
More information about the Rcpp-commits
mailing list