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

CHECK report for BufferedMatrix on tokay1

This page was generated on 2021-05-06 12:30:05 -0400 (Thu, 06 May 2021).

To the developers/maintainers of the BufferedMatrix package:
Please make sure to use the following settings in order to reproduce any error or warning you see on this page.
Package 215/1974HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.54.0  (landing page)
Ben Bolstad
Snapshot Date: 2021-05-05 14:51:38 -0400 (Wed, 05 May 2021)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_12
Last Commit: eae3841
Last Changed Date: 2020-10-27 10:30:14 -0400 (Tue, 27 Oct 2020)
malbec1Linux (Ubuntu 18.04.5 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version exists in internal repository
tokay1Windows Server 2012 R2 Standard / x64  OK    OK    OK    OK  UNNEEDED, same version exists in internal repository
merida1macOS 10.14.6 Mojave / x86_64  OK    OK    OK    OK  UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.54.0
Command: C:\Users\biocbuild\bbs-3.12-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.12-bioc\R\library --no-vignettes --timings BufferedMatrix_1.54.0.tar.gz
StartedAt: 2021-05-06 01:03:37 -0400 (Thu, 06 May 2021)
EndedAt: 2021-05-06 01:05:23 -0400 (Thu, 06 May 2021)
EllapsedTime: 105.5 seconds
RetCode: 0
Status:   OK   
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory 'C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck'
* using R version 4.0.5 (2021-03-31)
* 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.54.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 ... OK
** checking whether the namespace can be unloaded cleanly ... OK
* loading checks for arch 'x64'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files for i386 is not available
Note: information on .o files for x64 is not available
File 'C:/Users/biocbuild/bbs-3.12-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
File 'C:/Users/biocbuild/bbs-3.12-bioc/R/library/BufferedMatrix/libs/x64/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)

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

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

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


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

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  202k  100  202k    0     0  2072k      0 --:--:-- --:--:-- --:--:-- 2087k

install for i386

* installing *source* package 'BufferedMatrix' ...
** using staged installation
** libs
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c RBufferedMatrix.c -o RBufferedMatrix.o
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -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){
       ^~~~~~~~~~~~~~~~~~~
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:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init_package.c -o init_package.o
C:/rtools40/mingw32/bin/gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/extsoft/lib/i386 -LC:/extsoft/lib -LC:/Users/BIOCBU~1/BBS-3~1.12-/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.buildbin-libdir/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs/i386
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for 'rowMeans' in package 'BufferedMatrix'
Creating a new generic function for 'rowSums' in package 'BufferedMatrix'
Creating a new generic function for 'colMeans' in package 'BufferedMatrix'
Creating a new generic function for 'colSums' in package 'BufferedMatrix'
Creating a generic function for 'ncol' from package 'base' in package 'BufferedMatrix'
Creating a generic function for 'nrow' from package 'base' in package 'BufferedMatrix'
** help
*** installing help indices
  converting help for package 'BufferedMatrix'
    finding HTML links ... done
    BufferedMatrix-class                    html  
    as.BufferedMatrix                       html  
    createBufferedMatrix                    html  
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path

install for x64

* installing *source* package 'BufferedMatrix' ...
** libs
"C:/rtools40/mingw64/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c RBufferedMatrix.c -o RBufferedMatrix.o
"C:/rtools40/mingw64/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -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){
       ^~~~~~~~~~~~~~~~~~~
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:/rtools40/mingw64/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
"C:/rtools40/mingw64/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init_package.c -o init_package.o
C:/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/extsoft/lib/x64 -LC:/extsoft/lib -LC:/Users/BIOCBU~1/BBS-3~1.12-/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.54.0.zip
* DONE (BufferedMatrix)
* installing to library 'C:/Users/biocbuild/bbs-3.12-bioc/R/library'
package 'BufferedMatrix' successfully unpacked and MD5 sums checked

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.37    0.03    0.40 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.37    0.03    0.40 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.12-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 434371 13.3     920192 28.1   641734 19.6
Vcells 497006  3.8    8388608 64.0  1484756 11.4
> 
> 
> 
> 
> ##
> ## 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] "Thu May 06 01:04:37 2021"
> 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] "Thu May 06 01:04:37 2021"
> 
> 
> 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: 0x02f70c80>
> 
> 
> 
> 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] "Thu May 06 01:04:41 2021"
> 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] "Thu May 06 01:04:42 2021"
> 
> ColMode(tmp2)
<pointer: 0x02f70c80>
> 
> 
> 
> ### 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.2631894  0.146773811 -0.3384963  0.2566200
[2,]  -0.7370351 -0.008972358 -0.3559811  0.4506930
[3,]   0.7953254  1.054716558  0.7875092 -0.3565591
[4,]   0.4528045 -1.042283602 -3.0372702  0.4084834
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.12-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,] 100.2631894 0.146773811 0.3384963 0.2566200
[2,]   0.7370351 0.008972358 0.3559811 0.4506930
[3,]   0.7953254 1.054716558 0.7875092 0.3565591
[4,]   0.4528045 1.042283602 3.0372702 0.4084834
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.12-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.0131508 0.38311070 0.5818043 0.5065767
[2,]  0.8585075 0.09472253 0.5966415 0.6713367
[3,]  0.8918102 1.02699394 0.8874172 0.5971257
[4,]  0.6729075 1.02092292 1.7427766 0.6391271
> 
> 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.12-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,] 225.39470 28.97788 31.15654 30.32239
[2,]  34.32211 25.95620 31.32240 32.16406
[3,]  34.71343 36.32466 34.66168 31.32782
[4,]  32.18188 36.25151 45.46504 31.79975
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x086eaa68>
> exp(tmp5)
<pointer: 0x086eaa68>
> log(tmp5,2)
<pointer: 0x086eaa68>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.1295
> Min(tmp5)
[1] 54.02442
> mean(tmp5)
[1] 72.84184
> Sum(tmp5)
[1] 14568.37
> Var(tmp5)
[1] 864.567
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.09407 73.02020 70.66034 73.15741 70.22847 71.00757 70.55640 70.97315
 [9] 70.40376 70.31707
> rowSums(tmp5)
 [1] 1761.881 1460.404 1413.207 1463.148 1404.569 1420.151 1411.128 1419.463
 [9] 1408.075 1406.341
> rowVars(tmp5)
 [1] 8071.62345   81.76985   61.20329   77.58499   98.43002   70.75950
 [7]   81.12077   98.47181   71.15838   60.18580
> rowSd(tmp5)
 [1] 89.842214  9.042668  7.823253  8.808234  9.921190  8.411867  9.006707
 [8]  9.923296  8.435543  7.757951
> rowMax(tmp5)
 [1] 469.12953  96.82425  83.67038  94.62952  91.14040  86.62633  88.47865
 [8]  90.41774  86.97679  84.69262
> rowMin(tmp5)
 [1] 60.31366 54.02442 58.35089 59.96838 57.51818 55.99496 56.93759 57.62884
 [9] 55.54275 54.77369
> 
> colMeans(tmp5)
 [1] 111.38381  68.24301  70.67912  67.38239  73.24609  70.94499  67.93702
 [8]  68.70786  69.09618  69.60127  71.65603  68.25506  73.01403  70.65401
[15]  69.27812  71.68892  75.28381  76.39071  71.28111  72.11332
> colSums(tmp5)
 [1] 1113.8381  682.4301  706.7912  673.8239  732.4609  709.4499  679.3702
 [8]  687.0786  690.9618  696.0127  716.5603  682.5506  730.1403  706.5401
[15]  692.7812  716.8892  752.8381  763.9071  712.8111  721.1332
> colVars(tmp5)
 [1] 15864.68402   106.25312    96.05748    31.97495    84.07094    57.21376
 [7]    47.64221    57.00964    49.15056    47.73080    60.75126    78.86820
[13]    78.46657   154.00929    93.31231   109.48284    67.00508    32.52279
[19]    65.51393    75.51690
> colSd(tmp5)
 [1] 125.955087  10.307915   9.800892   5.654640   9.169021   7.563978
 [7]   6.902334   7.550473   7.010746   6.908748   7.794309   8.880777
[13]   8.858136  12.410048   9.659830  10.463405   8.185663   5.702876
[19]   8.094068   8.690046
> colMax(tmp5)
 [1] 469.12953  88.47865  94.62952  78.25081  86.97679  85.97084  80.49527
 [8]  82.55053  82.71535  77.19536  84.25993  86.62633  90.41774  91.14040
[15]  85.88827  96.82425  86.00459  83.67038  82.45416  84.69262
> colMin(tmp5)
 [1] 60.02624 54.02442 62.73488 62.42397 57.51818 61.92500 58.40242 55.99496
 [9] 58.37410 59.04864 54.77369 59.96838 62.45549 55.54275 58.89708 63.17919
[17] 56.93759 66.55161 61.99575 58.35089
> 
> 
> ### 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] 88.09407 73.02020 70.66034 73.15741       NA 71.00757 70.55640 70.97315
 [9] 70.40376 70.31707
> rowSums(tmp5)
 [1] 1761.881 1460.404 1413.207 1463.148       NA 1420.151 1411.128 1419.463
 [9] 1408.075 1406.341
> rowVars(tmp5)
 [1] 8071.62345   81.76985   61.20329   77.58499   94.45089   70.75950
 [7]   81.12077   98.47181   71.15838   60.18580
> rowSd(tmp5)
 [1] 89.842214  9.042668  7.823253  8.808234  9.718585  8.411867  9.006707
 [8]  9.923296  8.435543  7.757951
> rowMax(tmp5)
 [1] 469.12953  96.82425  83.67038  94.62952        NA  86.62633  88.47865
 [8]  90.41774  86.97679  84.69262
> rowMin(tmp5)
 [1] 60.31366 54.02442 58.35089 59.96838       NA 55.99496 56.93759 57.62884
 [9] 55.54275 54.77369
> 
> colMeans(tmp5)
 [1] 111.38381  68.24301  70.67912  67.38239        NA  70.94499  67.93702
 [8]  68.70786  69.09618  69.60127  71.65603  68.25506  73.01403  70.65401
[15]  69.27812  71.68892  75.28381  76.39071  71.28111  72.11332
> colSums(tmp5)
 [1] 1113.8381  682.4301  706.7912  673.8239        NA  709.4499  679.3702
 [8]  687.0786  690.9618  696.0127  716.5603  682.5506  730.1403  706.5401
[15]  692.7812  716.8892  752.8381  763.9071  712.8111  721.1332
> colVars(tmp5)
 [1] 15864.68402   106.25312    96.05748    31.97495          NA    57.21376
 [7]    47.64221    57.00964    49.15056    47.73080    60.75126    78.86820
[13]    78.46657   154.00929    93.31231   109.48284    67.00508    32.52279
[19]    65.51393    75.51690
> colSd(tmp5)
 [1] 125.955087  10.307915   9.800892   5.654640         NA   7.563978
 [7]   6.902334   7.550473   7.010746   6.908748   7.794309   8.880777
[13]   8.858136  12.410048   9.659830  10.463405   8.185663   5.702876
[19]   8.094068   8.690046
> colMax(tmp5)
 [1] 469.12953  88.47865  94.62952  78.25081        NA  85.97084  80.49527
 [8]  82.55053  82.71535  77.19536  84.25993  86.62633  90.41774  91.14040
[15]  85.88827  96.82425  86.00459  83.67038  82.45416  84.69262
> colMin(tmp5)
 [1] 60.02624 54.02442 62.73488 62.42397       NA 61.92500 58.40242 55.99496
 [9] 58.37410 59.04864 54.77369 59.96838 62.45549 55.54275 58.89708 63.17919
[17] 56.93759 66.55161 61.99575 58.35089
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.1295
> Min(tmp5,na.rm=TRUE)
[1] 54.02442
> mean(tmp5,na.rm=TRUE)
[1] 72.91885
> Sum(tmp5,na.rm=TRUE)
[1] 14510.85
> Var(tmp5,na.rm=TRUE)
[1] 867.7416
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.09407 73.02020 70.66034 73.15741 70.89744 71.00757 70.55640 70.97315
 [9] 70.40376 70.31707
> rowSums(tmp5,na.rm=TRUE)
 [1] 1761.881 1460.404 1413.207 1463.148 1347.051 1420.151 1411.128 1419.463
 [9] 1408.075 1406.341
> rowVars(tmp5,na.rm=TRUE)
 [1] 8071.62345   81.76985   61.20329   77.58499   94.45089   70.75950
 [7]   81.12077   98.47181   71.15838   60.18580
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.842214  9.042668  7.823253  8.808234  9.718585  8.411867  9.006707
 [8]  9.923296  8.435543  7.757951
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.12953  96.82425  83.67038  94.62952  91.14040  86.62633  88.47865
 [8]  90.41774  86.97679  84.69262
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.31366 54.02442 58.35089 59.96838 57.98027 55.99496 56.93759 57.62884
 [9] 55.54275 54.77369
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.38381  68.24301  70.67912  67.38239  74.99364  70.94499  67.93702
 [8]  68.70786  69.09618  69.60127  71.65603  68.25506  73.01403  70.65401
[15]  69.27812  71.68892  75.28381  76.39071  71.28111  72.11332
> colSums(tmp5,na.rm=TRUE)
 [1] 1113.8381  682.4301  706.7912  673.8239  674.9428  709.4499  679.3702
 [8]  687.0786  690.9618  696.0127  716.5603  682.5506  730.1403  706.5401
[15]  692.7812  716.8892  752.8381  763.9071  712.8111  721.1332
> colVars(tmp5,na.rm=TRUE)
 [1] 15864.68402   106.25312    96.05748    31.97495    60.22323    57.21376
 [7]    47.64221    57.00964    49.15056    47.73080    60.75126    78.86820
