Back to Multiple platform build/check report for BioC 3.8
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

CHECK report for BufferedMatrix on tokay1

This page was generated on 2019-04-13 11:20:07 -0400 (Sat, 13 Apr 2019).

Package 183/1649HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.46.0
Ben Bolstad
Snapshot Date: 2019-04-12 17:01:30 -0400 (Fri, 12 Apr 2019)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_8
Last Commit: 9fb17da
Last Changed Date: 2018-10-30 11:41:43 -0400 (Tue, 30 Oct 2018)
malbec1 Linux (Ubuntu 16.04.6 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
tokay1 Windows Server 2012 R2 Standard / x64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository
merida1 OS X 10.11.6 El Capitan / x86_64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.46.0
Command: C:\Users\biocbuild\bbs-3.8-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.8-bioc\R\library --no-vignettes --timings BufferedMatrix_1.46.0.tar.gz
StartedAt: 2019-04-13 00:55:01 -0400 (Sat, 13 Apr 2019)
EndedAt: 2019-04-13 00:56:45 -0400 (Sat, 13 Apr 2019)
EllapsedTime: 104.1 seconds
RetCode: 0
Status:  OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\Users\biocbuild\bbs-3.8-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.8-bioc\R\library --no-vignettes --timings BufferedMatrix_1.46.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck'
* using R version 3.5.3 (2019-03-11)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using option '--no-vignettes'
* checking for file 'BufferedMatrix/DESCRIPTION' ... OK
* this is package 'BufferedMatrix' version '1.46.0'
* checking package namespace information ... OK
* checking package dependencies ...Warning: unable to access index for repository https://CRAN.R-project.org/src/contrib:
  cannot open URL 'https://CRAN.R-project.org/src/contrib/PACKAGES'
 OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'BufferedMatrix' can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch 'i386'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
* loading checks for arch 'x64'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files for i386 is not available
Note: information on .o files for x64 is not available
File 'C:/Users/biocbuild/bbs-3.8-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)

Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs. The detected symbols are linked into the code but
might come from libraries and not actually be called.

See 'Writing portable packages' in the 'Writing R Extensions' manual.
* checking files in 'vignettes' ... OK
* checking examples ... NONE
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
** running tests for arch 'i386' ...
  Running 'Rcodetesting.R'
  Running 'c_code_level_tests.R'
  Running 'objectTesting.R'
  Running 'rawCalltesting.R'
 OK
** running tests for arch 'x64' ...
  Running 'Rcodetesting.R'
  Running 'c_code_level_tests.R'
  Running 'objectTesting.R'
  Running 'rawCalltesting.R'
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in 'inst/doc' ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  'C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\cygwin\bin\curl.exe -O https://malbec1.bioconductor.org/BBS/3.8/bioc/src/contrib/BufferedMatrix_1.46.0.tar.gz && rm -rf BufferedMatrix.buildbin-libdir && mkdir BufferedMatrix.buildbin-libdir && C:\Users\biocbuild\bbs-3.8-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.46.0.tar.gz && C:\Users\biocbuild\bbs-3.8-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix_1.46.0.zip && rm BufferedMatrix_1.46.0.tar.gz BufferedMatrix_1.46.0.zip
###
##############################################################################
##############################################################################


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  202k  100  202k    0     0  5251k      0 --:--:-- --:--:-- --:--:-- 5784k

install for i386

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c RBufferedMatrix.c -o RBufferedMatrix.o
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function 'dbm_ReadOnlyMode':
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '˜' [-Wparentheses]
   if (!(Matrix->readonly) & setting){
       ^
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: 'sort_double' defined but not used [-Wunused-function]
 static int sort_double(const double *a1,const double *a2){
            ^
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c init_package.c -o init_package.o
C:/Rtools/mingw_32/bin/gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/extsoft/lib/i386 -LC:/extsoft/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/i386
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for 'rowMeans' in package 'BufferedMatrix'
Creating a new generic function for 'rowSums' in package 'BufferedMatrix'
Creating a new generic function for 'colMeans' in package 'BufferedMatrix'
Creating a new generic function for 'colSums' in package 'BufferedMatrix'
Creating a generic function for 'ncol' from package 'base' in package 'BufferedMatrix'
Creating a generic function for 'nrow' from package 'base' in package 'BufferedMatrix'
** help
*** installing help indices
  converting help for package 'BufferedMatrix'
    finding HTML links ... done
    BufferedMatrix-class                    html  
    as.BufferedMatrix                       html  
    createBufferedMatrix                    html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
In R CMD INSTALL

install for x64

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c RBufferedMatrix.c -o RBufferedMatrix.o
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function 'dbm_ReadOnlyMode':
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '˜' [-Wparentheses]
   if (!(Matrix->readonly) & setting){
       ^
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: 'sort_double' defined but not used [-Wunused-function]
 static int sort_double(const double *a1,const double *a2){
            ^
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c init_package.c -o init_package.o
C:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/extsoft/lib/x64 -LC:/extsoft/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.8-B/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.46.0.zip
* DONE (BufferedMatrix)
In R CMD INSTALL
In R CMD INSTALL
* installing to library 'C:/Users/biocbuild/bbs-3.8-bioc/R/library'
package 'BufferedMatrix' successfully unpacked and MD5 sums checked
In R CMD INSTALL

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-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.

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
   0.29    0.06    0.35 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
   0.32    0.03    0.35 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-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.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 403488 12.4     839005 25.7   627634 19.2
Vcells 463177  3.6    8388608 64.0  1444033 11.1
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sat Apr 13 00:56:25 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Apr 13 00:56:25 2019"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x036ac7d0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sat Apr 13 00:56:26 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Apr 13 00:56:27 2019"
> 
> ColMode(tmp2)
<pointer: 0x036ac7d0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]       [,3]       [,4]
[1,] 99.7626183  1.4449717  0.3208007  0.4042921
[2,] -0.8621314  0.2503722 -0.9347703  1.8613645
[3,] -0.4862694  0.4778569 -0.9894395 -0.5229444
[4,] -0.1394231 -0.2220865  1.9888298 -1.0525122
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 99.7626183 1.4449717 0.3208007 0.4042921
[2,]  0.8621314 0.2503722 0.9347703 1.8613645
[3,]  0.4862694 0.4778569 0.9894395 0.5229444
[4,]  0.1394231 0.2220865 1.9888298 1.0525122
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9881239 1.2020697 0.5663927 0.6358397
[2,] 0.9285103 0.5003721 0.9668352 1.3643183
[3,] 0.6973302 0.6912719 0.9947057 0.7231489
[4,] 0.3733941 0.4712605 1.4102588 1.0259202
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.64386 38.46567 30.98473 31.76269
[2,]  35.14723 30.25409 35.60312 40.50455
[3,]  32.45957 32.39058 35.93650 32.75443
[4,]  28.87336 29.93469 41.09142 36.31171
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x02245008>
> exp(tmp5)
<pointer: 0x02245008>
> log(tmp5,2)
<pointer: 0x02245008>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.5668
> Min(tmp5)
[1] 53.81636
> mean(tmp5)
[1] 72.22722
> Sum(tmp5)
[1] 14445.44
> Var(tmp5)
[1] 862.0372
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.52388 68.23689 71.59004 70.32137 69.53959 70.04801 72.21605 71.04713
 [9] 67.02326 71.72603
> rowSums(tmp5)
 [1] 1810.478 1364.738 1431.801 1406.427 1390.792 1400.960 1444.321 1420.943
 [9] 1340.465 1434.521
> rowVars(tmp5)
 [1] 7912.24553   78.38223   75.70829   46.39380  100.95205   87.64832
 [7]   57.17862   49.24077   90.53717  114.18071
> rowSd(tmp5)
 [1] 88.950804  8.853374  8.701051  6.811299 10.047490  9.362068  7.561654
 [8]  7.017177  9.515102 10.685538
> rowMax(tmp5)
 [1] 467.56676  84.30491  97.00253  85.52640  91.07553  94.52547  86.36466
 [8]  81.84567  97.05604  93.52835
> rowMin(tmp5)
 [1] 61.52301 55.79748 57.45843 60.09612 53.81636 54.56522 55.50050 59.40360
 [9] 54.31305 54.30563
> 
> colMeans(tmp5)
 [1] 112.22643  68.17135  73.17148  70.91555  72.21987  63.90829  65.38423
 [8]  68.45040  68.14716  71.45402  71.02074  72.54173  69.53297  69.72062
[15]  69.86809  71.98528  68.01314  73.05612  74.98292  69.77409
> colSums(tmp5)
 [1] 1122.2643  681.7135  731.7148  709.1555  722.1987  639.0829  653.8423
 [8]  684.5040  681.4716  714.5402  710.2074  725.4173  695.3297  697.2062
[15]  698.6809  719.8528  680.1314  730.5612  749.8292  697.7409
> colVars(tmp5)
 [1] 15673.64243    65.18002    55.89788    66.54535    31.92403    80.39026
 [7]    37.44172    40.90668    64.33265    71.97389   119.01711    42.61237
[13]    57.42375    36.73587   154.48601    44.55779   155.69254   110.75190
[19]    59.88499    69.74004
> colSd(tmp5)
 [1] 125.194419   8.073414   7.476489   8.157533   5.650135   8.966061
 [7]   6.118964   6.395833   8.020764   8.483743  10.909497   6.527815
[13]   7.577846   6.061012  12.429240   6.675162  12.477682  10.523873
[19]   7.738539   8.351050
> colMax(tmp5)
 [1] 467.56676  80.88619  85.52640  84.30491  79.63803  79.84340  77.63149
 [8]  78.45384  82.79505  82.66241  92.94900  81.39635  77.59722  78.19073
[15]  97.05604  77.52153  97.00253  93.52835  91.07553  82.59428
> colMin(tmp5)
 [1] 60.09612 59.10720 59.40360 59.55012 60.35899 54.56522 56.95200 56.54561
 [9] 54.31305 58.89918 57.45843 60.86408 53.81636 61.52301 54.64788 54.30563
[17] 55.33259 61.33648 65.12009 56.22913
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.52388 68.23689       NA 70.32137 69.53959 70.04801 72.21605 71.04713
 [9] 67.02326 71.72603
> rowSums(tmp5)
 [1] 1810.478 1364.738       NA 1406.427 1390.792 1400.960 1444.321 1420.943
 [9] 1340.465 1434.521
> rowVars(tmp5)
 [1] 7912.24553   78.38223   42.14852   46.39380  100.95205   87.64832
 [7]   57.17862   49.24077   90.53717  114.18071
> rowSd(tmp5)
 [1] 88.950804  8.853374  6.492189  6.811299 10.047490  9.362068  7.561654
 [8]  7.017177  9.515102 10.685538
> rowMax(tmp5)
 [1] 467.56676  84.30491        NA  85.52640  91.07553  94.52547  86.36466
 [8]  81.84567  97.05604  93.52835
> rowMin(tmp5)
 [1] 61.52301 55.79748       NA 60.09612 53.81636 54.56522 55.50050 59.40360
 [9] 54.31305 54.30563
> 
> colMeans(tmp5)
 [1] 112.22643  68.17135  73.17148  70.91555  72.21987  63.90829  65.38423
 [8]  68.45040  68.14716  71.45402  71.02074  72.54173  69.53297  69.72062
[15]  69.86809  71.98528        NA  73.05612  74.98292  69.77409
> colSums(tmp5)
 [1] 1122.2643  681.7135  731.7148  709.1555  722.1987  639.0829  653.8423
 [8]  684.5040  681.4716  714.5402  710.2074  725.4173  695.3297  697.2062
[15]  698.6809  719.8528        NA  730.5612  749.8292  697.7409
> colVars(tmp5)
 [1] 15673.64243    65.18002    55.89788    66.54535    31.92403    80.39026
 [7]    37.44172    40.90668    64.33265    71.97389   119.01711    42.61237
[13]    57.42375    36.73587   154.48601    44.55779          NA   110.75190
[19]    59.88499    69.74004
> colSd(tmp5)
 [1] 125.194419   8.073414   7.476489   8.157533   5.650135   8.966061
 [7]   6.118964   6.395833   8.020764   8.483743  10.909497   6.527815
[13]   7.577846   6.061012  12.429240   6.675162         NA  10.523873
[19]   7.738539   8.351050
> colMax(tmp5)
 [1] 467.56676  80.88619  85.52640  84.30491  79.63803  79.84340  77.63149
 [8]  78.45384  82.79505  82.66241  92.94900  81.39635  77.59722  78.19073
[15]  97.05604  77.52153        NA  93.52835  91.07553  82.59428
> colMin(tmp5)
 [1] 60.09612 59.10720 59.40360 59.55012 60.35899 54.56522 56.95200 56.54561
 [9] 54.31305 58.89918 57.45843 60.86408 53.81636 61.52301 54.64788 54.30563
[17]       NA 61.33648 65.12009 56.22913
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.5668
> Min(tmp5,na.rm=TRUE)
[1] 53.81636
> mean(tmp5,na.rm=TRUE)
[1] 72.10273
> Sum(tmp5,na.rm=TRUE)
[1] 14348.44
> Var(tmp5,na.rm=TRUE)
[1] 863.2753
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.52388 68.23689 70.25254 70.32137 69.53959 70.04801 72.21605 71.04713
 [9] 67.02326 71.72603
> rowSums(tmp5,na.rm=TRUE)
 [1] 1810.478 1364.738 1334.798 1406.427 1390.792 1400.960 1444.321 1420.943
 [9] 1340.465 1434.521
> rowVars(tmp5,na.rm=TRUE)
 [1] 7912.24553   78.38223   42.14852   46.39380  100.95205   87.64832
 [7]   57.17862   49.24077   90.53717  114.18071
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.950804  8.853374  6.492189  6.811299 10.047490  9.362068  7.561654
 [8]  7.017177  9.515102 10.685538
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.56676  84.30491  81.01292  85.52640  91.07553  94.52547  86.36466
 [8]  81.84567  97.05604  93.52835
> rowMin(tmp5,na.rm=TRUE)
 [1] 61.52301 55.79748 57.45843 60.09612 53.81636 54.56522 55.50050 59.40360
 [9] 54.31305 54.30563
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.22643  68.17135  73.17148  70.91555  72.21987  63.90829  65.38423
 [8]  68.45040  68.14716  71.45402  71.02074  72.54173  69.53297  69.72062
[15]  69.86809  71.98528  64.79210  73.05612  74.98292  69.77409
> colSums(tmp5,na.rm=TRUE)
 [1] 1122.2643  681.7135  731.7148  709.1555  722.1987  639.0829  653.8423
 [8]  684.5040  681.4716  714.5402  710.2074  725.4173  695.3297  697.2062
[15]  698.6809  719.8528  583.1289  730.5612  749.8292  697.7409
> colVars(tmp5,na.rm=TRUE)
 [1] 15673.64243    65.18002    55.89788    66.54535    31.92403    80.39026
 [7]    37.44172    40.90668    64.33265    71.97389   119.01711    42.61237
[13]    57.42375    36.73587   154.48601    44.55779    58.43403   110.75190
[19]    59.88499    69.74004
> colSd(tmp5,na.rm=TRUE)
 [1] 125.194419   8.073414   7.476489   8.157533   5.650135   8.966061
 [7]   6.118964   6.395833   8.020764   8.483743  10.909497   6.527815
[13]   7.577846   6.061012  12.429240   6.675162   7.644215  10.523873
[19]   7.738539   8.351050
> colMax(tmp5,na.rm=TRUE)
 [1] 467.56676  80.88619  85.52640  84.30491  79.63803  79.84340  77.63149
 [8]  78.45384  82.79505  82.66241  92.94900  81.39635  77.59722  78.19073
[15]  97.05604  77.52153  77.54585  93.52835  91.07553  82.59428
> colMin(tmp5,na.rm=TRUE)
 [1] 60.09612 59.10720 59.40360 59.55012 60.35899 54.56522 56.95200 56.54561
 [9] 54.31305 58.89918 57.45843 60.86408 53.81636 61.52301 54.64788 54.30563
[17] 55.33259 61.33648 65.12009 56.22913
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.52388 68.23689      NaN 70.32137 69.53959 70.04801 72.21605 71.04713
 [9] 67.02326 71.72603
> rowSums(tmp5,na.rm=TRUE)
 [1] 1810.478 1364.738    0.000 1406.427 1390.792 1400.960 1444.321 1420.943
 [9] 1340.465 1434.521
> rowVars(tmp5,na.rm=TRUE)
 [1] 7912.24553   78.38223         NA   46.39380  100.95205   87.64832
 [7]   57.17862   49.24077   90.53717  114.18071
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.950804  8.853374        NA  6.811299 10.047490  9.362068  7.561654
 [8]  7.017177  9.515102 10.685538
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.56676  84.30491        NA  85.52640  91.07553  94.52547  86.36466
 [8]  81.84567  97.05604  93.52835
> rowMin(tmp5,na.rm=TRUE)
 [1] 61.52301 55.79748       NA 60.09612 53.81636 54.56522 55.50050 59.40360
 [9] 54.31305 54.30563
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.18933  68.25520  72.99086  71.22016  72.31540  62.13772  65.47848
 [8]  67.97291  68.17222  70.39192  72.52766  73.83925  68.63694  68.77950
[15]  70.41661  71.80502       NaN  74.12757  75.15971  69.75190
> colSums(tmp5,na.rm=TRUE)
 [1] 1054.7040  614.2968  656.9177  640.9815  650.8386  559.2395  589.3063
 [8]  611.7562  613.5500  633.5273  652.7490  664.5532  617.7325  619.0155
[15]  633.7495  646.2452    0.0000  667.1482  676.4374  627.7671
> colVars(tmp5,na.rm=TRUE)
 [1] 17355.75613    73.24843    62.51808    73.81966    35.81187    55.17128
 [7]    42.02201    43.45504    72.36717    68.28000   108.34755    28.99898
[13]    55.56949    31.36359   170.41189    49.76197          NA   111.68063
[19]    67.01901    78.45200
> colSd(tmp5,na.rm=TRUE)
 [1] 131.741247   8.558530   7.906838   8.591837   5.984302   7.427737
 [7]   6.482438   6.592044   8.506889   8.263171  10.409013   5.385070
[13]   7.454494   5.600320  13.054191   7.054217         NA  10.567906
[19]   8.186514   8.857313
> colMax(tmp5,na.rm=TRUE)
 [1] 467.56676  80.88619  85.52640  84.30491  79.63803  73.70103  77.63149
 [8]  78.45384  82.79505  82.66241  92.94900  81.39635  75.70564  77.61119
[15]  97.05604  77.52153      -Inf  93.52835  91.07553  82.59428
> colMin(tmp5,na.rm=TRUE)
 [1] 60.09612 59.10720 59.40360 59.55012 60.35899 54.56522 56.95200 56.54561
 [9] 54.31305 58.89918 59.25959 67.23702 53.81636 61.52301 54.64788 54.30563
[17]      Inf 61.33648 65.12009 56.22913
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1] 282.85943 299.20688 251.02555  64.10135 315.14199 261.80035 260.06417
 [8] 166.48241 203.26942 203.45989
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 282.85943 299.20688 251.02555  64.10135 315.14199 261.80035 260.06417
 [8] 166.48241 203.26942 203.45989
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  0.000000e+00 -1.421085e-14  2.842171e-14 -2.273737e-13 -2.842171e-14
 [6] -2.842171e-14  4.263256e-14 -2.273737e-13  1.705303e-13 -5.684342e-14
[11]  1.421085e-13  5.684342e-14  5.684342e-14 -2.842171e-14 -5.684342e-14
[16] -1.136868e-13 -2.842171e-14 -1.989520e-13  0.000000e+00  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
3   12 
1   1 
3   5 
2   10 
8   1 
3   11 
5   1 
5   20 
7   11 
10   5 
7   14 
4   20 
4   12 
8   15 
9   11 
4   1 
4   6 
5   16 
7   1 
1   2 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.895811
> Min(tmp)
[1] -3.382108
> mean(tmp)
[1] -0.07562126
> Sum(tmp)
[1] -7.562126
> Var(tmp)
[1] 1.074519
> 
> rowMeans(tmp)
[1] -0.07562126
> rowSums(tmp)
[1] -7.562126
> rowVars(tmp)
[1] 1.074519
> rowSd(tmp)
[1] 1.03659
> rowMax(tmp)
[1] 2.895811
> rowMin(tmp)
[1] -3.382108
> 
> colMeans(tmp)
  [1] -0.5204251143  0.3030658792  1.4908425088  0.5918516997  0.1922742650
  [6] -0.0921887061 -0.6229749674  0.3843319624 -0.2565160026 -1.0884447019
 [11]  0.9562688374  0.0447000652  0.7023937527  1.9578531069 -1.1309014679
 [16] -1.8924313287 -1.6010195465  0.1250225674 -1.1537766145 -0.7649731572
 [21] -0.7221377799 -0.7362708491  0.0629949071 -0.7326996703  0.3893402577
 [26]  0.1256888543 -0.2111803600  0.6656840271  1.1903563057  0.1026878478
 [31] -0.0606260157  0.6520303984  0.0531252724  0.4492886099  1.1084767342
 [36] -1.4985278623  0.2564284807  0.5399638593  2.8958110223  0.1338919019
 [41]  1.4004945543 -0.0355702469 -0.1314035587 -1.7732175544 -2.4484704616
 [46] -0.5798274427  0.3388607354 -0.2934841288  0.7202713754  0.5650233879
 [51] -1.6032204591 -0.8012694573  0.6799205634  0.6527171827  0.2035489813
 [56] -1.8408576535  0.9983753762  0.2028707839 -1.7702542628  0.0001959019
 [61] -0.7825574955  1.1357987680  0.3253342077 -0.2979980418 -1.9756796209
 [66] -0.9747859233  1.0733782045  0.7127791653 -0.7147136421 -0.0105472752
 [71] -1.1420807828 -1.0004014081  0.2587369993 -0.0825525277  0.3655717103
 [76]  0.1646454561  1.2696345167 -0.2695146984 -1.3496704858 -0.5974634820
 [81] -1.5423265714  2.1558603222  2.3201598346 -0.1576185792 -0.2068145330
 [86] -0.3198171873  0.0883450030 -1.1031958431  1.5434589447 -0.2131499731
 [91] -0.9511909538 -0.0006922638 -0.4701170804 -0.0789715647  0.3130842302
 [96]  0.5190225558 -0.0913680672 -3.3821079148  1.4284484259 -0.2950310614
> colSums(tmp)
  [1] -0.5204251143  0.3030658792  1.4908425088  0.5918516997  0.1922742650
  [6] -0.0921887061 -0.6229749674  0.3843319624 -0.2565160026 -1.0884447019
 [11]  0.9562688374  0.0447000652  0.7023937527  1.9578531069 -1.1309014679
 [16] -1.8924313287 -1.6010195465  0.1250225674 -1.1537766145 -0.7649731572
 [21] -0.7221377799 -0.7362708491  0.0629949071 -0.7326996703  0.3893402577
 [26]  0.1256888543 -0.2111803600  0.6656840271  1.1903563057  0.1026878478
 [31] -0.0606260157  0.6520303984  0.0531252724  0.4492886099  1.1084767342
 [36] -1.4985278623  0.2564284807  0.5399638593  2.8958110223  0.1338919019
 [41]  1.4004945543 -0.0355702469 -0.1314035587 -1.7732175544 -2.4484704616
 [46] -0.5798274427  0.3388607354 -0.2934841288  0.7202713754  0.5650233879
 [51] -1.6032204591 -0.8012694573  0.6799205634  0.6527171827  0.2035489813
 [56] -1.8408576535  0.9983753762  0.2028707839 -1.7702542628  0.0001959019
 [61] -0.7825574955  1.1357987680  0.3253342077 -0.2979980418 -1.9756796209
 [66] -0.9747859233  1.0733782045  0.7127791653 -0.7147136421 -0.0105472752
 [71] -1.1420807828 -1.0004014081  0.2587369993 -0.0825525277  0.3655717103
 [76]  0.1646454561  1.2696345167 -0.2695146984 -1.3496704858 -0.5974634820
 [81] -1.5423265714  2.1558603222  2.3201598346 -0.1576185792 -0.2068145330
 [86] -0.3198171873  0.0883450030 -1.1031958431  1.5434589447 -0.2131499731
 [91] -0.9511909538 -0.0006922638 -0.4701170804 -0.0789715647  0.3130842302
 [96]  0.5190225558 -0.0913680672 -3.3821079148  1.4284484259 -0.2950310614
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -0.5204251143  0.3030658792  1.4908425088  0.5918516997  0.1922742650
  [6] -0.0921887061 -0.6229749674  0.3843319624 -0.2565160026 -1.0884447019
 [11]  0.9562688374  0.0447000652  0.7023937527  1.9578531069 -1.1309014679
 [16] -1.8924313287 -1.6010195465  0.1250225674 -1.1537766145 -0.7649731572
 [21] -0.7221377799 -0.7362708491  0.0629949071 -0.7326996703  0.3893402577
 [26]  0.1256888543 -0.2111803600  0.6656840271  1.1903563057  0.1026878478
 [31] -0.0606260157  0.6520303984  0.0531252724  0.4492886099  1.1084767342
 [36] -1.4985278623  0.2564284807  0.5399638593  2.8958110223  0.1338919019
 [41]  1.4004945543 -0.0355702469 -0.1314035587 -1.7732175544 -2.4484704616
 [46] -0.5798274427  0.3388607354 -0.2934841288  0.7202713754  0.5650233879
 [51] -1.6032204591 -0.8012694573  0.6799205634  0.6527171827  0.2035489813
 [56] -1.8408576535  0.9983753762  0.2028707839 -1.7702542628  0.0001959019
 [61] -0.7825574955  1.1357987680  0.3253342077 -0.2979980418 -1.9756796209
 [66] -0.9747859233  1.0733782045  0.7127791653 -0.7147136421 -0.0105472752
 [71] -1.1420807828 -1.0004014081  0.2587369993 -0.0825525277  0.3655717103
 [76]  0.1646454561  1.2696345167 -0.2695146984 -1.3496704858 -0.5974634820
 [81] -1.5423265714  2.1558603222  2.3201598346 -0.1576185792 -0.2068145330
 [86] -0.3198171873  0.0883450030 -1.1031958431  1.5434589447 -0.2131499731
 [91] -0.9511909538 -0.0006922638 -0.4701170804 -0.0789715647  0.3130842302
 [96]  0.5190225558 -0.0913680672 -3.3821079148  1.4284484259 -0.2950310614
> colMin(tmp)
  [1] -0.5204251143  0.3030658792  1.4908425088  0.5918516997  0.1922742650
  [6] -0.0921887061 -0.6229749674  0.3843319624 -0.2565160026 -1.0884447019
 [11]  0.9562688374  0.0447000652  0.7023937527  1.9578531069 -1.1309014679
 [16] -1.8924313287 -1.6010195465  0.1250225674 -1.1537766145 -0.7649731572
 [21] -0.7221377799 -0.7362708491  0.0629949071 -0.7326996703  0.3893402577
 [26]  0.1256888543 -0.2111803600  0.6656840271  1.1903563057  0.1026878478
 [31] -0.0606260157  0.6520303984  0.0531252724  0.4492886099  1.1084767342
 [36] -1.4985278623  0.2564284807  0.5399638593  2.8958110223  0.1338919019
 [41]  1.4004945543 -0.0355702469 -0.1314035587 -1.7732175544 -2.4484704616
 [46] -0.5798274427  0.3388607354 -0.2934841288  0.7202713754  0.5650233879
 [51] -1.6032204591 -0.8012694573  0.6799205634  0.6527171827  0.2035489813
 [56] -1.8408576535  0.9983753762  0.2028707839 -1.7702542628  0.0001959019
 [61] -0.7825574955  1.1357987680  0.3253342077 -0.2979980418 -1.9756796209
 [66] -0.9747859233  1.0733782045  0.7127791653 -0.7147136421 -0.0105472752
 [71] -1.1420807828 -1.0004014081  0.2587369993 -0.0825525277  0.3655717103
 [76]  0.1646454561  1.2696345167 -0.2695146984 -1.3496704858 -0.5974634820
 [81] -1.5423265714  2.1558603222  2.3201598346 -0.1576185792 -0.2068145330
 [86] -0.3198171873  0.0883450030 -1.1031958431  1.5434589447 -0.2131499731
 [91] -0.9511909538 -0.0006922638 -0.4701170804 -0.0789715647  0.3130842302
 [96]  0.5190225558 -0.0913680672 -3.3821079148  1.4284484259 -0.2950310614
> colMedians(tmp)
  [1] -0.5204251143  0.3030658792  1.4908425088  0.5918516997  0.1922742650
  [6] -0.0921887061 -0.6229749674  0.3843319624 -0.2565160026 -1.0884447019
 [11]  0.9562688374  0.0447000652  0.7023937527  1.9578531069 -1.1309014679
 [16] -1.8924313287 -1.6010195465  0.1250225674 -1.1537766145 -0.7649731572
 [21] -0.7221377799 -0.7362708491  0.0629949071 -0.7326996703  0.3893402577
 [26]  0.1256888543 -0.2111803600  0.6656840271  1.1903563057  0.1026878478
 [31] -0.0606260157  0.6520303984  0.0531252724  0.4492886099  1.1084767342
 [36] -1.4985278623  0.2564284807  0.5399638593  2.8958110223  0.1338919019
 [41]  1.4004945543 -0.0355702469 -0.1314035587 -1.7732175544 -2.4484704616
 [46] -0.5798274427  0.3388607354 -0.2934841288  0.7202713754  0.5650233879
 [51] -1.6032204591 -0.8012694573  0.6799205634  0.6527171827  0.2035489813
 [56] -1.8408576535  0.9983753762  0.2028707839 -1.7702542628  0.0001959019
 [61] -0.7825574955  1.1357987680  0.3253342077 -0.2979980418 -1.9756796209
 [66] -0.9747859233  1.0733782045  0.7127791653 -0.7147136421 -0.0105472752
 [71] -1.1420807828 -1.0004014081  0.2587369993 -0.0825525277  0.3655717103
 [76]  0.1646454561  1.2696345167 -0.2695146984 -1.3496704858 -0.5974634820
 [81] -1.5423265714  2.1558603222  2.3201598346 -0.1576185792 -0.2068145330
 [86] -0.3198171873  0.0883450030 -1.1031958431  1.5434589447 -0.2131499731
 [91] -0.9511909538 -0.0006922638 -0.4701170804 -0.0789715647  0.3130842302
 [96]  0.5190225558 -0.0913680672 -3.3821079148  1.4284484259 -0.2950310614
> colRanges(tmp)
           [,1]      [,2]     [,3]      [,4]      [,5]        [,6]      [,7]
[1,] -0.5204251 0.3030659 1.490843 0.5918517 0.1922743 -0.09218871 -0.622975
[2,] -0.5204251 0.3030659 1.490843 0.5918517 0.1922743 -0.09218871 -0.622975
         [,8]      [,9]     [,10]     [,11]      [,12]     [,13]    [,14]
[1,] 0.384332 -0.256516 -1.088445 0.9562688 0.04470007 0.7023938 1.957853
[2,] 0.384332 -0.256516 -1.088445 0.9562688 0.04470007 0.7023938 1.957853
         [,15]     [,16]    [,17]     [,18]     [,19]      [,20]      [,21]
[1,] -1.130901 -1.892431 -1.60102 0.1250226 -1.153777 -0.7649732 -0.7221378
[2,] -1.130901 -1.892431 -1.60102 0.1250226 -1.153777 -0.7649732 -0.7221378
          [,22]      [,23]      [,24]     [,25]     [,26]      [,27]    [,28]
[1,] -0.7362708 0.06299491 -0.7326997 0.3893403 0.1256889 -0.2111804 0.665684
[2,] -0.7362708 0.06299491 -0.7326997 0.3893403 0.1256889 -0.2111804 0.665684
        [,29]     [,30]       [,31]     [,32]      [,33]     [,34]    [,35]
[1,] 1.190356 0.1026878 -0.06062602 0.6520304 0.05312527 0.4492886 1.108477
[2,] 1.190356 0.1026878 -0.06062602 0.6520304 0.05312527 0.4492886 1.108477
         [,36]     [,37]     [,38]    [,39]     [,40]    [,41]       [,42]
[1,] -1.498528 0.2564285 0.5399639 2.895811 0.1338919 1.400495 -0.03557025
[2,] -1.498528 0.2564285 0.5399639 2.895811 0.1338919 1.400495 -0.03557025
          [,43]     [,44]    [,45]      [,46]     [,47]      [,48]     [,49]
[1,] -0.1314036 -1.773218 -2.44847 -0.5798274 0.3388607 -0.2934841 0.7202714
[2,] -0.1314036 -1.773218 -2.44847 -0.5798274 0.3388607 -0.2934841 0.7202714
         [,50]    [,51]      [,52]     [,53]     [,54]    [,55]     [,56]
[1,] 0.5650234 -1.60322 -0.8012695 0.6799206 0.6527172 0.203549 -1.840858
[2,] 0.5650234 -1.60322 -0.8012695 0.6799206 0.6527172 0.203549 -1.840858
         [,57]     [,58]     [,59]        [,60]      [,61]    [,62]     [,63]
[1,] 0.9983754 0.2028708 -1.770254 0.0001959019 -0.7825575 1.135799 0.3253342
[2,] 0.9983754 0.2028708 -1.770254 0.0001959019 -0.7825575 1.135799 0.3253342
         [,64]    [,65]      [,66]    [,67]     [,68]      [,69]       [,70]
[1,] -0.297998 -1.97568 -0.9747859 1.073378 0.7127792 -0.7147136 -0.01054728
[2,] -0.297998 -1.97568 -0.9747859 1.073378 0.7127792 -0.7147136 -0.01054728
         [,71]     [,72]    [,73]       [,74]     [,75]     [,76]    [,77]
[1,] -1.142081 -1.000401 0.258737 -0.08255253 0.3655717 0.1646455 1.269635
[2,] -1.142081 -1.000401 0.258737 -0.08255253 0.3655717 0.1646455 1.269635
          [,78]    [,79]      [,80]     [,81]   [,82]   [,83]      [,84]
[1,] -0.2695147 -1.34967 -0.5974635 -1.542327 2.15586 2.32016 -0.1576186
[2,] -0.2695147 -1.34967 -0.5974635 -1.542327 2.15586 2.32016 -0.1576186
          [,85]      [,86]    [,87]     [,88]    [,89]    [,90]     [,91]
[1,] -0.2068145 -0.3198172 0.088345 -1.103196 1.543459 -0.21315 -0.951191
[2,] -0.2068145 -0.3198172 0.088345 -1.103196 1.543459 -0.21315 -0.951191
             [,92]      [,93]       [,94]     [,95]     [,96]       [,97]
[1,] -0.0006922638 -0.4701171 -0.07897156 0.3130842 0.5190226 -0.09136807
[2,] -0.0006922638 -0.4701171 -0.07897156 0.3130842 0.5190226 -0.09136807
         [,98]    [,99]     [,100]
[1,] -3.382108 1.428448 -0.2950311
[2,] -3.382108 1.428448 -0.2950311
> 
> 
> Max(tmp2)
[1] 2.367626
> Min(tmp2)
[1] -2.398993
> mean(tmp2)
[1] -0.07944759
> Sum(tmp2)
[1] -7.944759
> Var(tmp2)
[1] 0.8393671
> 
> rowMeans(tmp2)
  [1] -0.32619962  0.64958541  0.05329691  0.36684819  0.21843677 -0.16879286
  [7] -0.64283113 -0.80483141  0.37565186 -0.58780460  0.57928273  0.61994214
 [13] -1.43585553  2.28971506  0.53296254  0.44222630 -1.02151596  0.83908056
 [19] -0.25803212 -1.21112292 -0.13040152  0.60253143  0.15074601  0.29825618
 [25] -0.62962069  0.10847009 -2.13562378  0.50398136 -0.60170792  0.32972273
 [31] -0.99966852  0.57271758 -0.67367780 -0.63385749 -1.04589143 -1.43186052
 [37] -0.56581936 -0.48222750  0.18321416 -1.43094979  0.98170222  0.89841733
 [43]  0.19564356  2.36762631 -2.39899264 -0.38561707  0.22447020  0.32673795
 [49] -1.36049114 -0.66559464  1.13997423  0.75887161  1.57498715  0.39671087
 [55]  0.26965129 -0.73933074 -1.76356974  1.15324358  1.14404854 -0.11803211
 [61] -0.21796534  0.13033089 -0.28710386 -0.11140704  0.31967829  0.41147141
 [67] -0.56857358  0.34617373  2.00581991 -1.03976784  0.01686109  0.79270985
 [73] -1.12495296  0.52102767  0.99787400 -0.74110640  0.68870296 -0.62546864
 [79] -1.72308575 -0.16563190 -0.82974292  0.46196636  0.45866878  0.13805266
 [85]  0.83202358  1.77695293 -0.28565389 -1.03750886  0.28216566 -1.05111508
 [91]  0.24525798  0.66399903 -1.53972256 -1.50889834 -0.81867716 -0.67771192
 [97]  0.40698938 -0.31999481 -1.18970920 -0.07651936
> rowSums(tmp2)
  [1] -0.32619962  0.64958541  0.05329691  0.36684819  0.21843677 -0.16879286
  [7] -0.64283113 -0.80483141  0.37565186 -0.58780460  0.57928273  0.61994214
 [13] -1.43585553  2.28971506  0.53296254  0.44222630 -1.02151596  0.83908056
 [19] -0.25803212 -1.21112292 -0.13040152  0.60253143  0.15074601  0.29825618
 [25] -0.62962069  0.10847009 -2.13562378  0.50398136 -0.60170792  0.32972273
 [31] -0.99966852  0.57271758 -0.67367780 -0.63385749 -1.04589143 -1.43186052
 [37] -0.56581936 -0.48222750  0.18321416 -1.43094979  0.98170222  0.89841733
 [43]  0.19564356  2.36762631 -2.39899264 -0.38561707  0.22447020  0.32673795
 [49] -1.36049114 -0.66559464  1.13997423  0.75887161  1.57498715  0.39671087
 [55]  0.26965129 -0.73933074 -1.76356974  1.15324358  1.14404854 -0.11803211
 [61] -0.21796534  0.13033089 -0.28710386 -0.11140704  0.31967829  0.41147141
 [67] -0.56857358  0.34617373  2.00581991 -1.03976784  0.01686109  0.79270985
 [73] -1.12495296  0.52102767  0.99787400 -0.74110640  0.68870296 -0.62546864
 [79] -1.72308575 -0.16563190 -0.82974292  0.46196636  0.45866878  0.13805266
 [85]  0.83202358  1.77695293 -0.28565389 -1.03750886  0.28216566 -1.05111508
 [91]  0.24525798  0.66399903 -1.53972256 -1.50889834 -0.81867716 -0.67771192
 [97]  0.40698938 -0.31999481 -1.18970920 -0.07651936
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.32619962  0.64958541  0.05329691  0.36684819  0.21843677 -0.16879286
  [7] -0.64283113 -0.80483141  0.37565186 -0.58780460  0.57928273  0.61994214
 [13] -1.43585553  2.28971506  0.53296254  0.44222630 -1.02151596  0.83908056
 [19] -0.25803212 -1.21112292 -0.13040152  0.60253143  0.15074601  0.29825618
 [25] -0.62962069  0.10847009 -2.13562378  0.50398136 -0.60170792  0.32972273
 [31] -0.99966852  0.57271758 -0.67367780 -0.63385749 -1.04589143 -1.43186052
 [37] -0.56581936 -0.48222750  0.18321416 -1.43094979  0.98170222  0.89841733
 [43]  0.19564356  2.36762631 -2.39899264 -0.38561707  0.22447020  0.32673795
 [49] -1.36049114 -0.66559464  1.13997423  0.75887161  1.57498715  0.39671087
 [55]  0.26965129 -0.73933074 -1.76356974  1.15324358  1.14404854 -0.11803211
 [61] -0.21796534  0.13033089 -0.28710386 -0.11140704  0.31967829  0.41147141
 [67] -0.56857358  0.34617373  2.00581991 -1.03976784  0.01686109  0.79270985
 [73] -1.12495296  0.52102767  0.99787400 -0.74110640  0.68870296 -0.62546864
 [79] -1.72308575 -0.16563190 -0.82974292  0.46196636  0.45866878  0.13805266
 [85]  0.83202358  1.77695293 -0.28565389 -1.03750886  0.28216566 -1.05111508
 [91]  0.24525798  0.66399903 -1.53972256 -1.50889834 -0.81867716 -0.67771192
 [97]  0.40698938 -0.31999481 -1.18970920 -0.07651936
> rowMin(tmp2)
  [1] -0.32619962  0.64958541  0.05329691  0.36684819  0.21843677 -0.16879286
  [7] -0.64283113 -0.80483141  0.37565186 -0.58780460  0.57928273  0.61994214
 [13] -1.43585553  2.28971506  0.53296254  0.44222630 -1.02151596  0.83908056
 [19] -0.25803212 -1.21112292 -0.13040152  0.60253143  0.15074601  0.29825618
 [25] -0.62962069  0.10847009 -2.13562378  0.50398136 -0.60170792  0.32972273
 [31] -0.99966852  0.57271758 -0.67367780 -0.63385749 -1.04589143 -1.43186052
 [37] -0.56581936 -0.48222750  0.18321416 -1.43094979  0.98170222  0.89841733
 [43]  0.19564356  2.36762631 -2.39899264 -0.38561707  0.22447020  0.32673795
 [49] -1.36049114 -0.66559464  1.13997423  0.75887161  1.57498715  0.39671087
 [55]  0.26965129 -0.73933074 -1.76356974  1.15324358  1.14404854 -0.11803211
 [61] -0.21796534  0.13033089 -0.28710386 -0.11140704  0.31967829  0.41147141
 [67] -0.56857358  0.34617373  2.00581991 -1.03976784  0.01686109  0.79270985
 [73] -1.12495296  0.52102767  0.99787400 -0.74110640  0.68870296 -0.62546864
 [79] -1.72308575 -0.16563190 -0.82974292  0.46196636  0.45866878  0.13805266
 [85]  0.83202358  1.77695293 -0.28565389 -1.03750886  0.28216566 -1.05111508
 [91]  0.24525798  0.66399903 -1.53972256 -1.50889834 -0.81867716 -0.67771192
 [97]  0.40698938 -0.31999481 -1.18970920 -0.07651936
> 
> colMeans(tmp2)
[1] -0.07944759
> colSums(tmp2)
[1] -7.944759
> colVars(tmp2)
[1] 0.8393671
> colSd(tmp2)
[1] 0.9161698
> colMax(tmp2)
[1] 2.367626
> colMin(tmp2)
[1] -2.398993
> colMedians(tmp2)
[1] 0.035079
> colRanges(tmp2)
          [,1]
[1,] -2.398993
[2,]  2.367626
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -4.3272996 -2.3860609  2.9837363 -3.1669616 -5.3357482  0.9316281
 [7] -1.6139517 -5.0560840  0.4910627 -0.3084953
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.7812243
[2,] -1.0192644
[3,] -0.4118877
[4,] -0.2054003
[5,]  1.1706097
> 
> rowApply(tmp,sum)
 [1] -3.4759158 -0.5842783 -2.6000119 -0.2742435 -2.2033911 -1.3181707
 [7]  2.1500773 -5.3855560 -2.0926458 -2.0040384
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    9    4    2    3    3    8    5    2     1
 [2,]    3    3    9    7    1    4    1   10   10    10
 [3,]    6    8   10   10    6    9   10    4    4     2
 [4,]    2    6    1    6    2   10    5    7    3     5
 [5,]    7    7    8    1    9    1    3    3    7     4
 [6,]   10    5    5    9    8    8    2    1    6     7
 [7,]    9    4    3    8    5    6    4    8    1     3
 [8,]    1    1    2    5   10    2    7    2    8     9
 [9,]    8   10    7    3    4    7    6    9    5     6
[10,]    4    2    6    4    7    5    9    6    9     8
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.4211011  2.1967467  3.1185288 -1.2401753  0.1695992 -2.1350579
 [7]  1.8220763 -4.3157748  0.3978493 -4.4460582  1.3113335  1.4913120
[13] -1.3416251 -0.0264217  2.6548625  3.6407719 -5.1574873 -4.6361430
[19]  2.2353541 -0.1262913
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8175669
[2,] -1.4823008
[3,] -1.0952913
[4,] -0.1662234
[5,]  2.1402812
> 
> rowApply(tmp,sum)
[1]  1.276270 -2.870646  4.441441 -4.882776 -4.771990
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    8    3   20    3    1
[2,]    6    8    8   20   20
[3,]   18   10   17   16   10
[4,]   19    2    9    9   13
[5,]   11    9    4   19    4
> 
> 
> as.matrix(tmp)
           [,1]        [,2]        [,3]        [,4]        [,5]       [,6]
[1,] -0.1662234 -0.48968810  1.03156258  1.46245695  0.19820601 -1.3315718
[2,] -1.0952913  0.01107899  0.08546039 -1.75744783  0.06679601 -0.8825015
[3,]  2.1402812 -0.08342333  1.24854855  0.05081197 -0.64355983  0.8332739
[4,] -1.4823008  1.76307800  1.05896041 -0.87456267  1.31220928  0.2965315
[5,] -1.8175669  0.99570113 -0.30600316 -0.12143373 -0.76405228 -1.0507901
           [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,]  2.3845419 -1.4893720  0.2296561  0.63787664 -0.1306467 -1.3253309
[2,]  0.5640402 -1.0495101  0.4039519 -0.03902396  1.1265743  0.2201411
[3,]  0.1638225  0.4692002  1.8150508 -2.32925508  0.2736415  1.2466101
[4,] -1.1381352 -2.8520945 -1.3054505 -1.32419270  0.1618277  0.8202118
[5,] -0.1521932  0.6060017 -0.7453591 -1.39146309 -0.1200633  0.5296800
          [,13]      [,14]      [,15]      [,16]       [,17]      [,18]
[1,]  0.5704581 -0.4247588  0.5756817  0.7055403 -0.01662283  0.4615650
[2,]  0.5228411  0.1304783  0.6579335  0.4360454 -1.94796102 -0.9686577
[3,] -0.4139936 -0.3135150 -0.4351055  2.0850666 -2.47553977 -0.9835883
[4,] -1.4782831  0.7455230  1.2934534  1.0631532 -1.32263456 -2.3957691
[5,] -0.5426476 -0.1641492  0.5628995 -0.6490335  0.60527089 -0.7496929
          [,19]        [,20]
[1,] -0.6462502 -0.960810350
[2,]  0.1116930  0.532713489
[3,]  1.0509821  0.742131821
[4,]  0.7798921 -0.004193567
[5,]  0.9390370 -0.436132733
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  632  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  544  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1       col2       col3      col4      col5       col6     col7
row1 0.9030579 0.02167865 -0.6554579 -1.815439 0.3347825 -0.8060677 -1.57304
          col8       col9     col10      col11      col12    col13      col14
row1 0.4011512 -0.7381035 0.2910953 -0.1190348 -0.2295722 1.161515 -0.6400622
         col15      col16      col17      col18     col19      col20
row1 -3.040025 -0.7808761 -0.5763844 -0.5329826 0.2720188 -0.3751067
> tmp[,"col10"]
           col10
row1  0.29109531
row2 -0.03779837
row3  0.69070983
row4 -0.95978826
row5  0.47188475
> tmp[c("row1","row5"),]
           col1        col2       col3      col4       col5       col6
row1  0.9030579  0.02167865 -0.6554579 -1.815439  0.3347825 -0.8060677
row5 -0.9844274 -0.18658556  0.8725387  1.054009 -0.6471787  0.6410024
           col7       col8       col9     col10      col11      col12     col13
row1 -1.5730396  0.4011512 -0.7381035 0.2910953 -0.1190348 -0.2295722 1.1615147
row5 -0.9327303 -0.4137327  0.7302843 0.4718848  0.6094724 -0.3702213 0.3394651
          col14       col15      col16      col17      col18      col19
row1 -0.6400622 -3.04002538 -0.7808761 -0.5763844 -0.5329826  0.2720188
row5  0.9541104 -0.05065633  0.8883008  0.4383842  0.9982022 -1.6555885
          col20
row1 -0.3751067
row5 -1.1479265
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.8060677 -0.3751067
row2 -0.2981467 -1.7952465
row3  0.0488282  1.1300948
row4 -0.6739539 -0.6442789
row5  0.6410024 -1.1479265
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.8060677 -0.3751067
row5  0.6410024 -1.1479265
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.13405 49.02501 50.37459 49.27569 49.15654 106.2376 49.85732 51.03734
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.99768 49.79817 50.61001 50.75059 50.10351 49.93883 49.09391 49.82329
        col17    col18    col19    col20
row1 51.39663 49.52369 50.29615 103.7824
> tmp[,"col10"]
        col10
row1 49.79817
row2 30.73269
row3 31.80913
row4 29.81511
row5 51.44645
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.13405 49.02501 50.37459 49.27569 49.15654 106.2376 49.85732 51.03734
row5 48.56223 49.06156 50.59331 49.35167 48.09962 103.6103 49.78659 50.29174
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.99768 49.79817 50.61001 50.75059 50.10351 49.93883 49.09391 49.82329
row5 48.21812 51.44645 49.23558 50.76345 50.77133 50.13537 49.51419 49.56445
        col17    col18    col19    col20
row1 51.39663 49.52369 50.29615 103.7824
row5 49.82330 48.39391 50.83758 105.4665
> tmp[,c("col6","col20")]
          col6     col20
row1 106.23758 103.78243
row2  72.91508  73.67464
row3  73.73238  75.97616
row4  75.53093  75.48696
row5 103.61033 105.46645
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.2376 103.7824
row5 103.6103 105.4665
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.2376 103.7824
row5 103.6103 105.4665
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.1512978
[2,]  0.4225750
[3,]  0.1335793
[4,] -0.6921375
[5,]  0.2473909
> tmp[,c("col17","col7")]
          col17         col7
[1,]  0.9138100 -2.050345002
[2,]  0.4433523  0.748307806
[3,] -0.6378601 -1.289342747
[4,]  1.3225080  0.436580872
[5,]  3.3054927  0.006135886
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.3707896  0.7432738
[2,]  1.7272163  0.9220634
[3,]  0.3259435  0.2727229
[4,]  0.5814338 -0.7765572
[5,]  1.3696378 -0.8345141
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.3707896
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.3707896
[2,]  1.7272163
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]      [,4]       [,5]        [,6]
row3  0.6825744 -1.1428130  1.0016593 -1.464993  0.1687525 -0.01839349
row1 -2.1013485  0.2262532 -0.1192181 -1.197796 -0.9081133 -0.97584922
          [,7]      [,8]         [,9]      [,10]      [,11]       [,12]
row3 0.6378275 0.7039113 -0.006181636 -0.5033757 -1.7990515  0.03473497
row1 0.2613117 1.8011142 -0.902742265 -0.5461869  0.7530367 -1.84034455
         [,13]      [,14]      [,15]       [,16]      [,17]     [,18]     [,19]
row3 0.1560541 -0.1609492 0.02204607  0.04190705 -1.0225535 0.7390987 0.3112159
row1 0.8155766  0.6940215 0.77659330 -0.07502158 -0.2822334 1.2750516 1.0069134
         [,20]
row3 -0.065154
row1  1.046876
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]       [,3]      [,4]      [,5]       [,6]      [,7]
row2 -0.7213095 -1.611512 -0.7264375 0.2654686 0.8747299 -0.2424916 0.5310786
           [,8]      [,9]     [,10]
row2 0.07627079 0.1957221 0.3261981
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]      [,3]      [,4]      [,5]       [,6]       [,7]
row5 -0.2883697 -0.1882428 0.2186177 0.3656332 0.6889281 -0.9195502 -0.1949359
           [,8]     [,9]     [,10]    [,11]      [,12]      [,13]     [,14]
