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

CHECK report for BufferedMatrix on tokay1

This page was generated on 2018-04-12 13:18:33 -0400 (Thu, 12 Apr 2018).

Package 165/1472HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.42.0
Ben Bolstad
Snapshot Date: 2018-04-11 16:45:18 -0400 (Wed, 11 Apr 2018)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_6
Last Commit: 4631078
Last Changed Date: 2017-10-30 12:39:19 -0400 (Mon, 30 Oct 2017)
malbec1 Linux (Ubuntu 16.04.1 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
veracruz1 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.42.0
Command: rm -rf BufferedMatrix.buildbin-libdir BufferedMatrix.Rcheck && mkdir BufferedMatrix.buildbin-libdir BufferedMatrix.Rcheck && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD INSTALL --build --merge-multiarch --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.42.0.tar.gz >BufferedMatrix.Rcheck\00install.out 2>&1 && cp BufferedMatrix.Rcheck\00install.out BufferedMatrix-install.out && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD check --library=BufferedMatrix.buildbin-libdir --install="check:BufferedMatrix-install.out" --force-multiarch --no-vignettes --timings BufferedMatrix_1.42.0.tar.gz
StartedAt: 2018-04-11 22:37:47 -0400 (Wed, 11 Apr 2018)
EndedAt: 2018-04-11 22:38:51 -0400 (Wed, 11 Apr 2018)
EllapsedTime: 64.4 seconds
RetCode: 0
Status:  OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   rm -rf BufferedMatrix.buildbin-libdir BufferedMatrix.Rcheck && mkdir BufferedMatrix.buildbin-libdir BufferedMatrix.Rcheck && C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD INSTALL --build --merge-multiarch --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.42.0.tar.gz >BufferedMatrix.Rcheck\00install.out 2>&1 && cp BufferedMatrix.Rcheck\00install.out BufferedMatrix-install.out  &&  C:\Users\biocbuild\bbs-3.6-bioc\R\bin\R.exe CMD check --library=BufferedMatrix.buildbin-libdir --install="check:BufferedMatrix-install.out" --force-multiarch --no-vignettes --timings BufferedMatrix_1.42.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck'
* using R version 3.4.4 (2018-03-15)
* 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.42.0'
* checking package namespace information ... OK
* checking package dependencies ... 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 ... NOTE
Warning: no function found corresponding to methods exports from 'BufferedMatrix' for: 'coerce', 'show'

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.
** 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 ... NOTE
Warning: no function found corresponding to methods exports from 'BufferedMatrix' for: 'coerce', 'show'

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.
** checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... NOTE
Package in Depends field not imported from: 'methods'
  These packages need to be imported from (in the NAMESPACE file)
  for when this namespace is loaded but not attached.
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
NB: .First.lib is obsolete and will not be used in R >= 3.0.0

as.BufferedMatrix: warning in createBufferedMatrix(rows = dim(x)[1],
  cols = dim(x)[2], bufferrows = bufferrows, buffercols = buffercols,
  director = directory): partial argument match of 'director' to
  'directory'
createBufferedMatrix: no visible global function definition for 'new'
colApply,BufferedMatrix: no visible global function definition for
  'new'
duplicate,BufferedMatrix: no visible global function definition for
  'new'
rowApply,BufferedMatrix: no visible global function definition for
  'new'
subBufferedMatrix,BufferedMatrix: no visible global function definition
  for 'new'
Undefined global functions or variables:
  new
Consider adding
  importFrom("methods", "new")
to your NAMESPACE file (and ensure that your DESCRIPTION Imports field
contains 'methods').
* 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.6-bioc/meat/BufferedMatrix.buildbin-libdir/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 installed files from 'inst/doc' ... OK
* 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: 6 NOTEs
See
  'C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.



Installation output

BufferedMatrix.Rcheck/00install.out


install for i386

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/include" -DNDEBUG     -I"C:/local323/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.6-B/R/include" -DNDEBUG     -I"C:/local323/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.6-B/R/include" -DNDEBUG     -I"C:/local323/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.6-B/R/include" -DNDEBUG     -I"C:/local323/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c init_package.c -o init_package.o
C:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/local323/lib/i386 -LC:/local323/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/i386
** R
** inst
** preparing 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.6-B/R/include" -DNDEBUG     -I"C:/local323/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.6-B/R/include" -DNDEBUG     -I"C:/local323/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.6-B/R/include" -DNDEBUG     -I"C:/local323/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.6-B/R/include" -DNDEBUG     -I"C:/local323/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c init_package.c -o init_package.o
C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/local323/lib/x64 -LC:/local323/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.6-B/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.42.0.zip
* DONE (BufferedMatrix)
In R CMD INSTALL
In R CMD INSTALL

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.46    0.10    0.56 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.42    0.03    0.43 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.6-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 387895 10.4     750400 20.1   592000 15.9
Vcells 439126  3.4    1023718  7.9   786432  6.0
> 
> 
> 
> 
> ##
> ## 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] "Wed Apr 11 22:38:24 2018"
> 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] "Wed Apr 11 22:38:24 2018"
> 
> 
> 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: 0x02e753d0>
> 
> 
> 
> 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] "Wed Apr 11 22:38:26 2018"
> 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] "Wed Apr 11 22:38:27 2018"
> 
> ColMode(tmp2)
<pointer: 0x02e753d0>
> 
> 
> 
> ### 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,] 101.01054245  0.91165652  1.5662136 -0.79156934
[2,]  -0.78626581  0.09686903 -1.5431959  0.57291065
[3,]  -0.07080691 -1.72009568 -1.6265949  0.82720191
[4,]   0.28052717  1.22149985 -0.3565431 -0.03550101
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.6-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,] 101.01054245 0.91165652 1.5662136 0.79156934
[2,]   0.78626581 0.09686903 1.5431959 0.57291065
[3,]   0.07080691 1.72009568 1.6265949 0.82720191
[4,]   0.28052717 1.22149985 0.3565431 0.03550101
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.6-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,] 10.0504001 0.9548071 1.2514846 0.8897018
[2,]  0.8867163 0.3112379 1.2422544 0.7569086
[3,]  0.2660957 1.3115242 1.2753803 0.9095064
[4,]  0.5296482 1.1052148 0.5971123 0.1884171
> 
> 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.6-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,] 226.51454 35.45973 39.08106 34.68859
[2,]  34.65343 28.20925 38.96574 33.14200
[3,]  27.73176 39.83534 39.38040 34.92227
[4,]  30.57701 37.27365 31.32767 26.91967
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0308f358>
> exp(tmp5)
<pointer: 0x0308f358>
> log(tmp5,2)
<pointer: 0x0308f358>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.4603
> Min(tmp5)
[1] 54.0264
> mean(tmp5)
[1] 72.30784
> Sum(tmp5)
[1] 14461.57
> Var(tmp5)
[1] 877.3138
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.69197 70.11209 73.09397 66.75911 70.29269 71.73778 69.44735 69.51539
 [9] 71.14669 70.28135
> rowSums(tmp5)
 [1] 1813.839 1402.242 1461.879 1335.182 1405.854 1434.756 1388.947 1390.308
 [9] 1422.934 1405.627
> rowVars(tmp5)
 [1] 8097.63961   43.12094   97.85334   32.88338   72.15224   98.17692
 [7]   73.36976   75.61080  108.10453   68.71728
> rowSd(tmp5)
 [1] 89.986886  6.566654  9.892085  5.734403  8.494247  9.908427  8.565615
 [8]  8.695447 10.397333  8.289588
> rowMax(tmp5)
 [1] 471.46034  81.10208  91.68684  77.58022  85.86522  87.75554  94.87037
 [8]  86.65430  91.31551  84.34947
> rowMin(tmp5)
 [1] 54.51613 56.34120 57.72003 56.02977 58.39988 55.88112 59.22824 57.49452
 [9] 54.02640 58.80725
> 
> colMeans(tmp5)
 [1] 106.26118  72.50716  75.53842  68.26864  72.39722  67.77622  73.90189
 [8]  72.34749  75.05733  68.84243  66.11029  74.16487  68.79831  67.93832
[15]  70.45414  72.63649  67.50647  71.15099  68.43134  66.06759
> colSums(tmp5)
 [1] 1062.6118  725.0716  755.3842  682.6864  723.9722  677.7622  739.0189
 [8]  723.4749  750.5733  688.4243  661.1029  741.6487  687.9831  679.3832
[15]  704.5414  726.3649  675.0647  711.5099  684.3134  660.6759
> colVars(tmp5)
 [1] 16508.85338    90.28138    57.89104    67.34878    74.43539    47.72487
 [7]    98.98777    97.61237    89.86344    50.88518    47.10510    83.91953
[13]    43.97611   103.38581    74.28693   104.05184    47.68379    54.98809
[19]    84.42022    40.18509
> colSd(tmp5)
 [1] 128.486783   9.501652   7.608616   8.206630   8.627595   6.908319
 [7]   9.949260   9.879897   9.479633   7.133385   6.863316   9.160760
[13]   6.631448  10.167881   8.618987  10.200580   6.905345   7.415396
[19]   9.188048   6.339171
> colMax(tmp5)
 [1] 471.46034  86.65430  84.68443  83.60409  81.76151  78.89880  94.87037
 [8]  87.81485  91.68684  84.67186  77.11657  86.49919  84.34947  87.75554
[15]  83.54129  91.31551  74.52584  84.29084  83.37434  79.20419
> colMin(tmp5)
 [1] 55.88112 58.71385 65.20443 56.02977 59.53841 58.94175 62.46801 57.59605
 [9] 56.31637 61.99265 56.34120 59.22824 61.98542 54.51613 59.50776 58.97035
[17] 54.82351 63.18194 54.02640 59.16530
> 
> 
> ### 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.69197 70.11209 73.09397 66.75911 70.29269 71.73778       NA 69.51539
 [9] 71.14669 70.28135
> rowSums(tmp5)
 [1] 1813.839 1402.242 1461.879 1335.182 1405.854 1434.756       NA 1390.308
 [9] 1422.934 1405.627
> rowVars(tmp5)
 [1] 8097.63961   43.12094   97.85334   32.88338   72.15224   98.17692
 [7]   75.65728   75.61080  108.10453   68.71728
> rowSd(tmp5)
 [1] 89.986886  6.566654  9.892085  5.734403  8.494247  9.908427  8.698120
 [8]  8.695447 10.397333  8.289588
> rowMax(tmp5)
 [1] 471.46034  81.10208  91.68684  77.58022  85.86522  87.75554        NA
 [8]  86.65430  91.31551  84.34947
> rowMin(tmp5)
 [1] 54.51613 56.34120 57.72003 56.02977 58.39988 55.88112       NA 57.49452
 [9] 54.02640 58.80725
> 
> colMeans(tmp5)
 [1] 106.26118  72.50716        NA  68.26864  72.39722  67.77622  73.90189
 [8]  72.34749  75.05733  68.84243  66.11029  74.16487  68.79831  67.93832
[15]  70.45414  72.63649  67.50647  71.15099  68.43134  66.06759
> colSums(tmp5)
 [1] 1062.6118  725.0716        NA  682.6864  723.9722  677.7622  739.0189
 [8]  723.4749  750.5733  688.4243  661.1029  741.6487  687.9831  679.3832
[15]  704.5414  726.3649  675.0647  711.5099  684.3134  660.6759
> colVars(tmp5)
 [1] 16508.85338    90.28138          NA    67.34878    74.43539    47.72487
 [7]    98.98777    97.61237    89.86344    50.88518    47.10510    83.91953
[13]    43.97611   103.38581    74.28693   104.05184    47.68379    54.98809
[19]    84.42022    40.18509
> colSd(tmp5)
 [1] 128.486783   9.501652         NA   8.206630   8.627595   6.908319
 [7]   9.949260   9.879897   9.479633   7.133385   6.863316   9.160760
[13]   6.631448  10.167881   8.618987  10.200580   6.905345   7.415396
[19]   9.188048   6.339171
> colMax(tmp5)
 [1] 471.46034  86.65430        NA  83.60409  81.76151  78.89880  94.87037
 [8]  87.81485  91.68684  84.67186  77.11657  86.49919  84.34947  87.75554
[15]  83.54129  91.31551  74.52584  84.29084  83.37434  79.20419
> colMin(tmp5)
 [1] 55.88112 58.71385       NA 56.02977 59.53841 58.94175 62.46801 57.59605
 [9] 56.31637 61.99265 56.34120 59.22824 61.98542 54.51613 59.50776 58.97035
[17] 54.82351 63.18194 54.02640 59.16530
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.4603
> Min(tmp5,na.rm=TRUE)
[1] 54.0264
> mean(tmp5,na.rm=TRUE)
[1] 72.29442
> Sum(tmp5,na.rm=TRUE)
[1] 14386.59
> Var(tmp5,na.rm=TRUE)
[1] 881.7085
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.69197 70.11209 73.09397 66.75911 70.29269 71.73778 69.15628 69.51539
 [9] 71.14669 70.28135
> rowSums(tmp5,na.rm=TRUE)
 [1] 1813.839 1402.242 1461.879 1335.182 1405.854 1434.756 1313.969 1390.308
 [9] 1422.934 1405.627
> rowVars(tmp5,na.rm=TRUE)
 [1] 8097.63961   43.12094   97.85334   32.88338   72.15224   98.17692
 [7]   75.65728   75.61080  108.10453   68.71728
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.986886  6.566654  9.892085  5.734403  8.494247  9.908427  8.698120
 [8]  8.695447 10.397333  8.289588
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.46034  81.10208  91.68684  77.58022  85.86522  87.75554  94.87037
 [8]  86.65430  91.31551  84.34947
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.51613 56.34120 57.72003 56.02977 58.39988 55.88112 59.22824 57.49452
 [9] 54.02640 58.80725
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 106.26118  72.50716  75.60073  68.26864  72.39722  67.77622  73.90189
 [8]  72.34749  75.05733  68.84243  66.11029  74.16487  68.79831  67.93832