[13]    78.46657   154.00929    93.31231   109.48284    67.00508    32.52279
[19]    65.51393    75.51690
> colSd(tmp5,na.rm=TRUE)
 [1] 125.955087  10.307915   9.800892   5.654640   7.760363   7.563978
 [7]   6.902334   7.550473   7.010746   6.908748   7.794309   8.880777
[13]   8.858136  12.410048   9.659830  10.463405   8.185663   5.702876
[19]   8.094068   8.690046
> colMax(tmp5,na.rm=TRUE)
 [1] 469.12953  88.47865  94.62952  78.25081  86.97679  85.97084  80.49527
 [8]  82.55053  82.71535  77.19536  84.25993  86.62633  90.41774  91.14040
[15]  85.88827  96.82425  86.00459  83.67038  82.45416  84.69262
> colMin(tmp5,na.rm=TRUE)
 [1] 60.02624 54.02442 62.73488 62.42397 63.10853 61.92500 58.40242 55.99496
 [9] 58.37410 59.04864 54.77369 59.96838 62.45549 55.54275 58.89708 63.17919
[17] 56.93759 66.55161 61.99575 58.35089
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.09407 73.02020 70.66034 73.15741      NaN 71.00757 70.55640 70.97315
 [9] 70.40376 70.31707
> rowSums(tmp5,na.rm=TRUE)
 [1] 1761.881 1460.404 1413.207 1463.148    0.000 1420.151 1411.128 1419.463
 [9] 1408.075 1406.341
> rowVars(tmp5,na.rm=TRUE)
 [1] 8071.62345   81.76985   61.20329   77.58499         NA   70.75950
 [7]   81.12077   98.47181   71.15838   60.18580
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.842214  9.042668  7.823253  8.808234        NA  8.411867  9.006707
 [8]  9.923296  8.435543  7.757951
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.12953  96.82425  83.67038  94.62952        NA  86.62633  88.47865
 [8]  90.41774  86.97679  84.69262
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.31366 54.02442 58.35089 59.96838       NA 55.99496 56.93759 57.62884
 [9] 55.54275 54.77369
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.09021  69.38332  70.18651  66.17479       NaN  71.86441  67.79582
 [8]  67.16978  68.96337  70.77379  71.41940  68.92290  72.21354  68.37775
[15]  70.38717  71.54089  75.49960  76.42837  70.03966  73.41946
> colSums(tmp5,na.rm=TRUE)
 [1] 1053.8119  624.4498  631.6786  595.5731    0.0000  646.7797  610.1624
 [8]  604.5280  620.6703  636.9641  642.7746  620.3061  649.9219  615.3997
[15]  633.4846  643.8680  679.4964  687.8553  630.3569  660.7751
> colVars(tmp5,na.rm=TRUE)
 [1] 17481.43624   104.90644   105.33463    19.56594          NA    54.85548
 [7]    53.37318    37.52202    55.09594    38.23074    67.71523    83.70904
[13]    81.06607   114.96987    91.13881   122.92165    74.85683    36.57219
[19]    56.36468    65.76406
> colSd(tmp5,na.rm=TRUE)
 [1] 132.217383  10.242384  10.263266   4.423340         NA   7.406449
 [7]   7.305695   6.125522   7.422664   6.183101   8.228926   9.149265
[13]   9.003670  10.722400   9.546665  11.087004   8.651984   6.047494
[19]   7.507642   8.109504
> colMax(tmp5,na.rm=TRUE)
 [1] 469.12953  88.47865  94.62952  77.01531      -Inf  85.97084  80.49527
 [8]  75.80823  82.71535  77.19536  84.25993  86.62633  90.41774  84.86124
[15]  85.88827  96.82425  86.00459  83.67038  82.40425  84.69262
> colMin(tmp5,na.rm=TRUE)
 [1] 66.98237 54.02442 62.73488 62.42397      Inf 61.92500 58.40242 55.99496
 [9] 58.37410 59.82820 54.77369 59.96838 62.45549 55.54275 58.89708 63.17919
[17] 56.93759 66.55161 61.99575 58.35089
> 
> 
> 
> 
> 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] 305.8263 109.1178 213.2876 166.6822 135.6023 204.0610 132.1631 283.6612
 [9] 242.1039 228.4226
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 305.8263 109.1178 213.2876 166.6822 135.6023 204.0610 132.1631 283.6612
 [9] 242.1039 228.4226
> 
> 
> 
> 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 -1.705303e-13  1.705303e-13 -8.526513e-14  2.842171e-14
 [6] -1.136868e-13  2.273737e-13  1.705303e-13 -8.526513e-14  4.263256e-14
[11]  5.684342e-14 -5.684342e-14  2.842171e-14 -2.273737e-13  1.705303e-13
[16]  5.684342e-14  2.273737e-13 -8.526513e-14  1.136868e-13 -4.263256e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   2 
8   13 
6   10 
2   14 
4   5 
5   10 
6   15 
9   20 
1   10 
8   4 
2   15 
3   18 
8   18 
1   19 
1   5 
7   16 
10   11 
3   14 
5   4 
1   16 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.490015
> Min(tmp)
[1] -2.331923
> mean(tmp)
[1] -0.07803391
> Sum(tmp)
[1] -7.803391
> Var(tmp)
[1] 1.114002
> 
> rowMeans(tmp)
[1] -0.07803391
> rowSums(tmp)
[1] -7.803391
> rowVars(tmp)
[1] 1.114002
> rowSd(tmp)
[1] 1.055463
> rowMax(tmp)
[1] 3.490015
> rowMin(tmp)
[1] -2.331923
> 
> colMeans(tmp)
  [1]  0.63679991 -1.06986263  0.29096849  0.91826258  0.46389305 -1.17948063
  [7] -0.88739907 -0.80484986  0.32234094 -0.48347246  0.98296391  0.16423129
 [13] -0.31218678  0.36798728  2.04510730  0.20038246 -1.33421634 -0.01548397
 [19] -2.33192350 -0.21556473 -0.72504847  1.02820263 -0.30801548  1.64639769
 [25] -0.18094946 -0.10948861 -0.64945498 -1.24927000  0.94380237 -1.49248841
 [31]  0.68937818  0.77657226  1.74579381 -0.66994319  0.15310790 -0.57580342
 [37] -0.80914063 -1.31832622 -0.47115355 -1.95328305  1.17556365  1.01055001
 [43] -0.13843311  0.21220904 -1.43818555 -1.10548571  0.38688985 -0.24842085
 [49] -0.15934092  0.12676429 -0.97879720 -1.15520204 -1.15092622 -0.21847911
 [55]  0.81901042 -1.23162982  0.04043877 -0.82190771 -1.23030296  1.36363898
 [61]  1.52993253 -1.99245107 -1.02639441  0.39212325  0.84871682  0.60408157
 [67] -1.12447550 -0.15416380  0.29737221  3.49001529  1.70114256 -0.63885844
 [73] -0.58978826 -0.72388781 -0.49415820  0.40413174 -0.10600353  1.20977874
 [79]  0.23965750 -0.85418093 -0.94525527  1.48323621 -1.92567705  1.53651636
 [85]  0.32599850 -0.25919232 -2.21501308 -0.33218153  1.19099821 -2.29818621
 [91]  0.88289963 -0.31210566  0.14097196 -1.03603794  0.27374757  0.57894820
 [97]  0.04622287  1.18499751  0.08456342  1.29122666
> colSums(tmp)
  [1]  0.63679991 -1.06986263  0.29096849  0.91826258  0.46389305 -1.17948063
  [7] -0.88739907 -0.80484986  0.32234094 -0.48347246  0.98296391  0.16423129
 [13] -0.31218678  0.36798728  2.04510730  0.20038246 -1.33421634 -0.01548397
 [19] -2.33192350 -0.21556473 -0.72504847  1.02820263 -0.30801548  1.64639769
 [25] -0.18094946 -0.10948861 -0.64945498 -1.24927000  0.94380237 -1.49248841
 [31]  0.68937818  0.77657226  1.74579381 -0.66994319  0.15310790 -0.57580342
 [37] -0.80914063 -1.31832622 -0.47115355 -1.95328305  1.17556365  1.01055001
 [43] -0.13843311  0.21220904 -1.43818555 -1.10548571  0.38688985 -0.24842085
 [49] -0.15934092  0.12676429 -0.97879720 -1.15520204 -1.15092622 -0.21847911
 [55]  0.81901042 -1.23162982  0.04043877 -0.82190771 -1.23030296  1.36363898
 [61]  1.52993253 -1.99245107 -1.02639441  0.39212325  0.84871682  0.60408157
 [67] -1.12447550 -0.15416380  0.29737221  3.49001529  1.70114256 -0.63885844
 [73] -0.58978826 -0.72388781 -0.49415820  0.40413174 -0.10600353  1.20977874
 [79]  0.23965750 -0.85418093 -0.94525527  1.48323621 -1.92567705  1.53651636
 [85]  0.32599850 -0.25919232 -2.21501308 -0.33218153  1.19099821 -2.29818621
 [91]  0.88289963 -0.31210566  0.14097196 -1.03603794  0.27374757  0.57894820
 [97]  0.04622287  1.18499751  0.08456342  1.29122666
> 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.63679991 -1.06986263  0.29096849  0.91826258  0.46389305 -1.17948063
  [7] -0.88739907 -0.80484986  0.32234094 -0.48347246  0.98296391  0.16423129
 [13] -0.31218678  0.36798728  2.04510730  0.20038246 -1.33421634 -0.01548397
 [19] -2.33192350 -0.21556473 -0.72504847  1.02820263 -0.30801548  1.64639769
 [25] -0.18094946 -0.10948861 -0.64945498 -1.24927000  0.94380237 -1.49248841
 [31]  0.68937818  0.77657226  1.74579381 -0.66994319  0.15310790 -0.57580342
 [37] -0.80914063 -1.31832622 -0.47115355 -1.95328305  1.17556365  1.01055001
 [43] -0.13843311  0.21220904 -1.43818555 -1.10548571  0.38688985 -0.24842085
 [49] -0.15934092  0.12676429 -0.97879720 -1.15520204 -1.15092622 -0.21847911
 [55]  0.81901042 -1.23162982  0.04043877 -0.82190771 -1.23030296  1.36363898
 [61]  1.52993253 -1.99245107 -1.02639441  0.39212325  0.84871682  0.60408157
 [67] -1.12447550 -0.15416380  0.29737221  3.49001529  1.70114256 -0.63885844
 [73] -0.58978826 -0.72388781 -0.49415820  0.40413174 -0.10600353  1.20977874
 [79]  0.23965750 -0.85418093 -0.94525527  1.48323621 -1.92567705  1.53651636
 [85]  0.32599850 -0.25919232 -2.21501308 -0.33218153  1.19099821 -2.29818621
 [91]  0.88289963 -0.31210566  0.14097196 -1.03603794  0.27374757  0.57894820
 [97]  0.04622287  1.18499751  0.08456342  1.29122666
> colMin(tmp)
  [1]  0.63679991 -1.06986263  0.29096849  0.91826258  0.46389305 -1.17948063
  [7] -0.88739907 -0.80484986  0.32234094 -0.48347246  0.98296391  0.16423129
 [13] -0.31218678  0.36798728  2.04510730  0.20038246 -1.33421634 -0.01548397
 [19] -2.33192350 -0.21556473 -0.72504847  1.02820263 -0.30801548  1.64639769
 [25] -0.18094946 -0.10948861 -0.64945498 -1.24927000  0.94380237 -1.49248841
 [31]  0.68937818  0.77657226  1.74579381 -0.66994319  0.15310790 -0.57580342
 [37] -0.80914063 -1.31832622 -0.47115355 -1.95328305  1.17556365  1.01055001
 [43] -0.13843311  0.21220904 -1.43818555 -1.10548571  0.38688985 -0.24842085
 [49] -0.15934092  0.12676429 -0.97879720 -1.15520204 -1.15092622 -0.21847911
 [55]  0.81901042 -1.23162982  0.04043877 -0.82190771 -1.23030296  1.36363898
 [61]  1.52993253 -1.99245107 -1.02639441  0.39212325  0.84871682  0.60408157
 [67] -1.12447550 -0.15416380  0.29737221  3.49001529  1.70114256 -0.63885844
 [73] -0.58978826 -0.72388781 -0.49415820  0.40413174 -0.10600353  1.20977874
 [79]  0.23965750 -0.85418093 -0.94525527  1.48323621 -1.92567705  1.53651636
 [85]  0.32599850 -0.25919232 -2.21501308 -0.33218153  1.19099821 -2.29818621
 [91]  0.88289963 -0.31210566  0.14097196 -1.03603794  0.27374757  0.57894820
 [97]  0.04622287  1.18499751  0.08456342  1.29122666