row5 -0.4303427 1.162277 0.4384972 0.244177 -0.3785116 0.06852748 -1.598341
          [,15]      [,16]     [,17]       [,18]     [,19]    [,20]
row5 -0.2295019 -0.1942171 -0.282981 0.003438156 0.6173481 0.380236
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> colnames(tmp) <- NULL
> rownames(tmp) <- NULL
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> dimnames(tmp)
[[1]]
[1] "row1" "row2" "row3" "row4" "row5"

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> dimnames(tmp) <- NULL
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> dimnames(tmp)
[[1]]
NULL

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> 
> dimnames(tmp) <- NULL
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> dimnames(tmp)
[[1]]
[1] "row1" "row2" "row3" "row4" "row5"

[[2]]
NULL

> 
> dimnames(tmp) <- list(NULL,c(colnames(tmp,do.NULL=FALSE)))
> dimnames(tmp)
[[1]]
NULL

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> 
> 
> ###
> ### Testing logical indexing
> ###
> ###
> 
> tmp <- createBufferedMatrix(230,15)
> tmp[1:230,1:15] <- rnorm(230*15)
> x <-tmp[1:230,1:15]  
> 
> for (rep in 1:10){
+   which.cols <- sample(c(TRUE,FALSE),15,replace=T)
+   which.rows <- sample(c(TRUE,FALSE),230,replace=T)
+   
+   if (!all(tmp[which.rows,which.cols] == x[which.rows,which.cols])){
+     stop("No agreement when logical indexing\n")
+   }
+   
+   if (!all(subBufferedMatrix(tmp,,which.cols)[,1:sum(which.cols)] ==  x[,which.cols])){
+     stop("No agreement when logical indexing in subBufferedMatrix cols\n")
+   }
+   if (!all(subBufferedMatrix(tmp,which.rows,)[1:sum(which.rows),] ==  x[which.rows,])){
+     stop("No agreement when logical indexing in subBufferedMatrix rows\n")
+   }
+   
+   
+   if (!all(subBufferedMatrix(tmp,which.rows,which.cols)[1:sum(which.rows),1:sum(which.cols)]==  x[which.rows,which.cols])){
+     stop("No agreement when logical indexing in subBufferedMatrix rows and columns\n")
+   }
+ }
> 
> 
> ##
> ## Test the ReadOnlyMode
> ##
> 
> ReadOnlyMode(tmp)
<pointer: 0x0377a0d8>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a283e80435c"
 [2] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a28331d737" 
 [3] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a283f883fff"
 [4] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a28781568c" 
 [5] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a2836614972"
 [6] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a2879f413ac"
 [7] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a287e844d52"
 [8] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a283da26f3b"
 [9] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a287ea4287e"