[15]  70.45414  72.63649  67.50647  71.15099  68.43134  66.06759
> colSums(tmp5,na.rm=TRUE)
 [1] 1062.6118  725.0716  680.4065  682.6864  723.9722  677.7622  739.0189
 [8]  723.4749  750.5733  688.4243  661.1029  741.6487  687.9831  679.3832
[15]  704.5414  726.3649  675.0647  711.5099  684.3134  660.6759
> colVars(tmp5,na.rm=TRUE)
 [1] 16508.85338    90.28138    65.08375    67.34878    74.43539    47.72487
 [7]    98.98777    97.61237    89.86344    50.88518    47.10510    83.91953
[13]    43.97611   103.38581    74.28693   104.05184    47.68379    54.98809
[19]    84.42022    40.18509
> colSd(tmp5,na.rm=TRUE)
 [1] 128.486783   9.501652   8.067450   8.206630   8.627595   6.908319
 [7]   9.949260   9.879897   9.479633   7.133385   6.863316   9.160760
[13]   6.631448  10.167881   8.618987  10.200580   6.905345   7.415396
[19]   9.188048   6.339171
> colMax(tmp5,na.rm=TRUE)
 [1] 471.46034  86.65430  84.68443  83.60409  81.76151  78.89880  94.87037
 [8]  87.81485  91.68684  84.67186  77.11657  86.49919  84.34947  87.75554
[15]  83.54129  91.31551  74.52584  84.29084  83.37434  79.20419
> colMin(tmp5,na.rm=TRUE)
 [1] 55.88112 58.71385 65.20443 56.02977 59.53841 58.94175 62.46801 57.59605
 [9] 56.31637 61.99265 56.34120 59.22824 61.98542 54.51613 59.50776 58.97035
[17] 54.82351 63.18194 54.02640 59.16530
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.69197 70.11209 73.09397 66.75911 70.29269 71.73778      NaN 69.51539
 [9] 71.14669 70.28135
> rowSums(tmp5,na.rm=TRUE)
 [1] 1813.839 1402.242 1461.879 1335.182 1405.854 1434.756    0.000 1390.308
 [9] 1422.934 1405.627
> rowVars(tmp5,na.rm=TRUE)
 [1] 8097.63961   43.12094   97.85334   32.88338   72.15224   98.17692
 [7]         NA   75.61080  108.10453   68.71728
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.986886  6.566654  9.892085  5.734403  8.494247  9.908427        NA
 [8]  8.695447 10.397333  8.289588
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.46034  81.10208  91.68684  77.58022  85.86522  87.75554        NA
 [8]  86.65430  91.31551  84.34947
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.51613 56.34120 57.72003 56.02977 58.39988 55.88112       NA 57.49452
 [9] 54.02640 58.80725
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.41275  72.35504       NaN  67.67846  71.57832  68.36603  71.57206
 [8]  73.00795  75.66840  68.15147  65.26199  75.82450  69.33671  68.02817
[15]  71.67041  73.24952  67.43775  70.73944  69.15918  66.41454
> colSums(tmp5,na.rm=TRUE)
 [1] 1002.7148  651.1954    0.0000  609.1062  644.2049  615.2942  644.1486
 [8]  657.0715  681.0156  613.3633  587.3579  682.4205  624.0304  612.2535
[15]  645.0336  659.2457  606.9398  636.6550  622.4326  597.7309
> colVars(tmp5,na.rm=TRUE)
 [1] 18273.89966   101.30622          NA    71.84886    76.19576    49.77696
 [7]    50.29499   104.90663    96.89554    51.87485    44.89764    63.42294
[13]    46.21192   116.21822    66.93067   112.83044    53.59113    59.95616
[19]    89.01308    43.85399
> colSd(tmp5,na.rm=TRUE)
 [1] 135.180989  10.065099         NA   8.476371   8.729018   7.055279
 [7]   7.091896  10.242394   9.843553   7.202420   6.700570   7.963852
[13]   6.797935  10.780456   8.181117  10.622167   7.320596   7.743136
[19]   9.434674   6.622235
> colMax(tmp5,na.rm=TRUE)
 [1] 471.46034  86.65430      -Inf  83.60409  81.76151  78.89880  85.86522
 [8]  87.81485  91.68684  84.67186  77.11657  86.49919  84.34947  87.75554
[15]  83.54129  91.31551  74.52584  84.29084  83.37434  79.20419
> colMin(tmp5,na.rm=TRUE)
 [1] 55.88112 58.71385      Inf 56.02977 59.53841 58.94175 62.46801 57.59605
 [9] 56.31637 61.99265 56.34120 61.75118 61.98542 54.51613 59.74365 58.97035
[17] 54.82351 63.18194 54.02640 59.16530
> 
> 
> 
> 
> 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] 308.58290 257.65281 326.68158 445.19664 247.77983 256.24998 202.28799
 [8] 238.99505  88.51719 218.94567
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 308.58290 257.65281 326.68158 445.19664 247.77983 256.24998 202.28799
 [8] 238.99505  88.51719 218.94567
> 
> 
> 
> 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]  3.694822e-13  6.252776e-13  0.000000e+00 -1.421085e-14  1.278977e-13
 [6]  1.989520e-13  0.000000e+00  1.421085e-14  2.842171e-14  2.842171e-14
[11]  5.684342e-13  5.684342e-14 -1.705303e-13  0.000000e+00 -1.421085e-13
[16] -5.684342e-14 -5.684342e-14  3.410605e-13  1.136868e-13 -1.705303e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
1   15 
6   8 
4   4 
9   13 
8   1 
9   11 
5   17 
6   8 
7   9 
8   9 
9   10 
9   16 
4   18 
2   20 
5   18 
6   15 
1   7 
4   10 
2   18 
8   1 
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.646343
> Min(tmp)
[1] -3.654092
> mean(tmp)
[1] 0.06701054
> Sum(tmp)
[1] 6.701054
> Var(tmp)
[1] 0.9191925
> 
> rowMeans(tmp)
[1] 0.06701054
> rowSums(tmp)
[1] 6.701054
> rowVars(tmp)
[1] 0.9191925
> rowSd(tmp)
[1] 0.9587453
> rowMax(tmp)
[1] 2.646343
> rowMin(tmp)
[1] -3.654092
> 
> colMeans(tmp)
  [1]  0.25124050 -0.68917982  1.32465317 -0.48324518  0.71529556 -1.61830237
  [7]  0.71788778 -0.45468332  0.10480566  0.60535495 -1.46965024  0.76493269
 [13]  0.22780978  0.43296693 -0.62272643  0.26229913  1.09214137 -0.70899110
 [19]  0.34763685  0.38776249 -0.07187514  0.02045075 -0.85531564  0.46203793
 [25] -0.62295805 -0.80077976 -0.40115380  1.50074054  0.45283321 -0.06225586
 [31] -3.65409154 -0.90744536  0.69282643 -0.83970646 -0.79404544 -0.58362988
 [37] -0.25039101 -0.51589825  0.88347138  0.28601229 -0.85973054  1.59846395
 [43]  1.92225904  1.04537209 -1.47274556  2.35820901  0.14276018  0.78780420
 [49] -0.19376022 -0.44624249  1.02533753 -0.98317593 -1.38412267 -1.31097223
 [55]  0.39757771  1.86249757  0.14217198 -1.88452965  1.93194514 -0.35514291
 [61]  0.25414014  0.37522497 -1.09046955  2.64634274 -0.27495926  0.30527519
 [67] -0.38695691  0.18379763  0.80514694  1.60555988  0.98255303  0.54643098
 [73]  1.01063168 -0.13749487  0.02325716  0.55512551 -0.07850015  0.78524689
 [79] -0.22108013  0.83536480 -0.76695897 -0.26094023 -0.53207690  1.41267765
 [85]  0.78405522 -0.20789800 -0.10386798 -0.49121034 -0.52556382 -0.85114316
 [91] -0.11186663 -0.12431682  0.69575256  0.23027528 -0.21451717 -0.55686266
 [97] -0.28973651 -0.64235065 -0.14912252  1.23127783
> colSums(tmp)
  [1]  0.25124050 -0.68917982  1.32465317 -0.48324518  0.71529556 -1.61830237
  [7]  0.71788778 -0.45468332  0.10480566  0.60535495 -1.46965024  0.76493269
 [13]  0.22780978  0.43296693 -0.62272643  0.26229913  1.09214137 -0.70899110
 [19]  0.34763685  0.38776249 -0.07187514  0.02045075 -0.85531564  0.46203793
 [25] -0.62295805 -0.80077976 -0.40115380  1.50074054  0.45283321 -0.06225586
 [31] -3.65409154 -0.90744536  0.69282643 -0.83970646 -0.79404544 -0.58362988
 [37] -0.25039101 -0.51589825  0.88347138  0.28601229 -0.85973054  1.59846395
 [43]  1.92225904  1.04537209 -1.47274556  2.35820901  0.14276018  0.78780420
 [49] -0.19376022 -0.44624249  1.02533753 -0.98317593 -1.38412267 -1.31097223
 [55]  0.39757771  1.86249757  0.14217198 -1.88452965  1.93194514 -0.35514291
 [61]  0.25414014  0.37522497 -1.09046955  2.64634274 -0.27495926  0.30527519
 [67] -0.38695691  0.18379763  0.80514694  1.60555988  0.98255303  0.54643098
 [73]  1.01063168 -0.13749487  0.02325716  0.55512551 -0.07850015  0.78524689
 [79] -0.22108013  0.83536480 -0.76695897 -0.26094023 -0.53207690  1.41267765
 [85]  0.78405522 -0.20789800 -0.10386798 -0.49121034 -0.52556382 -0.85114316
 [91] -0.11186663 -0.12431682  0.69575256  0.23027528 -0.21451717 -0.55686266
 [97] -0.28973651 -0.64235065 -0.14912252  1.23127783
> 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.25124050 -0.68917982  1.32465317 -0.48324518  0.71529556 -1.61830237
  [7]  0.71788778 -0.45468332  0.10480566  0.60535495 -1.46965024  0.76493269
 [13]  0.22780978  0.43296693 -0.62272643  0.26229913  1.09214137 -0.70899110
 [19]  0.34763685  0.38776249 -0.07187514  0.02045075 -0.85531564  0.46203793
 [25] -0.62295805 -0.80077976 -0.40115380  1.50074054  0.45283321 -0.06225586
 [31] -3.65409154 -0.90744536  0.69282643 -0.83970646 -0.79404544 -0.58362988
 [37] -0.25039101 -0.51589825  0.88347138  0.28601229 -0.85973054  1.59846395
 [43]  1.92225904  1.04537209 -1.47274556  2.35820901  0.14276018  0.78780420
 [49] -0.19376022 -0.44624249  1.02533753 -0.98317593 -1.38412267 -1.31097223
 [55]  0.39757771  1.86249757  0.14217198 -1.88452965  1.93194514 -0.35514291
 [61]  0.25414014  0.37522497 -1.09046955  2.64634274 -0.27495926  0.30527519
 [67] -0.38695691  0.18379763  0.80514694  1.60555988  0.98255303  0.54643098
 [73]  1.01063168 -0.13749487  0.02325716  0.55512551 -0.07850015  0.78524689
 [79] -0.22108013  0.83536480 -0.76695897 -0.26094023 -0.53207690  1.41267765
 [85]  0.78405522 -0.20789800 -0.10386798 -0.49121034 -0.52556382 -0.85114316
 [91] -0.11186663 -0.12431682  0.69575256  0.23027528 -0.21451717 -0.55686266
 [97] -0.28973651 -0.64235065 -0.14912252  1.23127783
> colMin(tmp)
  [1]  0.25124050 -0.68917982  1.32465317 -0.48324518  0.71529556 -1.61830237
  [7]  0.71788778 -0.45468332  0.10480566  0.60535495 -1.46965024  0.76493269
 [13]  0.22780978  0.43296693 -0.62272643  0.26229913  1.09214137 -0.70899110
 [19]  0.34763685  0.38776249 -0.07187514  0.02045075 -0.85531564  0.46203793
 [25] -0.62295805 -0.80077976 -0.40115380  1.50074054  0.45283321 -0.06225586
 [31] -3.65409154 -0.90744536  0.69282643 -0.83970646 -0.79404544 -0.58362988
 [37] -0.25039101 -0.51589825  0.88347138  0.28601229 -0.85973054  1.59846395
 [43]  1.92225904  1.04537209 -1.47274556  2.35820901  0.14276018  0.78780420
 [49] -0.19376022 -0.44624249  1.02533753 -0.98317593 -1.38412267 -1.31097223
 [55]  0.39757771  1.86249757  0.14217198 -1.88452965  1.93194514 -0.35514291
 [61]  0.25414014  0.37522497 -1.09046955  2.64634274 -0.27495926  0.30527519
 [67] -0.38695691  0.18379763  0.80514694  1.60555988  0.98255303  0.54643098
 [73]  1.01063168 -0.13749487  0.02325716  0.55512551 -0.07850015  0.78524689
 [79] -0.22108013  0.83536480 -0.76695897 -0.26094023 -0.53207690  1.41267765
 [85]  0.78405522 -0.20789800 -0.10386798 -0.49121034 -0.52556382 -0.85114316
 [91] -0.11186663 -0.12431682  0.69575256  0.23027528 -0.21451717 -0.55686266
 [97] -0.28973651 -0.64235065 -0.14912252  1.23127783