> colMedians(tmp)
  [1]  0.63679991 -1.06986263  0.29096849  0.91826258  0.46389305 -1.17948063
  [7] -0.88739907 -0.80484986  0.32234094 -0.48347246  0.98296391  0.16423129
 [13] -0.31218678  0.36798728  2.04510730  0.20038246 -1.33421634 -0.01548397
 [19] -2.33192350 -0.21556473 -0.72504847  1.02820263 -0.30801548  1.64639769
 [25] -0.18094946 -0.10948861 -0.64945498 -1.24927000  0.94380237 -1.49248841
 [31]  0.68937818  0.77657226  1.74579381 -0.66994319  0.15310790 -0.57580342
 [37] -0.80914063 -1.31832622 -0.47115355 -1.95328305  1.17556365  1.01055001
 [43] -0.13843311  0.21220904 -1.43818555 -1.10548571  0.38688985 -0.24842085
 [49] -0.15934092  0.12676429 -0.97879720 -1.15520204 -1.15092622 -0.21847911
 [55]  0.81901042 -1.23162982  0.04043877 -0.82190771 -1.23030296  1.36363898
 [61]  1.52993253 -1.99245107 -1.02639441  0.39212325  0.84871682  0.60408157
 [67] -1.12447550 -0.15416380  0.29737221  3.49001529  1.70114256 -0.63885844
 [73] -0.58978826 -0.72388781 -0.49415820  0.40413174 -0.10600353  1.20977874
 [79]  0.23965750 -0.85418093 -0.94525527  1.48323621 -1.92567705  1.53651636
 [85]  0.32599850 -0.25919232 -2.21501308 -0.33218153  1.19099821 -2.29818621
 [91]  0.88289963 -0.31210566  0.14097196 -1.03603794  0.27374757  0.57894820
 [97]  0.04622287  1.18499751  0.08456342  1.29122666
> colRanges(tmp)
          [,1]      [,2]      [,3]      [,4]     [,5]      [,6]       [,7]
[1,] 0.6367999 -1.069863 0.2909685 0.9182626 0.463893 -1.179481 -0.8873991
[2,] 0.6367999 -1.069863 0.2909685 0.9182626 0.463893 -1.179481 -0.8873991
           [,8]      [,9]      [,10]     [,11]     [,12]      [,13]     [,14]
[1,] -0.8048499 0.3223409 -0.4834725 0.9829639 0.1642313 -0.3121868 0.3679873
[2,] -0.8048499 0.3223409 -0.4834725 0.9829639 0.1642313 -0.3121868 0.3679873
        [,15]     [,16]     [,17]       [,18]     [,19]      [,20]      [,21]
[1,] 2.045107 0.2003825 -1.334216 -0.01548397 -2.331923 -0.2155647 -0.7250485
[2,] 2.045107 0.2003825 -1.334216 -0.01548397 -2.331923 -0.2155647 -0.7250485
        [,22]      [,23]    [,24]      [,25]      [,26]     [,27]    [,28]
[1,] 1.028203 -0.3080155 1.646398 -0.1809495 -0.1094886 -0.649455 -1.24927
[2,] 1.028203 -0.3080155 1.646398 -0.1809495 -0.1094886 -0.649455 -1.24927
         [,29]     [,30]     [,31]     [,32]    [,33]      [,34]     [,35]
[1,] 0.9438024 -1.492488 0.6893782 0.7765723 1.745794 -0.6699432 0.1531079
[2,] 0.9438024 -1.492488 0.6893782 0.7765723 1.745794 -0.6699432 0.1531079
          [,36]      [,37]     [,38]      [,39]     [,40]    [,41]   [,42]
[1,] -0.5758034 -0.8091406 -1.318326 -0.4711536 -1.953283 1.175564 1.01055
[2,] -0.5758034 -0.8091406 -1.318326 -0.4711536 -1.953283 1.175564 1.01055
          [,43]    [,44]     [,45]     [,46]     [,47]      [,48]      [,49]
[1,] -0.1384331 0.212209 -1.438186 -1.105486 0.3868898 -0.2484209 -0.1593409
[2,] -0.1384331 0.212209 -1.438186 -1.105486 0.3868898 -0.2484209 -0.1593409
         [,50]      [,51]     [,52]     [,53]      [,54]     [,55]    [,56]
[1,] 0.1267643 -0.9787972 -1.155202 -1.150926 -0.2184791 0.8190104 -1.23163
[2,] 0.1267643 -0.9787972 -1.155202 -1.150926 -0.2184791 0.8190104 -1.23163
          [,57]      [,58]     [,59]    [,60]    [,61]     [,62]     [,63]
[1,] 0.04043877 -0.8219077 -1.230303 1.363639 1.529933 -1.992451 -1.026394
[2,] 0.04043877 -0.8219077 -1.230303 1.363639 1.529933 -1.992451 -1.026394
         [,64]     [,65]     [,66]     [,67]      [,68]     [,69]    [,70]
[1,] 0.3921233 0.8487168 0.6040816 -1.124475 -0.1541638 0.2973722 3.490015
[2,] 0.3921233 0.8487168 0.6040816 -1.124475 -0.1541638 0.2973722 3.490015
        [,71]      [,72]      [,73]      [,74]      [,75]     [,76]      [,77]
[1,] 1.701143 -0.6388584 -0.5897883 -0.7238878 -0.4941582 0.4041317 -0.1060035
[2,] 1.701143 -0.6388584 -0.5897883 -0.7238878 -0.4941582 0.4041317 -0.1060035
        [,78]     [,79]      [,80]      [,81]    [,82]     [,83]    [,84]
[1,] 1.209779 0.2396575 -0.8541809 -0.9452553 1.483236 -1.925677 1.536516
[2,] 1.209779 0.2396575 -0.8541809 -0.9452553 1.483236 -1.925677 1.536516
         [,85]      [,86]     [,87]      [,88]    [,89]     [,90]     [,91]
[1,] 0.3259985 -0.2591923 -2.215013 -0.3321815 1.190998 -2.298186 0.8828996
[2,] 0.3259985 -0.2591923 -2.215013 -0.3321815 1.190998 -2.298186 0.8828996
          [,92]    [,93]     [,94]     [,95]     [,96]      [,97]    [,98]
[1,] -0.3121057 0.140972 -1.036038 0.2737476 0.5789482 0.04622287 1.184998
[2,] -0.3121057 0.140972 -1.036038 0.2737476 0.5789482 0.04622287 1.184998
          [,99]   [,100]
[1,] 0.08456342 1.291227
[2,] 0.08456342 1.291227
> 
> 
> Max(tmp2)
[1] 2.53365
> Min(tmp2)
[1] -2.599261
> mean(tmp2)
[1] 0.1967687
> Sum(tmp2)
[1] 19.67687
> Var(tmp2)
[1] 0.9203204
> 
> rowMeans(tmp2)
  [1]  1.300033277  0.515645103  1.105565702 -0.877947112  0.659085794
  [6] -2.599261124  1.721951767 -0.290967291  1.188773325  1.275166749
 [11] -0.471654737  0.316689423 -0.659871396  0.146875039  0.133126963
 [16] -0.295584703  1.051303004 -0.768032135  1.420895289 -1.237144725
 [21]  0.675668642  1.121952410  0.588727034  0.998856360 -0.084300800
 [26]  0.443334429 -0.795554083  0.809815547 -0.151949247 -1.656707289
 [31]  0.006514957 -0.184135566 -0.673935675  0.504444655 -1.423816607
 [36] -0.007401984 -0.041138746  0.205407230  1.356736570  0.413346944
 [41]  0.314083705 -0.211882028 -0.945654371  1.160987967 -0.521664004
 [46] -0.544048444  0.167146067  0.068030218  1.329440912 -2.255915945
 [51] -0.218016825  0.841767959  0.407504603  0.336695460  0.913875625
 [56] -0.417396764  0.387024647  0.918210878 -0.345106896  0.749398307
 [61]  0.324302355  1.118778227 -0.125308529 -0.393250200 -0.186372688
 [66] -0.230049973  0.477751180 -0.681539397  0.407260370  0.720373927
 [71]  0.750734788  1.816886185 -2.358830575 -0.439996551  1.226528691
 [76] -0.404040603 -1.584321593 -0.749008322  0.142275300 -0.194494392
 [81] -0.431558114 -0.074337536  0.343742683  1.818523014  1.665235159
 [86]  1.296923930  0.595530178  2.197199852  0.075829552  0.491546273
 [91]  0.454120533  2.533649861  0.947543328 -0.476347341 -1.152415165
 [96]  0.228410382 -1.555444407  1.082204946  0.941185479  1.182658600
> rowSums(tmp2)
  [1]  1.300033277  0.515645103  1.105565702 -0.877947112  0.659085794
  [6] -2.599261124  1.721951767 -0.290967291  1.188773325  1.275166749
 [11] -0.471654737  0.316689423 -0.659871396  0.146875039  0.133126963
 [16] -0.295584703  1.051303004 -0.768032135  1.420895289 -1.237144725
 [21]  0.675668642  1.121952410  0.588727034  0.998856360 -0.084300800
 [26]  0.443334429 -0.795554083  0.809815547 -0.151949247 -1.656707289
 [31]  0.006514957 -0.184135566 -0.673935675  0.504444655 -1.423816607
 [36] -0.007401984 -0.041138746  0.205407230  1.356736570  0.413346944
 [41]  0.314083705 -0.211882028 -0.945654371  1.160987967 -0.521664004
 [46] -0.544048444  0.167146067  0.068030218  1.329440912 -2.255915945
 [51] -0.218016825  0.841767959  0.407504603  0.336695460  0.913875625
 [56] -0.417396764  0.387024647  0.918210878 -0.345106896  0.749398307
 [61]  0.324302355  1.118778227 -0.125308529 -0.393250200 -0.186372688
 [66] -0.230049973  0.477751180 -0.681539397  0.407260370  0.720373927
 [71]  0.750734788  1.816886185 -2.358830575 -0.439996551  1.226528691
 [76] -0.404040603 -1.584321593 -0.749008322  0.142275300 -0.194494392
 [81] -0.431558114 -0.074337536  0.343742683  1.818523014  1.665235159
 [86]  1.296923930  0.595530178  2.197199852  0.075829552  0.491546273
 [91]  0.454120533  2.533649861  0.947543328 -0.476347341 -1.152415165
 [96]  0.228410382 -1.555444407  1.082204946  0.941185479  1.182658600
> 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]  1.300033277  0.515645103  1.105565702 -0.877947112  0.659085794
  [6] -2.599261124  1.721951767 -0.290967291  1.188773325  1.275166749
 [11] -0.471654737  0.316689423 -0.659871396  0.146875039  0.133126963
 [16] -0.295584703  1.051303004 -0.768032135  1.420895289 -1.237144725
 [21]  0.675668642  1.121952410  0.588727034  0.998856360 -0.084300800
 [26]  0.443334429 -0.795554083  0.809815547 -0.151949247 -1.656707289
 [31]  0.006514957 -0.184135566 -0.673935675  0.504444655 -1.423816607
 [36] -0.007401984 -0.041138746  0.205407230  1.356736570  0.413346944
 [41]  0.314083705 -0.211882028 -0.945654371  1.160987967 -0.521664004
 [46] -0.544048444  0.167146067  0.068030218  1.329440912 -2.255915945
 [51] -0.218016825  0.841767959  0.407504603  0.336695460  0.913875625
 [56] -0.417396764  0.387024647  0.918210878 -0.345106896  0.749398307
 [61]  0.324302355  1.118778227 -0.125308529 -0.393250200 -0.186372688
 [66] -0.230049973  0.477751180 -0.681539397  0.407260370  0.720373927
 [71]  0.750734788  1.816886185 -2.358830575 -0.439996551  1.226528691
 [76] -0.404040603 -1.584321593 -0.749008322  0.142275300 -0.194494392
 [81] -0.431558114 -0.074337536  0.343742683  1.818523014  1.665235159
 [86]  1.296923930  0.595530178  2.197199852  0.075829552  0.491546273
 [91]  0.454120533  2.533649861  0.947543328 -0.476347341 -1.152415165
 [96]  0.228410382 -1.555444407  1.082204946  0.941185479  1.182658600
> rowMin(tmp2)
  [1]  1.300033277  0.515645103  1.105565702 -0.877947112  0.659085794
  [6] -2.599261124  1.721951767 -0.290967291  1.188773325  1.275166749
 [11] -0.471654737  0.316689423 -0.659871396  0.146875039  0.133126963
 [16] -0.295584703  1.051303004 -0.768032135  1.420895289 -1.237144725
 [21]  0.675668642  1.121952410  0.588727034  0.998856360 -0.084300800
 [26]  0.443334429 -0.795554083  0.809815547 -0.151949247 -1.656707289
 [31]  0.006514957 -0.184135566 -0.673935675  0.504444655 -1.423816607
 [36] -0.007401984 -0.041138746  0.205407230  1.356736570  0.413346944
 [41]  0.314083705 -0.211882028 -0.945654371  1.160987967 -0.521664004
 [46] -0.544048444  0.167146067  0.068030218  1.329440912 -2.255915945
 [51] -0.218016825  0.841767959  0.407504603  0.336695460  0.913875625
 [56] -0.417396764  0.387024647  0.918210878 -0.345106896  0.749398307
 [61]  0.324302355  1.118778227 -0.125308529 -0.393250200 -0.186372688
 [66] -0.230049973  0.477751180 -0.681539397  0.407260370  0.720373927
 [71]  0.750734788  1.816886185 -2.358830575 -0.439996551  1.226528691
 [76] -0.404040603 -1.584321593 -0.749008322  0.142275300 -0.194494392
 [81] -0.431558114 -0.074337536  0.343742683  1.818523014  1.665235159
 [86]  1.296923930  0.595530178  2.197199852  0.075829552  0.491546273
 [91]  0.454120533  2.533649861  0.947543328 -0.476347341 -1.152415165
 [96]  0.228410382 -1.555444407  1.082204946  0.941185479  1.182658600
> 
> colMeans(tmp2)
[1] 0.1967687
> colSums(tmp2)
[1] 19.67687
> colVars(tmp2)
[1] 0.9203204
> colSd(tmp2)
[1] 0.9593333
> colMax(tmp2)
[1] 2.53365
> colMin(tmp2)
[1] -2.599261
> colMedians(tmp2)
[1] 0.271247
> colRanges(tmp2)
          [,1]