[10] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a286f062d2f"
[11] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a284e915fcb"
[12] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a285610532a"
[13] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a28745c50fa"
[14] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a281cfd3108"
[15] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1a287cbc6fe7"
> 
> 
> ### testing coercion functions
> ###
> 
> tmp <- as(tmp,"matrix")
> tmp <- as(tmp,"BufferedMatrix")
> 
> 
> 
> ### testing whether can move storage from one location to another
> 
> MoveStorageDirectory(tmp,"NewDirectory",full.path=FALSE)
<pointer: 0x0268b208>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0268b208>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.8-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0268b208>
> rowMedians(tmp)
  [1]  0.0684037721 -0.1773330208  0.1003420690 -0.2040053698 -0.2144805657
  [6] -0.2441719282 -0.5160216197  0.2640221853  0.2444494926  0.4535428422
 [11]  0.0131214180 -0.0580606169 -0.3186857094  0.1134137927 -0.2555852470
 [16] -0.1923363827 -0.0053226638  0.4393653135 -0.0916606233 -0.3542857973
 [21] -0.0859069117 -0.1361763124  0.5823910870  0.0403298834  0.0214186817
 [26]  0.5561191480  0.0192597806  0.3304895480 -0.2461241480  0.1002881786
 [31]  0.1863477397 -0.2735839928 -0.1058291877 -0.2410757272 -0.3874790119
 [36] -0.4919104649  0.2268431877  0.1136672355 -0.4090017871 -0.1500787040
 [41] -0.0991128451  0.1488017855 -0.2080165311  0.2188100409  0.4170494712
 [46]  0.1294976250 -0.1340213643  0.2378910218 -0.0905104124 -0.0885876369
 [51] -0.2061740870  0.1114782050  0.5263920275  0.0013851817 -0.1648673638
 [56]  0.4682051171  0.1100588839 -0.7719427061 -0.2071500617  0.1862021778
 [61] -0.4985544634  0.4415997017 -0.0923855730  0.1887005931  0.1174728152
 [66]  0.0898010794  0.5078604121  0.1565945618 -0.0461243260  0.0447280695
 [71]  0.2518275300 -0.3689127974 -0.5574243726  0.0786323582 -0.1565675436
 [76] -0.2114586705 -0.3828992364 -0.1823035567  0.0449822197 -0.0612010616
 [81] -0.5656278395 -0.1044422628 -0.6996650800 -0.0878150331 -0.4876572407
 [86]  0.2263097565  0.2382348879 -0.0725994968 -0.4810246500 -0.2926715603
 [91] -0.3609513892  0.0284066730  0.4674157011  0.0689627608  0.0465927163
 [96]  0.2255380292 -0.1694411010  0.0096211488 -0.0266799241  0.2886731046