> colMedians(tmp)
  [1]  0.25124050 -0.68917982  1.32465317 -0.48324518  0.71529556 -1.61830237
  [7]  0.71788778 -0.45468332  0.10480566  0.60535495 -1.46965024  0.76493269
 [13]  0.22780978  0.43296693 -0.62272643  0.26229913  1.09214137 -0.70899110
 [19]  0.34763685  0.38776249 -0.07187514  0.02045075 -0.85531564  0.46203793
 [25] -0.62295805 -0.80077976 -0.40115380  1.50074054  0.45283321 -0.06225586
 [31] -3.65409154 -0.90744536  0.69282643 -0.83970646 -0.79404544 -0.58362988
 [37] -0.25039101 -0.51589825  0.88347138  0.28601229 -0.85973054  1.59846395
 [43]  1.92225904  1.04537209 -1.47274556  2.35820901  0.14276018  0.78780420
 [49] -0.19376022 -0.44624249  1.02533753 -0.98317593 -1.38412267 -1.31097223
 [55]  0.39757771  1.86249757  0.14217198 -1.88452965  1.93194514 -0.35514291
 [61]  0.25414014  0.37522497 -1.09046955  2.64634274 -0.27495926  0.30527519
 [67] -0.38695691  0.18379763  0.80514694  1.60555988  0.98255303  0.54643098
 [73]  1.01063168 -0.13749487  0.02325716  0.55512551 -0.07850015  0.78524689
 [79] -0.22108013  0.83536480 -0.76695897 -0.26094023 -0.53207690  1.41267765
 [85]  0.78405522 -0.20789800 -0.10386798 -0.49121034 -0.52556382 -0.85114316
 [91] -0.11186663 -0.12431682  0.69575256  0.23027528 -0.21451717 -0.55686266
 [97] -0.28973651 -0.64235065 -0.14912252  1.23127783
> colRanges(tmp)
          [,1]       [,2]     [,3]       [,4]      [,5]      [,6]      [,7]
[1,] 0.2512405 -0.6891798 1.324653 -0.4832452 0.7152956 -1.618302 0.7178878
[2,] 0.2512405 -0.6891798 1.324653 -0.4832452 0.7152956 -1.618302 0.7178878
           [,8]      [,9]     [,10]    [,11]     [,12]     [,13]     [,14]
[1,] -0.4546833 0.1048057 0.6053549 -1.46965 0.7649327 0.2278098 0.4329669
[2,] -0.4546833 0.1048057 0.6053549 -1.46965 0.7649327 0.2278098 0.4329669
          [,15]     [,16]    [,17]      [,18]     [,19]     [,20]       [,21]
[1,] -0.6227264 0.2622991 1.092141 -0.7089911 0.3476368 0.3877625 -0.07187514
[2,] -0.6227264 0.2622991 1.092141 -0.7089911 0.3476368 0.3877625 -0.07187514
          [,22]      [,23]     [,24]     [,25]      [,26]      [,27]    [,28]
[1,] 0.02045075 -0.8553156 0.4620379 -0.622958 -0.8007798 -0.4011538 1.500741
[2,] 0.02045075 -0.8553156 0.4620379 -0.622958 -0.8007798 -0.4011538 1.500741
         [,29]       [,30]     [,31]      [,32]     [,33]      [,34]      [,35]
[1,] 0.4528332 -0.06225586 -3.654092 -0.9074454 0.6928264 -0.8397065 -0.7940454
[2,] 0.4528332 -0.06225586 -3.654092 -0.9074454 0.6928264 -0.8397065 -0.7940454
          [,36]     [,37]      [,38]     [,39]     [,40]      [,41]    [,42]
[1,] -0.5836299 -0.250391 -0.5158982 0.8834714 0.2860123 -0.8597305 1.598464
[2,] -0.5836299 -0.250391 -0.5158982 0.8834714 0.2860123 -0.8597305 1.598464
        [,43]    [,44]     [,45]    [,46]     [,47]     [,48]      [,49]
[1,] 1.922259 1.045372 -1.472746 2.358209 0.1427602 0.7878042 -0.1937602
[2,] 1.922259 1.045372 -1.472746 2.358209 0.1427602 0.7878042 -0.1937602
          [,50]    [,51]      [,52]     [,53]     [,54]     [,55]    [,56]
[1,] -0.4462425 1.025338 -0.9831759 -1.384123 -1.310972 0.3975777 1.862498
[2,] -0.4462425 1.025338 -0.9831759 -1.384123 -1.310972 0.3975777 1.862498
        [,57]    [,58]    [,59]      [,60]     [,61]    [,62]    [,63]    [,64]
[1,] 0.142172 -1.88453 1.931945 -0.3551429 0.2541401 0.375225 -1.09047 2.646343
[2,] 0.142172 -1.88453 1.931945 -0.3551429 0.2541401 0.375225 -1.09047 2.646343
          [,65]     [,66]      [,67]     [,68]     [,69]   [,70]    [,71]
[1,] -0.2749593 0.3052752 -0.3869569 0.1837976 0.8051469 1.60556 0.982553
[2,] -0.2749593 0.3052752 -0.3869569 0.1837976 0.8051469 1.60556 0.982553
        [,72]    [,73]      [,74]      [,75]     [,76]       [,77]     [,78]
[1,] 0.546431 1.010632 -0.1374949 0.02325716 0.5551255 -0.07850015 0.7852469
[2,] 0.546431 1.010632 -0.1374949 0.02325716 0.5551255 -0.07850015 0.7852469
          [,79]     [,80]     [,81]      [,82]      [,83]    [,84]     [,85]
[1,] -0.2210801 0.8353648 -0.766959 -0.2609402 -0.5320769 1.412678 0.7840552
[2,] -0.2210801 0.8353648 -0.766959 -0.2609402 -0.5320769 1.412678 0.7840552
         [,86]     [,87]      [,88]      [,89]      [,90]      [,91]      [,92]
[1,] -0.207898 -0.103868 -0.4912103 -0.5255638 -0.8511432 -0.1118666 -0.1243168
[2,] -0.207898 -0.103868 -0.4912103 -0.5255638 -0.8511432 -0.1118666 -0.1243168
         [,93]     [,94]      [,95]      [,96]      [,97]      [,98]      [,99]
[1,] 0.6957526 0.2302753 -0.2145172 -0.5568627 -0.2897365 -0.6423507 -0.1491225
[2,] 0.6957526 0.2302753 -0.2145172 -0.5568627 -0.2897365 -0.6423507 -0.1491225
       [,100]
[1,] 1.231278
[2,] 1.231278
> 
> 
> Max(tmp2)
[1] 3.044279
> Min(tmp2)
[1] -2.481782
> mean(tmp2)
[1] -0.1098528
> Sum(tmp2)
[1] -10.98528
> Var(tmp2)
[1] 0.8456013
> 
> rowMeans(tmp2)
  [1]  3.04427937  0.26158430  0.10147469 -0.16771208 -0.95857230 -0.84714132
  [7]  0.50075506 -1.94493699 -0.87360456  0.33322201 -0.63413482  0.90534619
 [13]  0.60136057  0.69059877  0.66943233  0.74515252  0.36146792  0.44944666
 [19] -0.44553381  1.48999010  1.07181280  1.00962496 -1.19754544 -0.27611871
 [25] -0.63073124 -0.68622144  0.90930884  0.60975238 -0.50457931 -2.48178220
 [31]  0.87185494  1.23442635  0.01657365 -0.02352123  0.51877773 -0.53443272
 [37] -1.00380340 -2.25446421 -0.05880359  0.87668064 -0.58407706 -1.24675009
 [43] -1.50519641 -1.33667887  1.25937389 -1.43656466 -0.77670431  0.06847645
 [49] -0.71860570 -0.47408048 -0.20136406  0.75058199 -0.77641308 -0.69006524
 [55]  0.29222123 -0.23930144 -0.56320354  0.36112648  0.73921467 -0.73770066
 [61]  0.18953975 -0.01497507  0.69949198 -1.19039906  1.06650135  0.38629955
 [67] -1.45097064  0.06493246 -0.58622286 -2.04890617 -0.14880099 -1.92086107
 [73]  0.39763413 -0.08041592  0.45450815 -0.85262419  0.53339032  0.32155409
 [79]  0.29360118  0.50464763 -0.19459569  1.28864618  1.61390787  0.10678772
 [85] -0.10076164  0.64505111 -0.54983602  0.27678415 -0.83803782  0.89490725
 [91] -1.56799099 -0.22639607 -0.70909622 -0.74897447 -0.24826462 -1.00510654
 [97]  0.20284069 -0.32396154  0.27413348 -0.32680928
> rowSums(tmp2)
  [1]  3.04427937  0.26158430  0.10147469 -0.16771208 -0.95857230 -0.84714132
  [7]  0.50075506 -1.94493699 -0.87360456  0.33322201 -0.63413482  0.90534619
 [13]  0.60136057  0.69059877  0.66943233  0.74515252  0.36146792  0.44944666
 [19] -0.44553381  1.48999010  1.07181280  1.00962496 -1.19754544 -0.27611871
 [25] -0.63073124 -0.68622144  0.90930884  0.60975238 -0.50457931 -2.48178220
 [31]  0.87185494  1.23442635  0.01657365 -0.02352123  0.51877773 -0.53443272
 [37] -1.00380340 -2.25446421 -0.05880359  0.87668064 -0.58407706 -1.24675009
 [43] -1.50519641 -1.33667887  1.25937389 -1.43656466 -0.77670431  0.06847645
 [49] -0.71860570 -0.47408048 -0.20136406  0.75058199 -0.77641308 -0.69006524
 [55]  0.29222123 -0.23930144 -0.56320354  0.36112648  0.73921467 -0.73770066
 [61]  0.18953975 -0.01497507  0.69949198 -1.19039906  1.06650135  0.38629955
 [67] -1.45097064  0.06493246 -0.58622286 -2.04890617 -0.14880099 -1.92086107
 [73]  0.39763413 -0.08041592  0.45450815 -0.85262419  0.53339032  0.32155409
 [79]  0.29360118  0.50464763 -0.19459569  1.28864618  1.61390787  0.10678772
 [85] -0.10076164  0.64505111 -0.54983602  0.27678415 -0.83803782  0.89490725
 [91] -1.56799099 -0.22639607 -0.70909622 -0.74897447 -0.24826462 -1.00510654
 [97]  0.20284069 -0.32396154  0.27413348 -0.32680928
> 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]  3.04427937  0.26158430  0.10147469 -0.16771208 -0.95857230 -0.84714132
  [7]  0.50075506 -1.94493699 -0.87360456  0.33322201 -0.63413482  0.90534619
 [13]  0.60136057  0.69059877  0.66943233  0.74515252  0.36146792  0.44944666
 [19] -0.44553381  1.48999010  1.07181280  1.00962496 -1.19754544 -0.27611871
 [25] -0.63073124 -0.68622144  0.90930884  0.60975238 -0.50457931 -2.48178220
 [31]  0.87185494  1.23442635  0.01657365 -0.02352123  0.51877773 -0.53443272
 [37] -1.00380340 -2.25446421 -0.05880359  0.87668064 -0.58407706 -1.24675009
 [43] -1.50519641 -1.33667887  1.25937389 -1.43656466 -0.77670431  0.06847645
 [49] -0.71860570 -0.47408048 -0.20136406  0.75058199 -0.77641308 -0.69006524
 [55]  0.29222123 -0.23930144 -0.56320354  0.36112648  0.73921467 -0.73770066
 [61]  0.18953975 -0.01497507  0.69949198 -1.19039906  1.06650135  0.38629955
 [67] -1.45097064  0.06493246 -0.58622286 -2.04890617 -0.14880099 -1.92086107
 [73]  0.39763413 -0.08041592  0.45450815 -0.85262419  0.53339032  0.32155409
 [79]  0.29360118  0.50464763 -0.19459569  1.28864618  1.61390787  0.10678772
 [85] -0.10076164  0.64505111 -0.54983602  0.27678415 -0.83803782  0.89490725
 [91] -1.56799099 -0.22639607 -0.70909622 -0.74897447 -0.24826462 -1.00510654
 [97]  0.20284069 -0.32396154  0.27413348 -0.32680928
> rowMin(tmp2)
  [1]  3.04427937  0.26158430  0.10147469 -0.16771208 -0.95857230 -0.84714132
  [7]  0.50075506 -1.94493699 -0.87360456  0.33322201 -0.63413482  0.90534619
 [13]  0.60136057  0.69059877  0.66943233  0.74515252  0.36146792  0.44944666
 [19] -0.44553381  1.48999010  1.07181280  1.00962496 -1.19754544 -0.27611871
 [25] -0.63073124 -0.68622144  0.90930884  0.60975238 -0.50457931 -2.48178220
 [31]  0.87185494  1.23442635  0.01657365 -0.02352123  0.51877773 -0.53443272
 [37] -1.00380340 -2.25446421 -0.05880359  0.87668064 -0.58407706 -1.24675009
 [43] -1.50519641 -1.33667887  1.25937389 -1.43656466 -0.77670431  0.06847645
 [49] -0.71860570 -0.47408048 -0.20136406  0.75058199 -0.77641308 -0.69006524
 [55]  0.29222123 -0.23930144 -0.56320354  0.36112648  0.73921467 -0.73770066
 [61]  0.18953975 -0.01497507  0.69949198 -1.19039906  1.06650135  0.38629955
 [67] -1.45097064  0.06493246 -0.58622286 -2.04890617 -0.14880099 -1.92086107
 [73]  0.39763413 -0.08041592  0.45450815 -0.85262419  0.53339032  0.32155409
 [79]  0.29360118  0.50464763 -0.19459569  1.28864618  1.61390787  0.10678772
 [85] -0.10076164  0.64505111 -0.54983602  0.27678415 -0.83803782  0.89490725
 [91] -1.56799099 -0.22639607 -0.70909622 -0.74897447 -0.24826462 -1.00510654
 [97]  0.20284069 -0.32396154  0.27413348 -0.32680928
> 
> colMeans(tmp2)
[1] -0.1098528
> colSums(tmp2)
[1] -10.98528
> colVars(tmp2)
[1] 0.8456013
> colSd(tmp2)
[1] 0.9195658
> colMax(tmp2)
[1] 3.044279
> colMin(tmp2)
[1] -2.481782
> colMedians(tmp2)
[1] -0.06960975
> colRanges(tmp2)
          [,1]