[1,] -2.599261
[2,]  2.533650
> 
> 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] -5.63740861 -1.10344742 -1.52049908  4.18876232 -0.04422162 -1.02303644
 [7] -3.07016379 -2.75752537  4.45779765  1.55564361
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1962557
[2,] -1.7363214
[3,] -0.2194129
[4,]  0.1945224
[5,]  1.5640957
> 
> rowApply(tmp,sum)
 [1] -2.5487220 -0.1734164  0.7124805  3.4970904  5.3507011 -2.4701209
 [7] -6.9969666  1.3357008 -0.6398520 -3.0209935
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    4    6    5    6    1    3    5    1     1
 [2,]    1    9    2    4    1    6    1    8    9     7
 [3,]    8    7    7    2    8    9    5    3    3     5
 [4,]    9   10    3   10    7    4   10    1    6     9
 [5,]    3    3    5    3    3    3    8    6   10     8
 [6,]    2    8    9    1    4    7    6    2    7     4
 [7,]    4    1    1    6    9    5    4    4    4    10
 [8,]    5    6    4    9    2    2    2    7    8     3
 [9,]    7    5   10    8   10   10    7   10    2     2
[10,]    6    2    8    7    5    8    9    9    5     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.6176489  0.4386784 -0.2698176  3.8049020 -0.8026397 -1.9445087
 [7] -1.0968007  1.3417801 -2.9243514  1.0425313 -0.4973155  2.8559682
[13] -1.2125126 -2.3930987  3.0171461  1.5363530  0.5245611  2.5412581
[19]  3.2638938  3.2240891
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5449583
[2,] -1.2100847
[3,] -0.4889726
[4,]  0.5499324
[5,]  2.0764342
> 
> rowApply(tmp,sum)
[1] -0.8439005  4.1398500  5.3079077 -8.7970918 12.0257020
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   20   14    1    2    3
[2,]    4   15   16    3   16
[3,]   12    7    2   16   10
[4,]   13   20   14    9   14
[5,]   10    2   17   18    1
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,]  2.0764342 -0.7922467  0.1019329  0.1029604 -0.1238887 -1.1668989
[2,]  0.5499324  0.8309188 -0.3255613  2.8788524 -1.2694137 -1.6824325
[3,] -1.2100847  0.9340276 -1.0227977  0.7863428  1.1310481  0.4251274
[4,] -1.5449583 -1.5002924  0.4076942 -0.8451055  0.5206375  0.0907847
[5,] -0.4889726  0.9662711  0.5689143  0.8818518 -1.0610229  0.3889106
            [,7]       [,8]        [,9]      [,10]      [,11]      [,12]
[1,] -0.67656213 -0.1640841  0.93533985 -0.7120557 -1.7601021  0.4800756
[2,] -0.06928931  0.1213336 -1.24100893  0.3126455 -0.8967546 -0.3576753
[3,] -0.29043037  0.9058512 -0.04977242  0.1240021  0.7063901  1.6019523
[4,] -0.82393450  0.2206976 -2.43460514  0.4162322  0.7708785 -0.9128939
[5,]  0.76341558  0.2579818 -0.13430477  0.9017073  0.6822726  2.0445095
          [,13]      [,14]        [,15]      [,16]      [,17]      [,18]
[1,] -0.9756636 -0.7133308 -0.088915935 -0.6653762  0.2987143  1.8262196
[2,]  0.2642399  0.2399369  1.638575972  1.7067892 -0.4620485  0.9769327
[3,] -0.7341331 -0.3712207 -0.005029132 -0.0196773  2.1647167 -0.6048402
[4,] -0.3902355 -0.8907422  1.367200247 -1.3688333 -1.3211128  0.1475419
[5,]  0.6232797 -0.6577420  0.105314924  1.8834506 -0.1557086  0.1954042
          [,19]      [,20]
[1,]  0.6918504  0.4816971
[2,]  1.1263487 -0.2024720
[3,] -0.4971415  1.3335767
[4,]  0.3087059 -1.0147512
[5,]  1.6341304  2.6260385
> 
> 
> 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.12-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.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  638  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.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  550  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.12-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 -1.083625 1.457959 -0.4141023 -0.4378642 -0.354782 -1.713561 -0.9334979
         col8     col9      col10      col11    col12     col13     col14
row1 0.424791 1.042175 -0.2299333 0.06726554 2.785655 0.9695961 -1.509866
         col15     col16      col17  col18      col19      col20
row1 -1.745861 -1.193218 -0.6214161 1.4407 -0.6478855 -0.5865732
> tmp[,"col10"]
          col10
row1 -0.2299333
row2  1.6286268
row3 -0.5894382
row4  0.4610139
row5  0.3890902
> tmp[c("row1","row5"),]
          col1     col2       col3       col4       col5      col6       col7
row1 -1.083625 1.457959 -0.4141023 -0.4378642 -0.3547820 -1.713561 -0.9334979
row5  0.321574 0.329532 -1.2861163  2.4562750 -0.5617324 -0.330767 -3.3743486
          col8       col9      col10      col11     col12     col13     col14
row1 0.4247910  1.0421745 -0.2299333 0.06726554  2.785655 0.9695961 -1.509866
row5 0.7177453 -0.1839312  0.3890902 0.07744360 -1.620873 0.3797483  2.146038
         col15     col16      col17     col18      col19      col20
row1 -1.745861 -1.193218 -0.6214161  1.440700 -0.6478855 -0.5865732
row5 -1.627998  1.479130  1.2758543 -0.482678  0.9148167  1.1664044
> tmp[,c("col6","col20")]
           col6      col20
row1 -1.7135606 -0.5865732
row2 -0.8755963 -1.9333094
row3 -0.5485321  0.6963978
row4  0.5662403  1.9698287
row5 -0.3307670  1.1664044
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 -1.713561 -0.5865732
row5 -0.330767  1.1664044
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.58731 48.17529 50.13779 52.34983 51.82158 103.9498 49.88016 48.68434
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.20501 51.63932 48.50176 50.38728 50.27752 51.57055 50.69927 50.11973
        col17    col18    col19    col20
row1 51.05683 49.59258 50.60696 104.2954
> tmp[,"col10"]
        col10
row1 51.63932
row2 32.62867
row3 28.87613
row4 29.87037
row5 49.71829
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.58731 48.17529 50.13779 52.34983 51.82158 103.9498 49.88016 48.68434
row5 49.54380 50.15764 48.08277 51.32488 49.03162 103.7473 49.96840 48.31988
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.20501 51.63932 48.50176 50.38728 50.27752 51.57055 50.69927 50.11973
row5 50.39214 49.71829 49.70989 50.02011 50.42760 50.43969 50.55636 50.83127
        col17    col18    col19    col20
row1 51.05683 49.59258 50.60696 104.2954
row5 47.41637 51.01189 51.18696 105.1578
> tmp[,c("col6","col20")]
          col6     col20
row1 103.94982 104.29540
row2  76.31476  76.15384
row3  73.82562  74.47877
row4  76.47745  74.38029
row5 103.74733 105.15784
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.9498 104.2954
row5 103.7473 105.1578
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.9498 104.2954
row5 103.7473 105.1578
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.3028457
[2,]  1.0535529
[3,] -1.1638899
[4,]  2.0350325
[5,]  1.0098994
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.4652231  1.1290014
[2,] -0.9091935  1.0413004
[3,] -0.1869195  1.3773106
[4,]  0.2798180 -0.5264935
[5,]  0.3480631 -0.7999818
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.7506544 -1.5079581
[2,] -1.3141820 -1.7638026
[3,] -1.3091889  2.2088416
[4,] -1.3388632 -2.3995231
[5,] -0.2993170  0.9192931
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.7506544
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.7506544
[2,] -1.3141820
> 
> 
> 
> 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.734055 -0.1227657  1.351745  0.1164702 0.1018282 -1.4055531 -2.156355
row1 -1.098954 -0.2060289 -1.543077 -1.6658189 1.0815010  0.1053004  1.074452
          [,8]       [,9]      [,10]       [,11]     [,12]     [,13]      [,14]
row3 0.8734745 0.08197439  1.5939736 -0.01550746 0.4181700 -2.019473  0.8792975
row1 0.2937033 0.14062523 -0.7712237 -0.82817496 0.5154711 -0.298577 -1.0748032
          [,15]       [,16]      [,17]      [,18]       [,19]      [,20]
row3 -1.0225837  0.07758577 -0.5404019  1.3851822 -0.03601075 -1.0208192
row1  0.5221504 -0.62957883 -0.8526457 -0.5285124 -0.73160780 -0.6044927
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]       [,3]      [,4]      [,5]       [,6]       [,7]
row2 0.5526829 -0.1286741 -0.8878176 -1.276438 -1.077589 -0.5324786 -0.7639768
           [,8]    [,9]      [,10]
row2 -0.5832703 -2.3337 -0.3513114
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]      [,3]      [,4]       [,5]       [,6]      [,7]
row5 -0.2637497 -0.0427435 0.6740463 0.6480848 0.04828542 -0.8919844 -1.041258
         [,8]       [,9]     [,10]      [,11]      [,12]      [,13]    [,14]
row5 1.313955 -0.9736954 -1.843272 -0.3080684 -0.6958145 -0.3897772 0.240795
        [,15]     [,16]     [,17]     [,18]     [,19]     [,20]
row5 0.933357 -0.364012 0.3694874 -1.119818 0.1622482 0.7611965
> 
> 
> 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: 0x0241ae40>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c47c76b15"
 [2] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c3c2c24fd"
 [3] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c1606101b"
 [4] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c67be5490"
 [5] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c313d42c2"
 [6] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c3d8d6fa6"
 [7] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c7a79461" 
 [8] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c23863e5" 
 [9] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316cf651e6f" 
[10] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c15d92a1d"
[11] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c4f1b50e9"
[12] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c3f807d0" 
[13] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c213a3ff4"
[14] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c4ce19f2" 
[15] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM316c333964c4"
> 
> 
> ### 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: 0x0393c378>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0393c378>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.12-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0393c378>
> rowMedians(tmp)
  [1] -0.204080462  0.095280936  0.433866740  0.131394205  0.509521545
  [6] -0.176655953  0.318637444  0.027009272 -0.224218029  0.195652730
 [11] -0.015783439 -0.417291011  0.134228674 -0.216183330  0.245033156
 [16]  0.363258853  0.781557260 -0.130967531 -0.307434220  0.262421770
 [21]  0.343433980 -0.221885632 -0.176883043  0.002632763 -0.556006986
 [26]  0.146047859  0.352908339  0.681241067 -0.003180647  0.536998274
 [31]  0.036895909 -0.003973121 -0.272045237  0.003126757 -0.143252258
 [36]  0.255416072 -0.384140417 -0.351446146  0.468636537  0.296437455
 [41] -1.004762139 -0.319605993 -0.318976641 -0.403154226  0.112008924
 [46] -0.183911720 -0.184027770  0.321294571  0.149362849  0.088303075
 [51] -0.332774058 -0.219221048  0.138064951 -0.279721146 -0.588826444
 [56]  0.011325219  0.485495297  0.338262078 -0.430873912  0.625025261
 [61] -0.031420235  0.224178672  1.064551168 -0.020109692 -0.679472963
 [66]  0.609609843  0.104341552  0.008181631 -0.068012811 -0.387370383
 [71] -0.397771406 -0.148955021 -0.388425102  0.143087607  0.168672301
 [76] -0.136052817 -0.201451875  0.604163715 -0.116698471  0.229811975
 [81]  0.238838048 -0.324115165 -0.107809494  0.285938152  0.198272788
 [86] -0.202101156 -0.405930435 -0.561548120  0.084857333 -0.279816742
 [91]  0.046188892 -0.309612662  0.150114451 -0.263603384 -0.016729855
 [96] -0.339122216  0.134044661 -0.306740811  0.298583877 -0.387349649
[101] -0.010378383 -0.050056877  0.032575342 -0.131712071 -0.357784439
[106] -0.257115652  0.308199831  0.240888055 -0.637218406 -0.083847774
[111]  0.071761184 -0.376438973  0.320426593  0.263740559  0.363783632
[116]  0.003606134 -0.336445593  0.262710708 -0.379068781 -0.215064891
[121]  0.211126638 -0.004692170  0.147615436  0.247817364  0.210205877
[126] -0.447533973 -0.114883223  0.183335501  0.241130344 -0.195500615
[131] -0.032195015  0.026007751  0.045789082  0.059011923  0.057187611
[136]  0.436173694  0.297866201  0.197422964 -0.152338456  0.177032828
[141]  0.334868874 -0.399732450 -0.016598163  0.297145845  0.514165032
[146]  0.425228812  0.083840341 -0.474110845 -0.287107703  0.452228741
[151]  0.190381899  0.029168837  0.443704565  0.472462755  0.406170780
[156] -0.149509662  0.026609566 -0.148481808  0.414345331  0.135488213
[161]  0.386020693 -0.315437738 -1.183680112 -0.356435733  0.265070676
[166]  0.228237826  0.294558574 -0.119098145 -0.341980141  0.387556959
[171] -0.104725594 -0.051265907  0.018460960 -0.122733601 -0.092879674
[176]  0.206200539 -0.112982436 -0.563765267 -0.278082158 -0.710184375
[181] -0.019700565 -0.285870160  0.353198159  0.317107719  0.161283757
[186] -0.001490420  0.200788893  0.297397662 -0.431263532 -0.990340481
[191] -0.085128364 -0.292887103 -0.151195701  0.474439592  0.093809042
[196]  0.222816781  0.348919116 -0.201107971  0.225865259 -0.277774797
[201] -0.517822236  0.354023563 -0.394652803 -0.013409090  0.441886223
[206] -0.014944855  0.114402197 -0.118952496 -0.277432540  0.133767483
[211]  0.616406093 -0.717151351  0.258838365 -0.203920677 -0.857079832
[216] -0.180238096 -0.135882697 -0.870660905  0.280790006 -0.059273772
[221]  0.463167047  0.117715355 -0.362364677  0.623941543 -0.307481049
[226]  0.139019764  0.221111276  0.310789827  0.664580845  0.578791812
> 
> proc.time()
   user  system elapsed 
   2.21    5.70   21.37 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.12-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 434372 23.2     920184 49.2   641757 34.3