[101] -0.5032961800 -0.3795110759  0.1643222110 -0.3621963359  0.3918165656
[106] -0.2135414067  0.1336082376 -0.2133739046 -0.1024280415 -0.0560458594
[111]  0.3919136886 -0.3075839335  0.2499843814  0.2809401507  0.4538468806
[116]  0.1353725871 -0.1226873104  0.4004835961 -0.0673181479 -0.2612880173
[121] -0.0484790247  0.3504482142 -0.4759455288  0.0870126752 -0.1216031942
[126]  0.0115726619 -0.0823772234  0.5675336072 -0.0028998373 -0.1238171509
[131]  0.1422145035 -0.7550400266 -0.2841418461  0.2228096383 -0.3797411849
[136]  0.3380468454 -0.8492443769  0.0099050818 -0.4982046082  0.2522972250
[141] -0.0562775796  0.0154463949  0.5520233784  0.3671496195 -0.4115315622
[146]  0.0094794029  0.4534992619 -0.3314611177 -0.1441223060  0.4485234551
[151]  0.0187407274 -0.0704912370  0.1514922708 -0.3936149765  0.4313048437
[156]  0.1333455574  0.5009515482 -0.2556890736 -0.7686047842  0.3871377935
[161] -0.2949516239  0.1077521530 -0.2394024509  0.2658570490 -0.3962895112
[166]  0.3199754914  0.2387555770  0.4465534816  0.1944860009 -0.1391214090
[171] -0.2247372062 -0.3193307103 -0.5386751917  0.5149277644 -0.3645368496
[176]  0.4458356557 -0.2257243914 -0.4211687394 -0.0081040450  0.2028917361
[181]  0.1814550522  0.0608735693 -0.5417217898 -0.0650675494 -0.4032472995
[186]  0.1298110460 -0.1388511990  0.5564726077 -0.5347868129 -0.0007232258
[191]  0.2747325933 -0.3687685139  0.4985333043  0.0155892935  0.0264328197
[196]  0.5792241761 -0.0298439174 -0.1513296768  0.1539606488 -0.4438714210
[201]  0.3898743155 -0.4380744447 -0.6355056146 -0.4259177936  0.5480144538
[206]  0.0344800855 -0.2493642913 -0.1445446037 -0.1154961560 -0.3419666018
[211]  0.1326082024  0.2229746358 -0.0267333701 -0.3224630945 -0.0672962418
[216] -0.4833352570  0.1252512930  0.7062193921 -0.4372928895 -0.3674024017
[221] -0.4888801582  0.4840844639  0.1776290827 -0.3501192277 -0.2346379844
[226] -0.1585651109 -0.2956727873 -0.1073247226  0.0081569976  0.4268083670
> 
> proc.time()
   user  system elapsed 
   2.39    5.01    7.65 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 403489 21.6     839008 44.9   627634 33.6