[1,] -2.481782
[2,]  3.044279
> 
> 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] -2.6486596  1.9211783  1.0141964 -2.3805740  2.1967922  0.5146614
 [7] -0.2897057 -0.2412777  4.0919439 -1.0274477
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3624654
[2,] -0.9533434
[3,] -0.3786847
[4,]  0.1374389
[5,]  1.6026552
> 
> rowApply(tmp,sum)
 [1]  7.2887424  1.7648098 -1.6187136 -1.0619415  1.7459867 -2.2135883
 [7]  0.2868536  1.3417201 -2.3316825 -2.0510792
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    4    2    8    3    1   10    1    7     3
 [2,]    6    9    9    3    2    6    5    7   10     8
 [3,]    7    6    7    6    1    9    6    2    8     5
 [4,]    9    8    1    5    5    5    8    3    2     7
 [5,]   10    3    3    2   10    7    4    5    9    10
 [6,]    2    7   10    1    8    3    1    9    6     6
 [7,]    4   10    5    7    4    2    9    8    1     2
 [8,]    5    2    6    9    9   10    3    4    4     1
 [9,]    8    5    4   10    7    4    2   10    3     9
[10,]    3    1    8    4    6    8    7    6    5     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.355220539 -1.040650007 -0.005201167  1.884695714 -1.153324554
 [6]  2.751227371 -3.824204764  4.184035625  3.998805376  2.907430380
[11]  3.199532153  2.319582241 -1.535336915  1.380728442  2.091836227
[16]  2.863632478  1.821017482  1.585848229  1.208104139 -0.565407392
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.3793918
[2,]  0.1233614
[3,]  0.1528460
[4,]  0.2112416
[5,]  0.2471633
> 
> rowApply(tmp,sum)
[1] 8.339365 3.878929 5.902667 2.243277 4.063334
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    9   10   11   10   10
[2,]   12    1    8   15    1
[3,]    6   19    4   16    2
[4,]   10   15    6   19    8
[5,]    3    6   17    5    3
> 
> 
> as.matrix(tmp)
           [,1]       [,2]         [,3]        [,4]       [,5]        [,6]
[1,]  0.1528460  0.5368621  0.003315969  0.33741160 -0.4744013  0.02582693
[2,]  0.2112416 -1.2310613  0.879218411  0.68004326 -0.3283242 -0.84030697
[3,]  0.2471633 -0.2308469 -0.892125107 -0.67793646  1.3540108  2.23477873
[4,] -0.3793918  1.2662985  1.288894259  1.58352239 -0.8290180 -0.42623506
[5,]  0.1233614 -1.3819025 -1.284504699 -0.03834507 -0.8755919  1.75716374
           [,7]       [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  1.0867393 -0.6297192 -0.2571678  1.6122406  1.66413184  1.1672113
[2,] -0.8985957  0.4701838  0.7793526  0.4172443 -0.11389330  0.6133394
[3,] -1.3820248  2.3596637  1.2462418  1.2198117  0.04170846 -0.6700439
[4,] -1.8859299  1.0965065  1.4323742 -1.3356963  0.64474345  1.5046884
[5,] -0.7443936  0.8874008  0.7980045  0.9938301  0.96284169 -0.2956129
          [,13]      [,14]       [,15]       [,16]      [,17]      [,18]
[1,] -1.4897045 -0.2258214  0.77643487  0.01850985  1.1890925  1.1480754
[2,]  0.7457675  0.7657305  0.14530996 -0.59470804 -0.1280299 -0.3747354
[3,] -0.9731529  1.5203175  0.93860826  0.07847011  0.2558024  1.2554790
[4,] -0.3925490 -1.0556863  0.24581809  1.58739056  0.7736468 -0.7827569
[5,]  0.5743020  0.3761882 -0.01433495  1.77397000 -0.2694944  0.3397861
          [,19]     [,20]
[1,]  0.5144629  1.183018
[2,]  2.3743001  0.306852
[3,] -0.7247475 -1.298511
[4,] -0.7318814 -1.361462
[5,] -0.2240299  0.604695
> 
> 
> 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.6-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.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  631  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.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  543  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.6-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.4892798 -1.485915 -0.09326381 -1.583413 1.47167 0.03741334 0.5419318
          col8       col9    col10    col11      col12    col13     col14
row1 0.1603854 -0.0770387 1.981432 1.816843 -0.2017936 1.721762 0.5902164
          col15      col16     col17    col18     col19      col20
row1 -0.2680484 0.09689628 0.6148404 1.083016 -1.237795 -0.3424428
> tmp[,"col10"]
           col10
row1  1.98143229
row2  0.38425247
row3 -0.04899879
row4  1.78489553
row5  0.92157773
> tmp[c("row1","row5"),]
           col1        col2        col3       col4     col5       col6
row1  0.4892798 -1.48591517 -0.09326381 -1.5834132 1.471670 0.03741334
row5 -1.5052240 -0.05051883  2.03865391  0.3182086 1.962632 0.54437424
          col7      col8       col9     col10     col11       col12     col13
row1 0.5419318 0.1603854 -0.0770387 1.9814323 1.8168428 -0.20179364  1.721762
row5 0.4040367 1.1518739 -1.0459806 0.9215777 0.7804369 -0.01864656 -1.184626
         col14      col15       col16     col17     col18     col19      col20
row1 0.5902164 -0.2680484  0.09689628 0.6148404  1.083016 -1.237795 -0.3424428
row5 0.4447114  0.7515147 -0.08042622 1.0200984 -2.906795  1.004451 -0.2517408
> tmp[,c("col6","col20")]
            col6      col20
row1  0.03741334 -0.3424428
row2 -1.13839634  0.7696683
row3 -0.50111558  2.0263254
row4  0.83754729 -0.4622507
row5  0.54437424 -0.2517408
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 0.03741334 -0.3424428
row5 0.54437424 -0.2517408
> 
> 
> 
> 
> 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 50.37904 49.15615 49.41509 51.51599 51.00056 106.0564 47.95416 49.62822
         col9    col10    col11    col12   col13    col14    col15    col16
row1 48.85028 50.40857 49.54896 48.12953 49.9769 51.68464 48.92036 49.56788
        col17    col18   col19    col20
row1 50.13411 50.37773 49.3848 105.3691
> tmp[,"col10"]
        col10
row1 50.40857
row2 31.46855
row3 31.14873
row4 28.55082
row5 50.95325
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.37904 49.15615 49.41509 51.51599 51.00056 106.0564 47.95416 49.62822
row5 49.93219 49.35540 49.27861 50.12767 49.86562 105.2319 49.88552 50.66448
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.85028 50.40857 49.54896 48.12953 49.97690 51.68464 48.92036 49.56788
row5 49.67526 50.95325 47.97085 50.67356 51.74301 49.82537 50.43335 50.09277
        col17    col18    col19    col20
row1 50.13411 50.37773 49.38480 105.3691
row5 52.16944 49.54578 49.51131 105.2800
> tmp[,c("col6","col20")]
          col6     col20
row1 106.05638 105.36906
row2  74.72334  74.88472
row3  74.24298  73.73307
row4  76.47260  75.06260
row5 105.23193 105.27997
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.0564 105.3691
row5 105.2319 105.2800
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.0564 105.3691
row5 105.2319 105.2800
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.5674379
[2,] -0.7374979
[3,]  0.5838711
[4,]  0.7778766
[5,] -0.1703799
> tmp[,c("col17","col7")]
            col17       col7
[1,]  0.679805482 -0.5781688
[2,]  0.005623386  0.5127722
[3,]  0.390109663 -0.1481162
[4,]  0.036942680 -0.1983940
[5,] -1.126183378 -1.5530656
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  2.1374953 -0.03917491
[2,] -0.1623595  0.34445188
[3,]  1.5933282  2.39573552
[4,] -0.2269895  0.61193745
[5,] -0.7307255 -0.56460173
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 2.137495
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  2.1374953
[2,] -0.1623595
> 
> 
> 
> 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 -1.040003 -0.285826  0.2482136 -1.003115  0.6286516 -0.3257297 -0.6844508
row1 -1.458130 -1.325203 -0.2969067 -1.733544 -1.5950944  0.6906610  0.7970594
          [,8]      [,9]      [,10]      [,11]      [,12]       [,13]
row3 0.4362233 0.8359326 1.83899441 -0.1308329  0.6119340 -0.03360141
row1 0.3353216 0.2666076 0.01062213 -2.5675065 -0.5465411 -1.05952231
          [,14]      [,15]      [,16]      [,17]     [,18]     [,19]      [,20]
row3  0.2372795 -1.4116613  0.7224817  0.7923260 1.2500660 0.2020130  1.7566513
row1 -0.5922339  0.2377477 -1.7846535 -0.3828276 0.6386419 0.9515298 -0.2177721
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]     [,2]     [,3]    [,4]      [,5]      [,6]       [,7]
row2 -0.5951484 2.073918 -1.02002 1.26776 0.8414951 0.4407763 0.07753956
          [,8]     [,9]      [,10]
row2 -1.338671 1.015516 -0.4758805
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]       [,3]     [,4]        [,5]       [,6]      [,7]
row5 -1.371723 1.303327 -0.1516874 1.620951 -0.03306273 -0.5701038 -1.598076
          [,8]       [,9]      [,10]     [,11]     [,12]      [,13]      [,14]
row5 -2.141813 -0.4336464 -0.4334193 -1.645615 0.4349509 -0.1731735 0.09329817
         [,15]     [,16]      [,17]     [,18]     [,19]     [,20]
row5 -1.295433 0.6473776 -0.8433173 0.5438625 0.6351642 -1.199671
> 
> 
> 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: 0x02f10788>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM124432e22a6a"
 [2] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1244605fc54" 
 [3] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM124414f85843"
 [4] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12446d50306b"
 [5] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12445de63d12"
 [6] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM124426dd20ce"
 [7] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1244f602b8b" 
 [8] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12446cf42af3"
 [9] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12445e686af2"
[10] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12441f4d4f63"
[11] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM124440147830"
[12] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM1244304c2b6b"
[13] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM124433925d26"
[14] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12445f2a2b15"
[15] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM12446d691241"
> 
> 
> ### 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: 0x07b1f018>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x07b1f018>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.6-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x07b1f018>
> rowMedians(tmp)
  [1] -0.020999869  0.188942922 -0.271768991  0.364987340  0.802380446
  [6] -0.093605946  0.038449126 -0.296137508  0.126549235 -0.011324543
 [11]  0.207843188 -0.068476805  0.260185680  0.215200497  0.159124049
 [16] -0.324146008  0.397865424  0.079773049 -0.037708816  0.098946416
 [21] -0.181045519 -0.166018226 -0.325930365  0.333137046 -0.213611150
 [26] -0.499799049  0.517953231  0.115154402 -0.277667514 -0.311683683
 [31] -0.263363046 -0.444453396  0.076083187  0.308174796  0.710410604
 [36] -0.191505205  0.162971846 -0.353275746 -0.258049114  0.112326854
 [41]  0.120017905  0.041322515 -0.252944680 -0.159930766 -0.590729723
 [46]  0.071802639  0.504688158 -0.535104085 -0.430124235 -0.046772677
 [51]  0.219660772 -0.006517440 -0.053921540  0.123260790  0.277815046
 [56] -0.066784167  0.304740788 -0.463896592 -0.166732051 -0.055431495
 [61]  0.090073519 -0.822539135 -0.153153913  0.127400351 -0.026133523
 [66] -0.466446255  0.253299017 -0.205909853 -0.194883407 -0.503410134
 [71] -0.031790992 -0.327280897  0.034728766 -0.055608391  0.090512387
 [76]  0.318035183  0.337563797  0.192717803  0.040624601 -0.112383870
 [81]  0.117675647 -0.056024603  0.494332411 -0.063782722  0.086808593
 [86]  0.073287589  0.649524280  0.022278070 -0.237033097  0.269475694
 [91]  0.303567101 -0.343619152  0.172338409 -0.503856339  0.224229901
 [96] -0.618435745  0.149456637 -0.366447331 -0.133365727 -0.025993232
[101]  0.344628529 -0.183036866 -0.053627454  0.039834959  0.138989291
[106]  0.022308045 -0.309557436 -0.074857073 -0.305566860  0.208585813
[111] -0.471831480 -0.896046233  0.467473475  0.116434257 -0.009922656
[116] -0.023419798 -0.292528757 -0.035661466 -0.080406959 -0.396469094
[121]  0.483063767 -0.787484501 -0.342903400 -0.305952776  0.523185659
[126]  0.041154964  0.165294910  0.596686013  0.288638650  0.378498521
[131] -0.237964540  0.439886936 -0.238602400 -0.039765985  0.125991950
[136]  0.066632721  0.435481418  0.272832703 -0.322600190 -0.138740759
[141]  0.017065688  0.274572528  0.195961799 -0.356735629  0.196530328
[146] -0.430907946  0.719070640  0.290466789  0.119860451 -0.153644792
[151] -0.021130472  0.300092777 -0.013535591 -0.023374821 -0.007313249
[156]  0.245515483 -0.066431398 -0.164458468 -0.219136338  0.275194685
[161] -0.009706579 -0.454892770 -0.090129860 -0.175773286  0.141527172
[166] -0.195289359 -0.277159664  0.199152886  0.060838996  0.556468779
[171]  0.027479489  0.223298129  0.034061575  0.606876245 -0.145649149
[176] -0.169071440 -0.089624662  0.006391243  0.449224079 -0.375088020
[181]  0.002919832 -0.163698139  0.018689518 -0.109307926  0.733470376
[186] -0.171479764  0.178204027  0.089337435 -0.270065835 -0.081173514
[191] -0.349437955  0.358476599 -0.354415125 -0.425798769 -0.294877501
[196]  0.524569936  0.184607258  0.371417455  0.001367856 -0.075516350
[201] -0.215023407  0.214895456 -0.322040117 -0.472601744 -0.115108514
[206] -0.157508065 -0.546033744  0.302040216  0.274414572  0.098856296
[211] -0.227612988 -0.702065966  0.705109249 -0.225619923  0.112903733
[216]  0.392755232  0.528841661  0.250448390  0.073716783  0.276391641
[221]  0.610824797  0.277655565  0.010390972 -0.138760086 -0.069827556
[226]  0.395565191  0.132147838 -0.084424909  0.031653898 -0.227297483
> 
> proc.time()
   user  system elapsed 
   3.00    7.15   10.79 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.6-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 387896 20.8     750400 40.1   592000 31.7