Vcells 752088  5.8    8388608 64.0  1684481 12.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] "Thu May 06 01:04:59 2021"
> 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] "Thu May 06 01:04:59 2021"
> 
> 
> 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: 0x00000000078fc2e0>
> 
> 
> 
> 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] "Thu May 06 01:05:05 2021"
> 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] "Thu May 06 01:05:06 2021"
> 
> ColMode(tmp2)
<pointer: 0x00000000078fc2e0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]       [,3]       [,4]
[1,] 99.4203280 -1.7118091 -0.7163622  0.6267789
[2,] -2.2627719  1.4762308  2.3662023  0.4934079
[3,] -0.2740938 -1.6592087 -1.2418544 -0.9345971
[4,]  1.9322526  0.6024249 -1.5035543  1.1716543
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 99.4203280 1.7118091 0.7163622 0.6267789
[2,]  2.2627719 1.4762308 2.3662023 0.4934079
[3,]  0.2740938 1.6592087 1.2418544 0.9345971
[4,]  1.9322526 0.6024249 1.5035543 1.1716543
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9709743 1.3083612 0.8463818 0.7916937
[2,] 1.5042513 1.2150024 1.5382465 0.7024300
[3,] 0.5235397 1.2881028 1.1143852 0.9667456
[4,] 1.3900549 0.7761604 1.2261950 1.0824298
> 
> 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.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.13007 39.79542 34.18018 33.54372
[2,]  42.30528 38.62625 42.74867 32.51771
[3,]  30.50949 39.54024 37.38571 35.60205
[4,]  40.83280 33.36403 38.76550 36.99595
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x000000000552bb90>
> exp(tmp5)
<pointer: 0x000000000552bb90>
> log(tmp5,2)
<pointer: 0x000000000552bb90>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.4974
> Min(tmp5)
[1] 52.58971
> mean(tmp5)
[1] 73.71878
> Sum(tmp5)
[1] 14743.76
> Var(tmp5)
[1] 840.1045
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.78862 74.23148 71.92378 72.57421 71.70595 71.56179 71.06034 71.70771
 [9] 71.51775 70.11617
> rowSums(tmp5)
 [1] 1815.772 1484.630 1438.476 1451.484 1434.119 1431.236 1421.207 1434.154
 [9] 1430.355 1402.323
> rowVars(tmp5)
 [1] 7908.61611   91.75700   52.04304   57.83328   73.74276   63.70572
 [7]   69.73734   64.76729   45.66525   19.73866
> rowSd(tmp5)
 [1] 88.930400  9.578987  7.214086  7.604820  8.587360  7.981586  8.350889
 [8]  8.047813  6.757607  4.442821
> rowMax(tmp5)
 [1] 466.49738  88.97575  82.29782  84.98813  89.09849  82.28186  85.60664
 [8]  93.65615  82.83298  78.20836
> rowMin(tmp5)
 [1] 52.58971 58.33445 61.78416 56.51348 56.82824 53.51201 55.25421 60.09082
 [9] 58.49902 60.37136
> 
> colMeans(tmp5)
 [1] 113.87701  75.19188  75.35394  72.23846  72.62657  70.16571  67.12104
 [8]  71.00254  67.77654  72.89230  76.32259  70.36305  73.52203  69.98921
[15]  74.47961  70.35638  67.25917  73.71878  69.28439  70.83440
> colSums(tmp5)
 [1] 1138.7701  751.9188  753.5394  722.3846  726.2657  701.6571  671.2104
 [8]  710.0254  677.7654  728.9230  763.2259  703.6305  735.2203  699.8921
[15]  744.7961  703.5638  672.5917  737.1878  692.8439  708.3440
> colVars(tmp5)
 [1] 15460.22268    55.02646    45.88310    16.85831    47.75346    24.18153
 [7]    43.56391    67.30129    63.57377    90.67463    64.36200    69.15838
[13]    54.12128    67.32663    64.56778    81.86479    83.41497    33.11398
[19]    37.73078    67.14259
> colSd(tmp5)
 [1] 124.339144   7.417982   6.773707   4.105888   6.910388   4.917471
 [7]   6.600296   8.203736   7.973316   9.522322   8.022593   8.316152
[13]   7.356717   8.205281   8.035408   9.047917   9.133180   5.754475
[19]   6.142538   8.194058
> colMax(tmp5)
 [1] 466.49738  82.82896  88.97575  78.95313  83.16078  76.91773  81.70612
 [8]  84.62431  76.44854  87.25949  85.60664  89.09849  83.73503  82.28186
[15]  86.28299  82.20775  81.66078  80.77970  82.90914  81.19555
> colMin(tmp5)
 [1] 63.50151 60.37136 64.13439 66.61261 63.45764 61.78416 59.35465 58.56689
 [9] 55.25421 58.59971 63.60613 58.37124 63.59772 58.33445 63.12383 53.51201
[17] 52.58971 63.04979 60.54543 58.49902
> 
> 
> ### 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.78862 74.23148 71.92378 72.57421 71.70595 71.56179 71.06034 71.70771
 [9]       NA 70.11617
> rowSums(tmp5)
 [1] 1815.772 1484.630 1438.476 1451.484 1434.119 1431.236 1421.207 1434.154
 [9]       NA 1402.323
> rowVars(tmp5)
 [1] 7908.61611   91.75700   52.04304   57.83328   73.74276   63.70572
 [7]   69.73734   64.76729   44.62937   19.73866
> rowSd(tmp5)
 [1] 88.930400  9.578987  7.214086  7.604820  8.587360  7.981586  8.350889
 [8]  8.047813  6.680521  4.442821
> rowMax(tmp5)
 [1] 466.49738  88.97575  82.29782  84.98813  89.09849  82.28186  85.60664
 [8]  93.65615        NA  78.20836
> rowMin(tmp5)
 [1] 52.58971 58.33445 61.78416 56.51348 56.82824 53.51201 55.25421 60.09082
 [9]       NA 60.37136
> 
> colMeans(tmp5)
 [1] 113.87701  75.19188        NA  72.23846  72.62657  70.16571  67.12104
 [8]  71.00254  67.77654  72.89230  76.32259  70.36305  73.52203  69.98921
[15]  74.47961  70.35638  67.25917  73.71878  69.28439  70.83440
> colSums(tmp5)
 [1] 1138.7701  751.9188        NA  722.3846  726.2657  701.6571  671.2104
 [8]  710.0254  677.7654  728.9230  763.2259  703.6305  735.2203  699.8921
[15]  744.7961  703.5638  672.5917  737.1878  692.8439  708.3440
> colVars(tmp5)
 [1] 15460.22268    55.02646          NA    16.85831    47.75346    24.18153
 [7]    43.56391    67.30129    63.57377    90.67463    64.36200    69.15838
[13]    54.12128    67.32663    64.56778    81.86479    83.41497    33.11398
[19]    37.73078    67.14259
> colSd(tmp5)
 [1] 124.339144   7.417982         NA   4.105888   6.910388   4.917471
 [7]   6.600296   8.203736   7.973316   9.522322   8.022593   8.316152
[13]   7.356717   8.205281   8.035408   9.047917   9.133180   5.754475
[19]   6.142538   8.194058
> colMax(tmp5)
 [1] 466.49738  82.82896        NA  78.95313  83.16078  76.91773  81.70612
 [8]  84.62431  76.44854  87.25949  85.60664  89.09849  83.73503  82.28186
[15]  86.28299  82.20775  81.66078  80.77970  82.90914  81.19555
> colMin(tmp5)
 [1] 63.50151 60.37136       NA 66.61261 63.45764 61.78416 59.35465 58.56689
 [9] 55.25421 58.59971 63.60613 58.37124 63.59772 58.33445 63.12383 53.51201
[17] 52.58971 63.04979 60.54543 58.49902
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.4974
> Min(tmp5,na.rm=TRUE)
[1] 52.58971
> mean(tmp5,na.rm=TRUE)
[1] 73.69056
> Sum(tmp5,na.rm=TRUE)
[1] 14664.42
> Var(tmp5,na.rm=TRUE)
[1] 844.1874
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.78862 74.23148 71.92378 72.57421 71.70595 71.56179 71.06034 71.70771
 [9] 71.10636 70.11617
> rowSums(tmp5,na.rm=TRUE)
 [1] 1815.772 1484.630 1438.476 1451.484 1434.119 1431.236 1421.207 1434.154
 [9] 1351.021 1402.323
> rowVars(tmp5,na.rm=TRUE)
 [1] 7908.61611   91.75700   52.04304   57.83328   73.74276   63.70572
 [7]   69.73734   64.76729   44.62937   19.73866
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.930400  9.578987  7.214086  7.604820  8.587360  7.981586  8.350889
 [8]  8.047813  6.680521  4.442821
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.49738  88.97575  82.29782  84.98813  89.09849  82.28186  85.60664
 [8]  93.65615  82.83298  78.20836
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.58971 58.33445 61.78416 56.51348 56.82824 53.51201 55.25421 60.09082
 [9] 58.49902 60.37136
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.87701  75.19188  74.91170  72.23846  72.62657  70.16571  67.12104
 [8]  71.00254  67.77654  72.89230  76.32259  70.36305  73.52203  69.98921
[15]  74.47961  70.35638  67.25917  73.71878  69.28439  70.83440
> colSums(tmp5,na.rm=TRUE)
 [1] 1138.7701  751.9188  674.2053  722.3846  726.2657  701.6571  671.2104
 [8]  710.0254  677.7654  728.9230  763.2259  703.6305  735.2203  699.8921
[15]  744.7961  703.5638  672.5917  737.1878  692.8439  708.3440
> colVars(tmp5,na.rm=TRUE)
 [1] 15460.22268    55.02646    49.41823    16.85831    47.75346    24.18153
 [7]    43.56391    67.30129    63.57377    90.67463    64.36200    69.15838
[13]    54.12128    67.32663    64.56778    81.86479    83.41497    33.11398
[19]    37.73078    67.14259
> colSd(tmp5,na.rm=TRUE)
 [1] 124.339144   7.417982   7.029810   4.105888   6.910388   4.917471
 [7]   6.600296   8.203736   7.973316   9.522322   8.022593   8.316152
[13]   7.356717   8.205281   8.035408   9.047917   9.133180   5.754475
[19]   6.142538   8.194058
> colMax(tmp5,na.rm=TRUE)
 [1] 466.49738  82.82896  88.97575  78.95313  83.16078  76.91773  81.70612
 [8]  84.62431  76.44854  87.25949  85.60664  89.09849  83.73503  82.28186
[15]  86.28299  82.20775  81.66078  80.77970  82.90914  81.19555
> colMin(tmp5,na.rm=TRUE)
 [1] 63.50151 60.37136 64.13439 66.61261 63.45764 61.78416 59.35465 58.56689
 [9] 55.25421 58.59971 63.60613 58.37124 63.59772 58.33445 63.12383 53.51201
[17] 52.58971 63.04979 60.54543 58.49902
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.78862 74.23148 71.92378 72.57421 71.70595 71.56179 71.06034 71.70771
 [9]      NaN 70.11617
> rowSums(tmp5,na.rm=TRUE)
 [1] 1815.772 1484.630 1438.476 1451.484 1434.119 1431.236 1421.207 1434.154
 [9]    0.000 1402.323
> rowVars(tmp5,na.rm=TRUE)
 [1] 7908.61611   91.75700   52.04304   57.83328   73.74276   63.70572
 [7]   69.73734   64.76729         NA   19.73866
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.930400  9.578987  7.214086  7.604820  8.587360  7.981586  8.350889
 [8]  8.047813        NA  4.442821
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.49738  88.97575  82.29782  84.98813  89.09849  82.28186  85.60664
 [8]  93.65615        NA  78.20836
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.58971 58.33445 61.78416 56.51348 56.82824 53.51201 55.25421 60.09082
 [9]       NA 60.37136
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 119.04306  75.08301       NaN  72.14672  73.26020  69.63760  66.73470
 [8]  70.84635  68.71522  73.70757  75.93552  70.21691  72.48748  69.71455
[15]  75.02098  69.72842  67.76143  72.98062  69.12973  72.20499
> colSums(tmp5,na.rm=TRUE)
 [1] 1071.3875  675.7471    0.0000  649.3205  659.3418  626.7384  600.6123
 [8]  637.6172  618.4370  663.3681  683.4197  631.9522  652.3873  627.4310
[15]  675.1888  627.5558  609.8529  656.8256  622.1675  649.8450
> colVars(tmp5,na.rm=TRUE)
 [1] 17092.50993    61.77143          NA    18.87092    49.20584    24.06668
 [7]    47.33020    75.43952    61.60799    94.53139    70.72172    77.56293
[13]    48.84563    74.89380    69.34152    87.66158    91.00394    31.12334
[19]    42.17802    54.40188
> colSd(tmp5,na.rm=TRUE)
 [1] 130.738326   7.859480         NA   4.344067   7.014687   4.905780
 [7]   6.879695   8.685592   7.849076   9.722726   8.409621   8.806982