Vcells 702134  5.4    8388608 64.0  1643701 12.6
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sat Apr 13 00:56:34 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Apr 13 00:56:34 2019"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x00000000056bd1c0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sat Apr 13 00:56:35 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sat Apr 13 00:56:36 2019"
> 
> ColMode(tmp2)
<pointer: 0x00000000056bd1c0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]        [,2]       [,3]       [,4]
[1,] 99.86451858 -1.54642728 -1.7742472 -0.1930983
[2,]  0.48978356 -0.57141072  0.1181597  0.3683957
[3,] -0.33567650 -0.03998285 -1.0047574 -0.4095811
[4,] -0.03951757  0.08144727 -0.4522859 -0.1096237
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]       [,2]      [,3]      [,4]
[1,] 99.86451858 1.54642728 1.7742472 0.1930983
[2,]  0.48978356 0.57141072 0.1181597 0.3683957
[3,]  0.33567650 0.03998285 1.0047574 0.4095811
[4,]  0.03951757 0.08144727 0.4522859 0.1096237
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9932236 1.2435543 1.3320087 0.4394295
[2,] 0.6998454 0.7559171 0.3437437 0.6069561
[3,] 0.5793760 0.1999571 1.0023759 0.6399852
[4,] 0.1987903 0.2853897 0.6725221 0.3310947
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.79675 38.98197 40.09433 29.58739
[2,]  32.48824 33.13058 28.55560 31.43796
[3,]  31.12944 27.03955 36.02852 31.80943
[4,]  27.02742 27.93534 32.17751 28.42057
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0000000005ff3ed8>
> exp(tmp5)
<pointer: 0x0000000005ff3ed8>
> log(tmp5,2)
<pointer: 0x0000000005ff3ed8>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.885
> Min(tmp5)
[1] 53.93438
> mean(tmp5)
[1] 73.21389
> Sum(tmp5)
[1] 14642.78
> Var(tmp5)
[1] 853.1074
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.12344 69.58028 69.65132 70.13657 70.42358 73.15504 69.95822 73.03625
 [9] 71.77677 73.29742
> rowSums(tmp5)
 [1] 1822.469 1391.606 1393.026 1402.731 1408.472 1463.101 1399.164 1460.725
 [9] 1435.535 1465.948
> rowVars(tmp5)
 [1] 7944.36400   69.12993   64.57814  100.01028   75.50379   40.51939
 [7]   47.25128   77.90971   45.67159   73.80874
> rowSd(tmp5)
 [1] 89.131162  8.314441  8.036052 10.000514  8.689292  6.365484  6.873957
 [8]  8.826648  6.758076  8.591201
> rowMax(tmp5)
 [1] 467.88499  85.03548  84.21228  89.74490  86.78458  82.98077  82.95119
 [8]  85.93835  84.41880  85.87818
> rowMin(tmp5)
 [1] 56.00768 55.34650 55.81995 54.29108 53.93438 59.65466 57.07299 55.34589
 [9] 57.28671 60.98333
> 
> colMeans(tmp5)
 [1] 108.25326  71.95222  71.22754  69.28694  71.27282  70.58399  72.13919
 [8]  66.67715  70.73873  73.86182  73.28036  72.06240  75.49698  73.75281
[15]  70.64135  68.20549  70.17257  73.72939  69.43174  71.51100
> colSums(tmp5)
 [1] 1082.5326  719.5222  712.2754  692.8694  712.7282  705.8399  721.3919
 [8]  666.7715  707.3873  738.6182  732.8036  720.6240  754.9698  737.5281
[15]  706.4135  682.0549  701.7257  737.2939  694.3174  715.1100
> colVars(tmp5)
 [1] 16018.79299   108.14799    70.33878    64.60621    40.38999    33.26404
 [7]   100.23945    48.51937    63.83005    86.93273    76.91890    58.16466
[13]    66.14496   123.81317    84.37697    42.21561   121.24152    82.42590
[19]    13.55990    31.35708
> colSd(tmp5)
 [1] 126.565370  10.399423   8.386822   8.037799   6.355312   5.767498
 [7]  10.011965   6.965585   7.989371   9.323773   8.770342   7.626576
[13]   8.132955  11.127136   9.185694   6.497354  11.010973   9.078871
[19]   3.682377   5.599739
> colMax(tmp5)
 [1] 467.88499  85.93835  83.45110  79.90215  80.42998  77.39737  91.79164
 [8]  75.99281  82.98045  89.74490  84.67409  80.76602  85.03548  85.61344
[15]  81.54642  79.31926  84.25547  86.78458  73.95715  80.09281
> colMin(tmp5)
 [1] 56.25403 56.27929 59.43473 59.15369 63.29344 59.35183 58.53010 53.93438
 [9] 54.29108 61.33183 59.65466 57.07299 57.28139 55.81995 55.34589 57.63266
[17] 55.43713 56.00768 62.41059 63.44940
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.12344 69.58028       NA 70.13657 70.42358 73.15504 69.95822 73.03625
 [9] 71.77677 73.29742
> rowSums(tmp5)
 [1] 1822.469 1391.606       NA 1402.731 1408.472 1463.101 1399.164 1460.725
 [9] 1435.535 1465.948
> rowVars(tmp5)
 [1] 7944.36400   69.12993   68.12372  100.01028   75.50379   40.51939
 [7]   47.25128   77.90971   45.67159   73.80874
> rowSd(tmp5)
 [1] 89.131162  8.314441  8.253710 10.000514  8.689292  6.365484  6.873957
 [8]  8.826648  6.758076  8.591201
> rowMax(tmp5)
 [1] 467.88499  85.03548        NA  89.74490  86.78458  82.98077  82.95119
 [8]  85.93835  84.41880  85.87818
> rowMin(tmp5)
 [1] 56.00768 55.34650       NA 54.29108 53.93438 59.65466 57.07299 55.34589
 [9] 57.28671 60.98333
> 
> colMeans(tmp5)
 [1] 108.25326  71.95222  71.22754  69.28694  71.27282  70.58399  72.13919
 [8]  66.67715  70.73873  73.86182  73.28036  72.06240  75.49698  73.75281
[15]  70.64135  68.20549  70.17257  73.72939        NA  71.51100
> colSums(tmp5)
 [1] 1082.5326  719.5222  712.2754  692.8694  712.7282  705.8399  721.3919
 [8]  666.7715  707.3873  738.6182  732.8036  720.6240  754.9698  737.5281
[15]  706.4135  682.0549  701.7257  737.2939        NA  715.1100
> colVars(tmp5)
 [1] 16018.79299   108.14799    70.33878    64.60621    40.38999    33.26404
 [7]   100.23945    48.51937    63.83005    86.93273    76.91890    58.16466
[13]    66.14496   123.81317    84.37697    42.21561   121.24152    82.42590
[19]          NA    31.35708
> colSd(tmp5)
 [1] 126.565370  10.399423   8.386822   8.037799   6.355312   5.767498
 [7]  10.011965   6.965585   7.989371   9.323773   8.770342   7.626576
[13]   8.132955  11.127136   9.185694   6.497354  11.010973   9.078871
[19]         NA   5.599739
> colMax(tmp5)
 [1] 467.88499  85.93835  83.45110  79.90215  80.42998  77.39737  91.79164
 [8]  75.99281  82.98045  89.74490  84.67409  80.76602  85.03548  85.61344
[15]  81.54642  79.31926  84.25547  86.78458        NA  80.09281
> colMin(tmp5)
 [1] 56.25403 56.27929 59.43473 59.15369 63.29344 59.35183 58.53010 53.93438
 [9] 54.29108 61.33183 59.65466 57.07299 57.28139 55.81995 55.34589 57.63266
[17] 55.43713 56.00768       NA 63.44940
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.885
> Min(tmp5,na.rm=TRUE)
[1] 53.93438
> mean(tmp5,na.rm=TRUE)
[1] 73.22753
> Sum(tmp5,na.rm=TRUE)
[1] 14572.28
> Var(tmp5,na.rm=TRUE)
[1] 857.3787
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.12344 69.58028 69.60667 70.13657 70.42358 73.15504 69.95822 73.03625
 [9] 71.77677 73.29742
> rowSums(tmp5,na.rm=TRUE)
 [1] 1822.469 1391.606 1322.527 1402.731 1408.472 1463.101 1399.164 1460.725
 [9] 1435.535 1465.948
> rowVars(tmp5,na.rm=TRUE)
 [1] 7944.36400   69.12993   68.12372  100.01028   75.50379   40.51939
 [7]   47.25128   77.90971   45.67159   73.80874
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.131162  8.314441  8.253710 10.000514  8.689292  6.365484  6.873957
 [8]  8.826648  6.758076  8.591201
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.88499  85.03548  84.21228  89.74490  86.78458  82.98077  82.95119
 [8]  85.93835  84.41880  85.87818
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.00768 55.34650 55.81995 54.29108 53.93438 59.65466 57.07299 55.34589
 [9] 57.28671 60.98333
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.25326  71.95222  71.22754  69.28694  71.27282  70.58399  72.13919
 [8]  66.67715  70.73873  73.86182  73.28036  72.06240  75.49698  73.75281
[15]  70.64135  68.20549  70.17257  73.72939  69.31308  71.51100
> colSums(tmp5,na.rm=TRUE)
 [1] 1082.5326  719.5222  712.2754  692.8694  712.7282  705.8399  721.3919
 [8]  666.7715  707.3873  738.6182  732.8036  720.6240  754.9698  737.5281
[15]  706.4135  682.0549  701.7257  737.2939  623.8177  715.1100
> colVars(tmp5,na.rm=TRUE)
 [1] 16018.79299   108.14799    70.33878    64.60621    40.38999    33.26404
 [7]   100.23945    48.51937    63.83005    86.93273    76.91890    58.16466
[13]    66.14496   123.81317    84.37697    42.21561   121.24152    82.42590
[19]    15.09648    31.35708
> colSd(tmp5,na.rm=TRUE)
 [1] 126.565370  10.399423   8.386822   8.037799   6.355312   5.767498
 [7]  10.011965   6.965585   7.989371   9.323773   8.770342   7.626576
[13]   8.132955  11.127136   9.185694   6.497354  11.010973   9.078871
[19]   3.885419   5.599739
> colMax(tmp5,na.rm=TRUE)
 [1] 467.88499  85.93835  83.45110  79.90215  80.42998  77.39737  91.79164
 [8]  75.99281  82.98045  89.74490  84.67409  80.76602  85.03548  85.61344
[15]  81.54642  79.31926  84.25547  86.78458  73.95715  80.09281
> colMin(tmp5,na.rm=TRUE)
 [1] 56.25403 56.27929 59.43473 59.15369 63.29344 59.35183 58.53010 53.93438
 [9] 54.29108 61.33183 59.65466 57.07299 57.28139 55.81995 55.34589 57.63266
[17] 55.43713 56.00768 62.41059 63.44940
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.12344 69.58028      NaN 70.13657 70.42358 73.15504 69.95822 73.03625
 [9] 71.77677 73.29742
> rowSums(tmp5,na.rm=TRUE)
 [1] 1822.469 1391.606    0.000 1402.731 1408.472 1463.101 1399.164 1460.725
 [9] 1435.535 1465.948
> rowVars(tmp5,na.rm=TRUE)
 [1] 7944.36400   69.12993         NA  100.01028   75.50379   40.51939
 [7]   47.25128   77.90971   45.67159   73.80874
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.131162  8.314441        NA 10.000514  8.689292  6.365484  6.873957
 [8]  8.826648  6.758076  8.591201
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.88499  85.03548        NA  89.74490  86.78458  82.98077  82.95119
 [8]  85.93835  84.41880  85.87818
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.00768 55.34650       NA 54.29108 53.93438 59.65466 57.07299 55.34589
 [9] 57.28671 60.98333
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.08231  73.69366  70.80964  69.62913  70.98977  70.96959  72.65418
 [8]  66.23281  71.32984  72.96365  74.59053  71.99204  75.34496  75.74535
[15]  69.79868  68.87955  68.61260  73.15646       NaN  72.40673
> colSums(tmp5,na.rm=TRUE)
 [1] 1017.7408  663.2429  637.2868  626.6622  638.9079  638.7263  653.8876
 [8]  596.0953  641.9685  656.6729  671.3147  647.9283  678.1046  681.7082
[15]  628.1881  619.9159  617.5134  658.4082    0.0000  651.6606
> colVars(tmp5,na.rm=TRUE)
 [1] 17758.79557    87.54971    77.16643    71.36463    44.53744    35.74925
 [7]   109.78578    52.36311    67.87801    88.72381    67.22268    65.37955
[13]    74.15307    94.62486    86.93555    42.38098   109.01983    89.03636
[19]          NA    26.25041
> colSd(tmp5,na.rm=TRUE)
 [1] 133.262131   9.356800   8.784443   8.447759   6.673638   5.979068
 [7]  10.477871   7.236236   8.238811   9.419332   8.198944   8.085762