Vcells 661080  5.1    1308461 10.0  1023718  7.9
> 
> 
> 
> 
> ##
> ## 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] "Wed Apr 11 22:38:38 2018"
> 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] "Wed Apr 11 22:38:38 2018"
> 
> 
> 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: 0x00000000068ab7c0>
> 
> 
> 
> 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] "Wed Apr 11 22:38:40 2018"
> 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] "Wed Apr 11 22:38:41 2018"
> 
> ColMode(tmp2)
<pointer: 0x00000000068ab7c0>
> 
> 
> 
> ### 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,] 100.7991832 1.9864510 -0.4533436426 -0.55268551
[2,]  -1.2028543 1.1211628 -0.0005722444 -0.08296907
[3,]   0.4536412 0.5545540  1.2065891855  0.50912046
[4,]   0.2673513 0.8813558  0.9755083359  0.97790751
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.6-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,] 100.7991832 1.9864510 0.4533436426 0.55268551
[2,]   1.2028543 1.1211628 0.0005722444 0.08296907
[3,]   0.4536412 0.5545540 1.2065891855 0.50912046
[4,]   0.2673513 0.8813558 0.9755083359 0.97790751
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.6-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,] 10.0398796 1.4094151 0.67330798 0.7434282
[2,]  1.0967472 1.0588497 0.02392163 0.2880435
[3,]  0.6735289 0.7446838 1.09844854 0.7135268
[4,]  0.5170602 0.9388055 0.98767826 0.9888921
> 
> 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.6-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,] 226.19798 41.08060 32.18642 32.98697
[2,]  37.17033 36.70966 25.23979 27.96340
[3,]  32.18893 33.00139 37.19107 32.64439
[4,]  30.43795 35.26941 35.85229 35.86683
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x000000000bfaa330>
> exp(tmp5)
<pointer: 0x000000000bfaa330>
> log(tmp5,2)
<pointer: 0x000000000bfaa330>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.8015
> Min(tmp5)
[1] 52.15502
> mean(tmp5)
[1] 73.09596
> Sum(tmp5)
[1] 14619.19
> Var(tmp5)
[1] 873.7338
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.37896 71.10689 68.48547 68.93004 74.38204 73.75050 69.25735 72.29962
 [9] 70.63913 69.72965
> rowSums(tmp5)
 [1] 1847.579 1422.138 1369.709 1378.601 1487.641 1475.010 1385.147 1445.992
 [9] 1412.783 1394.593
> rowVars(tmp5)
 [1] 8013.25411   82.98915   50.34976   58.73499   42.80776   63.93765
 [7]   91.58952   79.19852   90.34908  105.13697
> rowSd(tmp5)
 [1] 89.516781  9.109838  7.095757  7.663875  6.542764  7.996102  9.570241
 [8]  8.899355  9.505213 10.253632
> rowMax(tmp5)
 [1] 470.80146  85.13366  83.75168  82.16223  86.15667  91.37433  86.46560
 [8]  88.91008  88.93920  95.98831
> rowMin(tmp5)
 [1] 54.32856 52.53331 57.20667 52.69041 59.24656 60.87735 52.15502 56.40120
 [9] 55.99231 54.81974
> 
> colMeans(tmp5)
 [1] 109.87257  71.19489  69.65009  73.88665  70.62396  70.73431  72.12679
 [8]  69.90317  72.63649  70.83836  71.93321  72.73964  73.57380  70.95345
[15]  71.70516  67.91627  71.42216  73.09331  67.14316  69.97185
> colSums(tmp5)
 [1] 1098.7257  711.9489  696.5009  738.8665  706.2396  707.3431  721.2679
 [8]  699.0317  726.3649  708.3836  719.3321  727.3964  735.7380  709.5345
[15]  717.0516  679.1627  714.2216  730.9331  671.4316  699.7185
> colVars(tmp5)
 [1] 16102.46325    74.80587   102.06595   133.60356    36.94329    66.55184
 [7]    56.70159   132.35239    68.41497   152.55869    84.43265    66.96174
[13]   110.59727   138.65185    77.31727    29.51593    87.23930    44.54091
[19]    40.55012    68.71277
> colSd(tmp5)
 [1] 126.895482   8.649038  10.102769  11.558701   6.078099   8.157931
 [7]   7.530046  11.504451   8.271334  12.351465   9.188724   8.183015
[13]  10.516524  11.775052   8.793024   5.432856   9.340198   6.673897
[19]   6.367898   8.289317
> colMax(tmp5)
 [1] 470.80146  85.50389  81.37693  91.37433  81.07939  85.13366  81.40704
 [8]  83.75168  84.97471  88.91008  86.46560  84.20133  84.96399  95.98831
[15]  82.66503  76.72541  85.45901  80.69925  77.80250  86.15667
> colMin(tmp5)
 [1] 63.35261 56.25545 52.53331 58.19319 60.87735 57.26413 61.04883 52.69041
 [9] 60.56454 52.15502 56.40120 58.65797 54.32856 55.99231 57.20667 59.11378
[17] 58.70697 65.57459 59.24656 58.60336
> 
> 
> ### 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] 92.37896 71.10689 68.48547 68.93004 74.38204 73.75050 69.25735 72.29962
 [9]       NA 69.72965
> rowSums(tmp5)
 [1] 1847.579 1422.138 1369.709 1378.601 1487.641 1475.010 1385.147 1445.992
 [9]       NA 1394.593
> rowVars(tmp5)
 [1] 8013.25411   82.98915   50.34976   58.73499   42.80776   63.93765
 [7]   91.58952   79.19852   87.69582  105.13697
> rowSd(tmp5)
 [1] 89.516781  9.109838  7.095757  7.663875  6.542764  7.996102  9.570241
 [8]  8.899355  9.364604 10.253632
> rowMax(tmp5)
 [1] 470.80146  85.13366  83.75168  82.16223  86.15667  91.37433  86.46560
 [8]  88.91008        NA  95.98831
> rowMin(tmp5)
 [1] 54.32856 52.53331 57.20667 52.69041 59.24656 60.87735 52.15502 56.40120
 [9]       NA 54.81974
> 
> colMeans(tmp5)
 [1] 109.87257  71.19489  69.65009  73.88665  70.62396  70.73431  72.12679
 [8]        NA  72.63649  70.83836  71.93321  72.73964  73.57380  70.95345
[15]  71.70516  67.91627  71.42216  73.09331  67.14316  69.97185
> colSums(tmp5)
 [1] 1098.7257  711.9489  696.5009  738.8665  706.2396  707.3431  721.2679
 [8]        NA  726.3649  708.3836  719.3321  727.3964  735.7380  709.5345
[15]  717.0516  679.1627  714.2216  730.9331  671.4316  699.7185
> colVars(tmp5)
 [1] 16102.46325    74.80587   102.06595   133.60356    36.94329    66.55184
 [7]    56.70159          NA    68.41497   152.55869    84.43265    66.96174
[13]   110.59727   138.65185    77.31727    29.51593    87.23930    44.54091
[19]    40.55012    68.71277
> colSd(tmp5)
 [1] 126.895482   8.649038  10.102769  11.558701   6.078099   8.157931
 [7]   7.530046         NA   8.271334  12.351465   9.188724   8.183015
[13]  10.516524  11.775052   8.793024   5.432856   9.340198   6.673897
[19]   6.367898   8.289317
> colMax(tmp5)
 [1] 470.80146  85.50389  81.37693  91.37433  81.07939  85.13366  81.40704
 [8]        NA  84.97471  88.91008  86.46560  84.20133  84.96399  95.98831
[15]  82.66503  76.72541  85.45901  80.69925  77.80250  86.15667
> colMin(tmp5)
 [1] 63.35261 56.25545 52.53331 58.19319 60.87735 57.26413 61.04883       NA
 [9] 60.56454 52.15502 56.40120 58.65797 54.32856 55.99231 57.20667 59.11378
[17] 58.70697 65.57459 59.24656 58.60336
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.8015
> Min(tmp5,na.rm=TRUE)
[1] 52.15502
> mean(tmp5,na.rm=TRUE)
[1] 73.05075
> Sum(tmp5,na.rm=TRUE)
[1] 14537.1
> Var(tmp5,na.rm=TRUE)
[1] 877.7357
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.37896 71.10689 68.48547 68.93004 74.38204 73.75050 69.25735 72.29962
 [9] 70.03627 69.72965
> rowSums(tmp5,na.rm=TRUE)
 [1] 1847.579 1422.138 1369.709 1378.601 1487.641 1475.010 1385.147 1445.992
 [9] 1330.689 1394.593
> rowVars(tmp5,na.rm=TRUE)
 [1] 8013.25411   82.98915   50.34976   58.73499   42.80776   63.93765
 [7]   91.58952   79.19852   87.69582  105.13697
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.516781  9.109838  7.095757  7.663875  6.542764  7.996102  9.570241
 [8]  8.899355  9.364604 10.253632
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.80146  85.13366  83.75168  82.16223  86.15667  91.37433  86.46560
 [8]  88.91008  88.93920  95.98831
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.32856 52.53331 57.20667 52.69041 59.24656 60.87735 52.15502 56.40120
 [9] 55.99231 54.81974
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.87257  71.19489  69.65009  73.88665  70.62396  70.73431  72.12679
 [8]  68.54869  72.63649  70.83836  71.93321  72.73964  73.57380  70.95345
[15]  71.70516  67.91627  71.42216  73.09331  67.14316  69.97185
> colSums(tmp5,na.rm=TRUE)
 [1] 1098.7257  711.9489  696.5009  738.8665  706.2396  707.3431  721.2679
 [8]  616.9383  726.3649  708.3836  719.3321  727.3964  735.7380  709.5345
[15]  717.0516  679.1627  714.2216  730.9331  671.4316  699.7185
> colVars(tmp5,na.rm=TRUE)
 [1] 16102.46325    74.80587   102.06595   133.60356    36.94329    66.55184
 [7]    56.70159   128.25701    68.41497   152.55869    84.43265    66.96174
[13]   110.59727   138.65185    77.31727    29.51593    87.23930    44.54091
[19]    40.55012    68.71277
> colSd(tmp5,na.rm=TRUE)
 [1] 126.895482   8.649038  10.102769  11.558701   6.078099   8.157931
 [7]   7.530046  11.325061   8.271334  12.351465   9.188724   8.183015
[13]  10.516524  11.775052   8.793024   5.432856   9.340198   6.673897
[19]   6.367898   8.289317
> colMax(tmp5,na.rm=TRUE)
 [1] 470.80146  85.50389  81.37693  91.37433  81.07939  85.13366  81.40704
 [8]  83.75168  84.97471  88.91008  86.46560  84.20133  84.96399  95.98831
[15]  82.66503  76.72541  85.45901  80.69925  77.80250  86.15667
> colMin(tmp5,na.rm=TRUE)
 [1] 63.35261 56.25545 52.53331 58.19319 60.87735 57.26413 61.04883 52.69041
 [9] 60.56454 52.15502 56.40120 58.65797 54.32856 55.99231 57.20667 59.11378
[17] 58.70697 65.57459 59.24656 58.60336
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.37896 71.10689 68.48547 68.93004 74.38204 73.75050 69.25735 72.29962
 [9]      NaN 69.72965
> rowSums(tmp5,na.rm=TRUE)
 [1] 1847.579 1422.138 1369.709 1378.601 1487.641 1475.010 1385.147 1445.992
 [9]    0.000 1394.593
> rowVars(tmp5,na.rm=TRUE)
 [1] 8013.25411   82.98915   50.34976   58.73499   42.80776   63.93765
 [7]   91.58952   79.19852         NA  105.13697
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.516781  9.109838  7.095757  7.663875  6.542764  7.996102  9.570241
 [8]  8.899355        NA 10.253632
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.80146  85.13366  83.75168  82.16223  86.15667  91.37433  86.46560
 [8]  88.91008        NA  95.98831
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.32856 52.53331 57.20667 52.69041 59.24656 60.87735 52.15502 56.40120
 [9]       NA 54.81974
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.22956  72.85483  69.63184  72.21414  70.31836  71.00480  71.09565
 [8]       NaN  73.97782  70.30263  72.06000  74.30427  73.91424  72.61580
[15]  70.75856  67.77099  69.86251  73.92277  67.75758  70.23391
> colSums(tmp5,na.rm=TRUE)
 [1] 1028.0660  655.6935  626.6865  649.9273  632.8652  639.0432  639.8609
 [8]    0.0000  665.8004  632.7237  648.5400  668.7384  665.2281  653.5422
[15]  636.8270  609.9389  628.7626  665.3050  609.8183  632.1052
> colVars(tmp5,na.rm=TRUE)
 [1] 17901.70870    53.15841   114.82044   118.83466    40.51055    74.04775
 [7]    51.82776          NA    56.72629   168.39976    94.80589    47.79122
[13]   123.11811   124.89503    76.90128    32.96795    70.77847    42.36841
[19]    41.37188    76.52926
> colSd(tmp5,na.rm=TRUE)
 [1] 133.797267   7.290981  10.715430  10.901131   6.364790   8.605101
 [7]   7.199150         NA   7.531686  12.976893   9.736832   6.913119