[13]   6.988965   8.654120   8.327156   9.362776   9.539598   5.578830
[19]   6.494461   7.375763
> colMax(tmp5,na.rm=TRUE)
 [1] 466.49738  82.82896      -Inf  78.95313  83.16078  76.91773  81.70612
 [8]  84.62431  76.44854  87.25949  85.60664  89.09849  83.73503  82.28186
[15]  86.28299  82.20775  81.66078  80.77970  82.90914  81.19555
> colMin(tmp5,na.rm=TRUE)
 [1] 63.50151 60.37136      Inf 66.61261 63.45764 61.78416 59.35465 58.56689
 [9] 55.25421 58.59971 63.60613 58.37124 63.59772 58.33445 63.12383 53.51201
[17] 52.58971 63.04979 60.54543 62.64999
> 
> 
> 
> 
> 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] 180.3538 161.6949 309.4696 342.7126 213.3873 234.6044 280.7854 184.6201
 [9] 143.2229 248.8611
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 180.3538 161.6949 309.4696 342.7126 213.3873 234.6044 280.7854 184.6201
 [9] 143.2229 248.8611
> 
> 
> 
> 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]  2.842171e-13  7.105427e-14  5.684342e-14  0.000000e+00 -2.842171e-14
 [6]  0.000000e+00  0.000000e+00  2.842171e-14  8.526513e-14  5.684342e-14
[11]  5.684342e-14 -1.136868e-13  8.526513e-14  1.136868e-13  0.000000e+00
[16]  0.000000e+00  0.000000e+00  0.000000e+00  1.136868e-13  2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
3   13 
8   19 
1   13 
8   17 
7   10 
4   2 
7   3 
1   13 
6   16 
4   17 
1   19 
4   2 
7   15 
5   8 
10   19 
3   18 
4   8 
9   5 
1   3 
9   2 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 1.745974
> Min(tmp)
[1] -1.991914
> mean(tmp)
[1] -0.07677234
> Sum(tmp)
[1] -7.677234
> Var(tmp)
[1] 0.6965035
> 
> rowMeans(tmp)
[1] -0.07677234
> rowSums(tmp)
[1] -7.677234
> rowVars(tmp)
[1] 0.6965035
> rowSd(tmp)
[1] 0.8345679
> rowMax(tmp)
[1] 1.745974
> rowMin(tmp)
[1] -1.991914
> 
> colMeans(tmp)
  [1] -1.024555009 -0.624733842  0.497406858  1.110465082  0.763755418
  [6]  1.259674560  0.006237886 -0.880337009  0.579643546 -1.093259354
 [11]  0.009237298 -0.301425181 -0.626944735 -1.683017728  1.679820058
 [16]  0.460693424 -0.109703186 -0.490052351  0.510460117 -0.067456112
 [21]  0.331296015 -1.316523522 -1.591583909  0.043735995  1.003826202
 [26]  0.772580793  0.740786111  0.158507459 -0.963672551 -0.371654092
 [31] -0.641333916  0.904962274  0.049862043  0.100517693 -0.429896614
 [36]  0.020277506 -1.380729985 -0.369326367 -0.743179601 -0.909495430
 [41]  0.809052137  0.047940483  0.395463751 -0.289448877  0.086843986
 [46]  1.371524180 -0.787089717  0.390906201 -0.392055849  0.155410322
 [51]  0.168070844  0.646903817 -0.605663222  1.097394662 -0.593794018
 [56] -1.043286086 -0.959487113  0.122179674  0.530983363 -0.177019424
 [61]  0.364799138 -0.914435619  0.028006715  1.543462662 -0.924507323
 [66]  0.358324240  0.475510107  1.678001892  1.745974454 -0.030692524
 [71] -0.818039671 -1.445117794  0.735999951 -0.093450560 -0.773800184
 [76]  0.602658807 -1.093727818 -0.060777215 -0.438624569 -1.332552136
 [81] -0.626275988 -1.079824775  0.003012200  1.009591982 -0.642399812
 [86]  0.870410350 -1.124654614  0.016960704  0.297693092  0.559077176
 [91] -0.440722148  0.206421206 -1.991914395 -0.952974260  1.411489352
 [96] -1.163010944  0.123432104 -1.352334820  0.720605077  0.511476566
> colSums(tmp)
  [1] -1.024555009 -0.624733842  0.497406858  1.110465082  0.763755418
  [6]  1.259674560  0.006237886 -0.880337009  0.579643546 -1.093259354
 [11]  0.009237298 -0.301425181 -0.626944735 -1.683017728  1.679820058
 [16]  0.460693424 -0.109703186 -0.490052351  0.510460117 -0.067456112
 [21]  0.331296015 -1.316523522 -1.591583909  0.043735995  1.003826202
 [26]  0.772580793  0.740786111  0.158507459 -0.963672551 -0.371654092
 [31] -0.641333916  0.904962274  0.049862043  0.100517693 -0.429896614
 [36]  0.020277506 -1.380729985 -0.369326367 -0.743179601 -0.909495430
 [41]  0.809052137  0.047940483  0.395463751 -0.289448877  0.086843986
 [46]  1.371524180 -0.787089717  0.390906201 -0.392055849  0.155410322
 [51]  0.168070844  0.646903817 -0.605663222  1.097394662 -0.593794018
 [56] -1.043286086 -0.959487113  0.122179674  0.530983363 -0.177019424
 [61]  0.364799138 -0.914435619  0.028006715  1.543462662 -0.924507323
 [66]  0.358324240  0.475510107  1.678001892  1.745974454 -0.030692524
 [71] -0.818039671 -1.445117794  0.735999951 -0.093450560 -0.773800184
 [76]  0.602658807 -1.093727818 -0.060777215 -0.438624569 -1.332552136
 [81] -0.626275988 -1.079824775  0.003012200  1.009591982 -0.642399812
 [86]  0.870410350 -1.124654614  0.016960704  0.297693092  0.559077176
 [91] -0.440722148  0.206421206 -1.991914395 -0.952974260  1.411489352
 [96] -1.163010944  0.123432104 -1.352334820  0.720605077  0.511476566
> 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] -1.024555009 -0.624733842  0.497406858  1.110465082  0.763755418
  [6]  1.259674560  0.006237886 -0.880337009  0.579643546 -1.093259354
 [11]  0.009237298 -0.301425181 -0.626944735 -1.683017728  1.679820058
 [16]  0.460693424 -0.109703186 -0.490052351  0.510460117 -0.067456112
 [21]  0.331296015 -1.316523522 -1.591583909  0.043735995  1.003826202
 [26]  0.772580793  0.740786111  0.158507459 -0.963672551 -0.371654092
 [31] -0.641333916  0.904962274  0.049862043  0.100517693 -0.429896614
 [36]  0.020277506 -1.380729985 -0.369326367 -0.743179601 -0.909495430
 [41]  0.809052137  0.047940483  0.395463751 -0.289448877  0.086843986
 [46]  1.371524180 -0.787089717  0.390906201 -0.392055849  0.155410322
 [51]  0.168070844  0.646903817 -0.605663222  1.097394662 -0.593794018
 [56] -1.043286086 -0.959487113  0.122179674  0.530983363 -0.177019424
 [61]  0.364799138 -0.914435619  0.028006715  1.543462662 -0.924507323
 [66]  0.358324240  0.475510107  1.678001892  1.745974454 -0.030692524
 [71] -0.818039671 -1.445117794  0.735999951 -0.093450560 -0.773800184
 [76]  0.602658807 -1.093727818 -0.060777215 -0.438624569 -1.332552136
 [81] -0.626275988 -1.079824775  0.003012200  1.009591982 -0.642399812
 [86]  0.870410350 -1.124654614  0.016960704  0.297693092  0.559077176
 [91] -0.440722148  0.206421206 -1.991914395 -0.952974260  1.411489352
 [96] -1.163010944  0.123432104 -1.352334820  0.720605077  0.511476566
> colMin(tmp)
  [1] -1.024555009 -0.624733842  0.497406858  1.110465082  0.763755418
  [6]  1.259674560  0.006237886 -0.880337009  0.579643546 -1.093259354
 [11]  0.009237298 -0.301425181 -0.626944735 -1.683017728  1.679820058
 [16]  0.460693424 -0.109703186 -0.490052351  0.510460117 -0.067456112
 [21]  0.331296015 -1.316523522 -1.591583909  0.043735995  1.003826202
 [26]  0.772580793  0.740786111  0.158507459 -0.963672551 -0.371654092
 [31] -0.641333916  0.904962274  0.049862043  0.100517693 -0.429896614
 [36]  0.020277506 -1.380729985 -0.369326367 -0.743179601 -0.909495430
 [41]  0.809052137  0.047940483  0.395463751 -0.289448877  0.086843986
 [46]  1.371524180 -0.787089717  0.390906201 -0.392055849  0.155410322
 [51]  0.168070844  0.646903817 -0.605663222  1.097394662 -0.593794018
 [56] -1.043286086 -0.959487113  0.122179674  0.530983363 -0.177019424
 [61]  0.364799138 -0.914435619  0.028006715  1.543462662 -0.924507323
 [66]  0.358324240  0.475510107  1.678001892  1.745974454 -0.030692524
 [71] -0.818039671 -1.445117794  0.735999951 -0.093450560 -0.773800184
 [76]  0.602658807 -1.093727818 -0.060777215 -0.438624569 -1.332552136
 [81] -0.626275988 -1.079824775  0.003012200  1.009591982 -0.642399812
 [86]  0.870410350 -1.124654614  0.016960704  0.297693092  0.559077176
 [91] -0.440722148  0.206421206 -1.991914395 -0.952974260  1.411489352
 [96] -1.163010944  0.123432104 -1.352334820  0.720605077  0.511476566
> colMedians(tmp)
  [1] -1.024555009 -0.624733842  0.497406858  1.110465082  0.763755418
  [6]  1.259674560  0.006237886 -0.880337009  0.579643546 -1.093259354
 [11]  0.009237298 -0.301425181 -0.626944735 -1.683017728  1.679820058
 [16]  0.460693424 -0.109703186 -0.490052351  0.510460117 -0.067456112
 [21]  0.331296015 -1.316523522 -1.591583909  0.043735995  1.003826202
 [26]  0.772580793  0.740786111  0.158507459 -0.963672551 -0.371654092
 [31] -0.641333916  0.904962274  0.049862043  0.100517693 -0.429896614
 [36]  0.020277506 -1.380729985 -0.369326367 -0.743179601 -0.909495430
 [41]  0.809052137  0.047940483  0.395463751 -0.289448877  0.086843986
 [46]  1.371524180 -0.787089717  0.390906201 -0.392055849  0.155410322
 [51]  0.168070844  0.646903817 -0.605663222  1.097394662 -0.593794018
 [56] -1.043286086 -0.959487113  0.122179674  0.530983363 -0.177019424
 [61]  0.364799138 -0.914435619  0.028006715  1.543462662 -0.924507323
 [66]  0.358324240  0.475510107  1.678001892  1.745974454 -0.030692524
 [71] -0.818039671 -1.445117794  0.735999951 -0.093450560 -0.773800184
 [76]  0.602658807 -1.093727818 -0.060777215 -0.438624569 -1.332552136
 [81] -0.626275988 -1.079824775  0.003012200  1.009591982 -0.642399812
 [86]  0.870410350 -1.124654614  0.016960704  0.297693092  0.559077176
 [91] -0.440722148  0.206421206 -1.991914395 -0.952974260  1.411489352
 [96] -1.163010944  0.123432104 -1.352334820  0.720605077  0.511476566
> colRanges(tmp)
          [,1]       [,2]      [,3]     [,4]      [,5]     [,6]        [,7]
[1,] -1.024555 -0.6247338 0.4974069 1.110465 0.7637554 1.259675 0.006237886
[2,] -1.024555 -0.6247338 0.4974069 1.110465 0.7637554 1.259675 0.006237886
          [,8]      [,9]     [,10]       [,11]      [,12]      [,13]     [,14]
[1,] -0.880337 0.5796435 -1.093259 0.009237298 -0.3014252 -0.6269447 -1.683018
[2,] -0.880337 0.5796435 -1.093259 0.009237298 -0.3014252 -0.6269447 -1.683018
       [,15]     [,16]      [,17]      [,18]     [,19]       [,20]    [,21]
[1,] 1.67982 0.4606934 -0.1097032 -0.4900524 0.5104601 -0.06745611 0.331296
[2,] 1.67982 0.4606934 -0.1097032 -0.4900524 0.5104601 -0.06745611 0.331296
         [,22]     [,23]    [,24]    [,25]     [,26]     [,27]     [,28]
[1,] -1.316524 -1.591584 0.043736 1.003826 0.7725808 0.7407861 0.1585075
[2,] -1.316524 -1.591584 0.043736 1.003826 0.7725808 0.7407861 0.1585075
          [,29]      [,30]      [,31]     [,32]      [,33]     [,34]      [,35]
[1,] -0.9636726 -0.3716541 -0.6413339 0.9049623 0.04986204 0.1005177 -0.4298966
[2,] -0.9636726 -0.3716541 -0.6413339 0.9049623 0.04986204 0.1005177 -0.4298966
          [,36]    [,37]      [,38]      [,39]      [,40]     [,41]      [,42]
[1,] 0.02027751 -1.38073 -0.3693264 -0.7431796 -0.9094954 0.8090521 0.04794048
[2,] 0.02027751 -1.38073 -0.3693264 -0.7431796 -0.9094954 0.8090521 0.04794048
         [,43]      [,44]      [,45]    [,46]      [,47]     [,48]      [,49]
[1,] 0.3954638 -0.2894489 0.08684399 1.371524 -0.7870897 0.3909062 -0.3920558
[2,] 0.3954638 -0.2894489 0.08684399 1.371524 -0.7870897 0.3909062 -0.3920558
         [,50]     [,51]     [,52]      [,53]    [,54]     [,55]     [,56]