[13]   8.611218   9.727531   9.323924   6.510068  10.441256   9.435908
[19]         NA   5.123516
> colMax(tmp5,na.rm=TRUE)
 [1] 467.88499  85.93835  83.45110  79.90215  80.42998  77.39737  91.79164
 [8]  75.99281  82.98045  89.74490  84.67409  80.76602  85.03548  85.61344
[15]  81.54642  79.31926  84.25547  86.78458      -Inf  80.09281
> colMin(tmp5,na.rm=TRUE)
 [1] 56.25403 58.14376 59.43473 59.15369 63.29344 59.35183 58.53010 53.93438
 [9] 54.29108 61.33183 59.65466 57.07299 57.28139 58.91696 55.34589 57.63266
[17] 55.43713 56.00768      Inf 64.66072
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1] 318.0331 356.0879 385.3475 252.9903 286.7511 166.4830 145.3886 192.7173
 [9] 113.0572 275.8522
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 318.0331 356.0879 385.3475 252.9903 286.7511 166.4830 145.3886 192.7173
 [9] 113.0572 275.8522
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  0.000000e+00  1.136868e-13  0.000000e+00 -1.136868e-13 -2.842171e-14
 [6]  8.526513e-14  8.526513e-14  1.989520e-13 -4.263256e-14  8.526513e-14
[11] -1.136868e-13  5.684342e-14  8.526513e-14  8.526513e-14  1.136868e-13
[16]  1.421085e-14  0.000000e+00  1.136868e-13 -2.842171e-14  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
7   1 
8   9 
8   5 
1   8 
2   19 
7   9 
5   14 
9   19 
9   3 
2   13 
7   3 
10   3 
3   10 
7   9 
9   19 
2   12 
1   13 
2   15 
7   8 
1   12 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.149294
> Min(tmp)
[1] -2.5635
> mean(tmp)
[1] -0.05465762
> Sum(tmp)
[1] -5.465762
> Var(tmp)
[1] 1.260495
> 
> rowMeans(tmp)
[1] -0.05465762
> rowSums(tmp)
[1] -5.465762
> rowVars(tmp)
[1] 1.260495
> rowSd(tmp)
[1] 1.122718
> rowMax(tmp)
[1] 3.149294
> rowMin(tmp)
[1] -2.5635
> 
> colMeans(tmp)
  [1] -2.363032372  0.718704425 -1.500994678  1.867490841 -0.321241500
  [6]  1.081791217 -0.737105766 -0.914985011 -1.556444175 -1.395323930
 [11] -1.076305216 -1.064159302  0.148939851 -1.135027990  0.668132346
 [16]  0.912314388 -0.788325729  0.089158686  0.067966621  2.487488040
 [21] -2.259297031 -0.593783576 -2.223523695 -2.386421353  0.840334414
 [26] -0.005852837  0.057232889  1.189740372  1.097916538 -0.478914236
 [31] -0.060187468 -2.563499875  1.296580392  1.048293199  0.243232401
 [36]  0.672880686  0.226050389 -0.415835175 -0.925962609 -1.596946790
 [41] -0.343558315 -0.481318071 -1.314948028  0.867018362  0.280739535
 [46]  0.491042616 -0.600233426 -0.608001153  1.831885330  1.384401647
 [51]  0.452695803  1.063929150  0.357096289 -0.515659271 -0.867496362
 [56] -1.713737007  0.656569936  0.413093469  3.149293781  1.220113439
 [61] -0.204747780  0.202270963  0.803628881 -0.383834430  0.854970313
 [66] -0.543192484  1.470453787  0.727884959 -0.352178226  0.340022335
 [71]  1.600572016 -0.677634974  0.134329502 -0.685814205  0.093745496
 [76] -1.221163572  0.440543611  0.137401724 -1.036531233  0.195057934
 [81]  2.001416515  0.385257857 -0.187346482 -0.795763444  0.065808853
 [86]  0.844988583 -0.647168626  0.044077957 -1.885462486  1.420906100
 [91]  0.826156026 -1.950890311 -0.950417802 -0.285634844 -0.959469682
 [96] -1.619702270 -0.422283505  0.516789478  0.707678373  1.455508031
> colSums(tmp)
  [1] -2.363032372  0.718704425 -1.500994678  1.867490841 -0.321241500
  [6]  1.081791217 -0.737105766 -0.914985011 -1.556444175 -1.395323930
 [11] -1.076305216 -1.064159302  0.148939851 -1.135027990  0.668132346
 [16]  0.912314388 -0.788325729  0.089158686  0.067966621  2.487488040
 [21] -2.259297031 -0.593783576 -2.223523695 -2.386421353  0.840334414
 [26] -0.005852837  0.057232889  1.189740372  1.097916538 -0.478914236
 [31] -0.060187468 -2.563499875  1.296580392  1.048293199  0.243232401
 [36]  0.672880686  0.226050389 -0.415835175 -0.925962609 -1.596946790
 [41] -0.343558315 -0.481318071 -1.314948028  0.867018362  0.280739535
 [46]  0.491042616 -0.600233426 -0.608001153  1.831885330  1.384401647
 [51]  0.452695803  1.063929150  0.357096289 -0.515659271 -0.867496362
 [56] -1.713737007  0.656569936  0.413093469  3.149293781  1.220113439
 [61] -0.204747780  0.202270963  0.803628881 -0.383834430  0.854970313
 [66] -0.543192484  1.470453787  0.727884959 -0.352178226  0.340022335
 [71]  1.600572016 -0.677634974  0.134329502 -0.685814205  0.093745496
 [76] -1.221163572  0.440543611  0.137401724 -1.036531233  0.195057934
 [81]  2.001416515  0.385257857 -0.187346482 -0.795763444  0.065808853
 [86]  0.844988583 -0.647168626  0.044077957 -1.885462486  1.420906100
 [91]  0.826156026 -1.950890311 -0.950417802 -0.285634844 -0.959469682
 [96] -1.619702270 -0.422283505  0.516789478  0.707678373  1.455508031
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -2.363032372  0.718704425 -1.500994678  1.867490841 -0.321241500
  [6]  1.081791217 -0.737105766 -0.914985011 -1.556444175 -1.395323930
 [11] -1.076305216 -1.064159302  0.148939851 -1.135027990  0.668132346
 [16]  0.912314388 -0.788325729  0.089158686  0.067966621  2.487488040
 [21] -2.259297031 -0.593783576 -2.223523695 -2.386421353  0.840334414
 [26] -0.005852837  0.057232889  1.189740372  1.097916538 -0.478914236
 [31] -0.060187468 -2.563499875  1.296580392  1.048293199  0.243232401
 [36]  0.672880686  0.226050389 -0.415835175 -0.925962609 -1.596946790
 [41] -0.343558315 -0.481318071 -1.314948028  0.867018362  0.280739535
 [46]  0.491042616 -0.600233426 -0.608001153  1.831885330  1.384401647
 [51]  0.452695803  1.063929150  0.357096289 -0.515659271 -0.867496362
 [56] -1.713737007  0.656569936  0.413093469  3.149293781  1.220113439
 [61] -0.204747780  0.202270963  0.803628881 -0.383834430  0.854970313
 [66] -0.543192484  1.470453787  0.727884959 -0.352178226  0.340022335
 [71]  1.600572016 -0.677634974  0.134329502 -0.685814205  0.093745496
 [76] -1.221163572  0.440543611  0.137401724 -1.036531233  0.195057934
 [81]  2.001416515  0.385257857 -0.187346482 -0.795763444  0.065808853
 [86]  0.844988583 -0.647168626  0.044077957 -1.885462486  1.420906100
 [91]  0.826156026 -1.950890311 -0.950417802 -0.285634844 -0.959469682
 [96] -1.619702270 -0.422283505  0.516789478  0.707678373  1.455508031
> colMin(tmp)
  [1] -2.363032372  0.718704425 -1.500994678  1.867490841 -0.321241500
  [6]  1.081791217 -0.737105766 -0.914985011 -1.556444175 -1.395323930
 [11] -1.076305216 -1.064159302  0.148939851 -1.135027990  0.668132346
 [16]  0.912314388 -0.788325729  0.089158686  0.067966621  2.487488040
 [21] -2.259297031 -0.593783576 -2.223523695 -2.386421353  0.840334414
 [26] -0.005852837  0.057232889  1.189740372  1.097916538 -0.478914236
 [31] -0.060187468 -2.563499875  1.296580392  1.048293199  0.243232401
 [36]  0.672880686  0.226050389 -0.415835175 -0.925962609 -1.596946790
 [41] -0.343558315 -0.481318071 -1.314948028  0.867018362  0.280739535
 [46]  0.491042616 -0.600233426 -0.608001153  1.831885330  1.384401647
 [51]  0.452695803  1.063929150  0.357096289 -0.515659271 -0.867496362
 [56] -1.713737007  0.656569936  0.413093469  3.149293781  1.220113439
 [61] -0.204747780  0.202270963  0.803628881 -0.383834430  0.854970313
 [66] -0.543192484  1.470453787  0.727884959 -0.352178226  0.340022335
 [71]  1.600572016 -0.677634974  0.134329502 -0.685814205  0.093745496
 [76] -1.221163572  0.440543611  0.137401724 -1.036531233  0.195057934
 [81]  2.001416515  0.385257857 -0.187346482 -0.795763444  0.065808853
 [86]  0.844988583 -0.647168626  0.044077957 -1.885462486  1.420906100
 [91]  0.826156026 -1.950890311 -0.950417802 -0.285634844 -0.959469682
 [96] -1.619702270 -0.422283505  0.516789478  0.707678373  1.455508031
> colMedians(tmp)
  [1] -2.363032372  0.718704425 -1.500994678  1.867490841 -0.321241500
  [6]  1.081791217 -0.737105766 -0.914985011 -1.556444175 -1.395323930
 [11] -1.076305216 -1.064159302  0.148939851 -1.135027990  0.668132346
 [16]  0.912314388 -0.788325729  0.089158686  0.067966621  2.487488040
 [21] -2.259297031 -0.593783576 -2.223523695 -2.386421353  0.840334414
 [26] -0.005852837  0.057232889  1.189740372  1.097916538 -0.478914236
 [31] -0.060187468 -2.563499875  1.296580392  1.048293199  0.243232401
 [36]  0.672880686  0.226050389 -0.415835175 -0.925962609 -1.596946790
 [41] -0.343558315 -0.481318071 -1.314948028  0.867018362  0.280739535
 [46]  0.491042616 -0.600233426 -0.608001153  1.831885330  1.384401647
 [51]  0.452695803  1.063929150  0.357096289 -0.515659271 -0.867496362
 [56] -1.713737007  0.656569936  0.413093469  3.149293781  1.220113439
 [61] -0.204747780  0.202270963  0.803628881 -0.383834430  0.854970313
 [66] -0.543192484  1.470453787  0.727884959 -0.352178226  0.340022335
 [71]  1.600572016 -0.677634974  0.134329502 -0.685814205  0.093745496
 [76] -1.221163572  0.440543611  0.137401724 -1.036531233  0.195057934
 [81]  2.001416515  0.385257857 -0.187346482 -0.795763444  0.065808853
 [86]  0.844988583 -0.647168626  0.044077957 -1.885462486  1.420906100
 [91]  0.826156026 -1.950890311 -0.950417802 -0.285634844 -0.959469682
 [96] -1.619702270 -0.422283505  0.516789478  0.707678373  1.455508031
> colRanges(tmp)
          [,1]      [,2]      [,3]     [,4]       [,5]     [,6]       [,7]
[1,] -2.363032 0.7187044 -1.500995 1.867491 -0.3212415 1.081791 -0.7371058
[2,] -2.363032 0.7187044 -1.500995 1.867491 -0.3212415 1.081791 -0.7371058
          [,8]      [,9]     [,10]     [,11]     [,12]     [,13]     [,14]
[1,] -0.914985 -1.556444 -1.395324 -1.076305 -1.064159 0.1489399 -1.135028
[2,] -0.914985 -1.556444 -1.395324 -1.076305 -1.064159 0.1489399 -1.135028
         [,15]     [,16]      [,17]      [,18]      [,19]    [,20]     [,21]
[1,] 0.6681323 0.9123144 -0.7883257 0.08915869 0.06796662 2.487488 -2.259297
[2,] 0.6681323 0.9123144 -0.7883257 0.08915869 0.06796662 2.487488 -2.259297
          [,22]     [,23]     [,24]     [,25]        [,26]      [,27]   [,28]
[1,] -0.5937836 -2.223524 -2.386421 0.8403344 -0.005852837 0.05723289 1.18974
[2,] -0.5937836 -2.223524 -2.386421 0.8403344 -0.005852837 0.05723289 1.18974
        [,29]      [,30]       [,31]   [,32]   [,33]    [,34]     [,35]
[1,] 1.097917 -0.4789142 -0.06018747 -2.5635 1.29658 1.048293 0.2432324
[2,] 1.097917 -0.4789142 -0.06018747 -2.5635 1.29658 1.048293 0.2432324
         [,36]     [,37]      [,38]      [,39]     [,40]      [,41]      [,42]
[1,] 0.6728807 0.2260504 -0.4158352 -0.9259626 -1.596947 -0.3435583 -0.4813181
[2,] 0.6728807 0.2260504 -0.4158352 -0.9259626 -1.596947 -0.3435583 -0.4813181
         [,43]     [,44]     [,45]     [,46]      [,47]      [,48]    [,49]
[1,] -1.314948 0.8670184 0.2807395 0.4910426 -0.6002334 -0.6080012 1.831885
[2,] -1.314948 0.8670184 0.2807395 0.4910426 -0.6002334 -0.6080012 1.831885
        [,50]     [,51]    [,52]     [,53]      [,54]      [,55]     [,56]
[1,] 1.384402 0.4526958 1.063929 0.3570963 -0.5156593 -0.8674964 -1.713737
[2,] 1.384402 0.4526958 1.063929 0.3570963 -0.5156593 -0.8674964 -1.713737
         [,57]     [,58]    [,59]    [,60]      [,61]    [,62]     [,63]
[1,] 0.6565699 0.4130935 3.149294 1.220113 -0.2047478 0.202271 0.8036289
[2,] 0.6565699 0.4130935 3.149294 1.220113 -0.2047478 0.202271 0.8036289
          [,64]     [,65]      [,66]    [,67]    [,68]      [,69]     [,70]
[1,] -0.3838344 0.8549703 -0.5431925 1.470454 0.727885 -0.3521782 0.3400223
[2,] -0.3838344 0.8549703 -0.5431925 1.470454 0.727885 -0.3521782 0.3400223
        [,71]     [,72]     [,73]      [,74]     [,75]     [,76]     [,77]