[13]  11.095860  11.175644   8.769338   5.741772   8.412994   6.509102
[19]   6.432098   8.748100
> colMax(tmp5,na.rm=TRUE)
 [1] 470.80146  85.50389  81.37693  91.37433  81.07939  85.13366  80.45644
 [8]      -Inf  84.97471  88.91008  86.46560  84.20133  84.96399  95.98831
[15]  82.66503  76.72541  83.90599  80.69925  77.80250  86.15667
> colMin(tmp5,na.rm=TRUE)
 [1] 63.35261 58.09741 52.53331 58.19319 60.87735 57.26413 61.04883      Inf
 [9] 60.77807 52.15502 56.40120 64.01008 54.32856 58.31209 57.20667 59.11378
[17] 58.70697 65.57459 59.24656 58.60336
> 
> 
> 
> 
> 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] 232.0204 356.6810 109.3844 209.7725 231.5947 218.6947 160.1926 207.3002
 [9] 194.7740 333.6527
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 232.0204 356.6810 109.3844 209.7725 231.5947 218.6947 160.1926 207.3002
 [9] 194.7740 333.6527
> 
> 
> 
> 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] -5.684342e-14  5.684342e-14 -1.705303e-13  1.136868e-13 -1.136868e-13
 [6]  5.684342e-14 -3.979039e-13 -1.136868e-13  5.684342e-14  1.136868e-13
[11]  5.684342e-14  0.000000e+00 -2.842171e-14  0.000000e+00  1.705303e-13
[16] -5.684342e-14  7.105427e-14 -5.684342e-14  1.136868e-13  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)
+ }
9   18 
5   9 
10   13 
1   14 
6   9 
3   10 
4   18 
5   14 
6   15 
8   14 
6   20 
7   11 
5   13 
10   2 
7   20 
9   15 
9   2 
8   8 
8   11 
6   13 
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.676685
> Min(tmp)
[1] -2.631028
> mean(tmp)
[1] -0.02780406
> Sum(tmp)
[1] -2.780406
> Var(tmp)
[1] 0.8666042
> 
> rowMeans(tmp)
[1] -0.02780406
> rowSums(tmp)
[1] -2.780406
> rowVars(tmp)
[1] 0.8666042
> rowSd(tmp)
[1] 0.9309158
> rowMax(tmp)
[1] 2.676685
> rowMin(tmp)
[1] -2.631028
> 
> colMeans(tmp)
  [1]  0.608367364  1.793301654 -0.291932756  0.356051538 -0.280671801
  [6]  0.054396311  0.354489600  1.472200896 -0.472201879  1.914003322
 [11]  0.308770186 -0.826048420  0.757995817  1.288247086 -0.842451463
 [16]  1.890004182 -0.318262824  0.093752278 -0.068728601 -0.592685620
 [21]  0.596883749 -1.167758940 -0.005961172  1.816109035 -0.585831797
 [26]  0.519320523  0.547933010 -0.471017522 -0.478409328 -0.870422660
 [31] -0.796374671 -0.311335043 -0.014745630  1.925113074  1.050241273
 [36] -0.624948675  0.502886790 -1.202011860 -1.009190181  2.676685395
 [41]  0.005194969 -0.944797306 -0.716791662  0.329262165  0.520815192
 [46]  0.789903679  0.675786448 -0.740851613 -1.891838080 -0.015976530
 [51]  0.209458316  0.458631743 -0.157484510 -2.631027786 -0.250348333
 [56] -1.145478620 -0.519159292  0.647716497 -0.252219513 -0.182334713
 [61]  0.819505105  2.203296112  1.110631046 -1.186001117  0.279037082
 [66] -1.092965912 -0.163604088  0.026033444 -1.024730717 -0.338035445
 [71] -0.231439989 -1.387027570 -0.001505870  0.301336595 -1.012354568
 [76] -1.103309067  0.126651438 -1.694845525 -0.343329252 -0.693740230
 [81]  0.383245830  0.342711052 -1.222450641  0.309466894  0.150635318
 [86] -0.698054861 -1.580904981 -0.232953217  1.163940046 -0.296888665
 [91] -0.931485109  0.430193655  0.281142404 -0.087871629 -0.686719796
 [96]  0.730727246 -0.456931056  0.602365765 -0.159406517  1.101007531
> colSums(tmp)
  [1]  0.608367364  1.793301654 -0.291932756  0.356051538 -0.280671801
  [6]  0.054396311  0.354489600  1.472200896 -0.472201879  1.914003322
 [11]  0.308770186 -0.826048420  0.757995817  1.288247086 -0.842451463
 [16]  1.890004182 -0.318262824  0.093752278 -0.068728601 -0.592685620
 [21]  0.596883749 -1.167758940 -0.005961172  1.816109035 -0.585831797
 [26]  0.519320523  0.547933010 -0.471017522 -0.478409328 -0.870422660
 [31] -0.796374671 -0.311335043 -0.014745630  1.925113074  1.050241273
 [36] -0.624948675  0.502886790 -1.202011860 -1.009190181  2.676685395
 [41]  0.005194969 -0.944797306 -0.716791662  0.329262165  0.520815192
 [46]  0.789903679  0.675786448 -0.740851613 -1.891838080 -0.015976530
 [51]  0.209458316  0.458631743 -0.157484510 -2.631027786 -0.250348333
 [56] -1.145478620 -0.519159292  0.647716497 -0.252219513 -0.182334713
 [61]  0.819505105  2.203296112  1.110631046 -1.186001117  0.279037082
 [66] -1.092965912 -0.163604088  0.026033444 -1.024730717 -0.338035445
 [71] -0.231439989 -1.387027570 -0.001505870  0.301336595 -1.012354568
 [76] -1.103309067  0.126651438 -1.694845525 -0.343329252 -0.693740230
 [81]  0.383245830  0.342711052 -1.222450641  0.309466894  0.150635318
 [86] -0.698054861 -1.580904981 -0.232953217  1.163940046 -0.296888665
 [91] -0.931485109  0.430193655  0.281142404 -0.087871629 -0.686719796
 [96]  0.730727246 -0.456931056  0.602365765 -0.159406517  1.101007531
> 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.608367364  1.793301654 -0.291932756  0.356051538 -0.280671801
  [6]  0.054396311  0.354489600  1.472200896 -0.472201879  1.914003322
 [11]  0.308770186 -0.826048420  0.757995817  1.288247086 -0.842451463
 [16]  1.890004182 -0.318262824  0.093752278 -0.068728601 -0.592685620
 [21]  0.596883749 -1.167758940 -0.005961172  1.816109035 -0.585831797
 [26]  0.519320523  0.547933010 -0.471017522 -0.478409328 -0.870422660
 [31] -0.796374671 -0.311335043 -0.014745630  1.925113074  1.050241273
 [36] -0.624948675  0.502886790 -1.202011860 -1.009190181  2.676685395
 [41]  0.005194969 -0.944797306 -0.716791662  0.329262165  0.520815192
 [46]  0.789903679  0.675786448 -0.740851613 -1.891838080 -0.015976530
 [51]  0.209458316  0.458631743 -0.157484510 -2.631027786 -0.250348333
 [56] -1.145478620 -0.519159292  0.647716497 -0.252219513 -0.182334713
 [61]  0.819505105  2.203296112  1.110631046 -1.186001117  0.279037082
 [66] -1.092965912 -0.163604088  0.026033444 -1.024730717 -0.338035445
 [71] -0.231439989 -1.387027570 -0.001505870  0.301336595 -1.012354568
 [76] -1.103309067  0.126651438 -1.694845525 -0.343329252 -0.693740230
 [81]  0.383245830  0.342711052 -1.222450641  0.309466894  0.150635318
 [86] -0.698054861 -1.580904981 -0.232953217  1.163940046 -0.296888665
 [91] -0.931485109  0.430193655  0.281142404 -0.087871629 -0.686719796
 [96]  0.730727246 -0.456931056  0.602365765 -0.159406517  1.101007531
> colMin(tmp)
  [1]  0.608367364  1.793301654 -0.291932756  0.356051538 -0.280671801
  [6]  0.054396311  0.354489600  1.472200896 -0.472201879  1.914003322
 [11]  0.308770186 -0.826048420  0.757995817  1.288247086 -0.842451463
 [16]  1.890004182 -0.318262824  0.093752278 -0.068728601 -0.592685620
 [21]  0.596883749 -1.167758940 -0.005961172  1.816109035 -0.585831797
 [26]  0.519320523  0.547933010 -0.471017522 -0.478409328 -0.870422660
 [31] -0.796374671 -0.311335043 -0.014745630  1.925113074  1.050241273
 [36] -0.624948675  0.502886790 -1.202011860 -1.009190181  2.676685395
 [41]  0.005194969 -0.944797306 -0.716791662  0.329262165  0.520815192
 [46]  0.789903679  0.675786448 -0.740851613 -1.891838080 -0.015976530
 [51]  0.209458316  0.458631743 -0.157484510 -2.631027786 -0.250348333
 [56] -1.145478620 -0.519159292  0.647716497 -0.252219513 -0.182334713
 [61]  0.819505105  2.203296112  1.110631046 -1.186001117  0.279037082
 [66] -1.092965912 -0.163604088  0.026033444 -1.024730717 -0.338035445
 [71] -0.231439989 -1.387027570 -0.001505870  0.301336595 -1.012354568
 [76] -1.103309067  0.126651438 -1.694845525 -0.343329252 -0.693740230
 [81]  0.383245830  0.342711052 -1.222450641  0.309466894  0.150635318
 [86] -0.698054861 -1.580904981 -0.232953217  1.163940046 -0.296888665
 [91] -0.931485109  0.430193655  0.281142404 -0.087871629 -0.686719796
 [96]  0.730727246 -0.456931056  0.602365765 -0.159406517  1.101007531
> colMedians(tmp)
  [1]  0.608367364  1.793301654 -0.291932756  0.356051538 -0.280671801
  [6]  0.054396311  0.354489600  1.472200896 -0.472201879  1.914003322
 [11]  0.308770186 -0.826048420  0.757995817  1.288247086 -0.842451463
 [16]  1.890004182 -0.318262824  0.093752278 -0.068728601 -0.592685620
 [21]  0.596883749 -1.167758940 -0.005961172  1.816109035 -0.585831797
 [26]  0.519320523  0.547933010 -0.471017522 -0.478409328 -0.870422660
 [31] -0.796374671 -0.311335043 -0.014745630  1.925113074  1.050241273
 [36] -0.624948675  0.502886790 -1.202011860 -1.009190181  2.676685395
 [41]  0.005194969 -0.944797306 -0.716791662  0.329262165  0.520815192
 [46]  0.789903679  0.675786448 -0.740851613 -1.891838080 -0.015976530
 [51]  0.209458316  0.458631743 -0.157484510 -2.631027786 -0.250348333
 [56] -1.145478620 -0.519159292  0.647716497 -0.252219513 -0.182334713
 [61]  0.819505105  2.203296112  1.110631046 -1.186001117  0.279037082
 [66] -1.092965912 -0.163604088  0.026033444 -1.024730717 -0.338035445
 [71] -0.231439989 -1.387027570 -0.001505870  0.301336595 -1.012354568
 [76] -1.103309067  0.126651438 -1.694845525 -0.343329252 -0.693740230
 [81]  0.383245830  0.342711052 -1.222450641  0.309466894  0.150635318
 [86] -0.698054861 -1.580904981 -0.232953217  1.163940046 -0.296888665
 [91] -0.931485109  0.430193655  0.281142404 -0.087871629 -0.686719796
 [96]  0.730727246 -0.456931056  0.602365765 -0.159406517  1.101007531
> colRanges(tmp)
          [,1]     [,2]       [,3]      [,4]       [,5]       [,6]      [,7]
[1,] 0.6083674 1.793302 -0.2919328 0.3560515 -0.2806718 0.05439631 0.3544896
[2,] 0.6083674 1.793302 -0.2919328 0.3560515 -0.2806718 0.05439631 0.3544896
         [,8]       [,9]    [,10]     [,11]      [,12]     [,13]    [,14]
[1,] 1.472201 -0.4722019 1.914003 0.3087702 -0.8260484 0.7579958 1.288247
[2,] 1.472201 -0.4722019 1.914003 0.3087702 -0.8260484 0.7579958 1.288247
          [,15]    [,16]      [,17]      [,18]      [,19]      [,20]     [,21]
[1,] -0.8424515 1.890004 -0.3182628 0.09375228 -0.0687286 -0.5926856 0.5968837
[2,] -0.8424515 1.890004 -0.3182628 0.09375228 -0.0687286 -0.5926856 0.5968837
         [,22]        [,23]    [,24]      [,25]     [,26]    [,27]      [,28]
[1,] -1.167759 -0.005961172 1.816109 -0.5858318 0.5193205 0.547933 -0.4710175
[2,] -1.167759 -0.005961172 1.816109 -0.5858318 0.5193205 0.547933 -0.4710175
          [,29]      [,30]      [,31]     [,32]       [,33]    [,34]    [,35]
[1,] -0.4784093 -0.8704227 -0.7963747 -0.311335 -0.01474563 1.925113 1.050241
[2,] -0.4784093 -0.8704227 -0.7963747 -0.311335 -0.01474563 1.925113 1.050241
          [,36]     [,37]     [,38]    [,39]    [,40]       [,41]      [,42]
[1,] -0.6249487 0.5028868 -1.202012 -1.00919 2.676685 0.005194969 -0.9447973
[2,] -0.6249487 0.5028868 -1.202012 -1.00919 2.676685 0.005194969 -0.9447973
          [,43]     [,44]     [,45]     [,46]     [,47]      [,48]     [,49]
[1,] -0.7167917 0.3292622 0.5208152 0.7899037 0.6757864 -0.7408516 -1.891838
[2,] -0.7167917 0.3292622 0.5208152 0.7899037 0.6757864 -0.7408516 -1.891838
           [,50]     [,51]     [,52]      [,53]     [,54]      [,55]     [,56]