[1,] 0.1554103 0.1680708 0.6469038 -0.6056632 1.097395 -0.593794 -1.043286
[2,] 0.1554103 0.1680708 0.6469038 -0.6056632 1.097395 -0.593794 -1.043286
          [,57]     [,58]     [,59]      [,60]     [,61]      [,62]      [,63]
[1,] -0.9594871 0.1221797 0.5309834 -0.1770194 0.3647991 -0.9144356 0.02800672
[2,] -0.9594871 0.1221797 0.5309834 -0.1770194 0.3647991 -0.9144356 0.02800672
        [,64]      [,65]     [,66]     [,67]    [,68]    [,69]       [,70]
[1,] 1.543463 -0.9245073 0.3583242 0.4755101 1.678002 1.745974 -0.03069252
[2,] 1.543463 -0.9245073 0.3583242 0.4755101 1.678002 1.745974 -0.03069252
          [,71]     [,72] [,73]       [,74]      [,75]     [,76]     [,77]
[1,] -0.8180397 -1.445118 0.736 -0.09345056 -0.7738002 0.6026588 -1.093728
[2,] -0.8180397 -1.445118 0.736 -0.09345056 -0.7738002 0.6026588 -1.093728
           [,78]      [,79]     [,80]     [,81]     [,82]     [,83]    [,84]
[1,] -0.06077722 -0.4386246 -1.332552 -0.626276 -1.079825 0.0030122 1.009592
[2,] -0.06077722 -0.4386246 -1.332552 -0.626276 -1.079825 0.0030122 1.009592
          [,85]     [,86]     [,87]     [,88]     [,89]     [,90]      [,91]
[1,] -0.6423998 0.8704103 -1.124655 0.0169607 0.2976931 0.5590772 -0.4407221
[2,] -0.6423998 0.8704103 -1.124655 0.0169607 0.2976931 0.5590772 -0.4407221
         [,92]     [,93]      [,94]    [,95]     [,96]     [,97]     [,98]
[1,] 0.2064212 -1.991914 -0.9529743 1.411489 -1.163011 0.1234321 -1.352335
[2,] 0.2064212 -1.991914 -0.9529743 1.411489 -1.163011 0.1234321 -1.352335
         [,99]    [,100]
[1,] 0.7206051 0.5114766
[2,] 0.7206051 0.5114766
> 
> 
> Max(tmp2)
[1] 3.269933
> Min(tmp2)
[1] -2.209855
> mean(tmp2)
[1] 0.2097211
> Sum(tmp2)
[1] 20.97211
> Var(tmp2)
[1] 0.9981095
> 
> rowMeans(tmp2)
  [1]  1.496825223  0.675031938  0.549126412  0.737548195  1.904387537
  [6]  0.006226765  0.977515256  0.086370166  1.513071018  0.318994164
 [11] -0.028629725 -0.767178733 -0.375939927 -1.010787870 -1.040461367
 [16] -0.070944541  0.376418735  3.269933352 -0.326630150  0.132312426
 [21]  0.961810410  0.448365262  0.528468402  1.293248898 -1.822501088
 [26]  0.320450462  0.875725295 -0.577564655  0.865654791  0.721469361
 [31]  0.406517170  1.058350833 -0.825075610 -0.297119324  2.625442608
 [36]  0.851750407  1.347884458 -0.140701159 -0.331904178 -0.287656894
 [41]  0.181871044 -0.120282619  0.615382232 -1.851067441 -0.084982331
 [46]  1.912313078 -1.325468803 -0.499167151  1.786176603 -0.425640714
 [51]  1.199736227 -0.521257941  0.738720433 -1.341495776 -0.056059288
 [56]  0.678917767 -2.209854837  0.461324098  0.502952071  0.311339477
 [61]  1.157656072  0.271666611  0.238685994 -0.233709307  0.336820115
 [66] -0.416446242 -0.937482412  0.333716816 -0.101924660 -1.360412517
 [71]  2.154936265 -0.868749865  2.231220389  1.842349504 -1.125318233
 [76]  0.553604183 -0.838966767 -1.717311261 -0.669285277  0.351941249
 [81] -1.120978309  0.404292877  0.629649760 -0.031507470 -0.292395752
 [86]  0.849244256  1.250096213 -0.112784489  0.514669141  1.487227104
 [91]  0.961865717 -1.402751325 -0.039949139 -0.334193283  0.693384695
 [96] -0.734981766  0.171261810 -0.290122934  0.618461302  0.149369872
> rowSums(tmp2)
  [1]  1.496825223  0.675031938  0.549126412  0.737548195  1.904387537
  [6]  0.006226765  0.977515256  0.086370166  1.513071018  0.318994164
 [11] -0.028629725 -0.767178733 -0.375939927 -1.010787870 -1.040461367
 [16] -0.070944541  0.376418735  3.269933352 -0.326630150  0.132312426
 [21]  0.961810410  0.448365262  0.528468402  1.293248898 -1.822501088
 [26]  0.320450462  0.875725295 -0.577564655  0.865654791  0.721469361
 [31]  0.406517170  1.058350833 -0.825075610 -0.297119324  2.625442608
 [36]  0.851750407  1.347884458 -0.140701159 -0.331904178 -0.287656894
 [41]  0.181871044 -0.120282619  0.615382232 -1.851067441 -0.084982331
 [46]  1.912313078 -1.325468803 -0.499167151  1.786176603 -0.425640714
 [51]  1.199736227 -0.521257941  0.738720433 -1.341495776 -0.056059288
 [56]  0.678917767 -2.209854837  0.461324098  0.502952071  0.311339477
 [61]  1.157656072  0.271666611  0.238685994 -0.233709307  0.336820115
 [66] -0.416446242 -0.937482412  0.333716816 -0.101924660 -1.360412517
 [71]  2.154936265 -0.868749865  2.231220389  1.842349504 -1.125318233
 [76]  0.553604183 -0.838966767 -1.717311261 -0.669285277  0.351941249
 [81] -1.120978309  0.404292877  0.629649760 -0.031507470 -0.292395752
 [86]  0.849244256  1.250096213 -0.112784489  0.514669141  1.487227104
 [91]  0.961865717 -1.402751325 -0.039949139 -0.334193283  0.693384695
 [96] -0.734981766  0.171261810 -0.290122934  0.618461302  0.149369872
> 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]  1.496825223  0.675031938  0.549126412  0.737548195  1.904387537
  [6]  0.006226765  0.977515256  0.086370166  1.513071018  0.318994164
 [11] -0.028629725 -0.767178733 -0.375939927 -1.010787870 -1.040461367
 [16] -0.070944541  0.376418735  3.269933352 -0.326630150  0.132312426
 [21]  0.961810410  0.448365262  0.528468402  1.293248898 -1.822501088
 [26]  0.320450462  0.875725295 -0.577564655  0.865654791  0.721469361
 [31]  0.406517170  1.058350833 -0.825075610 -0.297119324  2.625442608
 [36]  0.851750407  1.347884458 -0.140701159 -0.331904178 -0.287656894
 [41]  0.181871044 -0.120282619  0.615382232 -1.851067441 -0.084982331
 [46]  1.912313078 -1.325468803 -0.499167151  1.786176603 -0.425640714
 [51]  1.199736227 -0.521257941  0.738720433 -1.341495776 -0.056059288
 [56]  0.678917767 -2.209854837  0.461324098  0.502952071  0.311339477
 [61]  1.157656072  0.271666611  0.238685994 -0.233709307  0.336820115
 [66] -0.416446242 -0.937482412  0.333716816 -0.101924660 -1.360412517
 [71]  2.154936265 -0.868749865  2.231220389  1.842349504 -1.125318233
 [76]  0.553604183 -0.838966767 -1.717311261 -0.669285277  0.351941249
 [81] -1.120978309  0.404292877  0.629649760 -0.031507470 -0.292395752
 [86]  0.849244256  1.250096213 -0.112784489  0.514669141  1.487227104
 [91]  0.961865717 -1.402751325 -0.039949139 -0.334193283  0.693384695
 [96] -0.734981766  0.171261810 -0.290122934  0.618461302  0.149369872
> rowMin(tmp2)
  [1]  1.496825223  0.675031938  0.549126412  0.737548195  1.904387537
  [6]  0.006226765  0.977515256  0.086370166  1.513071018  0.318994164
 [11] -0.028629725 -0.767178733 -0.375939927 -1.010787870 -1.040461367
 [16] -0.070944541  0.376418735  3.269933352 -0.326630150  0.132312426
 [21]  0.961810410  0.448365262  0.528468402  1.293248898 -1.822501088
 [26]  0.320450462  0.875725295 -0.577564655  0.865654791  0.721469361
 [31]  0.406517170  1.058350833 -0.825075610 -0.297119324  2.625442608
 [36]  0.851750407  1.347884458 -0.140701159 -0.331904178 -0.287656894
 [41]  0.181871044 -0.120282619  0.615382232 -1.851067441 -0.084982331
 [46]  1.912313078 -1.325468803 -0.499167151  1.786176603 -0.425640714
 [51]  1.199736227 -0.521257941  0.738720433 -1.341495776 -0.056059288
 [56]  0.678917767 -2.209854837  0.461324098  0.502952071  0.311339477
 [61]  1.157656072  0.271666611  0.238685994 -0.233709307  0.336820115
 [66] -0.416446242 -0.937482412  0.333716816 -0.101924660 -1.360412517
 [71]  2.154936265 -0.868749865  2.231220389  1.842349504 -1.125318233
 [76]  0.553604183 -0.838966767 -1.717311261 -0.669285277  0.351941249
 [81] -1.120978309  0.404292877  0.629649760 -0.031507470 -0.292395752
 [86]  0.849244256  1.250096213 -0.112784489  0.514669141  1.487227104
 [91]  0.961865717 -1.402751325 -0.039949139 -0.334193283  0.693384695
 [96] -0.734981766  0.171261810 -0.290122934  0.618461302  0.149369872
> 
> colMeans(tmp2)
[1] 0.2097211
> colSums(tmp2)
[1] 20.97211
> colVars(tmp2)
[1] 0.9981095
> colSd(tmp2)
[1] 0.9990543
> colMax(tmp2)
[1] 3.269933
> colMin(tmp2)
[1] -2.209855
> colMedians(tmp2)
[1] 0.2551763
> colRanges(tmp2)
          [,1]
[1,] -2.209855
[2,]  3.269933
> 
> 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]  0.8113618  3.8655284  3.2562520 -2.0597074 -1.1409658  0.7750562
 [7]  4.7437156  2.6762069  2.2314135  0.9509987
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.88243525
[2,] -0.38191416
[3,] -0.07315471
[4,]  0.58554515
[5,]  1.19448494
> 
> rowApply(tmp,sum)
 [1]  2.746565  2.125293 -5.447199 -1.329492  1.945420  4.712298  2.418620
 [8]  2.101422  4.058563  2.778368
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    5    5   10    4    4    1    8    8     5
 [2,]    6    9    8    6    3   10    9    1    3    10
 [3,]    7    4    4    3    9    7    5    4    1     9
 [4,]    3   10    3    5    1    3    2    7    2     6
 [5,]    8    6    7    2    7    1   10    5    4     1
 [6,]    5    2    9    9    6    8    3    6    6     3
 [7,]    1    1   10    7   10    9    8    3    9     2
 [8,]   10    7    1    8    8    5    6    2    5     8
 [9,]    2    8    6    4    2    6    7   10    7     4
[10,]    9    3    2    1    5    2    4    9   10     7
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.4073435 -1.0257833  1.8312482  0.1333035  1.3635493 -0.9260714
 [7] -1.8284904  0.6297676  0.5022410  0.7604699 -1.3284106 -4.1479610
[13] -1.3594724 -2.3681878  5.2398324 -1.4002742  5.3475002  0.6934626
[19]  0.9759851  1.9593865
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.21239303
[2,] -0.77211770
[3,]  0.05646434
[4,]  0.52156075
[5,]  0.99914218
> 
> rowApply(tmp,sum)
[1]  4.671132  3.104607  7.219634 -1.841557 -8.509064
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10   15   14    4    6
[2,]   15    2    6   16    8
[3,]   16   19   13    8   10
[4,]   14   11    3    9   18
[5,]    2   20   16    2   17
> 
> 
> as.matrix(tmp)
            [,1]       [,2]       [,3]        [,4]       [,5]        [,6]
[1,]  0.05646434  0.7486797  0.8241904  0.42087906 -1.0909016 -0.60499268
[2,]  0.52156075 -1.0034792  1.3244356  0.07264778  1.9336716  0.04107833
[3,]  0.99914218 -0.2923008  0.7016796 -0.83004086  1.2296241 -0.26996502
[4,] -0.77211770  0.2239159 -0.4625418 -0.23478960 -1.3886493  0.19985435
[5,] -1.21239303 -0.7025989 -0.5565156  0.70460709  0.6798046 -0.29204635
           [,7]        [,8]         [,9]      [,10]      [,11]       [,12]
[1,]  0.2248948 -0.76906272  0.138972674 -1.1973126 -0.9349523  0.04033646
[2,]  0.4168051  0.34009098  0.006531521  0.1527855  0.6134632 -1.84160734
[3,] -1.9016700  1.68832188  0.077775316  1.4974213  0.5987426 -0.93865598
[4,] -0.1337976 -0.57447348 -0.555170084  0.8457713 -0.1270843 -1.06640684
[5,] -0.4347226 -0.05510903  0.834131559 -0.5381956 -1.4785799 -0.34162727
           [,13]      [,14]      [,15]        [,16]       [,17]       [,18]