[1,] 1.600572 -0.677635 0.1343295 -0.6858142 0.0937455 -1.221164 0.4405436
[2,] 1.600572 -0.677635 0.1343295 -0.6858142 0.0937455 -1.221164 0.4405436
         [,78]     [,79]     [,80]    [,81]     [,82]      [,83]      [,84]
[1,] 0.1374017 -1.036531 0.1950579 2.001417 0.3852579 -0.1873465 -0.7957634
[2,] 0.1374017 -1.036531 0.1950579 2.001417 0.3852579 -0.1873465 -0.7957634
          [,85]     [,86]      [,87]      [,88]     [,89]    [,90]    [,91]
[1,] 0.06580885 0.8449886 -0.6471686 0.04407796 -1.885462 1.420906 0.826156
[2,] 0.06580885 0.8449886 -0.6471686 0.04407796 -1.885462 1.420906 0.826156
        [,92]      [,93]      [,94]      [,95]     [,96]      [,97]     [,98]
[1,] -1.95089 -0.9504178 -0.2856348 -0.9594697 -1.619702 -0.4222835 0.5167895
[2,] -1.95089 -0.9504178 -0.2856348 -0.9594697 -1.619702 -0.4222835 0.5167895
         [,99]   [,100]
[1,] 0.7076784 1.455508
[2,] 0.7076784 1.455508
> 
> 
> Max(tmp2)
[1] 2.09668
> Min(tmp2)
[1] -2.424449
> mean(tmp2)
[1] -0.0738196
> Sum(tmp2)
[1] -7.38196
> Var(tmp2)
[1] 1.000755
> 
> rowMeans(tmp2)
  [1] -0.473415811 -0.302741607  0.475340892  0.532095141 -0.418022111
  [6]  0.976480539  0.749845119  1.082951383  0.543796029  0.878929705
 [11] -0.839996563  0.126775583  0.792980037 -0.821615318 -0.957983082
 [16]  0.119519516  0.552747012  0.364308807  0.913034698  0.440460044
 [21] -1.293050949  0.499586635  0.239076119  0.001382107  1.286651631
 [26]  1.585539415 -0.335432671  1.409580814  0.937163589 -0.519911479
 [31] -0.082208510  0.717494517  0.285189147 -0.177816835 -1.285366528
 [36] -0.069385259 -0.789625212 -1.167780214 -1.275604609 -1.528993843
 [41] -0.621541460 -0.715402142 -2.391554600  1.034800931 -0.631233154
 [46] -0.895754161 -1.510170420  0.330593962 -1.390430999  1.483637000
 [51]  0.817164455 -2.155213508 -0.188206761  1.612213427  2.096679885
 [56] -0.045820008 -0.129732465 -0.076910190 -0.541010288  0.965189997
 [61]  1.744569796  0.562048681  0.474071439  0.867699157 -1.092301017
 [66] -1.375270193  1.722058501  1.090900104 -1.013186400 -1.040150856
 [71]  0.792136749 -1.630696109 -1.920596661  0.071772946 -0.014521787
 [76] -0.635147965 -2.424449386  1.273573092 -0.677346555  0.485325548
 [81] -0.800594580 -0.148214287  0.950988885  0.643083028 -1.283919949
 [86] -0.008894716 -0.411608921  0.018547805 -0.057048593  1.370006160
 [91] -0.799713501 -1.318075639 -0.580438315 -2.133331291 -0.609888275
 [96] -0.517405326 -0.159317338  0.510238653 -0.286509866  0.760369382
> rowSums(tmp2)
  [1] -0.473415811 -0.302741607  0.475340892  0.532095141 -0.418022111
  [6]  0.976480539  0.749845119  1.082951383  0.543796029  0.878929705
 [11] -0.839996563  0.126775583  0.792980037 -0.821615318 -0.957983082
 [16]  0.119519516  0.552747012  0.364308807  0.913034698  0.440460044
 [21] -1.293050949  0.499586635  0.239076119  0.001382107  1.286651631
 [26]  1.585539415 -0.335432671  1.409580814  0.937163589 -0.519911479
 [31] -0.082208510  0.717494517  0.285189147 -0.177816835 -1.285366528
 [36] -0.069385259 -0.789625212 -1.167780214 -1.275604609 -1.528993843
 [41] -0.621541460 -0.715402142 -2.391554600  1.034800931 -0.631233154
 [46] -0.895754161 -1.510170420  0.330593962 -1.390430999  1.483637000
 [51]  0.817164455 -2.155213508 -0.188206761  1.612213427  2.096679885
 [56] -0.045820008 -0.129732465 -0.076910190 -0.541010288  0.965189997
 [61]  1.744569796  0.562048681  0.474071439  0.867699157 -1.092301017
 [66] -1.375270193  1.722058501  1.090900104 -1.013186400 -1.040150856
 [71]  0.792136749 -1.630696109 -1.920596661  0.071772946 -0.014521787
 [76] -0.635147965 -2.424449386  1.273573092 -0.677346555  0.485325548
 [81] -0.800594580 -0.148214287  0.950988885  0.643083028 -1.283919949
 [86] -0.008894716 -0.411608921  0.018547805 -0.057048593  1.370006160
 [91] -0.799713501 -1.318075639 -0.580438315 -2.133331291 -0.609888275
 [96] -0.517405326 -0.159317338  0.510238653 -0.286509866  0.760369382
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.473415811 -0.302741607  0.475340892  0.532095141 -0.418022111
  [6]  0.976480539  0.749845119  1.082951383  0.543796029  0.878929705
 [11] -0.839996563  0.126775583  0.792980037 -0.821615318 -0.957983082
 [16]  0.119519516  0.552747012  0.364308807  0.913034698  0.440460044
 [21] -1.293050949  0.499586635  0.239076119  0.001382107  1.286651631
 [26]  1.585539415 -0.335432671  1.409580814  0.937163589 -0.519911479
 [31] -0.082208510  0.717494517  0.285189147 -0.177816835 -1.285366528
 [36] -0.069385259 -0.789625212 -1.167780214 -1.275604609 -1.528993843
 [41] -0.621541460 -0.715402142 -2.391554600  1.034800931 -0.631233154
 [46] -0.895754161 -1.510170420  0.330593962 -1.390430999  1.483637000
 [51]  0.817164455 -2.155213508 -0.188206761  1.612213427  2.096679885
 [56] -0.045820008 -0.129732465 -0.076910190 -0.541010288  0.965189997
 [61]  1.744569796  0.562048681  0.474071439  0.867699157 -1.092301017
 [66] -1.375270193  1.722058501  1.090900104 -1.013186400 -1.040150856
 [71]  0.792136749 -1.630696109 -1.920596661  0.071772946 -0.014521787
 [76] -0.635147965 -2.424449386  1.273573092 -0.677346555  0.485325548
 [81] -0.800594580 -0.148214287  0.950988885  0.643083028 -1.283919949
 [86] -0.008894716 -0.411608921  0.018547805 -0.057048593  1.370006160
 [91] -0.799713501 -1.318075639 -0.580438315 -2.133331291 -0.609888275
 [96] -0.517405326 -0.159317338  0.510238653 -0.286509866  0.760369382
> rowMin(tmp2)
  [1] -0.473415811 -0.302741607  0.475340892  0.532095141 -0.418022111
  [6]  0.976480539  0.749845119  1.082951383  0.543796029  0.878929705
 [11] -0.839996563  0.126775583  0.792980037 -0.821615318 -0.957983082
 [16]  0.119519516  0.552747012  0.364308807  0.913034698  0.440460044
 [21] -1.293050949  0.499586635  0.239076119  0.001382107  1.286651631
 [26]  1.585539415 -0.335432671  1.409580814  0.937163589 -0.519911479
 [31] -0.082208510  0.717494517  0.285189147 -0.177816835 -1.285366528
 [36] -0.069385259 -0.789625212 -1.167780214 -1.275604609 -1.528993843
 [41] -0.621541460 -0.715402142 -2.391554600  1.034800931 -0.631233154
 [46] -0.895754161 -1.510170420  0.330593962 -1.390430999  1.483637000
 [51]  0.817164455 -2.155213508 -0.188206761  1.612213427  2.096679885
 [56] -0.045820008 -0.129732465 -0.076910190 -0.541010288  0.965189997
 [61]  1.744569796  0.562048681  0.474071439  0.867699157 -1.092301017
 [66] -1.375270193  1.722058501  1.090900104 -1.013186400 -1.040150856
 [71]  0.792136749 -1.630696109 -1.920596661  0.071772946 -0.014521787
 [76] -0.635147965 -2.424449386  1.273573092 -0.677346555  0.485325548
 [81] -0.800594580 -0.148214287  0.950988885  0.643083028 -1.283919949
 [86] -0.008894716 -0.411608921  0.018547805 -0.057048593  1.370006160
 [91] -0.799713501 -1.318075639 -0.580438315 -2.133331291 -0.609888275
 [96] -0.517405326 -0.159317338  0.510238653 -0.286509866  0.760369382
> 
> colMeans(tmp2)
[1] -0.0738196
> colSums(tmp2)
[1] -7.38196
> colVars(tmp2)
[1] 1.000755
> colSd(tmp2)
[1] 1.000378
> colMax(tmp2)
[1] 2.09668
> colMin(tmp2)
[1] -2.424449
> colMedians(tmp2)
[1] -0.06321693
> colRanges(tmp2)
          [,1]
[1,] -2.424449
[2,]  2.096680
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.6118614  2.4609008  1.0821941  3.0806053 -0.2628211 -3.6159916
 [7]  0.7376321  1.7651125  4.2811247  1.9614767
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.9447028
[2,] -0.1822519
[3,]  0.1788639
[4,]  0.5438228
[5,]  1.3804847
> 
> rowApply(tmp,sum)
 [1] -1.7770472  6.3829041  3.2751067  0.3578590  1.9003199  1.1264753
 [7]  2.4344072 -0.8106154 -1.0229627  1.2356479
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    3    4    6    4    2    9    3    6    8     7
 [2,]    4    2   10   10    8    1    2    5    9    10
 [3,]    2    9    4    7    4   10    4    9    3     2
 [4,]    9    7    7    8    9    3    1    2    7     9
 [5,]    7    1    2    9    7    2    6    8    6     5
 [6,]    1    5    3    5    6    5    8    3    4     1
 [7,]    5    8    5    2   10    7    9    1    2     6
 [8,]    6    3    9    1    3    4   10    7    1     8
 [9,]   10    6    8    6    1    8    7    4   10     4
[10,]    8   10    1    3    5    6    5   10    5     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.70610973  3.07405151 -3.51759696 -0.13877730  0.13550941  0.49125680
 [7] -0.39602388 -0.04424933  2.12075497 -0.96638656  2.90442117 -3.47700606
[13] -2.70938547  2.38940113  3.22606701 -1.62201809 -2.13251294 -1.25269422
[19]  0.15133521  1.50034465
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5085954
[2,] -0.3280366
[3,]  1.1543471
[4,]  1.5009444
[5,]  1.8874502
> 
> rowApply(tmp,sum)
[1]  3.9584369  3.0573760 -2.4364761  0.9933103 -3.1300464
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   19   19   17    2    9
[2,]   18   15   11   13   16
[3,]    2   17    5    4    2
[4,]    4   20    9   11    7
[5,]   14    8   12   15    4
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]        [,5]        [,6]
[1,]  1.8874502  1.4770441 -0.9410347 -0.75710675  0.60305382 -0.72107817
[2,]  1.5009444  0.6741777  1.2657202  1.61677985 -0.04976909  0.57805307
[3,]  1.1543471 -0.1120962 -1.1289756 -0.31447555 -0.08889879  0.04522145
[4,] -1.5085954  0.3825604 -0.9954625  0.03107583  0.95439665 -0.42343771
[5,] -0.3280366  0.6523654 -1.7178444 -0.71505068 -1.28327318  1.01249816
           [,7]       [,8]        [,9]       [,10]      [,11]      [,12]
[1,] -0.3796912  0.2780604 -0.86835684 -0.06593494  0.9969042  0.6518745
[2,] -0.3000612  1.0330986  1.38833643  0.42126233 -0.6239285 -1.5357656
[3,] -0.1484857 -1.1437414  1.02469196 -0.77820970  2.3224555 -2.2301032
[4,]  1.8906047 -0.6493310 -0.02443723  0.29212823 -0.3720985 -1.1346145
[5,] -1.4583906  0.4376641  0.60052064 -0.83563248  0.5810885  0.7716028
           [,13]      [,14]      [,15]       [,16]        [,17]      [,18]
[1,] -0.05221091  0.2211154  2.4400336 -0.08128286 -0.973454540  0.3070853
[2,]  0.65327190  0.4944663  0.1213258 -0.13655660 -1.567393209 -1.9209484
[3,] -2.47741744  1.3439795  0.5358835 -0.97147370  0.783017957 -0.9805743
[4,] -1.96302742  0.5790156  0.9581644  1.43020874 -0.004637774  1.1618402
[5,]  1.12999840 -0.2491756 -0.8293402 -1.86291367 -0.370045376  0.1799030
          [,19]      [,20]
[1,]  0.6269028 -0.6909365
[2,]  0.1313835 -0.6870214
[3,] -1.3208631  2.0492417
[4,] -0.6128294  1.0017868
[5,]  1.3267414 -0.1727260
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  680  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  588  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1      col2      col3     col4    col5       col6       col7
row1 -0.9512985 0.5177209 0.6188823 1.276753 -1.2355 -0.2575156 -0.8303799
           col8       col9      col10     col11    col12     col13     col14
row1 -0.3167515 -0.7660704 -0.3476618 -1.262372 0.420289 -1.280713 0.3106642
        col15      col16    col17      col18     col19    col20
row1 1.829084 -0.3511515 1.357464 -0.5784304 0.1721919 1.223726
> tmp[,"col10"]
          col10
row1 -0.3476618
row2 -0.8336860
row3 -0.9149888
row4  0.2536168
row5  1.6595347
> tmp[c("row1","row5"),]
           col1      col2      col3       col4      col5       col6       col7
row1 -0.9512985 0.5177209 0.6188823 1.27675346 -1.235500 -0.2575156 -0.8303799
row5 -0.1125087 0.8806504 0.1469774 0.06945031 -0.920021  1.1844259  1.7483050
           col8       col9      col10      col11     col12      col13
row1 -0.3167515 -0.7660704 -0.3476618 -1.2623719  0.420289 -1.2807135
row5  1.0107475 -0.9008617  1.6595347 -0.3697868 -1.014521  0.5056366
          col14    col15      col16     col17      col18     col19     col20