[1,] -0.01597653 0.2094583 0.4586317 -0.1574845 -2.631028 -0.2503483 -1.145479
[2,] -0.01597653 0.2094583 0.4586317 -0.1574845 -2.631028 -0.2503483 -1.145479
          [,57]     [,58]      [,59]      [,60]     [,61]    [,62]    [,63]
[1,] -0.5191593 0.6477165 -0.2522195 -0.1823347 0.8195051 2.203296 1.110631
[2,] -0.5191593 0.6477165 -0.2522195 -0.1823347 0.8195051 2.203296 1.110631
         [,64]     [,65]     [,66]      [,67]      [,68]     [,69]      [,70]
[1,] -1.186001 0.2790371 -1.092966 -0.1636041 0.02603344 -1.024731 -0.3380354
[2,] -1.186001 0.2790371 -1.092966 -0.1636041 0.02603344 -1.024731 -0.3380354
        [,71]     [,72]       [,73]     [,74]     [,75]     [,76]     [,77]
[1,] -0.23144 -1.387028 -0.00150587 0.3013366 -1.012355 -1.103309 0.1266514
[2,] -0.23144 -1.387028 -0.00150587 0.3013366 -1.012355 -1.103309 0.1266514
         [,78]      [,79]      [,80]     [,81]     [,82]     [,83]     [,84]
[1,] -1.694846 -0.3433293 -0.6937402 0.3832458 0.3427111 -1.222451 0.3094669
[2,] -1.694846 -0.3433293 -0.6937402 0.3832458 0.3427111 -1.222451 0.3094669
         [,85]      [,86]     [,87]      [,88]   [,89]      [,90]      [,91]
[1,] 0.1506353 -0.6980549 -1.580905 -0.2329532 1.16394 -0.2968887 -0.9314851
[2,] 0.1506353 -0.6980549 -1.580905 -0.2329532 1.16394 -0.2968887 -0.9314851
         [,92]     [,93]       [,94]      [,95]     [,96]      [,97]     [,98]
[1,] 0.4301937 0.2811424 -0.08787163 -0.6867198 0.7307272 -0.4569311 0.6023658
[2,] 0.4301937 0.2811424 -0.08787163 -0.6867198 0.7307272 -0.4569311 0.6023658
          [,99]   [,100]
[1,] -0.1594065 1.101008
[2,] -0.1594065 1.101008
> 
> 
> Max(tmp2)
[1] 2.288312
> Min(tmp2)
[1] -2.760983
> mean(tmp2)
[1] -0.1862338
> Sum(tmp2)
[1] -18.62338
> Var(tmp2)
[1] 0.9692308
> 
> rowMeans(tmp2)
  [1] -0.121827038 -0.621727915  0.020051477  0.004325182  0.292888646
  [6] -1.528525748 -0.314009073 -0.184596722  0.349192906  0.654364269
 [11]  2.288311638  0.492633110 -1.191676223 -1.060332197 -0.126581808
 [16] -0.487672513 -0.100016466 -0.175764549 -0.422898243 -1.395818951
 [21]  0.072340631 -1.112010168 -0.974615580 -0.507404008  1.194902866
 [26]  0.204361456  1.852201899 -0.434224278 -1.316634022 -1.136429989
 [31] -2.760983046  0.179626991  0.802878244  0.823578553 -1.587194012
 [36]  1.176441575 -0.889942422 -0.083434991 -0.102963895 -0.698686521
 [41] -1.611093386 -1.061544912 -1.130078578  0.357888009  0.196579572
 [46] -0.143095204 -0.336707901 -1.871194606  1.115555936  0.107354685
 [51] -1.990840029  0.111093388  0.681076974  0.167814189 -0.419262481
 [56] -0.723092599 -1.377547804  0.060563606  0.610195574 -1.496159973
 [61] -0.122729527  1.553793193 -1.716727375  0.997600541 -1.571104175
 [66]  0.045610195  1.437822275  0.290570473  0.850898309 -1.710592795
 [71] -1.447750180 -0.364475675 -0.555042072 -0.902252668 -0.093060071
 [76]  0.792780942 -0.650106892  0.030667706  0.807371166  1.634974411
 [81] -1.505185740  0.161385743  2.214406526  1.043706320 -0.030597399
 [86]  1.043110487 -0.267441912 -1.442906032 -0.788899049  0.019938427
 [91]  0.193311845 -0.873358935  0.174424914  0.029074080  1.747423071
 [96] -1.189592182 -0.789813978 -0.593643984  0.340760382  0.262634653
> rowSums(tmp2)
  [1] -0.121827038 -0.621727915  0.020051477  0.004325182  0.292888646
  [6] -1.528525748 -0.314009073 -0.184596722  0.349192906  0.654364269
 [11]  2.288311638  0.492633110 -1.191676223 -1.060332197 -0.126581808
 [16] -0.487672513 -0.100016466 -0.175764549 -0.422898243 -1.395818951
 [21]  0.072340631 -1.112010168 -0.974615580 -0.507404008  1.194902866
 [26]  0.204361456  1.852201899 -0.434224278 -1.316634022 -1.136429989
 [31] -2.760983046  0.179626991  0.802878244  0.823578553 -1.587194012
 [36]  1.176441575 -0.889942422 -0.083434991 -0.102963895 -0.698686521
 [41] -1.611093386 -1.061544912 -1.130078578  0.357888009  0.196579572
 [46] -0.143095204 -0.336707901 -1.871194606  1.115555936  0.107354685
 [51] -1.990840029  0.111093388  0.681076974  0.167814189 -0.419262481
 [56] -0.723092599 -1.377547804  0.060563606  0.610195574 -1.496159973
 [61] -0.122729527  1.553793193 -1.716727375  0.997600541 -1.571104175
 [66]  0.045610195  1.437822275  0.290570473  0.850898309 -1.710592795
 [71] -1.447750180 -0.364475675 -0.555042072 -0.902252668 -0.093060071
 [76]  0.792780942 -0.650106892  0.030667706  0.807371166  1.634974411
 [81] -1.505185740  0.161385743  2.214406526  1.043706320 -0.030597399
 [86]  1.043110487 -0.267441912 -1.442906032 -0.788899049  0.019938427
 [91]  0.193311845 -0.873358935  0.174424914  0.029074080  1.747423071
 [96] -1.189592182 -0.789813978 -0.593643984  0.340760382  0.262634653
> 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.121827038 -0.621727915  0.020051477  0.004325182  0.292888646
  [6] -1.528525748 -0.314009073 -0.184596722  0.349192906  0.654364269
 [11]  2.288311638  0.492633110 -1.191676223 -1.060332197 -0.126581808
 [16] -0.487672513 -0.100016466 -0.175764549 -0.422898243 -1.395818951
 [21]  0.072340631 -1.112010168 -0.974615580 -0.507404008  1.194902866
 [26]  0.204361456  1.852201899 -0.434224278 -1.316634022 -1.136429989
 [31] -2.760983046  0.179626991  0.802878244  0.823578553 -1.587194012
 [36]  1.176441575 -0.889942422 -0.083434991 -0.102963895 -0.698686521
 [41] -1.611093386 -1.061544912 -1.130078578  0.357888009  0.196579572
 [46] -0.143095204 -0.336707901 -1.871194606  1.115555936  0.107354685
 [51] -1.990840029  0.111093388  0.681076974  0.167814189 -0.419262481
 [56] -0.723092599 -1.377547804  0.060563606  0.610195574 -1.496159973
 [61] -0.122729527  1.553793193 -1.716727375  0.997600541 -1.571104175
 [66]  0.045610195  1.437822275  0.290570473  0.850898309 -1.710592795
 [71] -1.447750180 -0.364475675 -0.555042072 -0.902252668 -0.093060071
 [76]  0.792780942 -0.650106892  0.030667706  0.807371166  1.634974411
 [81] -1.505185740  0.161385743  2.214406526  1.043706320 -0.030597399
 [86]  1.043110487 -0.267441912 -1.442906032 -0.788899049  0.019938427
 [91]  0.193311845 -0.873358935  0.174424914  0.029074080  1.747423071
 [96] -1.189592182 -0.789813978 -0.593643984  0.340760382  0.262634653
> rowMin(tmp2)
  [1] -0.121827038 -0.621727915  0.020051477  0.004325182  0.292888646
  [6] -1.528525748 -0.314009073 -0.184596722  0.349192906  0.654364269
 [11]  2.288311638  0.492633110 -1.191676223 -1.060332197 -0.126581808
 [16] -0.487672513 -0.100016466 -0.175764549 -0.422898243 -1.395818951
 [21]  0.072340631 -1.112010168 -0.974615580 -0.507404008  1.194902866
 [26]  0.204361456  1.852201899 -0.434224278 -1.316634022 -1.136429989
 [31] -2.760983046  0.179626991  0.802878244  0.823578553 -1.587194012
 [36]  1.176441575 -0.889942422 -0.083434991 -0.102963895 -0.698686521
 [41] -1.611093386 -1.061544912 -1.130078578  0.357888009  0.196579572
 [46] -0.143095204 -0.336707901 -1.871194606  1.115555936  0.107354685
 [51] -1.990840029  0.111093388  0.681076974  0.167814189 -0.419262481
 [56] -0.723092599 -1.377547804  0.060563606  0.610195574 -1.496159973
 [61] -0.122729527  1.553793193 -1.716727375  0.997600541 -1.571104175
 [66]  0.045610195  1.437822275  0.290570473  0.850898309 -1.710592795
 [71] -1.447750180 -0.364475675 -0.555042072 -0.902252668 -0.093060071
 [76]  0.792780942 -0.650106892  0.030667706  0.807371166  1.634974411
 [81] -1.505185740  0.161385743  2.214406526  1.043706320 -0.030597399
 [86]  1.043110487 -0.267441912 -1.442906032 -0.788899049  0.019938427
 [91]  0.193311845 -0.873358935  0.174424914  0.029074080  1.747423071
 [96] -1.189592182 -0.789813978 -0.593643984  0.340760382  0.262634653
> 
> colMeans(tmp2)
[1] -0.1862338
> colSums(tmp2)
[1] -18.62338
> colVars(tmp2)
[1] 0.9692308
> colSd(tmp2)
[1] 0.9844952
> colMax(tmp2)
[1] 2.288312
> colMin(tmp2)
[1] -2.760983
> colMedians(tmp2)
[1] -0.1123955
> colRanges(tmp2)
          [,1]
[1,] -2.760983
[2,]  2.288312
> 
> 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.46133750 -3.41653582 -1.32245552 -2.06291201  3.24571103 -0.06015098
 [7] -2.15862064  3.73632214 -3.39411733  1.91073579
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.94307771
[2,] -0.01834947
[3,]  0.46730502
[4,]  1.11185687
[5,]  1.80728876
> 
> rowApply(tmp,sum)
 [1] -0.7696908 -4.8863756 -3.2394938  4.5661930  3.4904119 -4.6284588
 [7]  2.6957507 -3.3375638  4.0218837  3.0266575
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8   10    6    7    1    6   10    3    8     2
 [2,]    3    1    1    5   10    1    7    7   10     6
 [3,]    7    2    2    9    9    8    2    1    5     7
 [4,]    2    7    5    1    5    3    5   10    1    10
 [5,]    6    8    9    2    7    5    6    5    9     5
 [6,]    5    5    3    8    2    7    4    9    3     8
 [7,]    4    4   10    3    4   10    1    2    4     3
 [8,]   10    6    7    6    8    9    3    4    6     4
 [9,]    1    3    8    4    6    2    9    6    2     9
[10,]    9    9    4   10    3    4    8    8    7     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.69007659  1.48451931  1.76341500  2.27710774  0.83011308  1.40039703
 [7] -0.36224941  1.00696584 -0.90973267  0.06516137 -4.37344588  1.13394317
[13] -2.50262499 -0.18006283 -3.70915279  0.38900926  2.04765244 -3.09703820
[19]  2.45707907  1.19833826
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.9297268
[2,]  0.3217605
[3,]  0.4891377
[4,]  0.7035346
[5,]  3.1053706
> 
> rowApply(tmp,sum)
[1] -0.9117128  2.3402735 -0.2007129  0.8701974  2.5114262
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    3   13   14   20   14
[2,]   19    6   17    5   16
[3,]    2   19   19    1   20
[4,]    5    5   20   16   17
[5,]    8   14   12    7   12
> 
> 
> as.matrix(tmp)
           [,1]       [,2]      [,3]       [,4]       [,5]        [,6]
[1,] -0.9297268  0.8849200 -1.359281 -0.3770064 -0.1345512  0.54937418
[2,]  0.7035346 -0.4171568  1.488639 -1.0143894  0.8229758  0.64415293
[3,]  0.3217605  0.9183720  1.671142  1.8812117  0.1654867 -0.08236694
[4,]  3.1053706 -0.5557771 -1.580172  0.5983181 -0.4471688  0.45869919
[5,]  0.4891377  0.6541613  1.543088  1.1889737  0.4233707 -0.16946234
           [,7]       [,8]       [,9]      [,10]       [,11]      [,12]
[1,] -0.9264934  0.3519017  0.2779527  0.4643529 -0.18697020  0.3705654
[2,]  0.9868501  2.2164841  0.3876797 -1.0305114 -1.59378423 -0.3323296
[3,]  0.3155917 -1.7892676 -0.8367348 -1.6601236 -0.05255111  0.7274744
[4,] -0.3010820  0.9719190 -0.5177229  0.8856147 -0.72702472 -0.1255481
[5,] -0.4371159 -0.7440714 -0.2209073  1.4058286 -1.81311562  0.4937811
          [,13]       [,14]      [,15]       [,16]       [,17]       [,18]