[1,]  1.32033105 -0.2643106  2.0657214  0.027201456  2.16802312  1.47111254
[2,] -0.71537080 -0.1382712 -0.1011423 -0.006589094 -0.25055327  0.04900499
[3,]  0.06932208 -0.5244736  1.2249973  0.634315783  1.87433097 -0.29245742
[4,] -1.40085248 -0.2095962  1.8613465 -0.675958229  0.05990648  0.75800132
[5,] -0.63290222 -1.2315361  0.1889095 -1.379244139  1.49579286 -1.29219887
           [,19]       [,20]
[1,] -0.32404106  0.34989833
[2,]  0.86704004  0.82250478
[3,] -0.06385376  1.73737875
[4,]  1.88109064 -0.07000578
[5,] -1.38425074 -0.88038955
> 
> 
> 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.12-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.12-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.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  589  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.12-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.9665786 -0.0383086 0.925293 1.528415 -0.8460476 0.07224391 1.388734
         col8      col9     col10     col11    col12      col13    col14
row1 -1.71891 0.6833038 -0.750877 -1.216471 -2.15042 -0.5967329 0.706111
         col15    col16     col17     col18     col19     col20
row1 0.4189994 -2.62895 0.9209378 -1.521739 -0.671551 0.3490925
> tmp[,"col10"]
          col10
row1 -0.7508770
row2  0.4711448
row3 -0.2771663
row4 -0.5050707
row5  1.6798540
> tmp[c("row1","row5"),]
           col1       col2       col3        col4       col5        col6
row1  0.9665786 -0.0383086  0.9252930  1.52841471 -0.8460476  0.07224391
row5 -1.1192413 -0.7145259 -0.7346847 -0.03226592  1.5676328 -0.52411879
          col7       col8      col9     col10     col11      col12      col13
row1 1.3887342 -1.7189104 0.6833038 -0.750877 -1.216471 -2.1504204 -0.5967329
row5 0.4932658  0.4386106 2.3053476  1.679854 -1.328354  0.6338963 -0.8376689
         col14     col15     col16     col17      col18       col19     col20
row1 0.7061110 0.4189994 -2.628950 0.9209378 -1.5217386 -0.67155104 0.3490925
row5 0.9937025 0.1458020  1.305508 0.3015891  0.5735671  0.03217496 0.6692701
> tmp[,c("col6","col20")]
            col6      col20
row1  0.07224391  0.3490925
row2 -2.38989516 -0.6664914
row3 -0.44557271  0.4621159
row4  0.29316417 -0.9745962
row5 -0.52411879  0.6692701
> tmp[c("row1","row5"),c("col6","col20")]
            col6     col20
row1  0.07224391 0.3490925
row5 -0.52411879 0.6692701
> 
> 
> 
> 
> 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 51.05355 51.18531 49.85258 49.21352 49.43354 103.9874 50.40817 48.69859
         col9   col10    col11    col12    col13    col14    col15   col16
row1 49.94808 50.5898 49.34655 50.56726 51.18858 49.94807 49.74408 49.8039
        col17   col18  col19    col20
row1 47.94785 49.5604 51.737 104.8704
> tmp[,"col10"]
        col10
row1 50.58980
row2 29.37294
row3 30.45255
row4 32.07722
row5 49.95047
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.05355 51.18531 49.85258 49.21352 49.43354 103.9874 50.40817 48.69859
row5 49.02544 48.44540 50.59559 48.84880 50.19897 103.8861 50.39836 49.55791
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.94808 50.58980 49.34655 50.56726 51.18858 49.94807 49.74408 49.80390
row5 50.80911 49.95047 50.70186 50.23566 50.37536 48.85031 49.56294 50.48505
        col17    col18    col19    col20
row1 47.94785 49.56040 51.73700 104.8704
row5 49.21935 50.17814 50.00916 104.2705
> tmp[,c("col6","col20")]
          col6     col20
row1 103.98743 104.87045
row2  73.77374  75.19841
row3  75.08278  75.21283
row4  75.48514  75.16835
row5 103.88608 104.27051
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.9874 104.8704
row5 103.8861 104.2705
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.9874 104.8704
row5 103.8861 104.2705
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.8886952
[2,] -0.3951284
[3,]  0.7165117
[4,] -0.4262922
[5,]  0.6473624
> tmp[,c("col17","col7")]
          col17      col7
[1,]  0.9451658 0.8055901
[2,] -0.7720672 0.3097717
[3,] -2.2073748 1.0342197
[4,]  0.4343291 1.0667801
[5,] -1.3683682 0.2172761
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6        col20
[1,]  1.1387328  0.561472007
[2,]  0.1053944 -0.004350291
[3,] -0.1839216  0.875160603
[4,]  1.6105928 -0.133839373
[5,]  1.5605419  1.327210038
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.138733
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 1.1387328
[2,] 0.1053944
> 
> 
> 
> 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  1.6052743 -0.07735785 1.71807552 -0.4458327 -0.5027909 -0.8087320
row1 -0.7328736 -0.63648457 0.07559555  1.2323967 -0.7185288  0.1549539
           [,7]       [,8]       [,9]      [,10]     [,11]       [,12]
row3 -0.7874206 -0.4949990  0.4620967 -0.6839021 0.1876741  0.05085142
row1 -1.2621298  0.4752904 -1.5145666 -1.0365178 0.1096328 -0.43543805
         [,13]       [,14]        [,15]        [,16]      [,17]       [,18]
row3 0.6024327  1.05048392  0.002384042 -0.009015186 -0.4376676  0.05416297
row1 0.6404653 -0.07248897 -0.455700568  0.557894400  0.8089042 -0.21877632
          [,19]      [,20]
row3 -0.6833191 -0.7019817
row1  0.7962904 -1.9239583
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]       [,3]       [,4]     [,5]      [,6]      [,7]
row2 0.7248525 -1.114898 -0.1247496 -0.5195435 1.859741 0.2561715 0.5778141
         [,8]      [,9]    [,10]
row2 1.715009 0.1548852 1.421313
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]      [,2]     [,3]      [,4]      [,5]       [,6]       [,7]
row5 0.539732 0.4129937 1.230935 -1.755254 -1.264202 -0.9016928 -0.6583939
            [,8]     [,9]     [,10]    [,11]      [,12]      [,13]     [,14]
row5 -0.03247819 0.478373 -2.128251 0.562493 -0.1952674 0.01633883 0.5300143
          [,15]      [,16]     [,17]     [,18]      [,19]      [,20]
row5 -0.7051553 -0.8585175 -1.533374 0.8786183 -0.3115929 0.04163998
> 
> 
> 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: 0x00000000062ac408>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf453071140"
 [2] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf44b948ae" 
 [3] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf42e7b4fc7"
 [4] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf427365a75"
 [5] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf444801416"
 [6] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf42b303cce"
 [7] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf47d633e59"
 [8] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf419f55c64"
 [9] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf47b4b8"   
[10] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf4463825c0"
[11] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf42bae662b"
[12] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf41fb42ebe"
[13] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf424363f90"
[14] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf46a121442"
[15] "C:/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BMbf464a536fb"
> 
> 
> ### 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: 0x00000000079e0de0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x00000000079e0de0>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.12-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x00000000079e0de0>
> rowMedians(tmp)
  [1] -0.302475246 -0.313084051  0.071393465  0.306612748 -0.525116950
  [6]  0.284451174  0.021149192 -0.121599120 -0.255350662  0.187145068
 [11]  0.070007157 -0.271248632  0.105586856  0.010175980  0.005037144
 [16]  0.414426432  0.033319469  0.131128239  0.027036832  0.470210406
 [21] -0.294277432 -0.180945721 -0.532707967  0.534566697 -0.484381692
 [26]  0.258217436  0.016561721 -0.156220024 -0.496183450  0.453819046
 [31] -0.010816662  0.252975378 -0.034204332  0.217026558  0.150238684
 [36]  0.778400819  0.205441674 -0.559131503  0.030907395  0.403736663
 [41] -0.020787102 -0.106003406 -0.288846837  0.262359238  0.049872851
 [46]  0.269679111  0.190480633  0.271882951 -0.421475228  0.036090108
 [51]  0.190188304 -0.048791318  0.065181692 -0.314465585  0.354990079
 [56]  0.459230406 -0.138216889 -0.258209520  0.263181199 -0.252739296
 [61]  0.347541469 -0.265096009  0.229295695  0.017293197  0.105033473
 [66]  0.151574589  0.324989834 -0.167768307 -0.153275986 -0.356869441
 [71]  0.328880809 -0.275770137  0.265899059  0.113269132 -0.426982035
 [76]  0.159928137  0.054294009 -0.252760563 -0.375666465  0.281106617
 [81]  0.135956498 -0.178175051  0.160600082 -0.143130275 -0.119324065
 [86]  0.366105598 -0.395189262 -0.398858484 -0.044805908  0.076920756
 [91] -0.331137656  0.170671086  0.373916243  0.278982265 -0.229061106
 [96] -0.123810631  0.345636230  0.412380744 -0.252484075 -0.228070092
[101] -0.592906472  0.065208077  0.486608906  0.087567391  0.229249376
[106]  0.088992563  0.170917673 -0.097398065  0.454179670 -0.218073027
[111]  0.591493082  0.439863697 -0.036658614 -0.132989905 -0.197415008
[116]  0.178916656 -0.784062440  0.077079295 -0.116961860 -0.027221505
[121] -0.325982517  0.468739234  0.167520280 -0.302019795  0.194584568
[126]  0.076669951 -0.219713103  0.353596165 -0.212439180 -0.217338847
[131] -0.252968273 -0.079019743 -0.029949997  0.623652114 -0.120187738
[136] -0.370946855  0.189322622  0.087011129  0.403469425  0.349624189
[141]  0.052612812 -0.100154984  0.197950126  0.208851196 -0.262901723
[146]  0.383723376  0.222176596  0.109336992 -0.070624364 -0.394683857
[151]  0.269374044  0.046060447 -0.067011328  0.516706069 -0.050807661
[156]  0.181125276 -0.357636777  0.220836882 -0.383799015  0.571836050
[161]  0.197397130 -0.068504184  0.156005746 -0.090319148  0.192077758
[166]  0.026457944  0.322337565  0.123312887 -0.257718837  0.306415145
[171] -0.111659906 -0.121222781 -0.613456802 -0.380120516 -0.035165899
[176] -0.032671905  0.442870193 -0.693671253 -0.199160906  0.031011020
[181] -0.089991118 -0.230699643 -0.323529644 -0.293514020  0.206486810
[186] -0.315978767  0.363581771 -0.587981946  0.059643841  0.140122273
[191] -0.331184091 -0.052100982  0.069260464 -0.006534985 -0.020600436
[196] -0.768312561  0.520947981 -0.190727490  0.063641280 -0.336776640
[201] -0.160416382  0.596031966 -0.583425276  0.381706188 -0.108878747
[206] -0.280647138  0.442935485  0.149145490 -0.479714490  0.145089751
[211]  0.326182340  0.102874512 -0.211700095  0.198912005  0.331454563
[216]  0.213471520  0.149984465 -0.406524816  0.412521942  0.419274731
[221]  0.040791042  0.107315703 -0.046992610 -0.512084535  0.440048988
[226] -0.332328362 -0.454495208 -0.069058647  0.335496498 -0.747136536
> 
> proc.time()
   user  system elapsed 
   2.12    5.68   19.81 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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: 0x035d82a0>
> .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: 0x035d82a0>
> .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: 0x035d82a0>
> .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: 0x035d82a0>
> 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: 0x02de2638>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02de2638>
> .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: 0x02de2638>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02de2638>
> .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: 0x02de2638>
> 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: 0x02de07c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02de07c0>
> .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: 0x02de07c0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x02de07c0>
> .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: 0x02de07c0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x02de07c0>
> .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: 0x02de07c0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x02de07c0>
> .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: 0x02de07c0>
> 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: 0x029244c0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x029244c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x029244c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x029244c0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile128c1bca5b3b" "BufferedMatrixFile128c48e66e8" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile128c1bca5b3b" "BufferedMatrixFile128c48e66e8" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x02f73310>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02f73310>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x02f73310>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x02f73310>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x02f73310>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x02f73310>
> .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: 0x023b2e38>
> .Call("R_bm_AddColumn",P)
<pointer: 0x023b2e38>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x023b2e38>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x023b2e38>
> 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: 0x0385fe40>
> .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: 0x0385fe40>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.40    0.03    0.43 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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: 0x0000000007ce2708>
> .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: 0x0000000007ce2708>
> .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: 0x0000000007ce2708>
> .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: 0x0000000007ce2708>
> 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: 0x0000000007ea8890>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007ea8890>
> .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: 0x0000000007ea8890>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007ea8890>
> .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: 0x0000000007ea8890>
> 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: 0x0000000005cca6e8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005cca6e8>
> .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: 0x0000000005cca6e8>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005cca6e8>
> .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: 0x0000000005cca6e8>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005cca6e8>
> .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: 0x0000000005cca6e8>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005cca6e8>
> .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: 0x0000000005cca6e8>
> 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: 0x0000000005cea088>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000000005cea088>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005cea088>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005cea088>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1b802823fa8"  "BufferedMatrixFile1b805e1a6ede"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1b802823fa8"  "BufferedMatrixFile1b805e1a6ede"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005ffbe30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005ffbe30>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005ffbe30>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005ffbe30>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005ffbe30>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005ffbe30>
> .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: 0x0000000005f3a570>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005f3a570>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005f3a570>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x0000000005f3a570>
> 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: 0x0000000004f0baa0>
> .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: 0x0000000004f0baa0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.48    0.07    0.54 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.04    0.39 

Example timings