row1  0.3106642 1.829084 -0.3511515 1.3574640 -0.5784304 0.1721919 1.2237261
row5 -1.6052801 1.454835 -1.2730173 0.6440698 -1.3704527 0.4645770 0.1611466
> tmp[,c("col6","col20")]
           col6     col20
row1 -0.2575156 1.2237261
row2 -0.9232039 0.6199951
row3 -0.4851523 0.2427017
row4 -1.7618430 0.3523166
row5  1.1844259 0.1611466
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 -0.2575156 1.2237261
row5  1.1844259 0.1611466
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5    col6     col7     col8
row1 49.85915 51.22896 49.36067 52.07542 50.03704 105.981 50.98561 49.27293
         col9    col10   col11    col12    col13    col14    col15    col16
row1 49.80636 51.67605 49.3151 52.15562 50.84983 51.74314 50.32879 49.25424
        col17   col18    col19    col20
row1 49.36396 50.6321 49.26744 104.3771
> tmp[,"col10"]
        col10
row1 51.67605
row2 29.93216
row3 30.14114
row4 29.67637
row5 50.19658
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.85915 51.22896 49.36067 52.07542 50.03704 105.9810 50.98561 49.27293
row5 49.75589 48.18847 48.43483 50.12956 50.31487 104.3952 51.00080 49.44182
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.80636 51.67605 49.31510 52.15562 50.84983 51.74314 50.32879 49.25424
row5 50.32162 50.19658 51.10922 49.47223 49.61033 50.56094 50.55439 51.53653
        col17    col18    col19    col20
row1 49.36396 50.63210 49.26744 104.3771
row5 50.75794 50.09183 51.32208 108.3248
> tmp[,c("col6","col20")]
          col6     col20
row1 105.98103 104.37706
row2  74.17117  75.19659
row3  75.15015  74.04628
row4  75.96335  76.42231
row5 104.39520 108.32477
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.9810 104.3771
row5 104.3952 108.3248
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.9810 104.3771
row5 104.3952 108.3248
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.5119465
[2,]  1.2087900
[3,] -1.1819079
[4,] -0.9308754
[5,]  1.6026745
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.7813219 -1.9528175
[2,] -0.3303508 -1.6441406
[3,]  1.5360858 -0.4195770
[4,]  0.5963227  0.7599704
[5,]  0.6646728 -0.9062453
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -1.5603473 -0.8871170
[2,] -0.4293271 -1.2619255
[3,]  1.6540747 -0.6865168
[4,] -0.7307778 -1.9541432
[5,]  0.2437281  0.4183512
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.560347
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.5603473
[2,] -0.4293271
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]       [,3]      [,4]      [,5]        [,6]       [,7]
row3 0.8309678 -0.2614588  0.7201734 0.2392177 0.7038118 -0.06799108 -0.7770297
row1 0.8530879  0.7608259 -0.4890158 1.7693692 0.6660449  0.68381120  1.9855358
           [,8]       [,9]       [,10]     [,11]       [,12]      [,13]
row3 -0.7959352 -3.1168264  1.57382289 1.0789511 -0.84314892 -0.8440793
row1  0.7989063 -0.4630181 -0.04692746 0.5123497  0.09047395  1.7887371
         [,14]      [,15]      [,16]     [,17]     [,18]      [,19]     [,20]
row3 0.6999362  0.1081030 -1.0650274  1.091133 0.5628395 -0.6237680 1.0639463
row1 1.6453282 -0.7040793 -0.3347866 -1.782615 1.2543436 -0.7672588 0.6114203
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]       [,3]     [,4]     [,5]      [,6]     [,7]
row2 1.210624 -1.063089 -0.8714843 1.367036 -1.25611 0.2419656 1.056533
          [,8]     [,9]       [,10]
row2 0.3933581 1.341476 -0.05480857
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row5 0.3637188 -0.8997337 -0.381416 0.6465267 0.9892444 0.5112225 0.6197699
        [,8]       [,9]     [,10]     [,11]      [,12]     [,13]     [,14]
row5 1.62951 -0.7283609 -1.136602 0.3296869 -0.1020121 0.1264011 0.6031809
         [,15]     [,16]     [,17]      [,18]      [,19]      [,20]
row5 0.1598377 -0.190873 0.9893908 -0.9737485 -0.7983944 -0.1506113
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> colnames(tmp) <- NULL
> rownames(tmp) <- NULL
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> dimnames(tmp)
[[1]]
[1] "row1" "row2" "row3" "row4" "row5"

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> dimnames(tmp) <- NULL
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> dimnames(tmp)
[[1]]
NULL

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> 
> dimnames(tmp) <- NULL
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> dimnames(tmp)
[[1]]
[1] "row1" "row2" "row3" "row4" "row5"

[[2]]
NULL

> 
> dimnames(tmp) <- list(NULL,c(colnames(tmp,do.NULL=FALSE)))
> dimnames(tmp)
[[1]]
NULL

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> 
> 
> ###
> ### Testing logical indexing
> ###
> ###
> 
> tmp <- createBufferedMatrix(230,15)
> tmp[1:230,1:15] <- rnorm(230*15)
> x <-tmp[1:230,1:15]  
> 
> for (rep in 1:10){
+   which.cols <- sample(c(TRUE,FALSE),15,replace=T)
+   which.rows <- sample(c(TRUE,FALSE),230,replace=T)
+   
+   if (!all(tmp[which.rows,which.cols] == x[which.rows,which.cols])){
+     stop("No agreement when logical indexing\n")
+   }
+   
+   if (!all(subBufferedMatrix(tmp,,which.cols)[,1:sum(which.cols)] ==  x[,which.cols])){
+     stop("No agreement when logical indexing in subBufferedMatrix cols\n")
+   }
+   if (!all(subBufferedMatrix(tmp,which.rows,)[1:sum(which.rows),] ==  x[which.rows,])){
+     stop("No agreement when logical indexing in subBufferedMatrix rows\n")
+   }
+   
+   
+   if (!all(subBufferedMatrix(tmp,which.rows,which.cols)[1:sum(which.rows),1:sum(which.cols)]==  x[which.rows,which.cols])){
+     stop("No agreement when logical indexing in subBufferedMatrix rows and columns\n")
+   }
+ }
> 
> 
> ##
> ## Test the ReadOnlyMode
> ##
> 
> ReadOnlyMode(tmp)
<pointer: 0x00000000064f9a70>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM266428c848f9"
 [2] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM266421f93253"
 [3] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM2664649258a0"
 [4] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM26644b432ef8"
 [5] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM26645cd715e" 
 [6] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM26645e3fd2b" 
 [7] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM2664cdf55eb" 
 [8] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM2664389e320c"
 [9] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM26647016608" 
[10] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM266474d19fc" 
[11] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM266468e154c0"
[12] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM26641d484101"
[13] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM2664214033ee"
[14] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM26642caf6a6c"
[15] "C:/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM2664557958ff"
> 
> 
> ### testing coercion functions
> ###
> 
> tmp <- as(tmp,"matrix")
> tmp <- as(tmp,"BufferedMatrix")
> 
> 
> 
> ### testing whether can move storage from one location to another
> 
> MoveStorageDirectory(tmp,"NewDirectory",full.path=FALSE)
<pointer: 0x0000000005271158>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0000000005271158>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.8-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0000000005271158>
> rowMedians(tmp)
  [1] -0.500841461  0.155441113  0.627067936 -0.415185891  0.071821149
  [6]  0.516606869  0.088084757 -0.060517705 -0.004466875  1.000172132
 [11] -0.172494212  0.509598404  0.341204334  0.016204109 -0.028688815
 [16] -0.090454065  0.509860079  0.354915967  0.254373721  0.451333644
 [21] -0.059109858  0.269928466 -0.194819776 -0.098015760  0.002592993
 [26] -0.302849966 -0.430119267 -0.688558218 -0.322186487  0.404102881
 [31]  0.097329354  0.308348982 -0.162362290 -0.257679384 -0.017396942
 [36] -0.142753097  0.370369209 -0.347918780  0.056026441 -0.328102756
 [41]  0.230283705 -0.233933037  0.179486478 -0.142737848 -0.013229810
 [46]  0.011757167 -0.062477116  0.027707658  0.644908045 -0.142010879
 [51]  0.195440871 -0.331235305  0.260906556 -0.180780442  0.148432972
 [56]  0.032898827 -0.076172631  0.414527021 -0.273951093 -0.334573969
 [61] -0.243367375 -0.043600655  0.102703446  0.536966197 -0.216651485
 [66]  0.423253763  0.369303428  0.063006101 -0.303008738 -0.041401773
 [71]  0.038334419 -0.062495775  0.099996170  0.068221613 -0.411563319
 [76]  0.296599896 -0.384756428 -0.466628468 -0.186027834  0.103806324
 [81]  0.279751073  0.496783424 -0.105321452  0.027772647  0.942186575
 [86]  0.057680250 -0.093076473  0.130989939 -0.647244022 -0.143532013
 [91] -0.659950741  0.364400542 -0.306080683  0.394217270 -0.196997130
 [96]  0.485052159  0.161379455  0.488635114  0.319626202  0.063760058
[101] -0.058078221  0.089762507  0.180376888 -0.033393789  0.440240348
[106] -0.893723424 -0.475772276  0.191494931  0.096427023  0.180872267
[111] -0.230275032  0.363812071 -0.263112528  0.178827090  0.104067370
[116]  0.304799494  0.178964726  0.002871736  0.021538771 -0.403602941
[121] -0.970236227  0.328809931  0.180954434 -0.523258479  0.313687635
[126]  0.311038738 -0.195219072  0.108019498  0.273000445 -0.027374230
[131] -0.409310806 -0.199325184  0.140698432 -0.148684133  0.124093564
[136] -0.356683988  0.270914322  0.404030005  0.144617834  0.498495098
[141]  1.111382756  0.197871973 -0.089494404 -0.295639938 -0.316435398
[146]  0.054981972 -0.211204853 -0.650320639  0.185452773 -0.244900371
[151] -0.049750460 -0.040608314 -0.449519704  0.209123314  0.113206236
[156] -0.035433560 -0.237293495  0.234533358  0.254776692  0.046316861
[161]  0.096280631  0.233824412  0.138711661 -0.147803784 -0.374586323
[166] -0.520705749 -0.723556248 -0.089512307 -0.594104062 -0.332734854
[171] -0.846674690  0.054479961 -0.148049048  0.178569039 -0.068450405
[176]  0.014924882 -0.046761559  0.184347486 -0.427857696 -0.137648541
[181]  0.166208325 -0.167571981 -0.432968520  0.407381562  0.235994732
[186]  0.710844788  0.039300460 -0.193705240 -0.622501809  0.160795945
[191]  0.266980118  0.362626028 -0.368478828  0.208653524 -0.366583948
[196] -0.204096575  0.304326969 -0.156985190  0.048653705  0.233898346
[201] -0.659745191  0.097339960  0.020763413 -0.216781102 -0.112763046
[206]  0.427247494 -0.405932478 -0.205507794 -0.327482533  0.350827218
[211] -0.098520202 -0.263929669  0.635996139  0.139113822  0.195907802
[216] -0.136345296  0.274631398  0.045019335 -0.423197398 -0.518346597
[221]  0.694158506  0.468156559  0.286917880  0.022954207  0.740975741
[226]  0.825808130  0.226714929  0.270449301  0.277480738  0.117184826
> 
> proc.time()
   user  system elapsed 
   2.25    5.40    7.93 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-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.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0398a470>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0398a470>
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 10
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0398a470>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 10
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 

<pointer: 0x0398a470>
> rm(P)
> 
> #P <- .Call("R_bm_Destroy",P)
> #.Call("R_bm_Destroy",P)
> #.Call("R_bm_Test_C",P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 0
Buffer Rows: 1
Buffer Cols: 1

Printing Values






<pointer: 0x035f6c68>
> .Call("R_bm_AddColumn",P)
<pointer: 0x035f6c68>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 1
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 
0.000000 
0.000000 
0.000000 
0.000000 

<pointer: 0x035f6c68>
> .Call("R_bm_AddColumn",P)
<pointer: 0x035f6c68>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x035f6c68>
> rm(P)
> 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x035341b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x035341b0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x035341b0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x035341b0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x035341b0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x035341b0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x035341b0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x035341b0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x035341b0>
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0355cb38>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0355cb38>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0355cb38>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0355cb38>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilef3c771251c6" "BufferedMatrixFilef3c80228d6" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilef3c771251c6" "BufferedMatrixFilef3c80228d6" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0203bb48>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0203bb48>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0203bb48>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0203bb48>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0203bb48>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0203bb48>
> .Call("R_bm_isRowMode",P)
[1] FALSE
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x02e79bc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02e79bc0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x02e79bc0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x02e79bc0>
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x02e763b0>
> .Call("R_bm_getValue",P,3,3)
[1] 6
> 
> .Call("R_bm_getValue",P,100000,10000)
[1] NA
> .Call("R_bm_setValue",P,3,3,12345.0)
[1] TRUE
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 12345.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x02e763b0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.29    0.07    0.37 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0000000007d033b0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0000000007d033b0>
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 10
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0000000007d033b0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 10
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 

<pointer: 0x0000000007d033b0>
> rm(P)
> 
> #P <- .Call("R_bm_Destroy",P)
> #.Call("R_bm_Destroy",P)
> #.Call("R_bm_Test_C",P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 0
Buffer Rows: 1
Buffer Cols: 1

Printing Values






<pointer: 0x0000000007b8ee18>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007b8ee18>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 1
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 
0.000000 
0.000000 
0.000000 
0.000000 

<pointer: 0x0000000007b8ee18>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007b8ee18>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x0000000007b8ee18>
> rm(P)
> 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007a73e68>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007a73e68>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x0000000007a73e68>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000007a73e68>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x0000000007a73e68>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000007a73e68>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x0000000007a73e68>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000007a73e68>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x0000000007a73e68>
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005abb400>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000000005abb400>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005abb400>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005abb400>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2a601499331c" "BufferedMatrixFile2a6074f14da4"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2a601499331c" "BufferedMatrixFile2a6074f14da4"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005aa27e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005aa27e0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005aa27e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005aa27e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005aa27e0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005aa27e0>
> .Call("R_bm_isRowMode",P)
[1] FALSE
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005773620>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005773620>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005773620>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x0000000005773620>
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0000000005bc9e78>
> .Call("R_bm_getValue",P,3,3)
[1] 6
> 
> .Call("R_bm_getValue",P,100000,10000)
[1] NA
> .Call("R_bm_setValue",P,3,3,12345.0)
[1] TRUE
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 12345.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x0000000005bc9e78>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.31    0.06    0.35 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-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.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
   0.32    0.01    0.32 

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
   0.35    0.10    0.45 

Example timings