[1,]  0.3738980  0.04915249 -2.7872246  0.67252287 -0.29200052  0.07650978
[2,] -1.9289909  1.00052546  1.0746869  0.09499421  1.15166572 -1.66433542
[3,] -2.2917345 -0.06866738 -0.1930081  0.08356186  0.51992960 -1.03405637
[4,]  0.1116938 -0.43146860 -1.0353192 -0.66037727  0.62267190 -0.43114616
[5,]  1.2325086 -0.72960481 -0.7682878  0.19830760  0.04538573 -0.04401003
           [,19]      [,20]
[1,]  0.57753832  1.4328528
[2,] -0.07350702 -0.1769101
[3,]  1.04249918  0.1607680
[4,]  0.45194511  0.4767723
[5,]  0.45860347 -0.6951448
> 
> 
> 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.6-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.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  679  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.6-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.6-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.8514471 0.2703197 1.252723 -0.6969306 1.89497 -0.6768948 0.3753756
          col8     col9       col10    col11     col12     col13     col14
row1 0.3063049 1.140368 -0.02334931 1.139401 -0.181743 -1.971715 -1.701774
         col15      col16      col17     col18    col19    col20
row1 0.5851355 -0.5290219 -0.6255334 -0.688917 1.533991 0.486904
> tmp[,"col10"]
            col10
row1 -0.023349306
row2 -1.791404708
row3 -0.001591272
row4 -1.989790114
row5 -1.238679448
> tmp[c("row1","row5"),]
           col1      col2       col3       col4     col5       col6      col7
row1  0.8514471 0.2703197  1.2527231 -0.6969306 1.894970 -0.6768948 0.3753756
row5 -0.1710591 0.1803253 -0.3824604 -1.8770946 1.600946  0.3981932 0.1546385
          col8       col9       col10     col11      col12       col13
row1 0.3063049  1.1403675 -0.02334931 1.1394011 -0.1817430 -1.97171465
row5 0.4676666 -0.4260983 -1.23867945 0.5284227  0.3179518 -0.02095088
          col14      col15      col16      col17      col18    col19      col20
row1 -1.7017738  0.5851355 -0.5290219 -0.6255334 -0.6889170 1.533991  0.4869040
row5 -0.4705794 -0.3821890  0.8840776  2.0359383  0.3748784 1.957047 -0.3038788
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.6768948  0.4869040
row2 -0.4035983 -1.1046405
row3  0.4728309  0.3224378
row4 -0.7158832 -0.8302024
row5  0.3981932 -0.3038788
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.6768948  0.4869040
row5  0.3981932 -0.3038788
> 
> 
> 
> 
> 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 50.18934 49.73577 49.72869 49.63893 50.30578 105.2451 49.75455 51.14644
        col9    col10    col11    col12    col13    col14    col15   col16
row1 48.4605 49.83988 50.03666 50.53428 50.30793 49.29721 48.96727 49.8122
        col17    col18    col19    col20
row1 49.71553 48.62411 50.22692 104.6987
> tmp[,"col10"]
        col10
row1 49.83988
row2 29.51597
row3 29.82654
row4 29.96048
row5 49.06092
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.18934 49.73577 49.72869 49.63893 50.30578 105.2451 49.75455 51.14644
row5 50.91820 50.30893 49.71390 49.35219 50.91654 105.0585 51.05228 47.83693
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.46050 49.83988 50.03666 50.53428 50.30793 49.29721 48.96727 49.81220
row5 50.89386 49.06092 51.31655 49.29863 51.36699 50.32245 50.05893 49.67778
        col17    col18    col19    col20
row1 49.71553 48.62411 50.22692 104.6987
row5 49.62840 51.52614 49.90221 104.7320
> tmp[,c("col6","col20")]
          col6     col20
row1 105.24506 104.69868
row2  74.23299  74.95834
row3  72.70238  73.84044
row4  75.51894  74.16076
row5 105.05852 104.73202
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.2451 104.6987
row5 105.0585 104.7320
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.2451 104.6987
row5 105.0585 104.7320
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.9326477
[2,]  1.2200277
[3,] -0.3000212
[4,]  1.7514075
[5,]  0.2709712
> tmp[,c("col17","col7")]
          col17        col7
[1,]  1.1616111  0.45647136
[2,]  0.9064270 -0.21294511
[3,] -0.2167480 -0.54137713
[4,]  0.1128381  0.06978229
[5,]  0.4297695 -0.74959458
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  1.0067832 -1.7966666
[2,] -0.6592791 -0.6779591
[3,]  0.5344039 -0.5450912
[4,]  0.5651167  0.6465082
[5,] -0.7546512 -0.2492155
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.006783
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  1.0067832
[2,] -0.6592791
> 
> 
> 
> 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.1338937 1.26175055 -0.1426790 -0.8828652 -0.8941966  1.170914
row1 -1.2552859 0.02287856 -0.7006064 -0.7323725 -0.8998622 -1.117172
           [,7]       [,8]       [,9]      [,10]      [,11]     [,12]     [,13]
row3 -0.2246448 -1.1939108 -0.5916424 -2.3485049  0.4086685 1.1997051 0.4451943
row1 -0.2828135 -0.4244194  0.2672507 -0.7820725 -0.6692904 0.2369586 0.2828415
          [,14]      [,15]      [,16]    [,17]     [,18]       [,19]      [,20]
row3 -0.3050641 -0.2208069  1.2147740 1.172621 0.0925839 -0.08266532 -0.6618716
row1  1.5318899  1.0697460 -0.6016738 1.293540 0.4984534  2.40349247  0.8763167
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]       [,2]     [,3]       [,4]     [,5]       [,6]      [,7]
row2 1.846369 -0.4461545 0.604152 -0.2633499 1.311296 0.02600957 0.2260367
           [,8]       [,9]    [,10]
row2 -0.3992303 -0.2104834 1.315875
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]     [,4]       [,5]       [,6]      [,7]
row5 0.4787392 -1.383818 -0.2554899 0.568025 -0.9078263 -0.3788704 0.6457037
         [,8]      [,9]     [,10]    [,11]      [,12]       [,13]      [,14]
row5 1.569239 0.6841912 -1.061979 1.778177 -0.7553178 -0.01754741 -0.6141209
         [,15]     [,16]    [,17]    [,18]      [,19]    [,20]
row5 0.1920825 0.7056592 0.532178 1.271645 -0.4047963 1.056255
> 
> 
> 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: 0x0000000005023658>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1940768468b7"
 [2] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1940cfd5e04" 
 [3] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM19401d4d471c"
 [4] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1940f653ff9" 
 [5] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM194017fa4542"
 [6] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1940296760d6"
 [7] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1940407173b6"
 [8] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM194014415034"
 [9] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM19402b112e8a"
[10] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM1940215c174c"
[11] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM19401f9f7a54"
[12] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM19401adc1e16"
[13] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM19401e833279"
[14] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM194012756bb2"
[15] "C:/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM194046346cac"
> 
> 
> ### 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: 0x000000000b7227e8>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x000000000b7227e8>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.6-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x000000000b7227e8>
> rowMedians(tmp)
  [1] -0.3379020220 -0.2153367528 -0.3209684149  0.1521928554 -0.2397777313
  [6]  0.1484543288 -0.0523128210  0.0768651351  0.4507862812  0.1395834457
 [11] -0.1809097610 -0.1415543370  0.1679998545 -0.1153618286 -0.4426999789
 [16]  0.0046190666  0.1602307766 -0.1516056344 -0.2635133342 -0.1530725246
 [21] -0.2297714924 -0.2455203564 -0.0221421524 -0.5722633782  0.3595153672
 [26] -0.4132308931 -0.0388400268  0.2209296508 -0.4471142854  0.1046072917
 [31] -0.2535723847 -0.2017218104  0.2553451574  0.0127041283  0.2067855941
 [36]  0.2880198293  0.5916593459  0.2004455331 -0.1571520716  0.4935003205
 [41] -0.2525998946 -0.4270978885 -0.1982563085  0.5486271855  0.4790388336
 [46] -0.5969177018 -0.1729303005 -0.1322054044 -0.3882486557  0.1528209599
 [51] -0.2779006352 -0.2997095657  0.2484269476  0.0600045022  0.2359645802
 [56] -0.1485989119 -0.3271994889 -0.9230414396  0.0003645476  0.1647964288
 [61]  0.1652503943  0.6952627828 -0.0782739104  0.3797773531 -0.0389564645
 [66] -0.0016499787  0.7505754075  0.3953136494  0.2210139833  0.1609438440
 [71] -0.0013781555  0.3305376201 -0.4410929997 -0.4330148430 -0.2809136262
 [76] -0.4664000238  0.1447208158  0.0885510943 -0.4416775723 -0.1888121314
 [81]  0.2449855835 -0.1748361818  0.0824059086 -0.1508543969 -0.0727803801
 [86] -0.0367840110  0.1178770143  0.7233730148 -0.3261519565  0.0599243842
 [91]  0.1288060422 -0.1693222197  0.0310707571 -0.2498410861 -0.0316228963
 [96]  0.3467768846 -0.2400189959  0.0216236926  0.0929539432 -0.1104646107
[101] -0.3028524391 -0.7337697278 -0.0259369152  0.0994956980 -0.2313400839
[106]  0.3681328969  1.0187515402  0.0504299420  0.3906841964  0.0597876767
[111]  0.2974527327 -0.1132582233 -0.0872316976  0.5066382451 -0.1582803108
[116] -0.1097030068 -0.6048591814 -0.6031855965  0.0395058270 -0.1053950459
[121]  0.2132242759  0.6063308299 -0.3323542709  0.0511265877 -0.2681563572
[126]  0.0451261755  0.1074877908  0.4842713707 -0.0847527533  0.1370202142
[131]  0.1998035526 -0.5996871157  0.1948760745 -0.2849940607  0.4253237400
[136] -0.5688147089 -0.2767767860  0.2984337808 -0.4506092383  0.4795435232
[141]  0.2865719974 -0.6588905371  0.4109615439 -0.5902343713 -0.1279582950
[146]  0.5853150754  0.0530303282 -0.2722652638  0.0745202068 -0.5557052174
[151] -0.2665342812 -0.3703624944 -0.0933887611 -0.3060361181 -0.3919469972
[156] -0.0424362174 -0.1074703023 -0.2602001850  0.0354703888 -0.3192648681
[161]  0.7979225798  0.2483018877  0.3635606369 -0.3506910052 -0.3093720012
[166]  0.3314176505  0.3850007511  0.2681617953 -0.0735400390  0.3093560556
[171]  0.3231702353 -0.5017475551 -0.2691538803 -0.4140013908  0.0491084564
[176] -0.5289777839  0.6092362726  0.2525512379 -0.3706264487 -0.1858642115
[181]  0.2355751177  0.9591933432 -0.3571478275 -0.2599463724  0.1098196854
[186] -0.4576894535  0.5042992241  0.9319105911 -0.1141507018  0.5815168288
[191]  0.1959265987  0.6394579747  0.1502090288 -0.2852900533  0.2051925927
[196] -0.2869989678 -0.0408290173 -0.1075445835  0.4257510002  0.1974298209
[201]  0.3551975207  0.1079967408 -0.5434713293  0.3708384962 -0.4294939259
[206]  0.2080717640  0.4311810397  0.4134364418  0.1279548328 -0.0015667533
[211] -0.2384519207  0.2593500409  0.2816548023 -0.3635497340 -0.4981019917
[216]  0.6820422855 -0.3316305947 -0.4103019859 -0.4676226836  0.0816960963
[221] -0.2052958196  0.2653601403 -0.7419116593 -0.3692961369  0.0527889718
[226] -0.1562840509  0.3101587150 -0.4404008048  0.1354061672 -0.2550537538
> 
> proc.time()
   user  system elapsed 
   2.96    6.42    9.76 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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: 0x021fc878>
> .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: 0x021fc878>
> .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: 0x021fc878>
> .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: 0x021fc878>
> 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: 0x0228a4a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0228a4a0>
> .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: 0x0228a4a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0228a4a0>
> .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: 0x0228a4a0>
> 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: 0x026fa4c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x026fa4c0>
> .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: 0x026fa4c0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x026fa4c0>
> .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: 0x026fa4c0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x026fa4c0>
> .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: 0x026fa4c0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x026fa4c0>
> .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: 0x026fa4c0>
> 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: 0x02968f78>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x02968f78>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02968f78>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02968f78>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile186054dc5650" "BufferedMatrixFile1860563c2ed4"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile186054dc5650" "BufferedMatrixFile1860563c2ed4"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x02a452e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02a452e0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x02a452e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x02a452e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x02a452e0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x02a452e0>
> .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: 0x022643e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x022643e0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x022643e0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x022643e0>
> 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: 0x02f09a10>
> .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: 0x02f09a10>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.34    0.04    0.39 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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: 0x0000000006859638>
> .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: 0x0000000006859638>
> .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: 0x0000000006859638>
> .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: 0x0000000006859638>
> 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: 0x0000000006715c48>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000006715c48>
> .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: 0x0000000006715c48>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000006715c48>
> .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: 0x0000000006715c48>
> 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: 0x00000000051e5008>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000051e5008>
> .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: 0x00000000051e5008>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x00000000051e5008>
> .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: 0x00000000051e5008>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x00000000051e5008>
> .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: 0x00000000051e5008>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x00000000051e5008>
> .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: 0x00000000051e5008>
> 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: 0x0000000006075f48>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000000006075f48>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000006075f48>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000006075f48>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile11c827432ab2" "BufferedMatrixFile11c85dc9b13" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile11c827432ab2" "BufferedMatrixFile11c85dc9b13" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000059ccd98>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000059ccd98>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x00000000059ccd98>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x00000000059ccd98>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x00000000059ccd98>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x00000000059ccd98>
> .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: 0x0000000005174aa8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005174aa8>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005174aa8>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x0000000005174aa8>
> 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: 0x0000000004ed2c90>
> .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: 0x0000000004ed2c90>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.40    0.04    0.46 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.35    0.00    0.36 

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.06    0.40 

Example timings